pcf.particle.aws.dynamodb package

Submodules

pcf.particle.aws.dynamodb.dynamodb_table module

class pcf.particle.aws.dynamodb.dynamodb_table.DynamoDB(particle_definition, session=None)

Bases: pcf.core.aws_resource.AWSResource

This is the implementation of Amazon’s DynamoDB service

REMOVE_PARAM_FILTER = {'CreationDateTime', 'ItemCount', 'TableArn', 'TableSizeBytes', 'TableStatus'}
START_PARAM_FILTER = {'AttributeDefinitions', 'GlobalSecondaryIndexes', 'KeySchema', 'LocalSecondaryIndexes', 'ProvisionedThroughput', 'TableName'}
THROUGHPUT_PARAM_FILTER = {'ReadCapacityUnits', 'WriteCapacityUnits'}
UPDATE_PARAM_FILTER = {'AttributeDefinitions', 'GlobalSecondaryIndexUpdates', 'ProvisionedThroughput', 'StreamSpecification', 'TableName'}
_start()

Starts the dynamodb particle that matches the desired state function

Returns:reponse of boto3 create_table
_stop()

DynamoDB does not have a stopped state so calls terminate.

_terminate()

Terminates the dynamodb particle that matches the table_name

Returns:response of boto3 delete_table
_update()

Updates the dynamodb particle to match current state definition.

delete_item(key_value, **kwargs)

Deletes a single item in DynamoDB table by primary key

Parameters:
  • key_value (dict) – a map of attribute names to AttributeValue objects
  • **kwargs – options for boto3 delete_item
flavor = 'dynamodb_table'
get_item(key_value, **kwargs)

Returns a set of attributes for the item with the given primary key

Parameters:
  • key_value (dict) – a map of attribute names to AttributeValue objects
  • **kwargs – options for boto3 get_item
get_status()

Calls the describe table boto call and returns status missing if the function does not exist. Otherwise will return the current definition

Returns:current definition
is_state_definition_equivalent()

Compares the desired state and current state definitions.

Returns:bool
put_item(item_value, **kwargs)

Puts an item in the DynamoDB table

Parameters:
  • item (dict) – a map of attribute name/value pairs, one for each attribute
  • **kwargs – options for boto3 put_item
state_lookup = {'active': <State.running: 1>, 'creating': <State.pending: 4>, 'deleting': <State.pending: 4>, 'updating': <State.pending: 4>}
sync_state()

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

Module contents