#NEWLINE# def get_elb_config( name , region = None , key = None , keyid = None , profile = None ) : #NEWLINE# #INDENT# '\n    Get an ELB configuration.\n\n    CLI example:\n\n    .. code-block:: bash\n\n        salt myminion boto_elb.exists myelb region=us-east-1\n    ' #NEWLINE# conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) #NEWLINE# try : #NEWLINE# #INDENT# lb = conn . get_all_load_balancers ( load_balancer_names = [ name ] ) #NEWLINE# lb = lb [ 0 ] #NEWLINE# ret = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# ret [ 'availability_zones' ] = lb . availability_zones #NEWLINE# listeners = [ ] #NEWLINE# for _listener in lb . listeners : #NEWLINE# #INDENT# listener_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# listener_dict [ 'elb_port' ] = _listener . load_balancer_port #NEWLINE# listener_dict [ 'elb_protocol' ] = _listener . protocol #NEWLINE# listener_dict [ 'instance_port' ] = _listener . instance_port #NEWLINE# listener_dict [ 'instance_protocol' ] = _listener . instance_protocol #NEWLINE# listener_dict [ 'policies' ] = _listener . policy_names #NEWLINE# if _listener . ssl_certificate_id : #NEWLINE# #INDENT# listener_dict [ 'certificate' ] = _listener . ssl_certificate_id #NEWLINE# #UNINDENT# listeners . append ( listener_dict ) #NEWLINE# #UNINDENT# ret [ 'listeners' ] = listeners #NEWLINE# backends = [ ] #NEWLINE# for _backend in lb . backends : #NEWLINE# #INDENT# bs_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# bs_dict [ 'instance_port' ] = _backend . instance_port #NEWLINE# bs_dict [ 'policies' ] = [ p . policy_name for p in _backend . policies ] #NEWLINE# backends . append ( bs_dict ) #NEWLINE# #UNINDENT# ret [ 'backends' ] = backends #NEWLINE# ret [ 'subnets' ] = lb . subnets #NEWLINE# ret [ 'security_groups' ] = lb . security_groups #NEWLINE# ret [ 'scheme' ] = lb . scheme #NEWLINE# ret [ 'dns_name' ] = lb . dns_name #NEWLINE# ret [ 'tags' ] = _get_all_tags ( conn , name ) #NEWLINE# lb_policy_lists = [ lb . policies . app_cookie_stickiness_policies , lb . policies . lb_cookie_stickiness_policies , lb . policies . other_policies ] #NEWLINE# policies = [ ] #NEWLINE# for policy_list in lb_policy_lists : #NEWLINE# #INDENT# policies += [ p . policy_name for p in policy_list ] #NEWLINE# #UNINDENT# ret [ 'policies' ] = policies #NEWLINE# return ret #NEWLINE# #UNINDENT# except boto . exception . BotoServerError as error : #NEWLINE# #INDENT# log . debug ( error ) #NEWLINE# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# }