本文整理汇总了Python中pyvcloud.vcd.org.Org.update_org方法的典型用法代码示例。如果您正苦于以下问题:Python Org.update_org方法的具体用法?Python Org.update_org怎么用?Python Org.update_org使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.org.Org
的用法示例。
在下文中一共展示了Org.update_org方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Update
# 需要导入模块: from pyvcloud.vcd.org import Org [as 别名]
# 或者: from pyvcloud.vcd.org.Org import update_org [as 别名]
def Update(self, request, context):
"""
Update an organization.
Expected request params:
:param org_name: (string): name of organisation
:param is_enabled: (bool): enable/disable the organization
:return (bool): true/false based on the api execution success
"""
logging.info("__INIT_update_org_[org_plugin]")
org_name = request.name
is_enabled = request.is_enabled
res = org_pb2.UpdateOrgResult()
res.updated = False
try:
vref = VCDClientRef()
client = vref.get_ref()
org_resource = client.get_org_by_name(org_name)
org = Org(client, resource=org_resource)
org.update_org(is_enabled)
logging.info("__DONE_update_org_[org_plugin]")
res.updated = True
return res
except Exception as e:
error_message = '__ERROR_update_org_[org_plugin] failed for org {0} '.format(
org_name)
logging.warn(error_message, e)
context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
context.set_details(error_message)
return res
示例2: update
# 需要导入模块: from pyvcloud.vcd.org import Org [as 别名]
# 或者: from pyvcloud.vcd.org.Org import update_org [as 别名]
def update(ctx, name, is_enabled):
try:
restore_session(ctx)
client = ctx.obj['client']
org = Org(client, href=client.get_org_by_name(name).get('href'))
result = org.update_org(is_enabled=is_enabled)
stdout('Org \'%s\' is successfully updated.' % result.get('name'), ctx)
except Exception as e:
stderr(e, ctx)