Sha256: 73f4845c2f4e13f737194fc9d56b3bc9dad16e13bbde8811588d41585744877b

Contents?: true

Size: 903 Bytes

Versions: 10

Compression:

Stored size: 903 Bytes

Contents

module Bosh::Bootstrap::NetworkProviders
  class AWS
    attr_reader :cyoi_provider_client

    def initialize(cyoi_provider_client)
      @cyoi_provider_client = cyoi_provider_client
    end

    def perform(settings)
      attributes = {}
      sg_suffix = ""
      if vpc_id = settings.exists?("address.vpc_id")
        attributes[:vpc_id] = vpc_id
        sg_suffix = "-#{vpc_id}"
      end
      security_groups.each do |name, ports|
        sg_name = "#{name}#{sg_suffix}"
        cyoi_provider_client.create_security_group(sg_name, name.to_s, {ports: ports}, attributes)
      end
    end

    protected
    def security_groups
      {
        "ssh" => 22,
        "dns-server" => { protocol: "udp", ports: (53..53) },
        "bosh" => [4222, 6868, 25250, 25555, 25777]
      }
    end
  end
end
Bosh::Bootstrap::NetworkProviders.register_provider("aws", Bosh::Bootstrap::NetworkProviders::AWS)

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bosh-bootstrap-0.18.1 lib/bosh-bootstrap/network_providers/aws.rb
bosh-bootstrap-0.18.0 lib/bosh-bootstrap/network_providers/aws.rb
bosh-bootstrap-0.17.1 lib/bosh-bootstrap/network_providers/aws.rb
bosh-bootstrap-0.17.0 lib/bosh-bootstrap/network_providers/aws.rb
bosh-bootstrap-0.16.2 lib/bosh-bootstrap/network_providers/aws.rb
bosh-bootstrap-0.16.1 lib/bosh-bootstrap/network_providers/aws.rb
bosh-bootstrap-0.16.0 lib/bosh-bootstrap/network_providers/aws.rb
bosh-bootstrap-0.15.0 lib/bosh-bootstrap/network_providers/aws.rb
bosh-bootstrap-0.14.5 lib/bosh-bootstrap/network_providers/aws.rb
bosh-bootstrap-0.14.4 lib/bosh-bootstrap/network_providers/aws.rb