当前位置: 首页>>代码示例>>Python>>正文


Python Tenant.namespace_get方法代码示例

本文整理汇总了Python中tenant.Tenant.namespace_get方法的典型用法代码示例。如果您正苦于以下问题:Python Tenant.namespace_get方法的具体用法?Python Tenant.namespace_get怎么用?Python Tenant.namespace_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tenant.Tenant的用法示例。


在下文中一共展示了Tenant.namespace_get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: keypool_show

# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import namespace_get [as 别名]
    def keypool_show(self, keypool, tenant, uid, secret):
        '''
        show keypool
        parameters:
            keypool:  	label of the keypool
            tenant:  	tenant name
            uid:	user id
            secret:	secret key
        Returns:
            JSON payload response
        '''
        #uri = self.keypool_query(label)

        if (not common.is_uri(tenant)):
            from tenant import Tenant
            tenant_obj = Tenant(self.__ipAddr, self.__port)
            namespace = tenant_obj.namespace_get(tenant)

        try:
            if(apitype == 's3'):
                return s3_bucket_show(namespace, keypool, uid, secretkey)
            elif(apitype == 'swift'):
                return swift_container_show(namespace, keypool, uid, secretkey)
            elif(apitype == 'atmos'):
                return atmos_subtenant_show(namespace, keypool, uid, secretkey)
            else:
                raise SOSError(SOSError.VALUE_ERR,
                               "Wrong API type " + apitype + " specified")
        except SOSError as e:
            raise e
开发者ID:Lidaja,项目名称:coprhd-controller,代码行数:32,代码来源:keypool.py

示例2: keypool_update

# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import namespace_get [as 别名]
    def keypool_update(
            self, keypool, tenant, versioning, apitype, uid, secret):
        '''
        update keypool versioning
        parameters:
            keypool:  	label of the keypool
            project:  	project name
            tenant:  	tenant  name
            uid:	user id
            secret:	secret key
        Returns:
            JSON payload response
        '''

        if (not common.is_uri(tenant)):
            from tenant import Tenant
            tenant_obj = Tenant(self.__ipAddr, self.__port)
            namespace = tenant_obj.namespace_get(tenant)

        try:
            if(apitype == 's3'):
                return s3_bucket_update(
                    namespace, keypool, versioning, uid, secretkey)
            else:
                raise SOSError(SOSError.VALUE_ERR,
                               "Wrong API type " + apitype + " specified")

        except SOSError as e:
            raise e
开发者ID:Lidaja,项目名称:coprhd-controller,代码行数:31,代码来源:keypool.py

示例3: keypool_delete

# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import namespace_get [as 别名]
    def keypool_delete(self, keypool, tenant, uid, secret):
        '''Makes a REST API call to delete a keypool by its name,
        project and tenant
        '''

        if (not common.is_uri(tenant)):
            from tenant import Tenant
            tenant_obj = Tenant(self.__ipAddr, self.__port)
            namespace = tenant_obj.namespace_get(tenant)

        try:
            if(apitype == 's3'):
                return s3_bucket_delete(namespace, keypool, uid, secretkey)
            elif(apitype == 'swift'):
                return swift_container_delete(namespace,
                                              keypool,
                                              uid,
                                              secretkey)
            elif(apitype == 'atmos'):
                return atmos_subtenant_delete(namespace,
                                              keypool,
                                              uid,
                                              secretkey)
            else:
                raise SOSError(SOSError.VALUE_ERR,
                               "Wrong API type " + apitype + " specified")
        except SOSError as e:
            raise e
开发者ID:Lidaja,项目名称:coprhd-controller,代码行数:30,代码来源:keypool.py

示例4: key_write

# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import namespace_get [as 别名]
    def key_write(self, key, filepath , keypool, tenant, apitype,  uid, secret, type):
        '''
        write a key
        parameters:    
            key:  	key
            keypool:  	keypool
            tenant:   	tenant  name
            value:   	value
	    apitype:    api to be used
	    uid:	user id
	    secret:	secret
        Returns:
            JSON payload response
        '''

	if (not common.is_uri(tenant)):
            from tenant import Tenant
            tenant_obj = Tenant(self.__ipAddr, self.__port)
            namespace =  tenant_obj.namespace_get(tenant)

	if(apitype == 's3'):
            s3_key_write(namespace, keypool, key, filepath, uid, secret )
        elif(apitype == 'swift'):
            swift_object_write(namespace, keypool, key, filepath, uid, secret )
        elif(apitype == 'atmos'):
            atmos_object_write(namespace, keypool, key, filepath, uid, secret, type )
        else:
            raise SOSError(SOSError.VALUE_ERR,
                  "Wrong API type " + apitype + " specified")
开发者ID:Lujoel,项目名称:coprhd-controller,代码行数:31,代码来源:key.py

示例5: key_delete

# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import namespace_get [as 别名]
    def key_delete(self, key, keypool, tenant, apitype, version, uid, secret):
        '''
        Makes a REST API call to delete a key by its name
        Parameters:           
            key:  label of the key
            keypool:  label of the keypool
            project:  project name
            tenant:  tenant  name
	    apitype:    api to be used
	    uid:	user id
	    secret:	secret
        Returns:
                JSON payload of key list
        '''
	if (not common.is_uri(tenant)):
            from tenant import Tenant
            tenant_obj = Tenant(self.__ipAddr, self.__port)
            namespace =  tenant_obj.namespace_get(tenant)

	if(apitype == 's3'):
            s3_key_delete(namespace, keypool, key, version, uid, secret )
        elif(apitype == 'swift'):
            swift_object_delete(namespace, keypool, key, version, uid, secret )
        elif(apitype == 'atmos'):
            atmos_object_delete(namespace, keypool, key, uid, secret )
        else:
            raise SOSError(SOSError.VALUE_ERR,
                  "Wrong API type " + apitype + " specified")
开发者ID:Lujoel,项目名称:coprhd-controller,代码行数:30,代码来源:key.py

示例6: key_list_versions

# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import namespace_get [as 别名]
    def key_list_versions(self, keypool, key, tenant, apitype,  uid, secret):
        '''
        Returns versions of the key`
        Parameters:           
            key:  label of the key
            keypool:  label of the keypool
            project:  project name
            tenant:  tenant  name
	    apitype:    api to be used
	    uid:	user id
	    secret:	secret
        Returns:
                JSON payload of key list
        '''

	if (not common.is_uri(tenant)):
            from tenant import Tenant
            tenant_obj = Tenant(self.__ipAddr, self.__port)
            namespace =  tenant_obj.namespace_get(tenant)

	if(apitype == 's3'):
            s3_key_list_versions(namespace, keypool, key, uid, secret )
	elif ( (apitype =='swift') or (apitype=='atmos')) :
            raise SOSError(SOSError.NOT_FOUND_ERR,
                  "Versioning not available with  API type " + apitype)
        else:
            raise SOSError(SOSError.VALUE_ERR,
                  "Wroing API type " + apitype + " specified")
开发者ID:Lujoel,项目名称:coprhd-controller,代码行数:30,代码来源:key.py

示例7: keypool_list

# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import namespace_get [as 别名]
    def keypool_list(self, projectname, tenant, apitype, uid, secret):
        '''
        Returns all the keypools in a vdc
        Parameters:
            keypool:  label of the keypool
            project:  project name
            tenant:  tenant  name
            apitype:    api type(s3, swift or atmos)
            uid:	user id
            secret:	secret key
        Returns:
                JSON payload of keypool list
        '''

        if (not common.is_uri(tenant)):
            from tenant import Tenant
            tenant_obj = Tenant(self.__ipAddr, self.__port)
            namespace = tenant_obj.namespace_get(tenant)

        kplst = []

        try:
            if((not apitype) or (apitype == 's3')):
                kplst.append(
                    s3_bucket_list(
                        namespace,
                        projectname,
                        uid,
                        secretkey))
            if((not apitype) or (apitype == 'swift')):
                kplst.append(
                    swift_container_list(
                        namespace,
                        projectname,
                        uid,
                        secretkey))
            if((not apitype) or (apitype == 'atmos')):
                kplst.append(
                    atmos_subtenant_list(
                        namespace,
                        projectname,
                        uid,
                        secretkey))

            # need to convert to table format
            return kplst
        except SOSError as e:
            raise e
