本文整理汇总了Python中azure.storage.blob.BlobService.set_container_metadata方法的典型用法代码示例。如果您正苦于以下问题:Python BlobService.set_container_metadata方法的具体用法?Python BlobService.set_container_metadata怎么用?Python BlobService.set_container_metadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.storage.blob.BlobService
的用法示例。
在下文中一共展示了BlobService.set_container_metadata方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: module_impl
# 需要导入模块: from azure.storage.blob import BlobService [as 别名]
# 或者: from azure.storage.blob.BlobService import set_container_metadata [as 别名]
#.........这里部分代码省略.........
raise Exception(str(e.args[0]))
if mode == 'create':
container = get_container_facts(bs, container_name)
if container is not None:
# container exists
results['container'] = container
results['msg'] = "Container already exists."
return results
# create the container
if not check_mode:
log('Create container %s' % container_name)
bs.create_container(container_name, x_ms_meta_name_values, x_ms_blob_public_access)
results['container'] = get_container_facts(bs, container_name)
results['msg'] = "Container created successfully."
results['changed'] = True
return results
if mode == 'update':
container = get_container_facts(bs, container_name)
if container is None:
# container does not exist
if not check_mode:
log('Create container %s' % container_name)
bs.create_container(container_name, x_ms_meta_name_values, x_ms_blob_public_access)
results['changed'] = True
results['msg'] = 'Container created successfully.'
return results
# update existing container
results['msg'] = "Container not changed."
if x_ms_meta_name_values:
if not check_mode:
log('Update x_ms_meta_name_values for container %s' % container_name)
bs.set_container_metadata(container_name, x_ms_meta_name_values)
results['changed'] = True
results['msg'] = 'Container meta data updated successfully.'
if x_ms_blob_public_access:
access = x_ms_blob_public_access
if x_ms_blob_public_access == 'private':
access = None
if not check_mode:
log('Set access to %s for container %s' % (access, container_name))
bs.set_container_acl(container_name=container_name, x_ms_blob_public_access=access)
results['changed'] = True
results['msg'] = 'Container ACL updated successfully.'
if permissions:
if hours == 0 and days == 0:
raise Exception("Parameter error: expecting hours > 0 or days > 0")
id = "%s-%s" % (container_name, permissions)
si = get_identifier(id, hours, days, permissions)
identifiers = SignedIdentifiers()
identifiers.signed_identifiers.append(si)
if not check_mode:
log('Set permissions to %s for container %s' % (permissions, container_name))
bs.set_container_acl(container_name=container_name,signed_identifiers=identifiers)
results['changed'] = True
results['msg'] = 'Container ACL updated successfully.'
results['container'] = get_container_facts(bs, container_name)
return results
if mode == 'delete':
container = get_container_facts(bs, container_name)
if container is None:
results['msg'] = "Container %s could not be found." % container_name
return results
if not check_mode: