aws-sdk-ec2 1.0.0.rc1
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.
- checksums.yaml +7 -0
- data/lib/aws-sdk-ec2.rb +70 -0
- data/lib/aws-sdk-ec2/classic_address.rb +227 -0
- data/lib/aws-sdk-ec2/client.rb +14254 -0
- data/lib/aws-sdk-ec2/client_api.rb +6182 -0
- data/lib/aws-sdk-ec2/customizations.rb +21 -0
- data/lib/aws-sdk-ec2/customizations/instance.rb +29 -0
- data/lib/aws-sdk-ec2/customizations/resource.rb +18 -0
- data/lib/aws-sdk-ec2/dhcp_options.rb +183 -0
- data/lib/aws-sdk-ec2/errors.rb +23 -0
- data/lib/aws-sdk-ec2/image.rb +462 -0
- data/lib/aws-sdk-ec2/instance.rb +1570 -0
- data/lib/aws-sdk-ec2/internet_gateway.rb +204 -0
- data/lib/aws-sdk-ec2/key_pair.rb +120 -0
- data/lib/aws-sdk-ec2/key_pair_info.rb +122 -0
- data/lib/aws-sdk-ec2/network_acl.rb +341 -0
- data/lib/aws-sdk-ec2/network_interface.rb +474 -0
- data/lib/aws-sdk-ec2/network_interface_association.rb +151 -0
- data/lib/aws-sdk-ec2/placement_group.rb +426 -0
- data/lib/aws-sdk-ec2/plugins/copy_encrypted_snapshot.rb +59 -0
- data/lib/aws-sdk-ec2/plugins/region_validation.rb +19 -0
- data/lib/aws-sdk-ec2/resource.rb +2684 -0
- data/lib/aws-sdk-ec2/route.rb +243 -0
- data/lib/aws-sdk-ec2/route_table.rb +277 -0
- data/lib/aws-sdk-ec2/route_table_association.rb +177 -0
- data/lib/aws-sdk-ec2/security_group.rb +530 -0
- data/lib/aws-sdk-ec2/snapshot.rb +478 -0
- data/lib/aws-sdk-ec2/subnet.rb +972 -0
- data/lib/aws-sdk-ec2/tag.rb +223 -0
- data/lib/aws-sdk-ec2/types.rb +20124 -0
- data/lib/aws-sdk-ec2/volume.rb +555 -0
- data/lib/aws-sdk-ec2/vpc.rb +1698 -0
- data/lib/aws-sdk-ec2/vpc_address.rb +219 -0
- data/lib/aws-sdk-ec2/vpc_peering_connection.rb +265 -0
- data/lib/aws-sdk-ec2/waiters.rb +1334 -0
- metadata +107 -0
@@ -0,0 +1,204 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing for info on making contributions:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws
|
9
|
+
module EC2
|
10
|
+
class InternetGateway
|
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
|
26
|
+
|
27
|
+
# @!group Read-Only Attributes
|
28
|
+
|
29
|
+
# @return [String]
|
30
|
+
def id
|
31
|
+
@id
|
32
|
+
end
|
33
|
+
alias :internet_gateway_id :id
|
34
|
+
|
35
|
+
# Any VPCs attached to the Internet gateway.
|
36
|
+
# @return [Array<Types::InternetGatewayAttachment>]
|
37
|
+
def attachments
|
38
|
+
data.attachments
|
39
|
+
end
|
40
|
+
|
41
|
+
# Any tags assigned to the Internet gateway.
|
42
|
+
# @return [Array<Types::Tag>]
|
43
|
+
def tags
|
44
|
+
data.tags
|
45
|
+
end
|
46
|
+
|
47
|
+
# @!endgroup
|
48
|
+
|
49
|
+
# @return [Client]
|
50
|
+
def client
|
51
|
+
@client
|
52
|
+
end
|
53
|
+
|
54
|
+
# Loads, or reloads {#data} for the current {InternetGateway}.
|
55
|
+
# Returns `self` making it possible to chain methods.
|
56
|
+
#
|
57
|
+
# internet_gateway.reload.data
|
58
|
+
#
|
59
|
+
# @return [self]
|
60
|
+
def load
|
61
|
+
resp = @client.describe_internet_gateways(internet_gateway_ids: [@id])
|
62
|
+
@data = resp.internetgateways[0]
|
63
|
+
self
|
64
|
+
end
|
65
|
+
alias :reload :load
|
66
|
+
|
67
|
+
# @return [Types::InternetGateway]
|
68
|
+
# Returns the data for this {InternetGateway}. Calls
|
69
|
+
# {Client#describe_internet_gateways} if {#data_loaded?} is `false`.
|
70
|
+
def data
|
71
|
+
load unless @data
|
72
|
+
@data
|
73
|
+
end
|
74
|
+
|
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
|
81
|
+
|
82
|
+
# @!group Actions
|
83
|
+
|
84
|
+
# @example Request syntax with placeholder values
|
85
|
+
#
|
86
|
+
# internet_gateway.attach_to_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 attach_to_vpc(options = {})
|
100
|
+
options = options.merge(internet_gateway_id: @id)
|
101
|
+
resp = @client.attach_internet_gateway(options)
|
102
|
+
resp.data
|
103
|
+
end
|
104
|
+
|
105
|
+
# @example Request syntax with placeholder values
|
106
|
+
#
|
107
|
+
# tag = internet_gateway.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)
|
140
|
+
end
|
141
|
+
|
142
|
+
# @example Request syntax with placeholder values
|
143
|
+
#
|
144
|
+
# internet_gateway.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(internet_gateway_id: @id)
|
156
|
+
resp = @client.delete_internet_gateway(options)
|
157
|
+
resp.data
|
158
|
+
end
|
159
|
+
|
160
|
+
# @example Request syntax with placeholder values
|
161
|
+
#
|
162
|
+
# internet_gateway.detach_from_vpc({
|
163
|
+
# dry_run: false,
|
164
|
+
# vpc_id: "String", # required
|
165
|
+
# })
|
166
|
+
# @param [Hash] options ({})
|
167
|
+
# @option options [Boolean] :dry_run
|
168
|
+
# Checks whether you have the required permissions for the action,
|
169
|
+
# without actually making the request, and provides an error response.
|
170
|
+
# If you have the required permissions, the error response is
|
171
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
172
|
+
# @option options [required, String] :vpc_id
|
173
|
+
# The ID of the VPC.
|
174
|
+
# @return [EmptyStructure]
|
175
|
+
def detach_from_vpc(options = {})
|
176
|
+
options = options.merge(internet_gateway_id: @id)
|
177
|
+
resp = @client.detach_internet_gateway(options)
|
178
|
+
resp.data
|
179
|
+
end
|
180
|
+
|
181
|
+
# @deprecated
|
182
|
+
# @api private
|
183
|
+
def identifiers
|
184
|
+
{ id: @id }
|
185
|
+
end
|
186
|
+
deprecated(:identifiers)
|
187
|
+
|
188
|
+
private
|
189
|
+
|
190
|
+
def extract_id(args, options)
|
191
|
+
value = args[0] || options.delete(:id)
|
192
|
+
case value
|
193
|
+
when String then value
|
194
|
+
when nil then raise ArgumentError, "missing required option :id"
|
195
|
+
else
|
196
|
+
msg = "expected :id to be a String, got #{value.class}"
|
197
|
+
raise ArgumentError, msg
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
class Collection < Aws::Resources::Collection; end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing for info on making contributions:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws
|
9
|
+
module EC2
|
10
|
+
class KeyPair
|
11
|
+
|
12
|
+
extend Aws::Deprecations
|
13
|
+
|
14
|
+
# @overload def initialize(name, options = {})
|
15
|
+
# @param [String] name
|
16
|
+
# @option options [Client] :client
|
17
|
+
# @overload def initialize(options = {})
|
18
|
+
# @option options [required, String] :name
|
19
|
+
# @option options [Client] :client
|
20
|
+
def initialize(*args)
|
21
|
+
options = Hash === args.last ? args.pop.dup : {}
|
22
|
+
@name = extract_name(args, options)
|
23
|
+
@data = options.delete(:data)
|
24
|
+
@client = options.delete(:client) || Client.new(options)
|
25
|
+
end
|
26
|
+
|
27
|
+
# @!group Read-Only Attributes
|
28
|
+
|
29
|
+
# @return [String]
|
30
|
+
def name
|
31
|
+
@name
|
32
|
+
end
|
33
|
+
alias :key_name :name
|
34
|
+
|
35
|
+
# The SHA-1 digest of the DER encoded private key.
|
36
|
+
# @return [String]
|
37
|
+
def key_fingerprint
|
38
|
+
data.key_fingerprint
|
39
|
+
end
|
40
|
+
|
41
|
+
# An unencrypted PEM encoded RSA private key.
|
42
|
+
# @return [String]
|
43
|
+
def key_material
|
44
|
+
data.key_material
|
45
|
+
end
|
46
|
+
|
47
|
+
# @!endgroup
|
48
|
+
|
49
|
+
# @return [Client]
|
50
|
+
def client
|
51
|
+
@client
|
52
|
+
end
|
53
|
+
|
54
|
+
# @raise [Errors::ResourceNotLoadable]
|
55
|
+
# @api private
|
56
|
+
def load
|
57
|
+
msg = "#load is not implemented, data only available via enumeration"
|
58
|
+
raise Errors::ResourceNotLoadable, msg
|
59
|
+
end
|
60
|
+
alias :reload :load
|
61
|
+
|
62
|
+
# @raise [Errors::ResourceNotLoadableError] Raises when {#data_loaded?} is `false`.
|
63
|
+
# @return [Types::KeyPair]
|
64
|
+
# Returns the data for this {KeyPair}.
|
65
|
+
def data
|
66
|
+
load unless @data
|
67
|
+
@data
|
68
|
+
end
|
69
|
+
|
70
|
+
# @return [Boolean]
|
71
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
72
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
73
|
+
def data_loaded?
|
74
|
+
!!@data
|
75
|
+
end
|
76
|
+
|
77
|
+
# @!group Actions
|
78
|
+
|
79
|
+
# @example Request syntax with placeholder values
|
80
|
+
#
|
81
|
+
# key_pair.delete({
|
82
|
+
# dry_run: false,
|
83
|
+
# })
|
84
|
+
# @param [Hash] options ({})
|
85
|
+
# @option options [Boolean] :dry_run
|
86
|
+
# Checks whether you have the required permissions for the action,
|
87
|
+
# without actually making the request, and provides an error response.
|
88
|
+
# If you have the required permissions, the error response is
|
89
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
90
|
+
# @return [EmptyStructure]
|
91
|
+
def delete(options = {})
|
92
|
+
options = options.merge(key_name: @name)
|
93
|
+
resp = @client.delete_key_pair(options)
|
94
|
+
resp.data
|
95
|
+
end
|
96
|
+
|
97
|
+
# @deprecated
|
98
|
+
# @api private
|
99
|
+
def identifiers
|
100
|
+
{ name: @name }
|
101
|
+
end
|
102
|
+
deprecated(:identifiers)
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
def extract_name(args, options)
|
107
|
+
value = args[0] || options.delete(:name)
|
108
|
+
case value
|
109
|
+
when String then value
|
110
|
+
when nil then raise ArgumentError, "missing required option :name"
|
111
|
+
else
|
112
|
+
msg = "expected :name to be a String, got #{value.class}"
|
113
|
+
raise ArgumentError, msg
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
class Collection < Aws::Resources::Collection; end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing for info on making contributions:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws
|
9
|
+
module EC2
|
10
|
+
class KeyPairInfo
|
11
|
+
|
12
|
+
extend Aws::Deprecations
|
13
|
+
|
14
|
+
# @overload def initialize(name, options = {})
|
15
|
+
# @param [String] name
|
16
|
+
# @option options [Client] :client
|
17
|
+
# @overload def initialize(options = {})
|
18
|
+
# @option options [required, String] :name
|
19
|
+
# @option options [Client] :client
|
20
|
+
def initialize(*args)
|
21
|
+
options = Hash === args.last ? args.pop.dup : {}
|
22
|
+
@name = extract_name(args, options)
|
23
|
+
@data = options.delete(:data)
|
24
|
+
@client = options.delete(:client) || Client.new(options)
|
25
|
+
end
|
26
|
+
|
27
|
+
# @!group Read-Only Attributes
|
28
|
+
|
29
|
+
# @return [String]
|
30
|
+
def name
|
31
|
+
@name
|
32
|
+
end
|
33
|
+
alias :key_name :name
|
34
|
+
|
35
|
+
# If you used CreateKeyPair to create the key pair, this is the SHA-1
|
36
|
+
# digest of the DER encoded private key. If you used ImportKeyPair to
|
37
|
+
# provide AWS the public key, this is the MD5 public key fingerprint as
|
38
|
+
# specified in section 4 of RFC4716.
|
39
|
+
# @return [String]
|
40
|
+
def key_fingerprint
|
41
|
+
data.key_fingerprint
|
42
|
+
end
|
43
|
+
|
44
|
+
# @!endgroup
|
45
|
+
|
46
|
+
# @return [Client]
|
47
|
+
def client
|
48
|
+
@client
|
49
|
+
end
|
50
|
+
|
51
|
+
# Loads, or reloads {#data} for the current {KeyPairInfo}.
|
52
|
+
# Returns `self` making it possible to chain methods.
|
53
|
+
#
|
54
|
+
# key_pair_info.reload.data
|
55
|
+
#
|
56
|
+
# @return [self]
|
57
|
+
def load
|
58
|
+
resp = @client.describe_key_pairs(key_names: [@name])
|
59
|
+
@data = resp.keypairs[0]
|
60
|
+
self
|
61
|
+
end
|
62
|
+
alias :reload :load
|
63
|
+
|
64
|
+
# @return [Types::KeyPairInfo]
|
65
|
+
# Returns the data for this {KeyPairInfo}. Calls
|
66
|
+
# {Client#describe_key_pairs} if {#data_loaded?} is `false`.
|
67
|
+
def data
|
68
|
+
load unless @data
|
69
|
+
@data
|
70
|
+
end
|
71
|
+
|
72
|
+
# @return [Boolean]
|
73
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
74
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
75
|
+
def data_loaded?
|
76
|
+
!!@data
|
77
|
+
end
|
78
|
+
|
79
|
+
# @!group Actions
|
80
|
+
|
81
|
+
# @example Request syntax with placeholder values
|
82
|
+
#
|
83
|
+
# key_pair_info.delete({
|
84
|
+
# dry_run: false,
|
85
|
+
# })
|
86
|
+
# @param [Hash] options ({})
|
87
|
+
# @option options [Boolean] :dry_run
|
88
|
+
# Checks whether you have the required permissions for the action,
|
89
|
+
# without actually making the request, and provides an error response.
|
90
|
+
# If you have the required permissions, the error response is
|
91
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
92
|
+
# @return [EmptyStructure]
|
93
|
+
def delete(options = {})
|
94
|
+
options = options.merge(key_name: @name)
|
95
|
+
resp = @client.delete_key_pair(options)
|
96
|
+
resp.data
|
97
|
+
end
|
98
|
+
|
99
|
+
# @deprecated
|
100
|
+
# @api private
|
101
|
+
def identifiers
|
102
|
+
{ name: @name }
|
103
|
+
end
|
104
|
+
deprecated(:identifiers)
|
105
|
+
|
106
|
+
private
|
107
|
+
|
108
|
+
def extract_name(args, options)
|
109
|
+
value = args[0] || options.delete(:name)
|
110
|
+
case value
|
111
|
+
when String then value
|
112
|
+
when nil then raise ArgumentError, "missing required option :name"
|
113
|
+
else
|
114
|
+
msg = "expected :name to be a String, got #{value.class}"
|
115
|
+
raise ArgumentError, msg
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
class Collection < Aws::Resources::Collection; end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,341 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing for info on making contributions:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws
|
9
|
+
module EC2
|
10
|
+
class NetworkAcl
|
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
|
26
|
+
|
27
|
+
# @!group Read-Only Attributes
|
28
|
+
|
29
|
+
# @return [String]
|
30
|
+
def id
|
31
|
+
@id
|
32
|
+
end
|
33
|
+
alias :network_acl_id :id
|
34
|
+
|
35
|
+
# The ID of the VPC for the network ACL.
|
36
|
+
# @return [String]
|
37
|
+
def vpc_id
|
38
|
+
data.vpc_id
|
39
|
+
end
|
40
|
+
|
41
|
+
# Indicates whether this is the default network ACL for the VPC.
|
42
|
+
# @return [Boolean]
|
43
|
+
def is_default
|
44
|
+
data.is_default
|
45
|
+
end
|
46
|
+
|
47
|
+
# One or more entries (rules) in the network ACL.
|
48
|
+
# @return [Array<Types::NetworkAclEntry>]
|
49
|
+
def entries
|
50
|
+
data.entries
|
51
|
+
end
|
52
|
+
|
53
|
+
# Any associations between the network ACL and one or more subnets
|
54
|
+
# @return [Array<Types::NetworkAclAssociation>]
|
55
|
+
def associations
|
56
|
+
data.associations
|
57
|
+
end
|
58
|
+
|
59
|
+
# Any tags assigned to the network ACL.
|
60
|
+
# @return [Array<Types::Tag>]
|
61
|
+
def tags
|
62
|
+
data.tags
|
63
|
+
end
|
64
|
+
|
65
|
+
# @!endgroup
|
66
|
+
|
67
|
+
# @return [Client]
|
68
|
+
def client
|
69
|
+
@client
|
70
|
+
end
|
71
|
+
|
72
|
+
# Loads, or reloads {#data} for the current {NetworkAcl}.
|
73
|
+
# Returns `self` making it possible to chain methods.
|
74
|
+
#
|
75
|
+
# network_acl.reload.data
|
76
|
+
#
|
77
|
+
# @return [self]
|
78
|
+
def load
|
79
|
+
resp = @client.describe_network_acls(network_acl_ids: [@id])
|
80
|
+
@data = resp.networkacls[0]
|
81
|
+
self
|
82
|
+
end
|
83
|
+
alias :reload :load
|
84
|
+
|
85
|
+
# @return [Types::NetworkAcl]
|
86
|
+
# Returns the data for this {NetworkAcl}. Calls
|
87
|
+
# {Client#describe_network_acls} if {#data_loaded?} is `false`.
|
88
|
+
def data
|
89
|
+
load unless @data
|
90
|
+
@data
|
91
|
+
end
|
92
|
+
|
93
|
+
# @return [Boolean]
|
94
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
95
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
96
|
+
def data_loaded?
|
97
|
+
!!@data
|
98
|
+
end
|
99
|
+
|
100
|
+
# @!group Actions
|
101
|
+
|
102
|
+
# @example Request syntax with placeholder values
|
103
|
+
#
|
104
|
+
# network_acl.create_entry({
|
105
|
+
# dry_run: false,
|
106
|
+
# rule_number: 1, # required
|
107
|
+
# protocol: "String", # required
|
108
|
+
# rule_action: "allow", # required, accepts allow, deny
|
109
|
+
# egress: false, # required
|
110
|
+
# cidr_block: "String", # required
|
111
|
+
# icmp_type_code: {
|
112
|
+
# type: 1,
|
113
|
+
# code: 1,
|
114
|
+
# },
|
115
|
+
# port_range: {
|
116
|
+
# from: 1,
|
117
|
+
# to: 1,
|
118
|
+
# },
|
119
|
+
# })
|
120
|
+
# @param [Hash] options ({})
|
121
|
+
# @option options [Boolean] :dry_run
|
122
|
+
# Checks whether you have the required permissions for the action,
|
123
|
+
# without actually making the request, and provides an error response.
|
124
|
+
# If you have the required permissions, the error response is
|
125
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
126
|
+
# @option options [required, Integer] :rule_number
|
127
|
+
# The rule number for the entry (for example, 100). ACL entries are
|
128
|
+
# processed in ascending order by rule number.
|
129
|
+
#
|
130
|
+
# Constraints: Positive integer from 1 to 32766. The range 32767 to
|
131
|
+
# 65535 is reserved for internal use.
|
132
|
+
# @option options [required, String] :protocol
|
133
|
+
# The protocol. A value of -1 means all protocols.
|
134
|
+
# @option options [required, String] :rule_action
|
135
|
+
# Indicates whether to allow or deny the traffic that matches the rule.
|
136
|
+
# @option options [required, Boolean] :egress
|
137
|
+
# Indicates whether this is an egress rule (rule is applied to traffic
|
138
|
+
# leaving the subnet).
|
139
|
+
# @option options [required, String] :cidr_block
|
140
|
+
# The network range to allow or deny, in CIDR notation (for example
|
141
|
+
# `172.16.0.0/24`).
|
142
|
+
# @option options [Types::IcmpTypeCode] :icmp_type_code
|
143
|
+
# ICMP protocol: The ICMP type and code. Required if specifying ICMP for
|
144
|
+
# the protocol.
|
145
|
+
# @option options [Types::PortRange] :port_range
|
146
|
+
# TCP or UDP protocols: The range of ports the rule applies to.
|
147
|
+
# @return [EmptyStructure]
|
148
|
+
def create_entry(options = {})
|
149
|
+
options = options.merge(network_acl_id: @id)
|
150
|
+
resp = @client.create_network_acl_entry(options)
|
151
|
+
resp.data
|
152
|
+
end
|
153
|
+
|
154
|
+
# @example Request syntax with placeholder values
|
155
|
+
#
|
156
|
+
# tag = network_acl.create_tags({
|
157
|
+
# dry_run: false,
|
158
|
+
# tags: [ # required
|
159
|
+
# {
|
160
|
+
# key: "String",
|
161
|
+
# value: "String",
|
162
|
+
# },
|
163
|
+
# ],
|
164
|
+
# })
|
165
|
+
# @param [Hash] options ({})
|
166
|
+
# @option options [Boolean] :dry_run
|
167
|
+
# Checks whether you have the required permissions for the action,
|
168
|
+
# without actually making the request, and provides an error response.
|
169
|
+
# If you have the required permissions, the error response is
|
170
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
171
|
+
# @option options [required, Array<Types::Tag>] :tags
|
172
|
+
# One or more tags. The `value` parameter is required, but if you don't
|
173
|
+
# want the tag to have a value, specify the parameter with no value, and
|
174
|
+
# we set the value to an empty string.
|
175
|
+
# @return [Tag::Collection]
|
176
|
+
def create_tags(options = {})
|
177
|
+
batch = []
|
178
|
+
options = Aws::Util.deep_merge(options, resources: [@id])
|
179
|
+
resp = @client.create_tags(options)
|
180
|
+
options[:tags].each do |t|
|
181
|
+
batch << Tag.new(
|
182
|
+
resource_id: @id,
|
183
|
+
key: t[:key],
|
184
|
+
value: t[:value],
|
185
|
+
client: @client
|
186
|
+
)
|
187
|
+
end
|
188
|
+
Tag::Collection.new([batch], size: batch.size)
|
189
|
+
end
|
190
|
+
|
191
|
+
# @example Request syntax with placeholder values
|
192
|
+
#
|
193
|
+
# network_acl.delete({
|
194
|
+
# dry_run: false,
|
195
|
+
# })
|
196
|
+
# @param [Hash] options ({})
|
197
|
+
# @option options [Boolean] :dry_run
|
198
|
+
# Checks whether you have the required permissions for the action,
|
199
|
+
# without actually making the request, and provides an error response.
|
200
|
+
# If you have the required permissions, the error response is
|
201
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
202
|
+
# @return [EmptyStructure]
|
203
|
+
def delete(options = {})
|
204
|
+
options = options.merge(network_acl_id: @id)
|
205
|
+
resp = @client.delete_network_acl(options)
|
206
|
+
resp.data
|
207
|
+
end
|
208
|
+
|
209
|
+
# @example Request syntax with placeholder values
|
210
|
+
#
|
211
|
+
# network_acl.delete_entry({
|
212
|
+
# dry_run: false,
|
213
|
+
# rule_number: 1, # required
|
214
|
+
# egress: false, # required
|
215
|
+
# })
|
216
|
+
# @param [Hash] options ({})
|
217
|
+
# @option options [Boolean] :dry_run
|
218
|
+
# Checks whether you have the required permissions for the action,
|
219
|
+
# without actually making the request, and provides an error response.
|
220
|
+
# If you have the required permissions, the error response is
|
221
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
222
|
+
# @option options [required, Integer] :rule_number
|
223
|
+
# The rule number of the entry to delete.
|
224
|
+
# @option options [required, Boolean] :egress
|
225
|
+
# Indicates whether the rule is an egress rule.
|
226
|
+
# @return [EmptyStructure]
|
227
|
+
def delete_entry(options = {})
|
228
|
+
options = options.merge(network_acl_id: @id)
|
229
|
+
resp = @client.delete_network_acl_entry(options)
|
230
|
+
resp.data
|
231
|
+
end
|
232
|
+
|
233
|
+
# @example Request syntax with placeholder values
|
234
|
+
#
|
235
|
+
# network_acl.replace_association({
|
236
|
+
# dry_run: false,
|
237
|
+
# association_id: "String", # required
|
238
|
+
# })
|
239
|
+
# @param [Hash] options ({})
|
240
|
+
# @option options [Boolean] :dry_run
|
241
|
+
# Checks whether you have the required permissions for the action,
|
242
|
+
# without actually making the request, and provides an error response.
|
243
|
+
# If you have the required permissions, the error response is
|
244
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
245
|
+
# @option options [required, String] :association_id
|
246
|
+
# The ID of the current association between the original network ACL and
|
247
|
+
# the subnet.
|
248
|
+
# @return [Types::ReplaceNetworkAclAssociationResult]
|
249
|
+
def replace_association(options = {})
|
250
|
+
options = options.merge(network_acl_id: @id)
|
251
|
+
resp = @client.replace_network_acl_association(options)
|
252
|
+
resp.data
|
253
|
+
end
|
254
|
+
|
255
|
+
# @example Request syntax with placeholder values
|
256
|
+
#
|
257
|
+
# network_acl.replace_entry({
|
258
|
+
# dry_run: false,
|
259
|
+
# rule_number: 1, # required
|
260
|
+
# protocol: "String", # required
|
261
|
+
# rule_action: "allow", # required, accepts allow, deny
|
262
|
+
# egress: false, # required
|
263
|
+
# cidr_block: "String", # required
|
264
|
+
# icmp_type_code: {
|
265
|
+
# type: 1,
|
266
|
+
# code: 1,
|
267
|
+
# },
|
268
|
+
# port_range: {
|
269
|
+
# from: 1,
|
270
|
+
# to: 1,
|
271
|
+
# },
|
272
|
+
# })
|
273
|
+
# @param [Hash] options ({})
|
274
|
+
# @option options [Boolean] :dry_run
|
275
|
+
# Checks whether you have the required permissions for the action,
|
276
|
+
# without actually making the request, and provides an error response.
|
277
|
+
# If you have the required permissions, the error response is
|
278
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
279
|
+
# @option options [required, Integer] :rule_number
|
280
|
+
# The rule number of the entry to replace.
|
281
|
+
# @option options [required, String] :protocol
|
282
|
+
# The IP protocol. You can specify `all` or `-1` to mean all protocols.
|
283
|
+
# @option options [required, String] :rule_action
|
284
|
+
# Indicates whether to allow or deny the traffic that matches the rule.
|
285
|
+
# @option options [required, Boolean] :egress
|
286
|
+
# Indicates whether to replace the egress rule.
|
287
|
+
#
|
288
|
+
# Default: If no value is specified, we replace the ingress rule.
|
289
|
+
# @option options [required, String] :cidr_block
|
290
|
+
# The network range to allow or deny, in CIDR notation.
|
291
|
+
# @option options [Types::IcmpTypeCode] :icmp_type_code
|
292
|
+
# ICMP protocol: The ICMP type and code. Required if specifying 1 (ICMP)
|
293
|
+
# for the protocol.
|
294
|
+
# @option options [Types::PortRange] :port_range
|
295
|
+
# TCP or UDP protocols: The range of ports the rule applies to. Required
|
296
|
+
# if specifying 6 (TCP) or 17 (UDP) for the protocol.
|
297
|
+
# @return [EmptyStructure]
|
298
|
+
def replace_entry(options = {})
|
299
|
+
options = options.merge(network_acl_id: @id)
|
300
|
+
resp = @client.replace_network_acl_entry(options)
|
301
|
+
resp.data
|
302
|
+
end
|
303
|
+
|
304
|
+
# @!group Associations
|
305
|
+
|
306
|
+
# @return [Vpc, nil]
|
307
|
+
def vpc
|
308
|
+
if data.vpc_id
|
309
|
+
Vpc.new(
|
310
|
+
id: data.vpc_id,
|
311
|
+
client: @client
|
312
|
+
)
|
313
|
+
else
|
314
|
+
nil
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
# @deprecated
|
319
|
+
# @api private
|
320
|
+
def identifiers
|
321
|
+
{ id: @id }
|
322
|
+
end
|
323
|
+
deprecated(:identifiers)
|
324
|
+
|
325
|
+
private
|
326
|
+
|
327
|
+
def extract_id(args, options)
|
328
|
+
value = args[0] || options.delete(:id)
|
329
|
+
case value
|
330
|
+
when String then value
|
331
|
+
when nil then raise ArgumentError, "missing required option :id"
|
332
|
+
else
|
333
|
+
msg = "expected :id to be a String, got #{value.class}"
|
334
|
+
raise ArgumentError, msg
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
class Collection < Aws::Resources::Collection; end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
end
|