Class: Aws::EC2::Image
- Inherits:
-
Object
- Object
- Aws::EC2::Image
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-ec2/image.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#architecture ⇒ String
The architecture of the image.
-
#block_device_mappings ⇒ Array<Types::BlockDeviceMapping>
Any block device mapping entries.
-
#creation_date ⇒ String
The date and time the image was created.
-
#description ⇒ String
The description of the AMI that was provided during image creation.
-
#ena_support ⇒ Boolean
Specifies whether enhanced networking with ENA is enabled.
-
#hypervisor ⇒ String
The hypervisor type of the image.
- #id ⇒ String (also: #image_id)
-
#image_location ⇒ String
The location of the AMI.
-
#image_owner_alias ⇒ String
The AWS account alias (for example, ‘amazon`, `self`) or the AWS account ID of the AMI owner.
-
#image_type ⇒ String
The type of image.
-
#kernel_id ⇒ String
The kernel associated with the image, if any.
-
#name ⇒ String
The name of the AMI that was provided during image creation.
-
#owner_id ⇒ String
The AWS account ID of the image owner.
-
#platform ⇒ String
The value is ‘Windows` for Windows AMIs; otherwise blank.
-
#product_codes ⇒ Array<Types::ProductCode>
Any product codes associated with the AMI.
-
#public ⇒ Boolean
Indicates whether the image has public launch permissions.
-
#ramdisk_id ⇒ String
The RAM disk associated with the image, if any.
-
#root_device_name ⇒ String
The device name of the root device (for example, ‘/dev/sda1` or `/dev/xvda`).
-
#root_device_type ⇒ String
The type of root device used by the AMI.
-
#sriov_net_support ⇒ String
Specifies whether enhanced networking with the Intel 82599 Virtual Function interface is enabled.
-
#state ⇒ String
The current state of the AMI.
-
#state_reason ⇒ Types::StateReason
The reason for the state change.
-
#tags ⇒ Array<Types::Tag>
Any tags assigned to the image.
-
#virtualization_type ⇒ String
The type of virtualization of the AMI.
Actions collapse
- #create_tags(options = {}) ⇒ Tag::Collection
- #deregister(options = {}) ⇒ EmptyStructure
- #describe_attribute(options = {}) ⇒ Types::ImageAttribute
- #identifiers ⇒ Object deprecated private Deprecated.
- #modify_attribute(options = {}) ⇒ EmptyStructure
- #reset_attribute(options = {}) ⇒ EmptyStructure
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::Image
Returns the data for this Image.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#exists?(options = {}) ⇒ Boolean
Returns ‘true` if the Image exists.
-
#initialize(*args) ⇒ Image
constructor
A new instance of Image.
- #load ⇒ self (also: #reload)
- #wait_until_exists(options = {}) ⇒ Image
Constructor Details
#initialize(id, options = {}) ⇒ Image #initialize(options = {}) ⇒ Image
Returns a new instance of Image.
19 20 21 22 23 24 |
# File 'lib/aws-sdk-ec2/image.rb', line 19 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @id = extract_id(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() end |
Instance Method Details
#architecture ⇒ String
The architecture of the image.
36 37 38 |
# File 'lib/aws-sdk-ec2/image.rb', line 36 def architecture data.architecture end |
#block_device_mappings ⇒ Array<Types::BlockDeviceMapping>
Any block device mapping entries.
107 108 109 |
# File 'lib/aws-sdk-ec2/image.rb', line 107 def block_device_mappings data.block_device_mappings end |
#create_tags(options = {}) ⇒ Tag::Collection
272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/aws-sdk-ec2/image.rb', line 272 def ( = {}) batch = [] = Aws::Util.deep_merge(, resources: [@id]) resp = @client.() [:tags].each do |t| batch << Tag.new( resource_id: @id, key: t[:key], value: t[:value], client: @client ) end Tag::Collection.new([batch], size: batch.size) end |
#creation_date ⇒ String
The date and time the image was created.
42 43 44 |
# File 'lib/aws-sdk-ec2/image.rb', line 42 def creation_date data.creation_date end |
#data ⇒ Types::Image
Returns the data for this Aws::EC2::Image. Calls Client#describe_images if #data_loaded? is ‘false`.
204 205 206 207 |
# File 'lib/aws-sdk-ec2/image.rb', line 204 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
212 213 214 |
# File 'lib/aws-sdk-ec2/image.rb', line 212 def data_loaded? !!@data end |
#deregister(options = {}) ⇒ EmptyStructure
299 300 301 302 303 |
# File 'lib/aws-sdk-ec2/image.rb', line 299 def deregister( = {}) = .merge(image_id: @id) resp = @client.deregister_image() resp.data end |
#describe_attribute(options = {}) ⇒ Types::ImageAttribute
325 326 327 328 329 |
# File 'lib/aws-sdk-ec2/image.rb', line 325 def describe_attribute( = {}) = .merge(image_id: @id) resp = @client.describe_image_attribute() resp.data end |
#description ⇒ String
The description of the AMI that was provided during image creation.
113 114 115 |
# File 'lib/aws-sdk-ec2/image.rb', line 113 def description data.description end |
#ena_support ⇒ Boolean
Specifies whether enhanced networking with ENA is enabled.
119 120 121 |
# File 'lib/aws-sdk-ec2/image.rb', line 119 def ena_support data.ena_support end |
#exists?(options = {}) ⇒ Boolean
Returns ‘true` if the Image exists.
219 220 221 222 223 224 225 226 227 228 |
# File 'lib/aws-sdk-ec2/image.rb', line 219 def exists?( = {}) begin wait_until_exists(.merge(max_attempts: 1)) true rescue Aws::Waiters::Errors::UnexpectedError => e raise e.error rescue Aws::Waiters::Errors::WaiterFailed false end end |
#hypervisor ⇒ String
The hypervisor type of the image.
125 126 127 |
# File 'lib/aws-sdk-ec2/image.rb', line 125 def hypervisor data.hypervisor end |
#id ⇒ String Also known as: image_id
29 30 31 |
# File 'lib/aws-sdk-ec2/image.rb', line 29 def id @id end |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
415 416 417 |
# File 'lib/aws-sdk-ec2/image.rb', line 415 def identifiers { id: @id } end |
#image_location ⇒ String
The location of the AMI.
48 49 50 |
# File 'lib/aws-sdk-ec2/image.rb', line 48 def image_location data.image_location end |
#image_owner_alias ⇒ String
The AWS account alias (for example, ‘amazon`, `self`) or the AWS account ID of the AMI owner.
132 133 134 |
# File 'lib/aws-sdk-ec2/image.rb', line 132 def image_owner_alias data.image_owner_alias end |
#image_type ⇒ String
The type of image.
54 55 56 |
# File 'lib/aws-sdk-ec2/image.rb', line 54 def image_type data.image_type end |
#kernel_id ⇒ String
The kernel associated with the image, if any. Only applicable for machine images.
69 70 71 |
# File 'lib/aws-sdk-ec2/image.rb', line 69 def kernel_id data.kernel_id end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::EC2::Image. Returns ‘self` making it possible to chain methods.
image.reload.data
194 195 196 197 198 |
# File 'lib/aws-sdk-ec2/image.rb', line 194 def load resp = @client.describe_images(image_ids: [@id]) @data = resp.images[0] self end |
#modify_attribute(options = {}) ⇒ EmptyStructure
385 386 387 388 389 |
# File 'lib/aws-sdk-ec2/image.rb', line 385 def modify_attribute( = {}) = .merge(image_id: @id) resp = @client.modify_image_attribute() resp.data end |
#name ⇒ String
The name of the AMI that was provided during image creation.
138 139 140 |
# File 'lib/aws-sdk-ec2/image.rb', line 138 def name data.name end |
#owner_id ⇒ String
The AWS account ID of the image owner.
75 76 77 |
# File 'lib/aws-sdk-ec2/image.rb', line 75 def owner_id data.owner_id end |
#platform ⇒ String
The value is ‘Windows` for Windows AMIs; otherwise blank.
81 82 83 |
# File 'lib/aws-sdk-ec2/image.rb', line 81 def platform data.platform end |
#product_codes ⇒ Array<Types::ProductCode>
Any product codes associated with the AMI.
87 88 89 |
# File 'lib/aws-sdk-ec2/image.rb', line 87 def product_codes data.product_codes end |
#public ⇒ Boolean
Indicates whether the image has public launch permissions. The value is ‘true` if this image has public launch permissions or `false` if it has only implicit and explicit launch permissions.
62 63 64 |
# File 'lib/aws-sdk-ec2/image.rb', line 62 def public data.public end |
#ramdisk_id ⇒ String
The RAM disk associated with the image, if any. Only applicable for machine images.
94 95 96 |
# File 'lib/aws-sdk-ec2/image.rb', line 94 def ramdisk_id data.ramdisk_id end |
#reset_attribute(options = {}) ⇒ EmptyStructure
407 408 409 410 411 |
# File 'lib/aws-sdk-ec2/image.rb', line 407 def reset_attribute( = {}) = .merge(image_id: @id) resp = @client.reset_image_attribute() resp.data end |
#root_device_name ⇒ String
The device name of the root device (for example, ‘/dev/sda1` or `/dev/xvda`).
145 146 147 |
# File 'lib/aws-sdk-ec2/image.rb', line 145 def root_device_name data.root_device_name end |
#root_device_type ⇒ String
The type of root device used by the AMI. The AMI can use an EBS volume or an instance store volume.
152 153 154 |
# File 'lib/aws-sdk-ec2/image.rb', line 152 def root_device_type data.root_device_type end |
#sriov_net_support ⇒ String
Specifies whether enhanced networking with the Intel 82599 Virtual Function interface is enabled.
159 160 161 |
# File 'lib/aws-sdk-ec2/image.rb', line 159 def sriov_net_support data.sriov_net_support end |
#state ⇒ String
The current state of the AMI. If the state is ‘available`, the image is successfully registered and can be used to launch an instance.
101 102 103 |
# File 'lib/aws-sdk-ec2/image.rb', line 101 def state data.state end |
#state_reason ⇒ Types::StateReason
The reason for the state change.
165 166 167 |
# File 'lib/aws-sdk-ec2/image.rb', line 165 def state_reason data.state_reason end |
#tags ⇒ Array<Types::Tag>
Any tags assigned to the image.
171 172 173 |
# File 'lib/aws-sdk-ec2/image.rb', line 171 def data. end |
#virtualization_type ⇒ String
The type of virtualization of the AMI.
177 178 179 |
# File 'lib/aws-sdk-ec2/image.rb', line 177 def virtualization_type data.virtualization_type end |
#wait_until_exists(options = {}) ⇒ Image
236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/aws-sdk-ec2/image.rb', line 236 def wait_until_exists( = {}) , params = () waiter = Waiters::ImageExists.new() yield_waiter_and_warn(waiter, &Proc.new) if block_given? resp = waiter.wait(params.merge(image_ids: [@id])) Image.new({ id: @id, data: resp.data.images[0], client: @client }) end |