aws-sdk-ec2 1.0.0.rc2 → 1.0.0.rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,183 +1,181 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module EC2
10
- class DhcpOptions
11
-
12
- extend Aws::Deprecations
13
-
14
- # @overload def initialize(id, options = {})
15
- # @param [String] id
16
- # @option options [Client] :client
17
- # @overload def initialize(options = {})
18
- # @option options [required, String] :id
19
- # @option options [Client] :client
20
- def initialize(*args)
21
- options = Hash === args.last ? args.pop.dup : {}
22
- @id = extract_id(args, options)
23
- @data = options.delete(:data)
24
- @client = options.delete(:client) || Client.new(options)
25
- end
8
+ module Aws::EC2
9
+ class DhcpOptions
10
+
11
+ extend Aws::Deprecations
12
+
13
+ # @overload def initialize(id, options = {})
14
+ # @param [String] id
15
+ # @option options [Client] :client
16
+ # @overload def initialize(options = {})
17
+ # @option options [required, String] :id
18
+ # @option options [Client] :client
19
+ def initialize(*args)
20
+ options = Hash === args.last ? args.pop.dup : {}
21
+ @id = extract_id(args, options)
22
+ @data = options.delete(:data)
23
+ @client = options.delete(:client) || Client.new(options)
24
+ end
26
25
 
27
- # @!group Read-Only Attributes
26
+ # @!group Read-Only Attributes
28
27
 
29
- # @return [String]
30
- def id
31
- @id
32
- end
33
- alias :dhcp_options_id :id
28
+ # @return [String]
29
+ def id
30
+ @id
31
+ end
32
+ alias :dhcp_options_id :id
34
33
 
35
- # One or more DHCP options in the set.
36
- # @return [Array<Types::DhcpConfiguration>]
37
- def dhcp_configurations
38
- data.dhcp_configurations
39
- end
34
+ # One or more DHCP options in the set.
35
+ # @return [Array<Types::DhcpConfiguration>]
36
+ def dhcp_configurations
37
+ data.dhcp_configurations
38
+ end
40
39
 
41
- # Any tags assigned to the DHCP options set.
42
- # @return [Array<Types::Tag>]
43
- def tags
44
- data.tags
45
- end
40
+ # Any tags assigned to the DHCP options set.
41
+ # @return [Array<Types::Tag>]
42
+ def tags
43
+ data.tags
44
+ end
46
45
 
47
- # @!endgroup
46
+ # @!endgroup
48
47
 
49
- # @return [Client]
50
- def client
51
- @client
52
- end
48
+ # @return [Client]
49
+ def client
50
+ @client
51
+ end
53
52
 
54
- # Loads, or reloads {#data} for the current {DhcpOptions}.
55
- # Returns `self` making it possible to chain methods.
56
- #
57
- # dhcp_options.reload.data
58
- #
59
- # @return [self]
60
- def load
61
- resp = @client.describe_dhcp_options(dhcp_options_ids: [@id])
62
- @data = resp.dhcpoptions[0]
63
- self
64
- end
65
- alias :reload :load
66
-
67
- # @return [Types::DhcpOptions]
68
- # Returns the data for this {DhcpOptions}. Calls
69
- # {Client#describe_dhcp_options} if {#data_loaded?} is `false`.
70
- def data
71
- load unless @data
72
- @data
73
- end
53
+ # Loads, or reloads {#data} for the current {DhcpOptions}.
54
+ # Returns `self` making it possible to chain methods.
55
+ #
56
+ # dhcp_options.reload.data
57
+ #
58
+ # @return [self]
59
+ def load
60
+ resp = @client.describe_dhcp_options(dhcp_options_ids: [@id])
61
+ @data = resp.dhcpoptions[0]
62
+ self
63
+ end
64
+ alias :reload :load
65
+
66
+ # @return [Types::DhcpOptions]
67
+ # Returns the data for this {DhcpOptions}. Calls
68
+ # {Client#describe_dhcp_options} if {#data_loaded?} is `false`.
69
+ def data
70
+ load unless @data
71
+ @data
72
+ end
74
73
 
75
- # @return [Boolean]
76
- # Returns `true` if this resource is loaded. Accessing attributes or
77
- # {#data} on an unloaded resource will trigger a call to {#load}.
78
- def data_loaded?
79
- !!@data
80
- end
74
+ # @return [Boolean]
75
+ # Returns `true` if this resource is loaded. Accessing attributes or
76
+ # {#data} on an unloaded resource will trigger a call to {#load}.
77
+ def data_loaded?
78
+ !!@data
79
+ end
81
80
 
