def get_bucket_inventory(client, bucket, inventory_id):
    """Check a bucket for a named inventory, and return the destination."""
    inventories = client.list_bucket_inventory_configurations(
        Bucket=bucket).get('InventoryConfigurationList', [])
    inventories = {i['Id']: i for i in inventories}
    found = fnmatch.filter(inventories, inventory_id)
    if not found:
        return None

    i = inventories[found.pop()]
    s3_info = i['Destination']['S3BucketDestination']
    return {'bucket': s3_info['Bucket'].rsplit(':')[-1],
            'prefix': "%s/%s/%s" % (s3_info['Prefix'], bucket, i['Id'])}
def get_bucket_inventory ( client , bucket , inventory_id ) : inventories = client . list_bucket_inventory_configurations ( Bucket = bucket ) . get ( 'InventoryConfigurationList' , [ ] ) inventories = { i [ 'Id' ] : i for i in inventories } found = fnmatch . filter ( inventories , inventory_id ) if not found : return None i = inventories [ found . pop ( ) ] s3_info = i [ 'Destination' ] [ 'S3BucketDestination' ] return { 'bucket' : s3_info [ 'Bucket' ] . rsplit ( ':' ) [ - 1 ] , 'prefix' : "%s/%s/%s" % ( s3_info [ 'Prefix' ] , bucket , i [ 'Id' ] ) }
Check a bucket for a named inventory, and return the destination.