com.vmware.vcenter.content.registries package

Submodules

com.vmware.vcenter.content.registries.harbor_client module

The com.vmware.vcenter.content.registries.harbor_client module provides classes and classes for managing Harbor registry in vCenter.

class com.vmware.vcenter.content.registries.harbor_client.Projects(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The Projects class provides methods for managing the lifecycle of Harbor project that stores and distributes container repositories and images.

Parameters

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

class ConfigStatus(string)

Bases: vmware.vapi.bindings.enum.Enum

The Projects.ConfigStatus class describes the status of reaching the desired configuration state for the Harbor project.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

Parameters

string (str) – String value for the ConfigStatus instance.

ERROR = ConfigStatus(string='ERROR')

Failed to create Harbor project or apply the configuration to the project, user intervention needed.

PENDING = ConfigStatus(string='PENDING')

Harbor project is being created or the configuration is being applied to the project.

READY = ConfigStatus(string='READY')

Harbor project is created or configured correctly.

REMOVING = ConfigStatus(string='REMOVING')

The configuration is being removed and Harbor project is being deleted.

class CreateSpec(name=None, scope=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Projects.CreateSpec class defines the information required to create a Harbor project.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • name (str) – Name of the Harbor project. Should be between 2-63 characters long alphanumeric string and may contain the following characters: a-z,0-9, and ‘-‘. Must be starting with characters or numbers, with the ‘-‘ character allowed anywhere except the first or last character.

  • scope (Projects.Scope) – Access type of a Harbor project.

class Info(name=None, config_status=None, scope=None, creation_time=None, update_time=None, access_url=None, message=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Projects.Info class contains detailed information about a Harbor project.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • name (str) – Name of the Harbor project. Should be between 2-63 characters long alphanumeric string and may contain the following characters: a-z,0-9, and ‘-‘. Must be starting with characters or numbers, with the ‘-‘ character allowed anywhere except the first or last character.

  • config_status (Projects.ConfigStatus) – The status of the Harbor project.

  • scope (Projects.Scope) – The access type of a Harbor project.

  • creation_time (datetime.datetime) – The date and time when the harbor project creation API was triggered and project identifier generated.

  • update_time (datetime.datetime) – The date and time when the harbor project purge API was triggered. In case no purge was triggered, updateTime is same as creationTime. This attribute is optional and it is only relevant when the value of configStatus is Projects.ConfigStatus.READY.

  • access_url (str) – URL to access the harbor project through docker client. This attribute is optional and it is only relevant when the value of configStatus is Projects.ConfigStatus.READY.

  • message (com.vmware.vapi.std_client.LocalizableMessage) – Details about the ERROR project status. This attribute is optional and it is only relevant when the value of configStatus is Projects.ConfigStatus.ERROR.

class Scope(string)

Bases: vmware.vapi.bindings.enum.Enum

The Projects.Scope class in a project defines access levels of the project.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

Parameters

string (str) – String value for the Scope instance.

PRIVATE = Scope(string='PRIVATE')

A Harbor project can only be accessed by assigned users.

PUBLIC = Scope(string='PUBLIC')

A Harbor project can be accessed by everyone.

class Summary(project=None, name=None, scope=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Projects.Summary class contains basic information about a Harbor project.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • project (str) – Identifier of the harbor project. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.vcenter.content.Registry.Harbor.Project. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.vcenter.content.Registry.Harbor.Project.

  • name (str) – Name of the Harbor project. Should be between 2-63 characters long alphanumeric string and may contain the following characters: a-z,0-9, and ‘-‘. Must be starting with characters or numbers, with the ‘-‘ character allowed anywhere except the first or last character.

  • scope (Projects.Scope) – Access type of a Harbor project.

create(registry, spec)

Creates a project in a Harbor registry using the supplied specification. In vSphere 7.0, a Harbor registry is deployed in a vSphere cluster with vSphere namespaces enabled. When a namespace is created, a project with same name as the namespace is created in the Harbor registry, so this method should not be called.

Parameters
  • registry (str) – Identifier of the Registry. The parameter must be an identifier for the resource type: com.vmware.vcenter.content.Registry.

  • spec (Projects.CreateSpec) – Information used to create the Harbor project.

Return type

str

Returns

Identifier of the newly created Harbor project. The return value will be an identifier for the resource type: com.vmware.vcenter.content.Registry.Harbor.Project.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if spec contains any error.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if Harbor registry is being deleted.

Raise

com.vmware.vapi.std.errors_client.NotFound if a registry specified by registry could not be found.

Raise

com.vmware.vapi.std.errors_client.AlreadyExists if a project with the same name already exists in the registry. In vSphere 7.0, the existing project could have been created automatically when a namespace with the same name is created.

Raise

com.vmware.vapi.std.errors_client.Error if the system reports an error while responding to the request.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if the user does not have ContentLibrary.ManageRegistryProject privilege.

delete(registry, project)

Deletes the specified project from Harbor registry. Repositories and images in the project will be removed upon project deletion. Storage space of deleted images in the project will be reclaimed through next scheduled Harbor registry garbage collection. In vSphere 7.0, a Harbor registry is deployed in a vSphere cluster with vSphere namespaces enabled. When a namespace is deleted, a project with same name as the namespace is deleted from the Harbor registry, so this method should not be called.

Parameters
  • registry (str) – Identifier of the registry. The parameter must be an identifier for the resource type: com.vmware.vcenter.content.Registry.

  • project (str) – Identifier of the Harbor project. The parameter must be an identifier for the resource type: com.vmware.vcenter.content.Registry.Harbor.Project.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if Harbor registry is being deleted.

Raise

com.vmware.vapi.std.errors_client.NotFound if registry or project cannot be found. In vSphere 7.0, the existing project could have been deleted automatically when a namespace with the same name is deleted.

Raise

com.vmware.vapi.std.errors_client.Error if the system reports an error while responding to the request.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if the user does not have ContentLibrary.ManageRegistryProject privilege.

get(registry, project)

Returns detailed information about the specified Harbor project.

Parameters
  • registry (str) – Identifier of the registry. The parameter must be an identifier for the resource type: com.vmware.vcenter.content.Registry.

  • project (str) – Identifier of the Harbor project. The parameter must be an identifier for the resource type: com.vmware.vcenter.content.Registry.Harbor.Project.

Return type

Projects.Info

Returns

Detailed information about the specified Harbor project.

Raise

com.vmware.vapi.std.errors_client.NotFound if registry or project cannot be found.

Raise

com.vmware.vapi.std.errors_client.Error if the system reports an error while responding to the request.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if the user does not have System.Read privilege.

list(registry)

Returns basic information of all projects in a Harbor registry.

Parameters

registry (str) – Identifier of the registry. The parameter must be an identifier for the resource type: com.vmware.vcenter.content.Registry.

Return type

list of Projects.Summary

Returns

The list of summary information of all Harbor projects.

Raise

com.vmware.vapi.std.errors_client.NotFound if registry cannot be found.

Raise

com.vmware.vapi.std.errors_client.Error if the system reports an error while responding to the request.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if the user does not have System.Read privilege.

purge(registry, project)

Remove all repositories, images and members in the project. Storage space of deleted images in the project will be reclaimed through next scheduled Harbor registry garbage collection.

Parameters
  • registry (str) – Registry identifier. The parameter must be an identifier for the resource type: com.vmware.vcenter.content.Registry.

  • project (str) – Identifier of the Harbor project. The parameter must be an identifier for the resource type: com.vmware.vcenter.content.Registry.Harbor.Project.

Raise

com.vmware.vapi.std.errors_client.NotFound if registry or project cannot be found.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if Harbor registry is being deleted or the project is not in Projects.ConfigStatus.READY status.

Raise

com.vmware.vapi.std.errors_client.Error if the system reports an error while responding to the request.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if the user does not have ContentLibrary.ManageRegistryProject privilege.

class com.vmware.vcenter.content.registries.harbor_client.StubFactory(stub_config)

Bases: vmware.vapi.bindings.stub.StubFactoryBase

Initialize StubFactoryBase

Parameters

stub_config (vmware.vapi.bindings.stub.StubConfiguration) – Stub config instance