Sha256: 0c2740c1103ce4b13d111980ce1ded020d92c24a9cbb20d14f0a5b6f8a4ec4cb

Contents?: true

Size: 1.13 KB

Versions: 20

Compression:

Stored size: 1.13 KB

Contents

module Phase
  module Adapters
    module AWS
      class Network < ::Phase::Adapters::Abstract::Network

        # @param [Hash] options Filtering options
        # @see Phase::Adapters::AWS::Server.where Additional filter documentation
        # @return [Array<AWS::Server>] The AWS instances within this VPC
        def servers(options = {})
          options[:vpc_id] = resource.id
          Server.where(options)
        end

        # @return [Array<Fog::Compute::AWS::Subnet>] The subnets within this VPC
        def subnets
          Subnet.where(vpc_id: resource.id)
        end

        class << self
          # @return [Array<AWS::Network>] All known VPC instances
          def all
            api.vpcs.all.map {|network| new(network) }
          end

          # @param [String] network_id The ID of the requested VPC
          # @return [AWS::Network, nil] The requested VPC
          def find(network_id)
            new(api.vpcs.get(network_id))
          end

          private

            def api
              @api ||= ::Fog::Compute::AWS.new(region: ::Phase.config.aws_region)
            end
        end

      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
phase-1.0.2 lib/phase/adapters/aws/network.rb
phase-1.0.1 lib/phase/adapters/aws/network.rb
phase-1.0.0 lib/phase/adapters/aws/network.rb
phase-1.0.0.rc2 lib/phase/adapters/aws/network.rb
phase-1.0.0.rc1 lib/phase/adapters/aws/network.rb
phase-0.0.17 lib/phase/adapters/aws/network.rb
phase-0.0.16.1 lib/phase/adapters/aws/network.rb
phase-0.0.16 lib/phase/adapters/aws/network.rb
phase-0.0.15 lib/phase/adapters/aws/network.rb
phase-0.0.14 lib/phase/adapters/aws/network.rb
phase-0.0.13 lib/phase/adapters/aws/network.rb
phase-0.0.12 lib/phase/adapters/aws/network.rb
phase-0.0.11 lib/phase/adapters/aws/network.rb
phase-0.0.10 lib/phase/adapters/aws/network.rb
phase-0.0.9 lib/phase/adapters/aws/network.rb
phase-0.0.8 lib/phase/adapters/aws/network.rb
phase-0.0.7 lib/phase/adapters/aws/network.rb
phase-0.0.6 lib/phase/adapters/aws/network.rb
phase-0.0.5 lib/phase/adapters/aws/network.rb
phase-0.0.4 lib/phase/adapters/aws/network.rb