82
- # @!group Actions
83
-
84
- # @example Request syntax with placeholder values
85
- #
86
- # dhcp_options.associate_with_vpc({
87
- # dry_run: false,
88
- # vpc_id: "String", # required
89
- # })
90
- # @param [Hash] options ({})
91
- # @option options [Boolean] :dry_run
92
- # Checks whether you have the required permissions for the action,
93
- # without actually making the request, and provides an error response.
94
- # If you have the required permissions, the error response is
95
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
96
- # @option options [required, String] :vpc_id
97
- # The ID of the VPC.
98
- # @return [EmptyStructure]
99
- def associate_with_vpc(options = {})
100
- options = options.merge(dhcp_options_id: @id)
101
- resp = @client.associate_dhcp_options(options)
102
- resp.data
103
- end
81
+ # @!group Actions
82
+
83
+ # @example Request syntax with placeholder values
84
+ #
85
+ # dhcp_options.associate_with_vpc({
86
+ # dry_run: false,
87
+ # vpc_id: "String", # required
88
+ # })
89
+ # @param [Hash] options ({})
90
+ # @option options [Boolean] :dry_run
91
+ # Checks whether you have the required permissions for the action,
92
+ # without actually making the request, and provides an error response.
93
+ # If you have the required permissions, the error response is
94
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
95
+ # @option options [required, String] :vpc_id
96
+ # The ID of the VPC.
97
+ # @return [EmptyStructure]
98
+ def associate_with_vpc(options = {})
99
+ options = options.merge(dhcp_options_id: @id)
100
+ resp = @client.associate_dhcp_options(options)
101
+ resp.data
102
+ end
104
103
 
105
- # @example Request syntax with placeholder values
106
- #
107
- # tag = dhcp_options.create_tags({
108
- # dry_run: false,
109
- # tags: [ # required
110
- # {
111
- # key: "String",
112
- # value: "String",
113
- # },
114
- # ],
115
- # })
116
- # @param [Hash] options ({})
117
- # @option options [Boolean] :dry_run
118
- # Checks whether you have the required permissions for the action,
119
- # without actually making the request, and provides an error response.
120
- # If you have the required permissions, the error response is
121
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
122
- # @option options [required, Array<Types::Tag>] :tags
123
- # One or more tags. The `value` parameter is required, but if you don't
124
- # want the tag to have a value, specify the parameter with no value, and
125
- # we set the value to an empty string.
126
- # @return [Tag::Collection]
127
- def create_tags(options = {})
128
- batch = []
129
- options = Aws::Util.deep_merge(options, resources: [@id])
130
- resp = @client.create_tags(options)
131
- options[:tags].each do |t|
132
- batch << Tag.new(
133
- resource_id: @id,
134
- key: t[:key],
135
- value: t[:value],
136
- client: @client
137
- )
138
- end
139
- Tag::Collection.new([batch], size: batch.size)
104
+ # @example Request syntax with placeholder values
105
+ #
106
+ # tag = dhcp_options.create_tags({
107
+ # dry_run: false,
108
+ # tags: [ # required
109
+ # {
110
+ # key: "String",
111
+ # value: "String",
112
+ # },
113
+ # ],
114
+ # })
115
+ # @param [Hash] options ({})
116
+ # @option options [Boolean] :dry_run
117
+ # Checks whether you have the required permissions for the action,
118
+ # without actually making the request, and provides an error response.
119
+ # If you have the required permissions, the error response is
120
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
121
+ # @option options [required, Array<Types::Tag>] :tags
122
+ # One or more tags. The `value` parameter is required, but if you don't
123
+ # want the tag to have a value, specify the parameter with no value, and
124
+ # we set the value to an empty string.
125
+ # @return [Tag::Collection]
126
+ def create_tags(options = {})
127
+ batch = []
128
+ options = Aws::Util.deep_merge(options, resources: [@id])
129
+ resp = @client.create_tags(options)
130
+ options[:tags].each do |t|
131
+ batch << Tag.new(
132
+ resource_id: @id,
133
+ key: t[:key],
134
+ value: t[:value],
135
+ client: @client
136
+ )
140
137
  end
138
+ Tag::Collection.new([batch], size: batch.size)
139
+ end
141
140
 
142
- # @example Request syntax with placeholder values
143
- #
144
- # dhcp_options.delete({
145
- # dry_run: false,
146
- # })
147
- # @param [Hash] options ({})
148
- # @option options [Boolean] :dry_run
149
- # Checks whether you have the required permissions for the action,
150
- # without actually making the request, and provides an error response.
151
- # If you have the required permissions, the error response is
152
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
153
- # @return [EmptyStructure]
154
- def delete(options = {})
155
- options = options.merge(dhcp_options_id: @id)
156
- resp = @client.delete_dhcp_options(options)
157
- resp.data
158
- end
141
+ # @example Request syntax with placeholder values
142
+ #
143
+ # dhcp_options.delete({
144
+ # dry_run: false,
145
+ # })
146
+ # @param [Hash] options ({})
147
+ # @option options [Boolean] :dry_run
148
+ # Checks whether you have the required permissions for the action,
149
+ # without actually making the request, and provides an error response.
150
+ # If you have the required permissions, the error response is
151
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
152
+ # @return [EmptyStructure]
153
+ def delete(options = {})
154
+ options = options.merge(dhcp_options_id: @id)
155
+ resp = @client.delete_dhcp_options(options)
156
+ resp.data
157
+ end
159
158
 