开发者ID:Lidaja,项目名称:coprhd-controller,代码行数:50,代码来源:keypool.py

示例8: key_read

# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import namespace_get [as 别名]
    def key_read(self, key, keypool, tenant, apitype, version, filepath , uid, secret, type ):
        '''
        Makes a REST API call to retrieve details of a key  based on its key, keypool, apitype,uid, secret
        '''

	if (not common.is_uri(tenant)):
            from tenant import Tenant
            tenant_obj = Tenant(self.__ipAddr, self.__port)
            namespace =  tenant_obj.namespace_get(tenant)

	if(apitype == 's3'):
            return s3_key_read(namespace, keypool, key, version, filepath, uid, secret )
        elif(apitype == 'swift'):
            return swift_object_read(namespace, keypool, key, version, filepath, uid, secret )
        elif(apitype == 'atmos'):
            return atmos_object_read(namespace, keypool, key, version, filepath, uid, secret, type )
        else:
            raise SOSError(SOSError.VALUE_ERR,
                  "Wrong API type " + apitype + " specified")
开发者ID:Lujoel,项目名称:coprhd-controller,代码行数:21,代码来源:key.py

示例9: keypool_create

# 需要导入模块: from tenant import Tenant [as 别名]
# 或者: from tenant.Tenant import namespace_get [as 别名]
    def keypool_create(self,
                       keypool,
                       projectname,
                       tenant,
                       vpoolname,
                       apitype,
                       uid,
                       secret):
        '''
        creates a keypool
        parameters:
            keypool:  	label of the keypool
            project:  	project name
            tenant:  	tenant  name
            vpool:  	vpool  name
            apitype:    api type(s3, swift or atmos)
            uid:	user id
            secret:	secret key
        Returns:
            JSON payload response
        '''
        errorcontext = 0

        if ((projectname) and (not common.is_uri(projectname))):
            from project import Project
            obj = Project(self.__ipAddr, self.__port)
            projectlst = obj.project_list(tenant)

            project_uri = None

            for projiter in projectlst:
                if(projiter['name'] == projectname):
                    project_uri = projiter['id']

            if(not project_uri):
                raise SOSError(SOSError.VALUE_ERR,
                               "Porject " + projectname + ": not found")

        if ((vpoolname) and (not common.is_uri(vpoolname))):
            from virtualpool import VirtualPool
            obj = VirtualPool(self.__ipAddr, self.__port)
            vpool = obj.vpool_show(vpoolname, 'object')
            vpool_uri = vpool['id']

        if (not common.is_uri(tenant)):
            from tenant import Tenant
            tenant_obj = Tenant(self.__ipAddr, self.__port)
            namespace = tenant_obj.namespace_get(tenant)

        try:
            if(apitype == 's3'):
                return s3_bucket_create(namespace,
                                        keypool,
                                        project_uri,
                                        vpool_uri,
                                        uid,
                                        secretkey)
            elif(apitype == 'swift'):
                return swift_container_create(namespace,
                                              keypool,
                                              project_uri,
                                              vpool_uri,
                                              uid,
                                              secretkey)
            elif(apitype == 'atmos'):
                return atmos_subtenant_create(namespace,
                                              tenant,
                                              keypool,
                                              project_uri,
                                              vpool_uri,
                                              uid,
                                              secretkey)
            else:
                raise SOSError(SOSError.VALUE_ERR,
                               "Wrong API type " + apitype + " specified")

        except SOSError as e:
            raise e
开发者ID:Lidaja,项目名称:coprhd-controller,代码行数:80,代码来源:keypool.py


注:本文中的tenant.Tenant.namespace_get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。