Class: Bosh::Bootstrap::NetworkProviders::AWS

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh-bootstrap/network_providers/aws.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cyoi_provider_client) ⇒ AWS

Returns a new instance of AWS.



5
6
7
# File 'lib/bosh-bootstrap/network_providers/aws.rb', line 5

def initialize(cyoi_provider_client)
  @cyoi_provider_client = cyoi_provider_client
end

Instance Attribute Details

#cyoi_provider_clientObject (readonly)

Returns the value of attribute cyoi_provider_client.



3
4
5
# File 'lib/bosh-bootstrap/network_providers/aws.rb', line 3

def cyoi_provider_client
  @cyoi_provider_client
end

Instance Method Details

#perform(settings) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bosh-bootstrap/network_providers/aws.rb', line 9

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