160
- # @deprecated
161
- # @api private
162
- def identifiers
163
- { id: @id }
164
- end
165
- deprecated(:identifiers)
166
-
167
- private
168
-
169
- def extract_id(args, options)
170
- value = args[0] || options.delete(:id)
171
- case value
172
- when String then value
173
- when nil then raise ArgumentError, "missing required option :id"
174
- else
175
- msg = "expected :id to be a String, got #{value.class}"
176
- raise ArgumentError, msg
177
- end
159
+ # @deprecated
160
+ # @api private
161
+ def identifiers
162
+ { id: @id }
163
+ end
164
+ deprecated(:identifiers)
165
+
166
+ private
167
+
168
+ def extract_id(args, options)
169
+ value = args[0] || options.delete(:id)
170
+ case value
171
+ when String then value
172
+ when nil then raise ArgumentError, "missing required option :id"
173
+ else
174
+ msg = "expected :id to be a String, got #{value.class}"
175
+ raise ArgumentError, msg
178
176
  end
179
-
180
- class Collection < Aws::Resources::Collection; end
181
177
  end
178
+
179
+ class Collection < Aws::Resources::Collection; end
182
180
  end
183
181
  end
@@ -1,23 +1,14 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module EC2
10
- module Errors
8
+ module Aws::EC2
9
+ module Errors
11
10
 
12
- extend Aws::Errors::DynamicErrors
11
+ extend Aws::Errors::DynamicErrors
13
12
 
14
- # Raised when calling #load or #data on a resource class that can not be
15
- # loaded. This can happen when:
16
- #
17
- # * A resource class has identifiers, but no data attributes.
18
- # * Resource data is only available when making an API call that
19
- # enumerates all resources of that type.
20
- class ResourceNotLoadable < RuntimeError; end
21
- end
22
13
  end
23
14
  end
@@ -1,462 +1,460 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module EC2
10
- class Image
11
-
12
- extend Aws::Deprecations
13
-
14
- # @overload def initialize(id, options = {})
15
- # @param [String] id
16
- # @option options [Client] :client
17
- # @overload def initialize(options = {})
18
- # @option options [required, String] :id
19
- # @option options [Client] :client
20
- def initialize(*args)
21
- options = Hash === args.last ? args.pop.dup : {}
22
- @id = extract_id(args, options)
23
- @data = options.delete(:data)
24
- @client = options.delete(:client) || Client.new(options)
25
- end
8
+ module Aws::EC2
9
+ class Image
10
+
11
+ extend Aws::Deprecations
12
+
13
+ # @overload def initialize(id, options = {})
14
+ # @param [String] id
15
+ # @option options [Client] :client
16
+ # @overload def initialize(options = {})
17
+ # @option options [required, String] :id
18
+ # @option options [Client] :client
19
+ def initialize(*args)
20
+ options = Hash === args.last ? args.pop.dup : {}
21
+ @id = extract_id(args, options)
22
+ @data = options.delete(:data)
23
+ @client = options.delete(:client) || Client.new(options)
24
+ end
26
25
 
27
- # @!group Read-Only Attributes
26
+ # @!group Read-Only Attributes
28
27
 
29
- # @return [String]
30
- def id
31
- @id
32
- end
33
- alias :image_id :id
28
+ # @return [String]
29
+ def id
30
+ @id
31
+ end
32
+ alias :image_id :id
34
33
 
35
- # The location of the AMI.
36
- # @return [String]
37
- def image_location
38
- data.image_location
39
- end
34
+ # The location of the AMI.
35
+ # @return [String]
36
+ def image_location
37
+ data.image_location
38
+ end
40
39
 
41
- # The current state of the AMI. If the state is `available`, the image
42
- # is successfully registered and can be used to launch an instance.
43
- # @return [String]
44
- def state
45
- data.state
46
- end
40
+ # The current state of the AMI. If the state is `available`, the image
41
+ # is successfully registered and can be used to launch an instance.
42
+ # @return [String]
43
+ def state
44
+ data.state
45
+ end
47
46
 
48
- # The AWS account ID of the image owner.
49
- # @return [String]
50
- def owner_id
51
- data.owner_id
52
- end
47
+ # The AWS account ID of the image owner.
48
+ # @return [String]
49
+ def owner_id
50
+ data.owner_id
51
+ end
53
52
 
54
- # The date and time the image was created.
55
- # @return [String]
56
- def creation_date
57
- data.creation_date
58
- end
53
+ # The date and time the image was created.
54
+ # @return [String]
55
+ def creation_date
56
+ data.creation_date
57
+ end
59
58
 
60
- # Indicates whether the image has public launch permissions. The value
61
- # is `true` if this image has public launch permissions or `false` if it
62
- # has only implicit and explicit launch permissions.
63
- # @return [Boolean]
64
- def public
65
- data.public
66
- end
59
+ # Indicates whether the image has public launch permissions. The value
60
+ # is `true` if this image has public launch permissions or `false` if it
61
+ # has only implicit and explicit launch permissions.
62
+ # @return [Boolean]
63
+ def public
64
+ data.public
65
+ end
67
66
 
