hpecp.tenant module¶
- class hpecp.tenant.TenantStatus(value)[source]¶
Bases:
EnumBases: enum.Enum
The statuses for Tenant
Note:
The integer values do not have a meaning outside of this library. The API uses a string identifier with the status name rather than an integer value.
- ready = 1¶
- creating = 2¶
- updating = 3¶
- upgrading = 4¶
- deleting = 5¶
- error = 6¶
- warning = 7¶
- class hpecp.tenant.Tenant(json)[source]¶
Bases:
AbstractResource- all_fields = ['id', 'name', 'description', 'status', 'tenant_type', 'external_user_groups']¶
- default_display_fields = ['id', 'name', 'description', 'status', 'tenant_type']¶
- property id¶
@Field: from json[‘_links’][‘self’][‘href’].
- property status¶
- property name¶
- property description¶
- property tenant_type¶
- property external_user_groups¶
- class hpecp.tenant.TenantController(client)[source]¶
Bases:
AbstractWaitableResourceControllerClass that users will interact with to work with tenants.
An instance of this class is available in client.ContainerPlatformClient with the attribute name
tenant. The methods of this class can be invoked using client.tenant.method(). See the example below.>>> client = ContainerPlatformClient(...).create_session() >>> client.tenant.list()
- base_resource_path = '/api/v1/tenant/'¶
Declare the resource base path for the API resource.
- Getter:
Returns the resource base path
- Setter:
Sets the resource base path
- Type:
str
- class K8sClusterController(AbstractResourceController):
… base_resource_path = “/api/v2/k8scluster”
- resource_list_path = 'tenants'¶
Declare the implementing resource list path for the API resource. The resource list path is where the resources are after the ‘_embedded’ element in the API response json.
- Getter:
Returns the resource list path
- Setter:
Sets the resource list path
- Type:
str
- class K8sClusterController(AbstractResourceController):
… resource_list_path = “k8sclusters”
- status_class¶
alias of
TenantStatus
- status_fieldname = 'status'¶
Declare the Status fieldname in the API resource.
Usually either: status or state
- Getter:
Returns the Status fieldname
- Setter:
Sets the Status fieldname
- Type:
str
- class K8sClusterController(AbstractResourceController):
… status_fieldname = status
- create(name=None, description=None, tenant_type=None, k8s_cluster_id=None, is_namespace_owner=None, map_services_to_gateway=None, specified_namespace_name=None, adopt_existing_namespace=None, quota_memory=None, quota_persistent=None, quota_gpus=None, quota_cores=None, quota_disk=None, quota_tenant_storage=None, features=None)[source]¶
- k8skubeconfig()[source]¶
Retrieve the tenant kubeconfig.
This requires the ContainerPlatformClient to be created with a ‘tenant’ parameter.
- str
Tenant KubeConfig
- ContainerPlatformClientException
This is raised if the ContainerPlatformClient was not created with a ‘tenant’ parameter.
- assign_user_to_role(tenant_id, role_id, user_id)[source]¶
Assign a user to a given role using the tenant.
- tenant_idstr
The tenant ID - format: ‘/api/v1/tenant/[0-9]+’
- role_idstr
The role ID - format: ‘/api/v1/role/[0-9]+’
- user_idstr
The role ID - format: ‘/api/v1/user/[0-9]+’
APIItemNotFoundException APIItemConflictException APIException