本文整理汇总了Python中cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider.create_secgroup方法的典型用法代码示例。如果您正苦于以下问题:Python CloudProvider.create_secgroup方法的具体用法?Python CloudProvider.create_secgroup怎么用?Python CloudProvider.create_secgroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider
的用法示例。
在下文中一共展示了CloudProvider.create_secgroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from cloudmesh_client.cloud.iaas.CloudProvider import CloudProvider [as 别名]
# 或者: from cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider import create_secgroup [as 别名]
def create(cls, group=None, category=None):
"""
Method creates a new security group in database
& returns the uuid of the created group
:param group:
:param category:
:return:
"""
# Create the security group in given cloud
try:
cloud_provider = CloudProvider(category).provider
secgroup = cloud_provider.create_secgroup(group)
if secgroup:
uuid = secgroup.id
return uuid
else:
print("Failed to create security group, {}".format(secgroup))
except Exception as e:
print(
"Exception creating security group in cloud, {}".format(e))
return None
示例2: add_group_cloud
# 需要导入模块: from cloudmesh_client.cloud.iaas.CloudProvider import CloudProvider [as 别名]
# 或者: from cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider import create_secgroup [as 别名]
def add_group_cloud(cls, cloud, groupname):
provider = CloudProvider(cloud).provider
return provider.create_secgroup(groupname)