pcf.particle.aws.cloudwatch package

Submodules

pcf.particle.aws.cloudwatch.cloudwatch_event module

class pcf.particle.aws.cloudwatch.cloudwatch_event.CloudWatchEvent(particle_definition, session=None)

Bases: pcf.core.aws_resource.AWSResource

This is the implementation of Amazon’s CloudWatch Events service.

START_PARAM_FILTER = {'Description', 'EventPattern', 'Name', 'RoleArn', 'ScheduleExpression', 'State'}
UNIQUE_KEYS = ['aws_resource.Name']
_set_unique_keys()

Logic that sets keys from state definition that are used to uniquely identify the log group

_start()

Starts the events particle that matches desired state definition

Returns:response of boto3 put_rule
_stop()

CloudWatch Events does not have a stopped state so it calls terminate

Returns:response of terminate function
_terminate()

Terminates the events particle that matches the rule_name

Returns:response of boto3 delete_function
_update()

Logic that updates the particle. This is implemented for each individual particle

equivalent_states = {<State.running: 1>: 1, <State.stopped: 2>: 0, <State.terminated: 3>: 0}
flavor = 'cloudwatch_events'
get_status()

Calls the describe rule boto call and returns the

Returns:current definition
is_state_definition_equivalent()

Compared the desired state and current state definition

Returns:bool
sync_state()

CloudWatch Events implementation of sync state. Calls get status and sets the current state.

pcf.particle.aws.cloudwatch.cloudwatch_log module

class pcf.particle.aws.cloudwatch.cloudwatch_log.CloudWatchLog(particle_definition, session=None)

Bases: pcf.core.aws_resource.AWSResource

This is the implementation of Amazon’s CloudWatch Logs service.

START_PARAM_FILTER = {'kmsKeyId', 'logGroupName', 'tags'}
UNIQUE_KEYS = ['aws_resource.logGroupName']
_set_unique_keys()

Logic that sets keys from state definition that are used to uniquely identify the log group

_start()

Starts the Cloudwatch Log Group according to the desired definition

Returns:response of boto3 create_log_group
_stop()

CloudWatch Logs does not have a stopped state so it calls terminate

Returns:response of terminate function
_terminate()

Terminates the Log Group identified by the logGroupName

Returns:response of boto3 delete_log_group
_update()

Updates any changed tags or KMS key

Returns:void
equivalent_states = {<State.running: 1>: 1, <State.stopped: 2>: 0, <State.terminated: 3>: 0}
flavor = 'cloudwatch_logs'
get_current_definition()

Calls the describe log group boto call and returns the group’s attributes

Returns:current definition if the group exists, otherwise a status missing message
is_state_definition_equivalent()

Compared the desired state and current state definition

Returns:bool
sync_state()

CloudWatch Logs implementation of sync state. Calls get current definition and sets the current state.

Returns:void

Module contents