REST API - create

vcenter content registries harbor: create

Creates a Harbor registry in the cluster.

Request:

HTTP request

POST https://{server}/rest/vcenter/content/registries/harbor

Request Body Structure:

{
    "client_token""string",
    "spec"{
        "cluster""obj-103",
        "garbage_collection"{
            "hour"1,
            "type""NONE",
            "day_of_week""SUNDAY",
            "minute"1
        },
        "storage"[
            {
                "limit"1,
                "policy""obj-103"
            },
            {
                "limit"1,
                "policy""obj-103"
            }
        ]
    }
}

Request Body Parameters:

Name Type Description
bold = required
client_token string Optional. A unique token generated on the client for each creation request. The token should be a universally unique identifier (UUID), for example: b8a2a2e3-2314-43cd-a871-6ede0f429751. This token can be used to guarantee idempotent creation.
spec create_spec Specification for creating the Harbor registry.
spec.cluster string Identifier of the cluster hosting the registry.

Optional. If unset, registry will not be created on a specified cluster. This is required in current version, since Harbor can only be created on a cluster with Kubernetes enabled.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.

spec.garbage_collection garbage_collection Garbage collection configuration for the Harbor registry.

Optional. If unset, a default configuration is set, Recurrence#WEEKLY, DayOfWeek#SATURDAY, GarbageCollection#hour is 2, GarbageCollection#minute is 0.

spec.garbage_collection.type string Frequency of garbage collection.

Defines the supported values for how often to run a specific operation for a container registry. Value is one of:
NONE: No operation is scheduled.
DAILY: An operation occurs on a daily basis.
WEEKLY: An operation occurs on a weekly basis.

spec.garbage_collection.day_of_week string Day of the week when garbage collection should run.

Describes the supported days of the week to run a specific operation for a container registry. Value is one of:
SUNDAY: Sunday.
MONDAY: Monday.
TUESDAY: Tuesday.
WEDNESDAY: Wednesday.
THURSDAY: Thursday.
FRIDAY: Friday.
SATURDAY: Saturday.Optional. It is only relevant when type has value [WEEKLY]. This field is optional and it is only relevant when the value of type is WEEKLY.

spec.garbage_collection.hour long Hour at which garbage collection should run.

Optional. It is only relevant when type has value [DAILY, WEEKLY]. This field is optional and it is only relevant when the value of type is one of DAILY or WEEKLY.

spec.garbage_collection.minute long Minute at which garbage collection should run.

Optional. It is only relevant when type has value [DAILY, WEEKLY]. This field is optional and it is only relevant when the value of type is one of DAILY or WEEKLY.

spec.storage storage_spec[] Storage associated with the Harbor registry. The list contains only one storage backing in this version.

spec.storage[].policy string Identifier of the storage policy.

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.

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

Optional. If unset, a default limit of 204800 mebibytes will be set as the registry's storage capacity.

Response:

HTTP Status Code: 200

Representation:

{
    "value""obj-103"
}

Response Type:

Name Type Description
bold = required
value string Identifier of the deployed registry.

Errors:

HTTP Status Code Type Description
400 already_exists if a Harbor already exists in the associated cluster.
404 not_found if resources/objects could not be located.
400 unsupported if vcenter.content.registries.harbor.create_spec.cluster does not have vSphere namespace enabled.
400 invalid_argument if spec contains any errors.
500 error if the system reports an error while responding to the request.
401 unauthenticated if the user can not be authenticated.
403 unauthorized if the user does not have ContentLibrary.ManageRegistry and/or CertificateAuthority.Manage privilege, or user does not have ContentLibrary.ManageClusterRegistryResource privilege on vcenter.content.registries.harbor.create_spec.cluster.