68
- # Any product codes associated with the AMI.
69
- # @return [Array<Types::ProductCode>]
70
- def product_codes
71
- data.product_codes
72
- end
67
+ # Any product codes associated with the AMI.
68
+ # @return [Array<Types::ProductCode>]
69
+ def product_codes
70
+ data.product_codes
71
+ end
73
72
 
74
- # The architecture of the image.
75
- # @return [String]
76
- def architecture
77
- data.architecture
78
- end
73
+ # The architecture of the image.
74
+ # @return [String]
75
+ def architecture
76
+ data.architecture
77
+ end
79
78
 
80
- # The type of image.
81
- # @return [String]
82
- def image_type
83
- data.image_type
84
- end
79
+ # The type of image.
80
+ # @return [String]
81
+ def image_type
82
+ data.image_type
83
+ end
85
84
 
86
- # The kernel associated with the image, if any. Only applicable for
87
- # machine images.
88
- # @return [String]
89
- def kernel_id
90
- data.kernel_id
91
- end
85
+ # The kernel associated with the image, if any. Only applicable for
86
+ # machine images.
87
+ # @return [String]
88
+ def kernel_id
89
+ data.kernel_id
90
+ end
92
91
 
93
- # The RAM disk associated with the image, if any. Only applicable for
94
- # machine images.
95
- # @return [String]
96
- def ramdisk_id
97
- data.ramdisk_id
98
- end
92
+ # The RAM disk associated with the image, if any. Only applicable for
93
+ # machine images.
94
+ # @return [String]
95
+ def ramdisk_id
96
+ data.ramdisk_id
97
+ end
99
98
 
100
- # The value is `Windows` for Windows AMIs; otherwise blank.
101
- # @return [String]
102
- def platform
103
- data.platform
104
- end
99
+ # The value is `Windows` for Windows AMIs; otherwise blank.
100
+ # @return [String]
101
+ def platform
102
+ data.platform
103
+ end
105
104
 
106
- # Specifies whether enhanced networking with the Intel 82599 Virtual
107
- # Function interface is enabled.
108
- # @return [String]
109
- def sriov_net_support
110
- data.sriov_net_support
111
- end
105
+ # Specifies whether enhanced networking with the Intel 82599 Virtual
106
+ # Function interface is enabled.
107
+ # @return [String]
108
+ def sriov_net_support
109
+ data.sriov_net_support
110
+ end
112
111
 
113
- # Specifies whether enhanced networking with ENA is enabled.
114
- # @return [Boolean]
115
- def ena_support
116
- data.ena_support
117
- end
112
+ # Specifies whether enhanced networking with ENA is enabled.
113
+ # @return [Boolean]
114
+ def ena_support
115
+ data.ena_support
116
+ end
118
117
 
119
- # The reason for the state change.
120
- # @return [Types::StateReason]
121
- def state_reason
122
- data.state_reason
123
- end
118
+ # The reason for the state change.
119
+ # @return [Types::StateReason]
120
+ def state_reason
121
+ data.state_reason
122
+ end
124
123
 
125
- # The AWS account alias (for example, `amazon`, `self`) or the AWS
126
- # account ID of the AMI owner.
127
- # @return [String]
128
- def image_owner_alias
129
- data.image_owner_alias
130
- end
124
+ # The AWS account alias (for example, `amazon`, `self`) or the AWS
125
+ # account ID of the AMI owner.
126
+ # @return [String]
127
+ def image_owner_alias
128
+ data.image_owner_alias
129
+ end
131
130
 
132
- # The name of the AMI that was provided during image creation.
133
- # @return [String]
134
- def name
135
- data.name
136
- end
131
+ # The name of the AMI that was provided during image creation.
132
+ # @return [String]
133
+ def name
134
+ data.name
135
+ end
137
136
 
138
- # The description of the AMI that was provided during image creation.
139
- # @return [String]
140
- def description
141
- data.description
142
- end
137
+ # The description of the AMI that was provided during image creation.
138
+ # @return [String]
139
+ def description
140
+ data.description
141
+ end
143
142
 
144
- # The type of root device used by the AMI. The AMI can use an EBS volume
145
- # or an instance store volume.
146
- # @return [String]
147
- def root_device_type
148
- data.root_device_type
149
- end
143
+ # The type of root device used by the AMI. The AMI can use an EBS volume
144
+ # or an instance store volume.
145
+ # @return [String]
146
+ def root_device_type
147
+ data.root_device_type
148
+ end
150
149
 
151
- # The device name of the root device (for example, `/dev/sda1` or
152
- # `/dev/xvda`).
153
- # @return [String]
154
- def root_device_name
155
- data.root_device_name
156
- end
150
+ # The device name of the root device (for example, `/dev/sda1` or
151
+ # `/dev/xvda`).
152
+ # @return [String]
153
+ def root_device_name
154
+ data.root_device_name
155
+ end
157
156
 
158
- # Any block device mapping entries.
159
- # @return [Array<Types::BlockDeviceMapping>]
160
- def block_device_mappings
161
- data.block_device_mappings
162
- end
157
+ # Any block device mapping entries.
158
+ # @return [Array<Types::BlockDeviceMapping>]
159
+ def block_device_mappings
160
+ data.block_device_mappings
161
+ end
163
162
 
