def get_buckets_acls(self, resource_name, timestamp):
"""Select the bucket acls from a bucket acls snapshot table.
Args:
resource_name (str): String of the resource name.
timestamp (str): String of timestamp, formatted as
YYYYMMDDTHHMMSSZ.
Returns:
list: List of bucket acls.
Raises:
MySQLError: An error with MySQL has occurred.
"""
bucket_acls = {}
cnt = 0
try:
bucket_acls_sql = select_data.BUCKET_ACLS.format(timestamp)
rows = self.execute_sql_with_fetch(resource_name,
bucket_acls_sql,
None)
for row in rows:
bucket_acl = bkt_acls.\
BucketAccessControls(bucket=row['bucket'],
entity=row['entity'],
email=row['email'],
domain=row['domain'],
role=row['role'],
project_number=row['project_number'])
bucket_acls[cnt] = bucket_acl
cnt += 1
except (DataError, IntegrityError, InternalError, NotSupportedError,
OperationalError, ProgrammingError) as e:
LOGGER.error(errors.MySQLError(resource_name, e))
return bucket_acls
bucket_dao.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录