dynamo.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:ebs_snapper 作者: rackerlabs 项目源码 文件源码
def list_ids(context, installed_region, aws_account_id=None):
    """Retrieve configuration from DynamoDB and return array of dictionary objects"""
    found_configurations = {}
    if aws_account_id is None:
        aws_account_id = utils.get_owner_id(context)[0]

    dynamodb = boto3.resource('dynamodb', region_name=installed_region)
    table = dynamodb.Table('ebs_snapshot_configuration')

    results = table.query(
        KeyConditionExpression=Key('aws_account_id').eq(aws_account_id)
    )

    for item in results.get('Items', []):
        str_item = item.get('configuration', None)
        found_configurations[str_item] = item['id']

    return found_configurations.values()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号