164
- # The type of virtualization of the AMI.
165
- # @return [String]
166
- def virtualization_type
167
- data.virtualization_type
168
- end
163
+ # The type of virtualization of the AMI.
164
+ # @return [String]
165
+ def virtualization_type
166
+ data.virtualization_type
167
+ end
169
168
 
170
- # Any tags assigned to the image.
171
- # @return [Array<Types::Tag>]
172
- def tags
173
- data.tags
174
- end
169
+ # Any tags assigned to the image.
170
+ # @return [Array<Types::Tag>]
171
+ def tags
172
+ data.tags
173
+ end
175
174
 
176
- # The hypervisor type of the image.
177
- # @return [String]
178
- def hypervisor
179
- data.hypervisor
180
- end
175
+ # The hypervisor type of the image.
176
+ # @return [String]
177
+ def hypervisor
178
+ data.hypervisor
179
+ end
181
180
 
182
- # @!endgroup
181
+ # @!endgroup
183
182
 
184
- # @return [Client]
185
- def client
186
- @client
187
- end
183
+ # @return [Client]
184
+ def client
185
+ @client
186
+ end
188
187
 
189
- # Loads, or reloads {#data} for the current {Image}.
190
- # Returns `self` making it possible to chain methods.
191
- #
192
- # image.reload.data
193
- #
194
- # @return [self]
195
- def load
196
- resp = @client.describe_images(image_ids: [@id])
197
- @data = resp.images[0]
198
- self
199
- end
200
- alias :reload :load
201
-
202
- # @return [Types::Image]
203
- # Returns the data for this {Image}. Calls
204
- # {Client#describe_images} if {#data_loaded?} is `false`.
205
- def data
206
- load unless @data
207
- @data
208
- end
188
+ # Loads, or reloads {#data} for the current {Image}.
189
+ # Returns `self` making it possible to chain methods.
190
+ #
191
+ # image.reload.data
192
+ #
193
+ # @return [self]
194
+ def load
195
+ resp = @client.describe_images(image_ids: [@id])
196
+ @data = resp.images[0]
197
+ self
198
+ end
199
+ alias :reload :load
200
+
201
+ # @return [Types::Image]
202
+ # Returns the data for this {Image}. Calls
203
+ # {Client#describe_images} if {#data_loaded?} is `false`.
204
+ def data
205
+ load unless @data
206
+ @data
207
+ end
209
208
 
210
- # @return [Boolean]
211
- # Returns `true` if this resource is loaded. Accessing attributes or
212
- # {#data} on an unloaded resource will trigger a call to {#load}.
213
- def data_loaded?
214
- !!@data
215
- end
209
+ # @return [Boolean]
210
+ # Returns `true` if this resource is loaded. Accessing attributes or
211
+ # {#data} on an unloaded resource will trigger a call to {#load}.
212
+ def data_loaded?
213
+ !!@data
214
+ end
216
215
 
217
- # @param [Hash] options ({})
218
- # @return [Boolean]
219
- # Returns `true` if the Image exists.
220
- def exists?(options = {})
221
- begin
222
- wait_until_exists(options.merge(max_attempts: 1))
223
- true
224
- rescue Aws::Waiters::Errors::UnexpectedError => e
225
- raise e.error
226
- rescue Aws::Waiters::Errors::WaiterFailed
227
- false
228
- end
216
+ # @param [Hash] options ({})
217
+ # @return [Boolean]
218
+ # Returns `true` if the Image exists.
219
+ def exists?(options = {})
220
+ begin
221
+ wait_until_exists(options.merge(max_attempts: 1))
222
+ true
223
+ rescue Aws::Waiters::Errors::UnexpectedError => e
224
+ raise e.error
225
+ rescue Aws::Waiters::Errors::WaiterFailed
226
+ false
229
227
  end
228
+ end
230
229
 
231
- # @param [Hash] options ({})
232
- # @option options [Integer] :max_attempts (40)
233
- # @option options [Float] :delay (15)
234
- # @option options [Proc] :before_attempt
235
- # @option options [Proc] :before_wait
236
- # @return [Image]
237
- def wait_until_exists(options = {})
238
- options, params = separate_params_and_options(options)
239
- waiter = Waiters::ImageExists.new(options)
240
- yield_waiter_and_warn(waiter, &Proc.new) if block_given?
241
- resp = waiter.wait(params.merge(image_ids: [@id]))
242
- Image.new({
243
- id: @id,
244
- data: resp.data.images[0],
245
- client: @client
246
- })
247
- end
230
+ # @param [Hash] options ({})
231
+ # @option options [Integer] :max_attempts (40)
232
+ # @option options [Float] :delay (15)
233
+ # @option options [Proc] :before_attempt
234
+ # @option options [Proc] :before_wait
235
+ # @return [Image]
236
+ def wait_until_exists(options = {})
237
+ options, params = separate_params_and_options(options)
238
+ waiter = Waiters::ImageExists.new(options)
239
+ yield_waiter_and_warn(waiter, &Proc.new) if block_given?
240
+ resp = waiter.wait(params.merge(image_ids: [@id]))
241
+ Image.new({
242
+ id: @id,
243
+ data: resp.data.images[0],
244
+ client: @client
245
+ })
246
+ end
248
247
 
