Class: Phase::Adapters::AWS::Network

Inherits:
Phase::Adapters::Abstract::Network show all
Defined in:
lib/phase/adapters/aws/network.rb

Instance Attribute Summary

Attributes inherited from Phase::Adapters::Abstract::Base

#resource

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Phase::Adapters::Abstract::Base

#initialize

Constructor Details

This class inherits a constructor from Phase::Adapters::Abstract::Base

Class Method Details

.allArray<AWS::Network>

Returns All known VPC instances.

Returns:



21
22
23
# File 'lib/phase/adapters/aws/network.rb', line 21

def all
  api.vpcs.all.map {|network| new(network) }
end

.find(network_id) ⇒ AWS::Network?

Returns The requested VPC.

Parameters:

  • network_id (String)

    The ID of the requested VPC

Returns:



27
28
29
# File 'lib/phase/adapters/aws/network.rb', line 27

def find(network_id)
  new(api.vpcs.get(network_id))
end

Instance Method Details

#servers(options = {}) ⇒ Array<AWS::Server>

Returns The AWS instances within this VPC.

Parameters:

  • options (Hash) (defaults to: {})

    Filtering options

Returns:

  • (Array<AWS::Server>)

    The AWS instances within this VPC

See Also:



9
10
11
12
# File 'lib/phase/adapters/aws/network.rb', line 9

def servers(options = {})
  options[:vpc_id] = resource.id
  Server.where(options)
end

#subnetsArray<Fog::Compute::AWS::Subnet>

Returns The subnets within this VPC.

Returns:

  • (Array<Fog::Compute::AWS::Subnet>)

    The subnets within this VPC



15
16
17
# File 'lib/phase/adapters/aws/network.rb', line 15

def subnets
  Subnet.where(vpc_id: resource.id)
end