module RubyAemAws::AbstractStackManager

Add common methods to StackManager resource

Private Instance Methods

filter_for_db_query(dynamodb_tablename, key_attribute_value) click to toggle source

@param dynamodb_tablename AWS DynamoDB table name @param attkey_attribute_valueribute_value Key value to query for @return Array of a DynamoDB filter to query for a specific value

# File lib/ruby_aem_aws/abstract/stackmanager.rb, line 40
def filter_for_db_query(dynamodb_tablename, key_attribute_value)
  {
    table_name: dynamodb_tablename,
    consistent_read: true,
    attributes_to_get: ['state'],
    key_conditions: {
      'command_id' => {
        attribute_value_list: [key_attribute_value],
        comparison_operator: 'EQ'
      }
    },
    query_filter: {
      'state' => {
        attribute_value_list: ['Pending'],
        comparison_operator: 'NE'
      }
    }
  }
end
filter_for_db_scan(dynamodb_tablename, attribute_value) click to toggle source

@param dynamodb_tablename AWS DynamoDB table name @param attribute_value value to scan for @return Array of a DynamoDB filter to scan for a specific value

# File lib/ruby_aem_aws/abstract/stackmanager.rb, line 23
def filter_for_db_scan(dynamodb_tablename, attribute_value)
  {
    table_name: dynamodb_tablename,
    attributes_to_get: ['command_id'],
    scan_filter: {
      'message_id' => {
        attribute_value_list: [attribute_value],
        comparison_operator: 'EQ'
      }
    },
    consistent_read: true
  }
end
message_for_sns_publish(task, stack_prefix, details) click to toggle source

@param task Stack Manager task to trigger @param stack_prefix Target Stack Prefix name @param details SNS Message payload @return Array of a AWS SNS publish filter to query for a specific value

# File lib/ruby_aem_aws/abstract/stackmanager.rb, line 64
def message_for_sns_publish(task, stack_prefix, details)
  "{ \"default\": \"{ 'task': '#{task}', 'stack_prefix': '#{stack_prefix}', 'details': #{details} }\"}"
end