pcf.particle.aws.ec2.alb package

Submodules

pcf.particle.aws.ec2.alb.alb module

class pcf.particle.aws.ec2.alb.alb.ApplicationLoadBalancing(particle_definition, session=None)

Bases: pcf.core.aws_resource.AWSResource

This is the implementation of Amazon’s Application Load Balancer.

REMOVE_PARAM_FILTER = {'IpAddressType', 'Name', 'Scheme', 'Subnets', 'Tags', 'Type', 'custom_config'}
START_PARAM_FILTER = {'IpAddressType', 'Name', 'Scheme', 'SecurityGroups', 'SubnetMappings', 'Subnets', 'Tags', 'Type'}
UPDATE_PARAM_FILTER = {'SecurityGroups'}
_get_arn()

Calls boto3 describe_load_balancers using Names to get current ALB status. Uses result to get LoadBalancerArn from the return object.

Returns:ALB arn
_need_update(curr_list, desired_list)

Checks to see if there are any difference in curr_list or desired_list. If they are different this returns True.

Parameters:
  • curr_list (list) – list of dictionaries
  • desired_list (list) – list of dictionaries
Returns:

bool

_start()

creates ALB particle that matches current state definition and calls create_listener() if ‘Listeners’ key is found in custom_config

_terminate()

deletes the load balancer particle that matches the LoadBalancerArn

Returns:response of boto3 delete_load_balancer()
_update()

updates the alb particle to match the desired state

create()

Creates an Application Load Balancer that matches current state definition

Returns:response of boto3 create alb instance with action create_load_balancer.
create_listener(create_listener_def)

Creates listeners for an Application Load Balancer that matches current state definition

Returns:response of boto3 create alb instance with action create_listener.
flavor = 'alb'
get_listener_status()

Get the current status of your load balancer’s listener(s). Calls boto3 describe_listeners using LoadBalancerArn

Returns:dict with the load balancer’s listeners that matches the LoadBalancerArn provided
get_status()

Get the current status of your load balancer. Calls boto3 describe_load_balancers using Names

Returns:dict with the load balancer that matches the Name provided
is_state_definition_equivalent()

Determines if the current state definition and the desired state definition are equivalent.

Returns:bool
state_lookup = {'active': <State.running: 1>, 'active_impaired': <State.terminated: 3>, 'failed': <State.terminated: 3>, 'provisioning': <State.pending: 4>}
sync_state()

Sync state calls get_status to determines and the state of the alb particle.

Module contents