Class: Aws::EC2::InternetGateway
- Inherits:
-
Object
- Object
- Aws::EC2::InternetGateway
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-ec2/internet_gateway.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#attachments ⇒ Array<Types::InternetGatewayAttachment>
Any VPCs attached to the Internet gateway.
- #id ⇒ String (also: #internet_gateway_id)
-
#tags ⇒ Array<Types::Tag>
Any tags assigned to the Internet gateway.
Actions collapse
- #attach_to_vpc(options = {}) ⇒ EmptyStructure
- #create_tags(options = {}) ⇒ Tag::Collection
- #delete(options = {}) ⇒ EmptyStructure
- #detach_from_vpc(options = {}) ⇒ EmptyStructure
- #identifiers ⇒ Object deprecated private Deprecated.
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::InternetGateway
Returns the data for this InternetGateway.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#initialize(*args) ⇒ InternetGateway
constructor
A new instance of InternetGateway.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current InternetGateway.
Constructor Details
#initialize(id, options = {}) ⇒ InternetGateway #initialize(options = {}) ⇒ InternetGateway
Returns a new instance of InternetGateway.
19 20 21 22 23 24 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 19 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @id = extract_id(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() end |
Instance Method Details
#attach_to_vpc(options = {}) ⇒ EmptyStructure
98 99 100 101 102 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 98 def attach_to_vpc( = {}) = .merge(internet_gateway_id: @id) resp = @client.attach_internet_gateway() resp.data end |
#attachments ⇒ Array<Types::InternetGatewayAttachment>
Any VPCs attached to the Internet gateway.
36 37 38 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 36 def data. end |
#client ⇒ Client
49 50 51 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 49 def client @client end |
#create_tags(options = {}) ⇒ Tag::Collection
126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 126 def ( = {}) batch = [] = Aws::Util.deep_merge(, resources: [@id]) resp = @client.() [:tags].each do |t| batch << Tag.new( resource_id: @id, key: t[:key], value: t[:value], client: @client ) end Tag::Collection.new([batch], size: batch.size) end |
#data ⇒ Types::InternetGateway
Returns the data for this Aws::EC2::InternetGateway. Calls Client#describe_internet_gateways if #data_loaded? is ‘false`.
69 70 71 72 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 69 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
77 78 79 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 77 def data_loaded? !!@data end |
#delete(options = {}) ⇒ EmptyStructure
153 154 155 156 157 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 153 def delete( = {}) = .merge(internet_gateway_id: @id) resp = @client.delete_internet_gateway() resp.data end |
#detach_from_vpc(options = {}) ⇒ EmptyStructure
174 175 176 177 178 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 174 def detach_from_vpc( = {}) = .merge(internet_gateway_id: @id) resp = @client.detach_internet_gateway() resp.data end |
#id ⇒ String Also known as: internet_gateway_id
29 30 31 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 29 def id @id end |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
182 183 184 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 182 def identifiers { id: @id } end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::EC2::InternetGateway. Returns ‘self` making it possible to chain methods.
internet_gateway.reload.data
59 60 61 62 63 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 59 def load resp = @client.describe_internet_gateways(internet_gateway_ids: [@id]) @data = resp.internet_gateways[0] self end |
#tags ⇒ Array<Types::Tag>
Any tags assigned to the Internet gateway.
42 43 44 |
# File 'lib/aws-sdk-ec2/internet_gateway.rb', line 42 def data. end |