本文整理汇总了Python中tenant.Tenant.tenant_getid方法的典型用法代码示例。如果您正苦于以下问题:Python Tenant.tenant_getid方法的具体用法?Python Tenant.tenant_getid怎么用?Python Tenant.tenant_getid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tenant.Tenant
的用法示例。
在下文中一共展示了Tenant.tenant_getid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cluster_create
# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import tenant_getid [as 别名]
def cluster_create(self, label, tenant, project, datacenter, vcenter):
tenant_obj = Tenant(self.__ipAddr, self.__port)
vdatacenterobj = VcenterDatacenter(self.__ipAddr, self.__port)
projectobj = Project(self.__ipAddr, self.__port)
if(tenant == None):
tenant_uri = tenant_obj.tenant_getid()
else:
tenant_uri = tenant_obj.tenant_query(tenant)
parms = { 'name' : label
}
#project
if(project):
if(tenant):
projectname = tenant + "/" + project
else:
projectname = "" + "/" + project
#on failure, query raise exception
parms['project'] = projectobj.project_query(projectname)
#datacenter
if(datacenter):
#on failure, query raise exception
parms['vcenter_data_center'] = vdatacenterobj.vcenterdatacenter_query(datacenter, vcenter)
body = json.dumps(parms)
(s, h) = common.service_json_request(self.__ipAddr, self.__port,
"POST",
Cluster.URI_TENANTS_CLUSTERS.format(tenant_uri),
body)
o = common.json_decode(s)
示例2: cluster_create
# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import tenant_getid [as 别名]
def cluster_create(self, label, tenant, datacenter, vcenter):
tenant_obj = Tenant(self.__ipAddr, self.__port)
vdatacenterobj = VcenterDatacenter(self.__ipAddr, self.__port)
if(tenant is None):
tenant_uri = tenant_obj.tenant_getid()
else:
tenant_uri = tenant_obj.tenant_query(tenant)
parms = {'name': label}
# datacenter
if(datacenter):
# on failure, query raise exception
parms['vcenter_data_center'] = \
vdatacenterobj.vcenterdatacenter_query(
datacenter, vcenter, tenant)
body = json.dumps(parms)
(s, h) = common.service_json_request(
self.__ipAddr, self.__port,
"POST",
Cluster.URI_TENANTS_CLUSTERS.format(tenant_uri),
body)
o = common.json_decode(s)
示例3: list_from_all_tenants
# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import tenant_getid [as 别名]
def list_from_all_tenants(self):
hostList = []
from tenant import Tenant
obj = Tenant(self.__ipAddr, self.__port)
tenants = obj.tenant_list()
uris = []
for tenant in tenants:
uris.append(tenant["id"])
defaultTenantId = obj.tenant_getid()
uris.append(defaultTenantId)
for uri in uris:
if hostList.__len__() == 0:
hostList = self.list_by_tenant(uri)
else:
tempList = self.list_by_tenant(uri)
for tempHost in tempList:
hostList.append(tempHost)
return hostList