249
- # @!group Actions
250
-
251
- # @example Request syntax with placeholder values
252
- #
253
- # tag = image.create_tags({
254
- # dry_run: false,
255
- # tags: [ # required
256
- # {
257
- # key: "String",
258
- # value: "String",
259
- # },
260
- # ],
261
- # })
262
- # @param [Hash] options ({})
263
- # @option options [Boolean] :dry_run
264
- # Checks whether you have the required permissions for the action,
265
- # without actually making the request, and provides an error response.
266
- # If you have the required permissions, the error response is
267
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
268
- # @option options [required, Array<Types::Tag>] :tags
269
- # One or more tags. The `value` parameter is required, but if you don't
270
- # want the tag to have a value, specify the parameter with no value, and
271
- # we set the value to an empty string.
272
- # @return [Tag::Collection]
273
- def create_tags(options = {})
274
- batch = []
275
- options = Aws::Util.deep_merge(options, resources: [@id])
276
- resp = @client.create_tags(options)
277
- options[:tags].each do |t|
278
- batch << Tag.new(
279
- resource_id: @id,
280
- key: t[:key],
281
- value: t[:value],
282
- client: @client
283
- )
284
- end
285
- Tag::Collection.new([batch], size: batch.size)
248
+ # @!group Actions
249
+
250
+ # @example Request syntax with placeholder values
251
+ #
252
+ # tag = image.create_tags({
253
+ # dry_run: false,
254
+ # tags: [ # required
255
+ # {
256
+ # key: "String",
257
+ # value: "String",
258
+ # },
259
+ # ],
260
+ # })
261
+ # @param [Hash] options ({})
262
+ # @option options [Boolean] :dry_run
263
+ # Checks whether you have the required permissions for the action,
264
+ # without actually making the request, and provides an error response.
265
+ # If you have the required permissions, the error response is
266
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
267
+ # @option options [required, Array<Types::Tag>] :tags
268
+ # One or more tags. The `value` parameter is required, but if you don't
269
+ # want the tag to have a value, specify the parameter with no value, and
270
+ # we set the value to an empty string.
271
+ # @return [Tag::Collection]
272
+ def create_tags(options = {})
273
+ batch = []
274
+ options = Aws::Util.deep_merge(options, resources: [@id])
275
+ resp = @client.create_tags(options)
276
+ options[:tags].each do |t|
277
+ batch << Tag.new(
278
+ resource_id: @id,
279
+ key: t[:key],
280
+ value: t[:value],
281
+ client: @client
282
+ )
286
283
  end
284
+ Tag::Collection.new([batch], size: batch.size)
285
+ end
287
286
 
288
- # @example Request syntax with placeholder values
289
- #
290
- # image.deregister({
291
- # dry_run: false,
292
- # })
293
- # @param [Hash] options ({})
294
- # @option options [Boolean] :dry_run
295
- # Checks whether you have the required permissions for the action,
296
- # without actually making the request, and provides an error response.
297
- # If you have the required permissions, the error response is
298
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
299
- # @return [EmptyStructure]
300
- def deregister(options = {})
301
- options = options.merge(image_id: @id)
302
- resp = @client.deregister_image(options)
303
- resp.data
304
- end
287
+ # @example Request syntax with placeholder values
288
+ #
289
+ # image.deregister({
290
+ # dry_run: false,
291
+ # })
292
+ # @param [Hash] options ({})
293
+ # @option options [Boolean] :dry_run
294
+ # Checks whether you have the required permissions for the action,
295
+ # without actually making the request, and provides an error response.
296
+ # If you have the required permissions, the error response is
297
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
298
+ # @return [EmptyStructure]
299
+ def deregister(options = {})
300
+ options = options.merge(image_id: @id)
301
+ resp = @client.deregister_image(options)
302
+ resp.data
303
+ end
305
304
 
