Class: AWSCDK::Lightsail::CfnInstanceProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
lightsail/cfn_instance_props.rb

Overview

Properties for defining a CfnInstance.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(blueprint_id:, bundle_id:, instance_name:, add_ons: nil, availability_zone: nil, hardware: nil, key_pair_name: nil, location: nil, networking: nil, state: nil, tags: nil, user_data: nil) ⇒ CfnInstanceProps

Returns a new instance of CfnInstanceProps.

Parameters:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lightsail/cfn_instance_props.rb', line 21

def initialize(blueprint_id:, bundle_id:, instance_name:, add_ons: nil, availability_zone: nil, hardware: nil, key_pair_name: nil, location: nil, networking: nil, state: nil, tags: nil, user_data: nil)
  @blueprint_id = blueprint_id
  Jsii::Type.check_type(@blueprint_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "blueprintId")
  @bundle_id = bundle_id
  Jsii::Type.check_type(@bundle_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bundleId")
  @instance_name = instance_name
  Jsii::Type.check_type(@instance_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceName")
  @add_ons = add_ons
  Jsii::Type.check_type(@add_ons, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGlnaHRzYWlsLkNmbkluc3RhbmNlLkFkZE9uUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "addOns") unless @add_ons.nil?
  @availability_zone = availability_zone
  Jsii::Type.check_type(@availability_zone, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "availabilityZone") unless @availability_zone.nil?
  @hardware = hardware.is_a?(Hash) ? ::AWSCDK::Lightsail::CfnInstance::HardwareProperty.new(**hardware.transform_keys(&:to_sym)) : hardware
  Jsii::Type.check_type(@hardware, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19saWdodHNhaWwuQ2ZuSW5zdGFuY2UuSGFyZHdhcmVQcm9wZXJ0eSJ9XX19")), "hardware") unless @hardware.nil?
  @key_pair_name = key_pair_name
  Jsii::Type.check_type(@key_pair_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyPairName") unless @key_pair_name.nil?
  @location = location.is_a?(Hash) ? ::AWSCDK::Lightsail::CfnInstance::LocationProperty.new(**location.transform_keys(&:to_sym)) : location
  Jsii::Type.check_type(@location, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19saWdodHNhaWwuQ2ZuSW5zdGFuY2UuTG9jYXRpb25Qcm9wZXJ0eSJ9XX19")), "location") unless @location.nil?
  @networking = networking.is_a?(Hash) ? ::AWSCDK::Lightsail::CfnInstance::NetworkingProperty.new(**networking.transform_keys(&:to_sym)) : networking
  Jsii::Type.check_type(@networking, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19saWdodHNhaWwuQ2ZuSW5zdGFuY2UuTmV0d29ya2luZ1Byb3BlcnR5In1dfX0=")), "networking") unless @networking.nil?
  @state = state.is_a?(Hash) ? ::AWSCDK::Lightsail::CfnInstance::StateProperty.new(**state.transform_keys(&:to_sym)) : state
  Jsii::Type.check_type(@state, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19saWdodHNhaWwuQ2ZuSW5zdGFuY2UuU3RhdGVQcm9wZXJ0eSJ9XX19")), "state") unless @state.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
  @user_data = user_data
  Jsii::Type.check_type(@user_data, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "userData") unless @user_data.nil?
end

Instance Attribute Details

#add_onsAWSCDK::IResolvable, ... (readonly)

An array of add-ons for the instance.

If the instance has an add-on enabled when performing a delete instance request, the add-on is automatically disabled before the instance is deleted.



69
70
71
# File 'lightsail/cfn_instance_props.rb', line 69

def add_ons
  @add_ons
end

#availability_zoneString? (readonly)

The Availability Zone for the instance.



74
75
76
# File 'lightsail/cfn_instance_props.rb', line 74

def availability_zone
  @availability_zone
end

#blueprint_idString (readonly)

The blueprint ID for the instance (for example, os_amlinux_2016_03 ).



52
53
54
# File 'lightsail/cfn_instance_props.rb', line 52

def blueprint_id
  @blueprint_id
end

#bundle_idString (readonly)

The bundle ID for the instance (for example, micro_1_0 ).



57
58
59
# File 'lightsail/cfn_instance_props.rb', line 57

def bundle_id
  @bundle_id
end

#hardwareAWSCDK::IResolvable, ... (readonly)

The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.

The instance restarts when performing an attach disk or detach disk request. This resets the public IP address of your instance if a static IP isn't attached to it.



81
82
83
# File 'lightsail/cfn_instance_props.rb', line 81

def hardware
  @hardware
end

#instance_nameString (readonly)

The name of the instance.



62
63
64
# File 'lightsail/cfn_instance_props.rb', line 62

def instance_name
  @instance_name
end

#key_pair_nameString? (readonly)

The name of the key pair to use for the instance.

If no key pair name is specified, the Regional Lightsail default key pair is used.



88
89
90
# File 'lightsail/cfn_instance_props.rb', line 88

def key_pair_name
  @key_pair_name
end

#locationAWSCDK::IResolvable, ... (readonly)

The location for the instance, such as the AWS Region and Availability Zone.

The Location property is read-only and should not be specified in a create instance or update instance request.



95
96
97
# File 'lightsail/cfn_instance_props.rb', line 95

def location
  @location
end

#networkingAWSCDK::IResolvable, ... (readonly)

The public ports and the monthly amount of data transfer allocated for the instance.



100
101
102
# File 'lightsail/cfn_instance_props.rb', line 100

def networking
  @networking
end

#stateAWSCDK::IResolvable, ... (readonly)

The status code and the state (for example, running ) of the instance.

The State property is read-only and should not be specified in a create instance or update instance request.



107
108
109
# File 'lightsail/cfn_instance_props.rb', line 107

def state
  @state
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

An array of key-value pairs to apply to this resource.

For more information, see Tag in the AWS CloudFormation User Guide .

The Value of Tags is optional for Lightsail resources.



116
117
118
# File 'lightsail/cfn_instance_props.rb', line 116

def tags
  @tags
end

#user_dataString? (readonly)

The optional launch script for the instance.

Specify a launch script to configure an instance with additional user data. For example, you might want to specify apt-get -y update as a launch script.

Depending on the blueprint of your instance, the command to get software on your instance varies. Amazon Linux and CentOS use yum , Debian and Ubuntu use apt-get , and FreeBSD uses pkg .



125
126
127
# File 'lightsail/cfn_instance_props.rb', line 125

def user_data
  @user_data
end

Class Method Details

.jsii_propertiesObject



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lightsail/cfn_instance_props.rb', line 127

def self.jsii_properties
  {
    :blueprint_id => "blueprintId",
    :bundle_id => "bundleId",
    :instance_name => "instanceName",
    :add_ons => "addOns",
    :availability_zone => "availabilityZone",
    :hardware => "hardware",
    :key_pair_name => "keyPairName",
    :location => "location",
    :networking => "networking",
    :state => "state",
    :tags => "tags",
    :user_data => "userData",
  }
end

Instance Method Details

#to_jsiiObject



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lightsail/cfn_instance_props.rb', line 144

def to_jsii
  result = {}
  result.merge!({
    "blueprintId" => @blueprint_id,
    "bundleId" => @bundle_id,
    "instanceName" => @instance_name,
    "addOns" => @add_ons,
    "availabilityZone" => @availability_zone,
    "hardware" => @hardware,
    "keyPairName" => @key_pair_name,
    "location" => @location,
    "networking" => @networking,
    "state" => @state,
    "tags" => @tags,
    "userData" => @user_data,
  })
  result.compact
end