aws-sdk-ec2 1.0.0.rc2 → 1.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-sdk-ec2.rb +2 -2
- data/lib/aws-sdk-ec2/classic_address.rb +198 -200
- data/lib/aws-sdk-ec2/client.rb +17169 -14563
- data/lib/aws-sdk-ec2/client_api.rb +6458 -6301
- data/lib/aws-sdk-ec2/dhcp_options.rb +158 -160
- data/lib/aws-sdk-ec2/errors.rb +4 -13
- data/lib/aws-sdk-ec2/image.rb +404 -406
- data/lib/aws-sdk-ec2/instance.rb +1423 -1422
- data/lib/aws-sdk-ec2/internet_gateway.rb +178 -180
- data/lib/aws-sdk-ec2/key_pair.rb +98 -100
- data/lib/aws-sdk-ec2/key_pair_info.rb +102 -104
- data/lib/aws-sdk-ec2/network_acl.rb +326 -328
- data/lib/aws-sdk-ec2/network_interface.rb +428 -430
- data/lib/aws-sdk-ec2/network_interface_association.rb +126 -128
- data/lib/aws-sdk-ec2/placement_group.rb +400 -399
- data/lib/aws-sdk-ec2/resource.rb +2696 -2659
- data/lib/aws-sdk-ec2/route.rb +229 -231
- data/lib/aws-sdk-ec2/route_table.rb +243 -245
- data/lib/aws-sdk-ec2/route_table_association.rb +148 -150
- data/lib/aws-sdk-ec2/security_group.rb +515 -517
- data/lib/aws-sdk-ec2/snapshot.rb +431 -433
- data/lib/aws-sdk-ec2/subnet.rb +981 -977
- data/lib/aws-sdk-ec2/tag.rb +185 -187
- data/lib/aws-sdk-ec2/types.rb +24081 -20965
- data/lib/aws-sdk-ec2/volume.rb +513 -512
- data/lib/aws-sdk-ec2/vpc.rb +1671 -1649
- data/lib/aws-sdk-ec2/vpc_address.rb +189 -191
- data/lib/aws-sdk-ec2/vpc_peering_connection.rb +219 -221
- data/lib/aws-sdk-ec2/waiters.rb +1252 -1210
- metadata +2 -2
@@ -1,183 +1,181 @@
|
|
1
1
|
# WARNING ABOUT GENERATED CODE
|
2
2
|
#
|
3
|
-
# This file is generated. See the contributing for
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
26
|
+
# @!group Read-Only Attributes
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
# @return [String]
|
29
|
+
def id
|
30
|
+
@id
|
31
|
+
end
|
32
|
+
alias :dhcp_options_id :id
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
46
|
+
# @!endgroup
|
48
47
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
# @return [Client]
|
49
|
+
def client
|
50
|
+
@client
|
51
|
+
end
|
53
52
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
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
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
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
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
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
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
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
|
data/lib/aws-sdk-ec2/errors.rb
CHANGED
@@ -1,23 +1,14 @@
|
|
1
1
|
# WARNING ABOUT GENERATED CODE
|
2
2
|
#
|
3
|
-
# This file is generated. See the contributing for
|
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
|
10
|
-
module Errors
|
8
|
+
module Aws::EC2
|
9
|
+
module Errors
|
11
10
|
|
12
|
-
|
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
|
data/lib/aws-sdk-ec2/image.rb
CHANGED
@@ -1,462 +1,460 @@
|
|
1
1
|
# WARNING ABOUT GENERATED CODE
|
2
2
|
#
|
3
|
-
# This file is generated. See the contributing for
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
26
|
+
# @!group Read-Only Attributes
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
# @return [String]
|
29
|
+
def id
|
30
|
+
@id
|
31
|
+
end
|
32
|
+
alias :image_id :id
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
# The location of the AMI.
|
35
|
+
# @return [String]
|
36
|
+
def image_location
|
37
|
+
data.image_location
|
38
|
+
end
|
40
39
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
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
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
73
|
+
# The architecture of the image.
|
74
|
+
# @return [String]
|
75
|
+
def architecture
|
76
|
+
data.architecture
|
77
|
+
end
|
79
78
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
79
|
+
# The type of image.
|
80
|
+
# @return [String]
|
81
|
+
def image_type
|
82
|
+
data.image_type
|
83
|
+
end
|
85
84
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
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
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
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
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
99
|
+
# The value is `Windows` for Windows AMIs; otherwise blank.
|
100
|
+
# @return [String]
|
101
|
+
def platform
|
102
|
+
data.platform
|
103
|
+
end
|
105
104
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
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
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
118
|
+
# The reason for the state change.
|
119
|
+
# @return [Types::StateReason]
|
120
|
+
def state_reason
|
121
|
+
data.state_reason
|
122
|
+
end
|
124
123
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
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
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
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
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
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
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
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
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
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
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
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
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
163
|
+
# The type of virtualization of the AMI.
|
164
|
+
# @return [String]
|
165
|
+
def virtualization_type
|
166
|
+
data.virtualization_type
|
167
|
+
end
|
169
168
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
169
|
+
# Any tags assigned to the image.
|
170
|
+
# @return [Array<Types::Tag>]
|
171
|
+
def tags
|
172
|
+
data.tags
|
173
|
+
end
|
175
174
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
175
|
+
# The hypervisor type of the image.
|
176
|
+
# @return [String]
|
177
|
+
def hypervisor
|
178
|
+
data.hypervisor
|
179
|
+
end
|
181
180
|
|
182
|
-
|
181
|
+
# @!endgroup
|
183
182
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
183
|
+
# @return [Client]
|
184
|
+
def client
|
185
|
+
@client
|
186
|
+
end
|
188
187
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
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
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
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
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
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
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
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
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
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
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
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
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
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
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
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
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
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
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
413
|
+
# @deprecated
|
414
|
+
# @api private
|
415
|
+
def identifiers
|
416
|
+
{ id: @id }
|
417
|
+
end
|
418
|
+
deprecated(:identifiers)
|
420
419
|
|
421
|
-
|
420
|
+
private
|
422
421
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
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
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
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
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
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
|
-
|
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
|