class UpdateElbForWebsockets
Public Instance Methods
execute()
click to toggle source
# File migrations/20130826150635_update_elb_for_websockets.rb, line 2 def execute validate_receipt vpc = Bosh::AwsCliPlugin::VPC.find(ec2, vpc_id) security_group = vpc.security_group_by_name(cfrouter_security_group_name) params = {"protocol" => "tcp", "ports" => "4443", "sources" => "0.0.0.0/0"} if WebSocketElbHelpers.authorize_ingress(security_group, params) WebSocketElbHelpers.record_ingress(vpc_receipt, cfrouter_security_group_name, params) save_receipt('aws_vpc_receipt', vpc_receipt) end cfrouter_elb = elb.find_by_name("cfrouter") params = {port: 443, protocol: :https} https_listener_server_certificate = WebSocketElbHelpers.find_server_certificate_from_listeners(cfrouter_elb, params) params = {port: 4443, protocol: :ssl, instance_port: 80, instance_protocol: :tcp, server_certificate: https_listener_server_certificate} WebSocketElbHelpers.create_listener(cfrouter_elb, params) end
Private Instance Methods
cfrouter_config()
click to toggle source
# File migrations/20130826150635_update_elb_for_websockets.rb, line 50 def cfrouter_config vpc_receipt.fetch('original_configuration').fetch('vpc').fetch('elbs').fetch('cfrouter') end
cfrouter_security_group_name()
click to toggle source
# File migrations/20130826150635_update_elb_for_websockets.rb, line 54 def cfrouter_security_group_name cfrouter_config.fetch('security_group') end
validate_receipt()
click to toggle source
# File migrations/20130826150635_update_elb_for_websockets.rb, line 25 def validate_receipt begin cfrouter_config rescue KeyError err("Unable to find `cfrouter' ELB configuration in AWS VPC Receipt") end begin cfrouter_security_group_name rescue KeyError err("Unable to find `cfrouter' ELB Security Group in AWS VPC Receipt") end begin vpc_id rescue KeyError err("Unable to find VPC ID in AWS VPC Receipt") end end
vpc_id()
click to toggle source
# File migrations/20130826150635_update_elb_for_websockets.rb, line 58 def vpc_id vpc_receipt.fetch('vpc').fetch('id') end
vpc_receipt()
click to toggle source
# File migrations/20130826150635_update_elb_for_websockets.rb, line 46 def vpc_receipt @vpc_receipt ||= load_receipt('aws_vpc_receipt') end