Class: Aws::EC2::NatGateway

Inherits:
Resources::Resource
  • Object
show all
Defined in:
lib/chef/resource/aws_nat_gateway.rb

Overview

We provide this class because the AWS SDK V2 does not provide it (as of May 2016). We copied the pattern in their SDK so when they do add a real resource there shouldn’t be a need for much translation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, options = {}) ⇒ NatGateway

Returns a new instance of NatGateway.



21
22
23
24
25
26
27
28
29
# File 'lib/chef/resource/aws_nat_gateway.rb', line 21

def initialize(id, options = {})
  @id = id
  @nat_gateway_id = id
  @client = options[:client]
  nat_gateway_struct = get_nat_gateway_struct
  @vpc_id = nat_gateway_struct.vpc_id
  @subnet_id = nat_gateway_struct.subnet_id
  @nat_gateway_addresses = nat_gateway_struct.nat_gateway_addresses
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



19
20
21
# File 'lib/chef/resource/aws_nat_gateway.rb', line 19

def id
  @id
end

#nat_gateway_addressesObject (readonly)

Returns the value of attribute nat_gateway_addresses.



19
20
21
# File 'lib/chef/resource/aws_nat_gateway.rb', line 19

def nat_gateway_addresses
  @nat_gateway_addresses
end

#nat_gateway_idObject (readonly)

Returns the value of attribute nat_gateway_id.



19
20
21
# File 'lib/chef/resource/aws_nat_gateway.rb', line 19

def nat_gateway_id
  @nat_gateway_id
end

#resourceObject (readonly)

Returns the value of attribute resource.



19
20
21
# File 'lib/chef/resource/aws_nat_gateway.rb', line 19

def resource
  @resource
end

#subnet_idObject (readonly)

Returns the value of attribute subnet_id.



19
20
21
# File 'lib/chef/resource/aws_nat_gateway.rb', line 19

def subnet_id
  @subnet_id
end

#vpc_idObject (readonly)

Returns the value of attribute vpc_id.



19
20
21
# File 'lib/chef/resource/aws_nat_gateway.rb', line 19

def vpc_id
  @vpc_id
end

Instance Method Details

#deleteObject



35
36
37
# File 'lib/chef/resource/aws_nat_gateway.rb', line 35

def delete
  @client.delete_nat_gateway(nat_gateway_id: @id)
end

#stateObject



31
32
33
# File 'lib/chef/resource/aws_nat_gateway.rb', line 31

def state
  get_nat_gateway_struct.state
end