306
- # @example Request syntax with placeholder values
307
- #
308
- # image.describe_attribute({
309
- # dry_run: false,
310
- # attribute: "description", # required, accepts description, kernel, ramdisk, launchPermission, productCodes, blockDeviceMapping, sriovNetSupport
311
- # })
312
- # @param [Hash] options ({})
313
- # @option options [Boolean] :dry_run
314
- # Checks whether you have the required permissions for the action,
315
- # without actually making the request, and provides an error response.
316
- # If you have the required permissions, the error response is
317
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
318
- # @option options [required, String] :attribute
319
- # The AMI attribute.
320
- #
321
- # **Note**\: Depending on your account privileges, the
322
- # `blockDeviceMapping` attribute may return a `Client.AuthFailure`
323
- # error. If this happens, use DescribeImages to get information about
324
- # the block device mapping for the AMI.
325
- # @return [Types::ImageAttribute]
326
- def describe_attribute(options = {})
327
- options = options.merge(image_id: @id)
328
- resp = @client.describe_image_attribute(options)
329
- resp.data
330
- end
305
+ # @example Request syntax with placeholder values
306
+ #
307
+ # image.describe_attribute({
308
+ # dry_run: false,
309
+ # attribute: "description", # required, accepts description, kernel, ramdisk, launchPermission, productCodes, blockDeviceMapping, sriovNetSupport
310
+ # })
311
+ # @param [Hash] options ({})
312
+ # @option options [Boolean] :dry_run
313
+ # Checks whether you have the required permissions for the action,
314
+ # without actually making the request, and provides an error response.
315
+ # If you have the required permissions, the error response is
316
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
317
+ # @option options [required, String] :attribute
318
+ # The AMI attribute.
319
+ #
320
+ # **Note**\: Depending on your account privileges, the
321
+ # `blockDeviceMapping` attribute may return a `Client.AuthFailure`
322
+ # error. If this happens, use DescribeImages to get information about
323
+ # the block device mapping for the AMI.
324
+ # @return [Types::ImageAttribute]
325
+ def describe_attribute(options = {})
326
+ options = options.merge(image_id: @id)
327
+ resp = @client.describe_image_attribute(options)
328
+ resp.data
329
+ end
331
330
 
332
- # @example Request syntax with placeholder values
333
- #
334
- # image.modify_attribute({
335
- # dry_run: false,
336
- # attribute: "String",
337
- # operation_type: "add", # accepts add, remove
338
- # user_ids: ["String"],
339
- # user_groups: ["String"],
340
- # product_codes: ["String"],
341
- # value: "String",
342
- # launch_permission: {
343
- # add: [
344
- # {
345
- # user_id: "String",
346
- # group: "all", # accepts all
347
- # },
348
- # ],
349
- # remove: [
350
- # {
351
- # user_id: "String",
352
- # group: "all", # accepts all
353
- # },
354
- # ],
355
- # },
356
- # description: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
357
- # })
358
- # @param [Hash] options ({})
359
- # @option options [Boolean] :dry_run
360
- # Checks whether you have the required permissions for the action,
361
- # without actually making the request, and provides an error response.
362
- # If you have the required permissions, the error response is
363
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
364
- # @option options [String] :attribute
365
- # The name of the attribute to modify.
366
- # @option options [String] :operation_type
367
- # The operation type.
368
- # @option options [Array<String>] :user_ids
369
- # One or more AWS account IDs. This is only valid when modifying the
370
- # `launchPermission` attribute.
371
- # @option options [Array<String>] :user_groups
372
- # One or more user groups. This is only valid when modifying the
373
- # `launchPermission` attribute.
374
- # @option options [Array<String>] :product_codes
375
- # One or more product codes. After you add a product code to an AMI, it
376
- # can't be removed. This is only valid when modifying the
377
- # `productCodes` attribute.
378
- # @option options [String] :value
379
- # The value of the attribute being modified. This is only valid when
380
- # modifying the `description` attribute.
381
- # @option options [Types::LaunchPermissionModifications] :launch_permission
382
- # A launch permission modification.
383
- # @option options [Types::AttributeValue] :description
384
- # A description for the AMI.
385
- # @return [EmptyStructure]
386
- def modify_attribute(options = {})
387
- options = options.merge(image_id: @id)
388
- resp = @client.modify_image_attribute(options)
389
- resp.data
390
- end
331
+ # @example Request syntax with placeholder values
332
+ #
333
+ # image.modify_attribute({
334
+ # dry_run: false,
335
+ # attribute: "String",
336
+ # operation_type: "add", # accepts add, remove
337
+ # user_ids: ["String"],
338
+ # user_groups: ["String"],
339
+ # product_codes: ["String"],
340
+ # value: "String",
341
+ # launch_permission: {
342
+ # add: [
343
+ # {
344
+ # user_id: "String",
345
+ # group: "all", # accepts all
346
+ # },
347
+ # ],
348
+ # remove: [
349
+ # {
350
+ # user_id: "String",
351
+ # group: "all", # accepts all
352
+ # },
353
+ # ],
354
+ # },
355
+ # description: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
356
+ # })
357
+ # @param [Hash] options ({})
358
+ # @option options [Boolean] :dry_run
359
+ # Checks whether you have the required permissions for the action,
360
+ # without actually making the request, and provides an error response.
361
+ # If you have the required permissions, the error response is
362
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
363
+ # @option options [String] :attribute
364
+ # The name of the attribute to modify.
365
+ # @option options [String] :operation_type
366
+ # The operation type.
367
+ # @option options [Array<String>] :user_ids
368
+ # One or more AWS account IDs. This is only valid when modifying the
369
+ # `launchPermission` attribute.
370
+ # @option options [Array<String>] :user_groups
371
+ # One or more user groups. This is only valid when modifying the
372
+ # `launchPermission` attribute.
373
+ # @option options [Array<String>] :product_codes
374
+ # One or more product codes. After you add a product code to an AMI, it
375
+ # can't be removed. This is only valid when modifying the
376
+ # `productCodes` attribute.
377
+ # @option options [String] :value
378
+ # The value of the attribute being modified. This is only valid when
379
+ # modifying the `description` attribute.
380
+ # @option options [Types::LaunchPermissionModifications] :launch_permission
381
+ # A launch permission modification.
382
+ # @option options [Types::AttributeValue] :description
383
+ # A description for the AMI.
384
+ # @return [EmptyStructure]
385
+ def modify_attribute(options = {})
386
+ options = options.merge(image_id: @id)
387
+ resp = @client.modify_image_attribute(options)
388
+ resp.data
389
+ end
391
390
 
