REST API - create

vcenter namespaces instances: create

Create namespace object in the cluster.

Request:

HTTP request

POST https://{server}/api/vcenter/namespaces/instances
{
    "cluster""obj-103",
    "namespace""obj-103",
    "description""string",
    "access_list"[
        {
            "role""EDIT",
            "subject_type""USER",
            "subject""string",
            "domain""string"
        },
        {
            "role""EDIT",
            "subject_type""USER",
            "subject""string",
            "domain""string"
        }
    ],
    "networks"[
        "obj-103",
        "obj-103"
    ],
    "storage_specs"[
        {
            "limit"1,
            "policy""obj-103"
        },
        {
            "limit"1,
            "policy""obj-103"
        }
    ],
    "resource_spec"{}
}

Body Parameters:

Name Type Description
bold = required
- create_spec Specification for setting up the namespace.
-.namespace string Identifier of the namespace. This has DNS_LABEL restrictions as specified in . This must be an alphanumeric (a-z and 0-9) string and with maximum length of 63 characters and with the '-' character allowed anywhere except the first or last character. This name is unique across all Namespaces in this vCenter server. In this version, this maps to the name of a Kubernetes namespace.

When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: com.vmware.vcenter.namespaces.Instance. When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.vcenter.namespaces.Instance.

-.cluster string Identifier of the cluster on which the namespace is being created.

When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: ClusterComputeResource. When operations return a value of this structure as a result, the field will be an identifier for the resource type: ClusterComputeResource.

-.description string Description for the namespace.

Optional. If unset, no description is added to the namespace.

-.resource_spec object Resource quota on the namespace. Refer to vcenter.namespace_management.namespace_resource_options.info.create_resource_quota_type and use get for retrieving the type for the value for this field. For an example of this, see vcenter.namespaces.resource_quota_options_v1.

Optional. If unset, no resource limits will be set on the namespace.

-.access_list access[] Access controls associated with the namespace.

Optional. If unset, only users with Administrator role can access the namespace.

-.access_list[].subject_type string Type of the subject.

Lists the types of subjects who can be associated with a role on the namespace. Value is one of:
USER: Single user.
GROUP: Group of users.

-.access_list[].subject string Name of the subject.

-.access_list[].domain string Domain of the subject.

-.access_list[].role string Role of the subject on the namespace instance.

Lists the default roles which can be associated with a subject on a domain on the namespace. Value is one of:
EDIT: This role allows modification of the namespace.
VIEW: This is a read-only role on the namespace.

-.storage_specs storage_spec[] Storage associated with the namespace.

Optional. If unset, storage policies will not be associated with the namespace which will prevent users from being able to provision pods with persistent storage on the namespace. Users will be able to provision pods which use local storage.

-.storage_specs[].policy string ID of the storage policy. A Kubernetes storage class is created for this storage policy if it does not exist already.

When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: SpsStorageProfile. When operations return a value of this structure as a result, the field will be an identifier for the resource type: SpsStorageProfile.

-.storage_specs[].limit long The maximum amount of storage (in mebibytes) which can be utilized by the namespace for this specification.

Optional. If unset, no limits are placed.

-.networks string[] vSphere Namespaces network objects to be associated with the namespace. The values of this list need to reference names of pre-existing Networks.Info structures. This attribute was added in vSphere API 7.0.1.0.

Optional. The field must be left unset if the cluster hosting the namespace uses NSXT_CONTAINER_PLUGIN as the network provider, since the network(s) for this namespace will be managed by NSX-T Container Plugin. If field is unset when the cluster hosting the namespace uses VSPHERE_NETWORK as its network provider, the namespace will automatically be associated with the cluster's Supervisor Primary Workload Network. The field currently accepts at most only 1 vSphere Namespaces network object reference.When clients pass a value of this structure as a parameter, the field must contain identifiers for the resource type: com.vmware.vcenter.namespaces.Instance. When operations return a value of this structure as a result, the field will contain identifiers for the resource type: com.vmware.vcenter.namespaces.Instance.

Response:

HTTP Status Code: 204

Headers:

None

Type:

None

Errors:

HTTP Status Code Type Description
400 already_exists if a namespace with the same name exists in vCenter server.
500 error if the system reports an error while responding to the request.
400 invalid_argument if spec contain any errors or if an invalid name is specified.
400 not_allowed_in_current_state if the associated cluster is deing disabled.
404 not_found if vcenter.namespaces.instances.create_spec.cluster is not registered on this vCenter server.
400 unsupported if vcenter.namespaces.instances.create_spec.cluster is not enabled for Namespaces, or if the networks field is set when the vcenter.namespaces.instances.create_spec.cluster hosting the namespace uses NSXT_CONTAINER_PLUGIN as its network provider.
401 unauthenticated if the user can not be authenticated.
403 unauthorized if the user does not have Namespaces.Configure privilege or the namespace identifier begins with "vmware-system" prefix.