本文整理汇总了Python中azure.servicemanagement.ServiceManagementService.update_role方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceManagementService.update_role方法的具体用法?Python ServiceManagementService.update_role怎么用?Python ServiceManagementService.update_role使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.servicemanagement.ServiceManagementService
的用法示例。
在下文中一共展示了ServiceManagementService.update_role方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: azure_add_endpoints
# 需要导入模块: from azure.servicemanagement import ServiceManagementService [as 别名]
# 或者: from azure.servicemanagement.ServiceManagementService import update_role [as 别名]
def azure_add_endpoints(name, portConfigs):
sms = ServiceManagementService(AZURE_SUBSCRIPTION_ID, AZURE_CERTIFICATE)
role = sms.get_role(name, name, name)
network_config = role.configuration_sets[0]
for i, portConfig in enumerate(portConfigs):
network_config.input_endpoints.input_endpoints.append(
ConfigurationSetInputEndpoint(
name=portConfig["service"],
protocol=portConfig["protocol"],
port=portConfig["port"],
local_port=portConfig["local_port"],
load_balanced_endpoint_set_name=None,
enable_direct_server_return=True if portConfig["protocol"] == "udp" else False,
idle_timeout_in_minutes=None if portConfig["protocol"] == "udp" else 4)
)
try:
sms.update_role(name, name, name, network_config=network_config)
except AzureHttpError as e:
debug.warn("Exception opening ports for %s: %r" % (name, e))