392
- # @example Request syntax with placeholder values
393
- #
394
- # image.reset_attribute({
395
- # dry_run: false,
396
- # attribute: "launchPermission", # required, accepts launchPermission
397
- # })
398
- # @param [Hash] options ({})
399
- # @option options [Boolean] :dry_run
400
- # Checks whether you have the required permissions for the action,
401
- # without actually making the request, and provides an error response.
402
- # If you have the required permissions, the error response is
403
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
404
- # @option options [required, String] :attribute
405
- # The attribute to reset (currently you can only reset the launch
406
- # permission attribute).
407
- # @return [EmptyStructure]
408
- def reset_attribute(options = {})
409
- options = options.merge(image_id: @id)
410
- resp = @client.reset_image_attribute(options)
411
- resp.data
412
- end
391
+ # @example Request syntax with placeholder values
392
+ #
393
+ # image.reset_attribute({
394
+ # dry_run: false,
395
+ # attribute: "launchPermission", # required, accepts launchPermission
396
+ # })
397
+ # @param [Hash] options ({})
398
+ # @option options [Boolean] :dry_run
399
+ # Checks whether you have the required permissions for the action,
400
+ # without actually making the request, and provides an error response.
401
+ # If you have the required permissions, the error response is
402
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
403
+ # @option options [required, String] :attribute
404
+ # The attribute to reset (currently you can only reset the launch
405
+ # permission attribute).
406
+ # @return [EmptyStructure]
407
+ def reset_attribute(options = {})
408
+ options = options.merge(image_id: @id)
409
+ resp = @client.reset_image_attribute(options)
410
+ resp.data
411
+ end
413
412
 
414
- # @deprecated
415
- # @api private
416
- def identifiers
417
- { id: @id }
418
- end
419
- deprecated(:identifiers)
413
+ # @deprecated
414
+ # @api private
415
+ def identifiers
416
+ { id: @id }
417
+ end
418
+ deprecated(:identifiers)
420
419
 
421
- private
420
+ private
422
421
 
423
- def extract_id(args, options)
424
- value = args[0] || options.delete(:id)
425
- case value
426
- when String then value
427
- when nil then raise ArgumentError, "missing required option :id"
428
- else
429
- msg = "expected :id to be a String, got #{value.class}"
430
- raise ArgumentError, msg
431
- end
422
+ def extract_id(args, options)
423
+ value = args[0] || options.delete(:id)
424
+ case value
425
+ when String then value
426
+ when nil then raise ArgumentError, "missing required option :id"
427
+ else
428
+ msg = "expected :id to be a String, got #{value.class}"
429
+ raise ArgumentError, msg
432
430
  end
431
+ end
433
432
 
434
- def yield_waiter_and_warn(waiter, &block)
435
- if !@waiter_block_warned
436
- msg = "pass options to configure the waiter; "
437
- msg << "yielding the waiter is deprecated"
438
- warn(msg)
439
- @waiter_block_warned = true
440
- end
441
- yield(waiter.waiter)
433
+ def yield_waiter_and_warn(waiter, &block)
434
+ if !@waiter_block_warned
435
+ msg = "pass options to configure the waiter; "
436
+ msg << "yielding the waiter is deprecated"
437
+ warn(msg)
438
+ @waiter_block_warned = true
442
439
  end
440
+ yield(waiter.waiter)
441
+ end
443
442
 
444
- def separate_params_and_options(options)
445
- opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
446
- waiter_opts = {}
447
- waiter_params = {}
448
- options.each_pair do |key, value|
449
- if opts.include?(key)
450
- waiter_opts[key] = value
451
- else
452
- waiter_params[key] = value
453
- end
443
+ def separate_params_and_options(options)
444
+ opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
445
+ waiter_opts = {}
446
+ waiter_params = {}
447
+ options.each_pair do |key, value|
448
+ if opts.include?(key)
449
+ waiter_opts[key] = value
450
+ else
451
+ waiter_params[key] = value
454
452
  end
455
- waiter_opts[:client] ||= @client
456
- [waiter_opts, waiter_params]
457
453
  end
458
-
459
- class Collection < Aws::Resources::Collection; end
454
+ waiter_opts[:client] ||= @client
455
+ [waiter_opts, waiter_params]
460
456
  end
457
+
458
+ class Collection < Aws::Resources::Collection; end
461
459
  end
462
460
  end