class Providers(VapiInterface): """ The ``Providers`` class provides methods to create a sync session, get information on Sync. Usage beyond VMware Cloud on AWS is not supported. **Warning:** This class is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ RESOURCE_TYPE = "com.vmware.vcenter.hvc.links.sync.Providers" """ Resource type for Sync Providers. **Warning:** This class attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ _VAPI_SERVICE_ID = 'com.vmware.vcenter.hvc.links.sync.providers' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _ProvidersStub) self._VAPI_OPERATION_IDS = {} class Status(Enum): """ The ``Providers.Status`` class defines valid sync status. **Warning:** This enumeration is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. .. 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 :ref:`enumerated type description page <enumeration_description>`. """ SUCCEEDED = None """ If Sync was successful. **Warning:** This class attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ FAILED = None """ If Sync failed. **Warning:** This class attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ NO_SYNC_FOUND = None """ If Sync has not been triggered. **Warning:** This class attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`Status` instance. """ Enum.__init__(string) Status._set_values([ Status('SUCCEEDED'), Status('FAILED'), Status('NO_SYNC_FOUND'), ]) Status._set_binding_type(type.EnumType( 'com.vmware.vcenter.hvc.links.sync.providers.status', Status)) class Info(VapiStruct): """ The ``Providers.Info`` class contains information about sync for a provider. **Warning:** This class is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. .. tip:: The arguments are used to initialize data attributes with the same names. """ _validator_list = [ UnionValidator( 'status', { 'FAILED' : [('status_message', True)], 'SUCCEEDED' : [], 'NO_SYNC_FOUND' : [], } ), ] def __init__(self, last_sync_time=None, status=None, polling_interval_in_seconds=None, current_session_info=None, status_message=None, ): """ :type last_sync_time: :class:`datetime.datetime` or ``None`` :param last_sync_time: Last sync time for the provider. This indicates the last time that either a background sync or a force sync was started for the provider. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. If None no sync was found for the provider. :type status: :class:`Providers.Status` :param status: Last Sync status for the provider. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type polling_interval_in_seconds: :class:`long` :param polling_interval_in_seconds: Sync Polling interval between local and remote replicas for the provider. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type current_session_info: :class:`Providers.SessionInfo` or ``None`` :param current_session_info: Returns information on the forced sync for the provider. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. If None there is no outstanding sync session created for this provider :type status_message: :class:`com.vmware.vapi.std_client.LocalizableMessage` :param status_message: Localizable messages associated with sync status. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. This attribute is optional and it is only relevant when the value of ``status`` is :attr:`Providers.Status.FAILED`. """ self.last_sync_time = last_sync_time self.status = status self.polling_interval_in_seconds = polling_interval_in_seconds self.current_session_info = current_session_info self.status_message = status_message VapiStruct.__init__(self) Info._set_binding_type(type.StructType( 'com.vmware.vcenter.hvc.links.sync.providers.info', { 'last_sync_time': type.OptionalType(type.DateTimeType()), 'status': type.ReferenceType(__name__, 'Providers.Status'), 'polling_interval_in_seconds': type.IntegerType(), 'current_session_info': type.OptionalType(type.ReferenceType(__name__, 'Providers.SessionInfo')), 'status_message': type.OptionalType(type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage')), }, Info, False, None)) class SessionInfo(VapiStruct): """ The ``Providers.SessionInfo`` class contains sync session information. **Warning:** This class is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. .. tip:: The arguments are used to initialize data attributes with the same names. """ _validator_list = [ UnionValidator( 'stage', { 'FAILED' : [('completion_time', True), ('exception', True)], 'COMPLETED' : [('completion_time', True)], 'CHANGE_DETECTION' : [], 'CHANGE_ENUMERATION' : [], 'CHANGE_APPLICATION' : [], 'WAITING' : [], } ), ] def __init__(self, stage=None, completed_work=None, total_work=None, completion_time=None, start_time=None, exception=None, ): """ :type stage: :class:`Providers.SessionInfo.Stage` :param stage: Sync stage for the session. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type completed_work: :class:`long` :param completed_work: Completed work for the session. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type total_work: :class:`long` :param total_work: Total work for the session. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type completion_time: :class:`datetime.datetime` :param completion_time: Time at which forced sync session was completed. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. If None there is an ongoing sync that has not completed :type start_time: :class:`datetime.datetime` :param start_time: Time at which force sync was initiated. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type exception: :class:`com.vmware.vapi.std_client.LocalizableMessage` :param exception: Exception message if there is a sync failure on forced sync. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. This attribute is optional and it is only relevant when the value of ``stage`` is :attr:`Providers.SessionInfo.Stage.FAILED`. """ self.stage = stage self.completed_work = completed_work self.total_work = total_work self.completion_time = completion_time self.start_time = start_time self.exception = exception VapiStruct.__init__(self) class Stage(Enum): """ The ``Providers.SessionInfo.Stage`` class defines the different stages of Sync. **Warning:** This enumeration is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. .. 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 :ref:`enumerated type description page <enumeration_description>`. """ CHANGE_DETECTION = None """ Changes are being detected on the source replica. **Warning:** This class attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ CHANGE_ENUMERATION = None """ Changes from the source replica are being enumerated. **Warning:** This class attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ CHANGE_APPLICATION = None """ Changes are being applied to the destination replica. **Warning:** This class attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ COMPLETED = None """ Sync has completed. **Warning:** This class attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ FAILED = None """ Sync failed. **Warning:** This class attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ WAITING = None """ Session is waiting for progress to be set. **Warning:** This class attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`Stage` instance. """ Enum.__init__(string) Stage._set_values([ Stage('CHANGE_DETECTION'), Stage('CHANGE_ENUMERATION'), Stage('CHANGE_APPLICATION'), Stage('COMPLETED'), Stage('FAILED'), Stage('WAITING'), ]) Stage._set_binding_type(type.EnumType( 'com.vmware.vcenter.hvc.links.sync.providers.session_info.stage', Stage)) SessionInfo._set_binding_type(type.StructType( 'com.vmware.vcenter.hvc.links.sync.providers.session_info', { 'stage': type.ReferenceType(__name__, 'Providers.SessionInfo.Stage'), 'completed_work': type.IntegerType(), 'total_work': type.IntegerType(), 'completion_time': type.OptionalType(type.DateTimeType()), 'start_time': type.DateTimeType(), 'exception': type.OptionalType(type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage')), }, SessionInfo, False, None)) class Summary(VapiStruct): """ The ``Providers.Summary`` class contains information about a provider. **Warning:** This class is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__(self, provider=None, ): """ :type provider: :class:`str` :param provider: Sync provider id. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``com.vmware.vcenter.hvc.links.sync.Providers``. 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.hvc.links.sync.Providers``. """ self.provider = provider VapiStruct.__init__(self) Summary._set_binding_type(type.StructType( 'com.vmware.vcenter.hvc.links.sync.providers.summary', { 'provider': type.IdType(resource_types='com.vmware.vcenter.hvc.links.sync.Providers'), }, Summary, False, None)) class Credentials(VapiStruct): """ The ``Providers.Credentials`` class specifies user credentials to make a successful connection to remote endpoint. **Warning:** This class is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__(self, user_name=None, password=None, ): """ :type user_name: :class:`str` :param user_name: Name of the user to authenticate. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type password: :class:`str` :param password: Password for the user. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ self.user_name = user_name self.password = password VapiStruct.__init__(self) Credentials._set_binding_type(type.StructType( 'com.vmware.vcenter.hvc.links.sync.providers.credentials', { 'user_name': type.StringType(), 'password': type.SecretType(), }, Credentials, False, None)) def list(self, link, ): """ Enumerates the sync providers. Usage beyond VMware Cloud on AWS is not supported. **Warning:** This method is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type link: :class:`str` :param link: Unique identifier of the link The parameter must be an identifier for the resource type: ``com.vmware.vcenter.hvc.Links``. :rtype: :class:`list` of :class:`Providers.Summary` :return: The :class:`list` of sync provider information. :raise: :class:`com.vmware.vapi.std.errors_client.Error` If list fails. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` If the user is not authorized to perform this operation. """ return self._invoke('list', { 'link': link, }) def get(self, link, provider, ): """ Gets Sync information for a sync provider. Usage beyond VMware Cloud on AWS is not supported. **Warning:** This method is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type link: :class:`str` :param link: Unique identifier of the link The parameter must be an identifier for the resource type: ``com.vmware.vcenter.hvc.Links``. :type provider: :class:`str` :param provider: Unique identifier of the sync provider. The parameter must be an identifier for the resource type: ``com.vmware.vcenter.hvc.sync.Providers``. :rtype: :class:`Providers.Info` :return: The Info of sync information for the provider. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if the system reports an error while responding to the request. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` if the sync provider associated with ``provider`` does not exist. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user is not authorized to perform this operation. """ return self._invoke('get', { 'link': link, 'provider': provider, }) def start(self, link, provider, ): """ Initiates synchronization between the local and remote replicas for the sync provider. Usage beyond VMware Cloud on AWS is not supported. **Warning:** This method is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type link: :class:`str` :param link: Unique identifier of the link The parameter must be an identifier for the resource type: ``com.vmware.vcenter.hvc.Links``. :type provider: :class:`str` :param provider: Unique identifier representing the sync provider The parameter must be an identifier for the resource type: ``com.vmware.vcenter.hvc.sync.Providers``. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if the system reports an error while responding to the request. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` if the link associated with ``link`` does not exist if the provider associated with ``provider`` is not registered for sync :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user is not authorized to perform this operation. :raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy` if a sync is already running. """ return self._invoke('start', { 'link': link, 'provider': provider, })
class Pscs(VapiInterface): """ The ``Pscs`` class provides methods to decommission the external Platform Services Controller node. This class was added in vSphere API 6.7.2. """ _VAPI_SERVICE_ID = 'com.vmware.vcenter.topology.pscs' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _PscsStub) class DecommissionSpec(VapiStruct): """ The ``Pscs.DecommissionSpec`` class contains information about the Platform Services Controller node to be decommissioned. This class was added in vSphere API 6.7.2. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, sso_admin_username=None, sso_admin_password=None, ssl_thumbprint=None, ssl_verify=None, ): """ :type sso_admin_username: :class:`str` :param sso_admin_username: The SSO administrator username for example "administrator\\\\@vsphere.local". This attribute was added in vSphere API 6.7.2. :type sso_admin_password: :class:`str` :param sso_admin_password: The SSO administrator account password. This attribute was added in vSphere API 6.7.2. :type ssl_thumbprint: :class:`str` or ``None`` :param ssl_thumbprint: SHA1 thumbprint of the external Platform Services Controller node to be decommissioned that will be used for verification. This attribute was added in vSphere API 6.7.2. This attribute is only relevant if ``sslVerify`` is :class:`set` or has the value true. No verification will be performed if ``sslVerify`` value is set to false. :type ssl_verify: :class:`bool` or ``None`` :param ssl_verify: SSL verification should be enabled or disabled. This attribute was added in vSphere API 6.7.2. If None, ssl_verify false will be used. """ self.sso_admin_username = sso_admin_username self.sso_admin_password = sso_admin_password self.ssl_thumbprint = ssl_thumbprint self.ssl_verify = ssl_verify VapiStruct.__init__(self) DecommissionSpec._set_binding_type( type.StructType( 'com.vmware.vcenter.topology.pscs.decommission_spec', { 'sso_admin_username': type.StringType(), 'sso_admin_password': type.SecretType(), 'ssl_thumbprint': type.OptionalType(type.StringType()), 'ssl_verify': type.OptionalType(type.BooleanType()), }, DecommissionSpec, False, None)) def decommission_task( self, hostname, spec, only_precheck=None, ): """ Decommission the external Platform Services Controller node. This method was added in vSphere API 6.7.2. :type hostname: :class:`str` :param hostname: FQDN or IP address of external Platform Services Controller node to be decommissioned. The parameter must be an identifier for the resource type: ``com.vmware.vcenter.VCenter.name``. :type spec: :class:`Pscs.DecommissionSpec` :param spec: Information needed to decommission the external Platform Services Controller node. :type only_precheck: :class:`bool` or ``None`` :param only_precheck: Flag indicating whether only a pre-check should be performed. If None the full decommission will be performed. :raise: :class:`com.vmware.vapi.std.errors_client.Unsupported` if the appliance is in not a management node. :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` if passed arguments are invalid. :raise: :class:`com.vmware.vapi.std.errors_client.UnverifiedPeer` If the SSL certificate of the foreign external Platform Services Controller node cannot be validated. The value of the data attribute of null will be a class that contains all the attributes defined in null. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the caller is not authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` if the provided Platform Services Controller node doesn't qualify for decommission due to some reasons like it has some other nodes connected to it. """ task_id = self._invoke('decommission$task', { 'hostname': hostname, 'spec': spec, 'only_precheck': only_precheck, }) task_svc = Tasks(self._config) task_instance = Task(task_id, task_svc, type.VoidType()) return task_instance
class Job(VapiInterface): """ ``Job`` class provides methods Performs backup restore operations """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _JobStub) class ReturnStatus(Enum): """ ``Job.ReturnStatus`` class Defines the state of precheck .. 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 :ref:`enumerated type description page <enumeration_description>`. """ FAIL = None """ Check failed """ WARNING = None """ Passed with warnings """ OK = None """ Check passed """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`ReturnStatus` instance. """ Enum.__init__(string) ReturnStatus._set_values([ ReturnStatus('FAIL'), ReturnStatus('WARNING'), ReturnStatus('OK'), ]) ReturnStatus._set_binding_type( type.EnumType('com.vmware.appliance.recovery.backup.job.return_status', ReturnStatus)) class LocationType(Enum): """ ``Job.LocationType`` class Defines type of all locations for backup/restore .. 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 :ref:`enumerated type description page <enumeration_description>`. """ FTPS = None """ Destination is FTPS server """ HTTP = None """ Destination is HTTP server """ SCP = None """ Destination is SSH server """ HTTPS = None """ Destination is HTTPS server """ FTP = None """ Destination is FTP server """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`LocationType` instance. """ Enum.__init__(string) LocationType._set_values([ LocationType('FTPS'), LocationType('HTTP'), LocationType('SCP'), LocationType('HTTPS'), LocationType('FTP'), ]) LocationType._set_binding_type( type.EnumType('com.vmware.appliance.recovery.backup.job.location_type', LocationType)) class BackupRestoreProcessState(Enum): """ ``Job.BackupRestoreProcessState`` class Defines state of backup/restore process .. 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 :ref:`enumerated type description page <enumeration_description>`. """ FAILED = None """ Failed """ INPROGRESS = None """ In progress """ NONE = None """ Not started """ SUCCEEDED = None """ Completed successfully """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`BackupRestoreProcessState` instance. """ Enum.__init__(string) BackupRestoreProcessState._set_values([ BackupRestoreProcessState('FAILED'), BackupRestoreProcessState('INPROGRESS'), BackupRestoreProcessState('NONE'), BackupRestoreProcessState('SUCCEEDED'), ]) BackupRestoreProcessState._set_binding_type( type.EnumType( 'com.vmware.appliance.recovery.backup.job.backup_restore_process_state', BackupRestoreProcessState)) class LocalizableMessage(VapiStruct): """ ``Job.LocalizableMessage`` class Structure representing message .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, id=None, default_message=None, args=None, ): """ :type id: :class:`str` :param id: id in message bundle :type default_message: :class:`str` :param default_message: text in english :type args: :class:`list` of :class:`str` :param args: nested data """ self.id = id self.default_message = default_message self.args = args VapiStruct.__init__(self) LocalizableMessage._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.backup.job.localizable_message', { 'id': type.StringType(), 'default_message': type.StringType(), 'args': type.ListType(type.StringType()), }, LocalizableMessage, False, None)) class ReturnResult(VapiStruct): """ ``Job.ReturnResult`` class Structure representing precheck result .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, status=None, messages=None, ): """ :type status: :class:`Job.ReturnStatus` :param status: Check status :type messages: :class:`list` of :class:`Job.LocalizableMessage` :param messages: List of messages """ self.status = status self.messages = messages VapiStruct.__init__(self) ReturnResult._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.backup.job.return_result', { 'status': type.ReferenceType(sys.modules[__name__], 'Job.ReturnStatus'), 'messages': type.ListType( type.ReferenceType(sys.modules[__name__], 'Job.LocalizableMessage')), }, ReturnResult, False, None)) class BackupRequest(VapiStruct): """ ``Job.BackupRequest`` class Structure representing requested backup piece .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, parts=None, backup_password=None, location_type=None, location=None, location_user=None, location_password=None, comment=None, ): """ :type parts: :class:`list` of :class:`str` :param parts: a list of optional parts. Run backup parts APIs to get list of optional parts and description :type backup_password: :class:`str` or ``None`` :param backup_password: a password for a backup piece The backupPassword must adhere to the following password requirements: At least 8 characters, cannot be more than 20 characters in length. At least 1 uppercase letter. At least 1 lowercase letter. At least 1 numeric digit. At least 1 special character (i.e. any character not in [0-9,a-z,A-Z]). Only visible ASCII characters (for example, no space). backupPassword If no password then the piece will not be encrypted :type location_type: :class:`Job.LocationType` :param location_type: a type of location :type location: :class:`str` :param location: path or url :type location_user: :class:`str` or ``None`` :param location_user: username for location locationUser User name for this location if login is required. :type location_password: :class:`str` or ``None`` :param location_password: password for location locationPassword Password for the specified user if login is required at this location. :type comment: :class:`str` or ``None`` :param comment: Custom comment comment an optional comment """ self.parts = parts self.backup_password = backup_password self.location_type = location_type self.location = location self.location_user = location_user self.location_password = location_password self.comment = comment VapiStruct.__init__(self) BackupRequest._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.backup.job.backup_request', { 'parts': type.ListType(type.StringType()), 'backup_password': type.OptionalType(type.SecretType()), 'location_type': type.ReferenceType(sys.modules[__name__], 'Job.LocationType'), 'location': type.StringType(), 'location_user': type.OptionalType(type.StringType()), 'location_password': type.OptionalType(type.SecretType()), 'comment': type.OptionalType(type.StringType()), }, BackupRequest, False, None)) class BackupJobStatus(VapiStruct): """ ``Job.BackupJobStatus`` class Structure representing backup restore status .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, id=None, state=None, messages=None, progress=None, start_time=None, end_time=None, ): """ :type id: :class:`str` :param id: TimeStamp based ID :type state: :class:`Job.BackupRestoreProcessState` :param state: process state :type messages: :class:`list` of :class:`Job.LocalizableMessage` :param messages: list of messages :type progress: :class:`long` :param progress: percentage complete :type start_time: :class:`datetime.datetime` :param start_time: Time when this backup was started. :type end_time: :class:`datetime.datetime` or ``None`` :param end_time: Time when this backup was finished. endTime End time is None till backup is finished. """ self.id = id self.state = state self.messages = messages self.progress = progress self.start_time = start_time self.end_time = end_time VapiStruct.__init__(self) BackupJobStatus._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.backup.job.backup_job_status', { 'id': type.StringType(), 'state': type.ReferenceType(sys.modules[__name__], 'Job.BackupRestoreProcessState'), 'messages': type.ListType( type.ReferenceType(sys.modules[__name__], 'Job.LocalizableMessage')), 'progress': type.IntegerType(), 'start_time': type.DateTimeType(), 'end_time': type.OptionalType(type.DateTimeType()), }, BackupJobStatus, False, None)) def cancel( self, id, ): """ Cancel the backup job :type id: :class:`str` :param id: ID (ID of job) The parameter must be an identifier for the resource type: ``com.vmware.appliance.recovery.backup.job``. :rtype: :class:`Job.ReturnResult` :return: BackupJobStatus Structure :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` ID is not found :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('cancel', { 'id': id, }) def create( self, piece, ): """ Initiate backup. :type piece: :class:`Job.BackupRequest` :param piece: BackupRequest Structure :rtype: :class:`Job.BackupJobStatus` :return: BackupJobStatus Structure :raise: :class:`com.vmware.vapi.std.errors_client.FeatureInUse` A backup or restore is already in progress :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('create', { 'piece': piece, }) def list(self): """ Get list of backup jobs :rtype: :class:`list` of :class:`str` :return: list of BackupJob IDs The return value will contain identifiers for the resource type: ``com.vmware.appliance.recovery.backup.job``. :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('list', None) def get( self, id, ): """ See backup job progress/result. :type id: :class:`str` :param id: ID (ID of job) The parameter must be an identifier for the resource type: ``com.vmware.appliance.recovery.backup.job``. :rtype: :class:`Job.BackupJobStatus` :return: BackupJobStatus Structure :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` ID is not found :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('get', { 'id': id, })
class Software(VapiInterface): """ The ``Software`` class provides methods to get and extract the current software specification applied to the host. """ _VAPI_SERVICE_ID = 'com.vmware.esx.hosts.software' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _SoftwareStub) self._VAPI_OPERATION_IDS = {} class HostCredentials(VapiStruct): """ The ``Software.HostCredentials`` class contains attributes that describe the host's username, password, port number and ssl thumbprint to be used when connecting to the host using USERNAME_PASSWORD option in the ``AuthenticationType`` class. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, host_name=None, user_name=None, password=None, port=None, ssl_thumb_print=None, ): """ :type host_name: :class:`str` :param host_name: The IP address or DNS resolvable name of the host. :type user_name: :class:`str` :param user_name: Specifies the username to be used during the :func:`Software.get` method :type password: :class:`str` :param password: Specifies the password to be used during the :func:`Software.get` method :type port: :class:`long` or ``None`` :param port: Specifies the port number of the host to be used during :func:`Software.get` method If None, port number is set to 443. :type ssl_thumb_print: :class:`str` or ``None`` :param ssl_thumb_print: Specifies the sslThumbPrint of the host to be used during :func:`Software.get` method SHA1 hash of the host's SSL certificate. If None, :func:`Software.get` method throws UnverifiedPeer with the expected thumbprint as data. """ self.host_name = host_name self.user_name = user_name self.password = password self.port = port self.ssl_thumb_print = ssl_thumb_print VapiStruct.__init__(self) HostCredentials._set_binding_type( type.StructType( 'com.vmware.esx.hosts.software.host_credentials', { 'host_name': type.StringType(), 'user_name': type.StringType(), 'password': type.SecretType(), 'port': type.OptionalType(type.IntegerType()), 'ssl_thumb_print': type.OptionalType(type.StringType()), }, HostCredentials, False, None)) class ConnectionSpec(VapiStruct): """ The ``Software.ConnectionSpec`` class contains attributes that describe the specification to be used for connecting to the host during the :func:`Software.get` method .. tip:: The arguments are used to initialize data attributes with the same names. """ _validator_list = [ UnionValidator( 'auth_type', { 'USERNAME_PASSWORD': [('host_credential', True)], 'EXISTING': [('host', True)], }), ] def __init__( self, auth_type=None, host_credential=None, host=None, ): """ :type auth_type: :class:`Software.ConnectionSpec.AuthenticationType` :param auth_type: Specifies what type of authentication (USERNAME_PASSWORD, EXISTING) is to be used when connecting with the host. USERNAME_PASSWORD is intended to be used when connecting to a host that is not currently part of the vCenter inventory. EXISTING is intented for hosts that are in vCenter inventory, in which case, HostServiceTicket will be used to connect to the host. :type host_credential: :class:`Software.HostCredentials` :param host_credential: Specifies the host details to be used during the :func:`Software.get` method This attribute is optional and it is only relevant when the value of ``authType`` is :attr:`Software.ConnectionSpec.AuthenticationType.USERNAME_PASSWORD`. :type host: :class:`str` :param host: Specifies the host Managed Object ID to be used during the :func:`Software.get` method When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``HostSystem``. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ``HostSystem``. This attribute is optional and it is only relevant when the value of ``authType`` is :attr:`Software.ConnectionSpec.AuthenticationType.EXISTING`. """ self.auth_type = auth_type self.host_credential = host_credential self.host = host VapiStruct.__init__(self) class AuthenticationType(Enum): """ The ``Software.ConnectionSpec.AuthenticationType`` class defines the possible types of authentication supported when connecting to the host. .. 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 :ref:`enumerated type description page <enumeration_description>`. """ USERNAME_PASSWORD = None """ Connect to host using host's credentials ``HostCredentials`` class. """ EXISTING = None """ Connect to the host using service ticket. Note: This is supported only for hosts present in the VC inventory. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`AuthenticationType` instance. """ Enum.__init__(string) AuthenticationType._set_values([ AuthenticationType('USERNAME_PASSWORD'), AuthenticationType('EXISTING'), ]) AuthenticationType._set_binding_type( type.EnumType( 'com.vmware.esx.hosts.software.connection_spec.authentication_type', AuthenticationType)) ConnectionSpec._set_binding_type( type.StructType( 'com.vmware.esx.hosts.software.connection_spec', { 'auth_type': type.ReferenceType( __name__, 'Software.ConnectionSpec.AuthenticationType'), 'host_credential': type.OptionalType( type.ReferenceType(__name__, 'Software.HostCredentials')), 'host': type.OptionalType(type.IdType()), }, ConnectionSpec, False, None)) class Info(VapiStruct): """ The ``Software.Info`` class contains attributes that describe the current software information on a host. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, notifications=None, software_info=None, ): """ :type notifications: :class:`Notifications` :param notifications: Notifications returned by the get operation. :type software_info: :class:`SoftwareInfo` :param software_info: Host software information returned by the get operation. """ self.notifications = notifications self.software_info = software_info VapiStruct.__init__(self) Info._set_binding_type( type.StructType( 'com.vmware.esx.hosts.software.info', { 'notifications': type.ReferenceType(__name__, 'Notifications'), 'software_info': type.ReferenceType(__name__, 'SoftwareInfo'), }, Info, False, None)) def get( self, spec, ): """ Returns details about the current software specification applied to the host. :type spec: :class:`Software.ConnectionSpec` :param spec: ConnectionSpec connection spec for the host. :rtype: :class:`Software.Info` :return: Info details about the current software specification applied to the host. :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` if the ``ConnectionSpec.HostCredentials#hostName`` attribute of ``spec`` is invalid. :raise: :class:`com.vmware.vapi.std.errors_client.Error` If there is some unknown internal error. The accompanying error message will give more details about the failure. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` If there is no ``ConnectionSpec.HostCredentials#hostName`` attribute associated with host id in the system. :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` If the service is not available. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the caller is not authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.UnverifiedPeer` If the SSL certificate of the target node cannot be validated by comparing with the thumbprint provided in ConnectionSpec.HostCredentials#sslThumbPrint. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if you do not have all of the privileges described as follows: * Method execution requires ``VcIntegrity.lifecycleSoftwareSpecification.Read``. """ return self._invoke('get', { 'spec': spec, })
def __init__(self, config): # properties for set operation set_input_type = type.StructType( 'operation-input', { 'cluster': type.IdType(resource_types='ClusterComputeResource'), 'provider': type.IdType( resource_types= 'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.Provider' ), 'credential': type.SecretType(), }) set_error_dict = { 'com.vmware.vapi.std.errors.invalid_argument': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidArgument'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), 'com.vmware.vapi.std.errors.unauthenticated': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'), 'com.vmware.vapi.std.errors.error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'), } set_input_value_validator_list = [] set_output_validator_list = [] set_rest_metadata = OperationRestMetadata( http_method='PUT', url_template= '/vcenter/trusted-infrastructure/trust-authority-clusters/{cluster}/kms/providers/{provider}/credential', request_body_parameter='credential', path_variables={ 'cluster': 'cluster', 'provider': 'provider', }, query_parameters={}, dispatch_parameters={}, header_parameters={}, dispatch_header_parameters={}) operations = { 'set$task': { 'input_type': set_input_type, 'output_type': type.IdType(resource_types='com.vmware.cis.TASK'), 'errors': set_error_dict, 'input_value_validator_list': set_input_value_validator_list, 'output_validator_list': [], 'task_type': TaskType.TASK_ONLY, }, } rest_metadata = { 'set': set_rest_metadata, } ApiInterfaceStub.__init__( self, iface_name= 'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.providers.credential', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=True)
class Sync(VapiInterface): """ The ``Sync`` class provides methods to create a sync session, get information on Sync. Usage beyond VMware Cloud on AWS is not supported. **Warning:** This class is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ _VAPI_SERVICE_ID = 'com.vmware.vcenter.hvc.links.sync' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _SyncStub) self._VAPI_OPERATION_IDS = {} class Credentials(VapiStruct): """ The ``Sync.Credentials`` class specifies user credentials to make a successful connection to remote endpoint. **Warning:** This class is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__(self, user_name=None, password=None, ): """ :type user_name: :class:`str` :param user_name: Name of the user to authenticate. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type password: :class:`str` :param password: Password for the user. **Warning:** This attribute is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. """ self.user_name = user_name self.password = password VapiStruct.__init__(self) Credentials._set_binding_type(type.StructType( 'com.vmware.vcenter.hvc.links.sync.credentials', { 'user_name': type.StringType(), 'password': type.SecretType(), }, Credentials, False, None)) def reset(self, link, ): """ Resets the sync state between the linked domains by initiating a fresh sync for all providers. If an existing sync is in progress this cancels the sync. Usage beyond VMware Cloud on AWS is not supported. **Warning:** This method is available as Technology Preview. These are early access APIs provided to test, automate and provide feedback on the feature. Since this can change based on feedback, VMware does not guarantee backwards compatibility and recommends against using them in production environments. Some Technology Preview APIs might only be applicable to specific environments. :type link: :class:`str` :param link: Unique identifier of the link. The parameter must be an identifier for the resource type: ``com.vmware.vcenter.hvc.Links``. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if the system reports an error while responding to the request. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` if the link Identifier associated with ``link`` does not exist. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user is not authorized to perform this operation. """ return self._invoke('reset', { 'link': link, })
class Restore(VapiInterface): """ ``Restore`` class provides methods Performs restore operations """ _VAPI_SERVICE_ID = 'com.vmware.appliance.recovery.restore' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _RestoreStub) class LocationType(Enum): """ ``Restore.LocationType`` class Defines type of all locations for backup/restore .. 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 :ref:`enumerated type description page <enumeration_description>`. """ FTP = None """ Destination is FTP server """ HTTP = None """ Destination is HTTP server """ FTPS = None """ Destination is FTPS server """ HTTPS = None """ Destination is HTTPS server """ SCP = None """ Destination is SSH server """ SFTP = None """ Destination is SFTP server """ NFS = None """ Destination is NFS server. This class attribute was added in vSphere API 6.7.2. """ SMB = None """ Destination is SMB server. This class attribute was added in vSphere API 6.7.2. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`LocationType` instance. """ Enum.__init__(string) LocationType._set_values([ LocationType('FTP'), LocationType('HTTP'), LocationType('FTPS'), LocationType('HTTPS'), LocationType('SCP'), LocationType('SFTP'), LocationType('NFS'), LocationType('SMB'), ]) LocationType._set_binding_type( type.EnumType('com.vmware.appliance.recovery.restore.location_type', LocationType)) class RestoreRequest(VapiStruct): """ ``Restore.RestoreRequest`` class Structure representing requested restore piece .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, backup_password=None, location_type=None, location=None, location_user=None, location_password=None, sso_admin_user_name=None, sso_admin_user_password=None, ): """ :type backup_password: :class:`str` or ``None`` :param backup_password: a password for a backup piece backupPassword If no password then the piece will not be decrypted :type location_type: :class:`Restore.LocationType` :param location_type: a type of location :type location: :class:`str` :param location: path or url :type location_user: :class:`str` or ``None`` :param location_user: username for location locationUser User name for this location if login is required. :type location_password: :class:`str` or ``None`` :param location_password: password for location locationPassword Password for the specified user if login is required at this location. :type sso_admin_user_name: :class:`str` or ``None`` :param sso_admin_user_name: Administrators username for SSO. This attribute was added in vSphere API 6.7. If None SSO authentication will not be used. If the vCenter Server is a management node or an embedded node, authentication is required. :type sso_admin_user_password: :class:`str` or ``None`` :param sso_admin_user_password: The password for SSO admin user. This attribute was added in vSphere API 6.7. If None SSO authentication will not be used. If the vCenter Server is a management node or an embedded node, authentication is required. """ self.backup_password = backup_password self.location_type = location_type self.location = location self.location_user = location_user self.location_password = location_password self.sso_admin_user_name = sso_admin_user_name self.sso_admin_user_password = sso_admin_user_password VapiStruct.__init__(self) RestoreRequest._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.restore.restore_request', { 'backup_password': type.OptionalType(type.SecretType()), 'location_type': type.ReferenceType(__name__, 'Restore.LocationType'), 'location': type.StringType(), 'location_user': type.OptionalType(type.StringType()), 'location_password': type.OptionalType(type.SecretType()), 'sso_admin_user_name': type.OptionalType(type.StringType()), 'sso_admin_user_password': type.OptionalType(type.SecretType()), }, RestoreRequest, False, None)) class LocalizableMessage(VapiStruct): """ ``Restore.LocalizableMessage`` class Structure representing message .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, id=None, default_message=None, args=None, ): """ :type id: :class:`str` :param id: id in message bundle :type default_message: :class:`str` :param default_message: text in english :type args: :class:`list` of :class:`str` :param args: nested data """ self.id = id self.default_message = default_message self.args = args VapiStruct.__init__(self) LocalizableMessage._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.restore.localizable_message', { 'id': type.StringType(), 'default_message': type.StringType(), 'args': type.ListType(type.StringType()), }, LocalizableMessage, False, None)) class Metadata(VapiStruct): """ ``Restore.Metadata`` class Structure representing metadata .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, timestamp=None, parts=None, version=None, boxname=None, sso_login_required=None, comment=None, applicable=None, messages=None, ): """ :type timestamp: :class:`datetime.datetime` :param timestamp: Time when this backup was completed. :type parts: :class:`list` of :class:`str` :param parts: List of parts included in the backup. :type version: :class:`str` :param version: VCSA version :type boxname: :class:`str` :param boxname: Box name is PNID/ FQDN etc :type sso_login_required: :class:`bool` :param sso_login_required: Is SSO login required for the vCenter server. This attribute was added in vSphere API 6.7. This attribute is optional because it was added in a newer version than its parent node. :type comment: :class:`str` :param comment: Custom comment :type applicable: :class:`bool` :param applicable: Does the VCSA match the deployment type, network properties and version of backed up VC :type messages: :class:`list` of :class:`Restore.LocalizableMessage` :param messages: Any messages if the backup is not aplicable """ self.timestamp = timestamp self.parts = parts self.version = version self.boxname = boxname self.sso_login_required = sso_login_required self.comment = comment self.applicable = applicable self.messages = messages VapiStruct.__init__(self) Metadata._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.restore.metadata', { 'timestamp': type.DateTimeType(), 'parts': type.ListType(type.StringType()), 'version': type.StringType(), 'boxname': type.StringType(), 'sso_login_required': type.OptionalType(type.BooleanType()), 'comment': type.StringType(), 'applicable': type.BooleanType(), 'messages': type.ListType( type.ReferenceType(__name__, 'Restore.LocalizableMessage')), }, Metadata, False, None)) def validate( self, piece, ): """ Get metadata before restore :type piece: :class:`Restore.RestoreRequest` :param piece: RestoreRequest Structure :rtype: :class:`Restore.Metadata` :return: Metadata Structure :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('validate', { 'piece': piece, })
class Proxy(VapiInterface): """ The ``Proxy`` class provides methods Proxy configuration. This class was added in vSphere API 6.7 """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _ProxyStub) class Protocol(Enum): """ ``Proxy.Protocol`` class defines the protocols for which proxying is supported. This enumeration was added in vSphere API 6.7 .. 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 :ref:`enumerated type description page <enumeration_description>`. """ HTTP = None """ Proxy configuration for http. This class attribute was added in vSphere API 6.7 """ HTTPS = None """ Proxy configuration for https. This class attribute was added in vSphere API 6.7 """ FTP = None """ Proxy configuration for ftp. This class attribute was added in vSphere API 6.7 """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`Protocol` instance. """ Enum.__init__(string) Protocol._set_values([ Protocol('HTTP'), Protocol('HTTPS'), Protocol('FTP'), ]) Protocol._set_binding_type( type.EnumType('com.vmware.appliance.networking.proxy.protocol', Protocol)) class ServerStatus(Enum): """ ``Proxy.ServerStatus`` class defines the status of the server associated with the test run. This enumeration was added in vSphere API 6.7 .. 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 :ref:`enumerated type description page <enumeration_description>`. """ SERVER_REACHABLE = None """ Server is reachable. This class attribute was added in vSphere API 6.7 """ SERVER_UNREACHABLE = None """ Server is unreachable. This class attribute was added in vSphere API 6.7 """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`ServerStatus` instance. """ Enum.__init__(string) ServerStatus._set_values([ ServerStatus('SERVER_REACHABLE'), ServerStatus('SERVER_UNREACHABLE'), ]) ServerStatus._set_binding_type( type.EnumType('com.vmware.appliance.networking.proxy.server_status', ServerStatus)) class Config(VapiStruct): """ The ``Proxy.Config`` class defines proxy configuration. This class was added in vSphere API 6.7 .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, server=None, port=None, username=None, password=None, enabled=None, ): """ :type server: :class:`str` :param server: Hostname or IP address of the proxy server. This attribute was added in vSphere API 6.7 :type port: :class:`long` :param port: Port to connect to the proxy server. In a 'get' call, indicates the port connected to the proxy server. In a 'set' call, specifies the port to connect to the proxy server. A value of -1 indicates the default port. This attribute was added in vSphere API 6.7 :type username: :class:`str` or ``None`` :param username: Username for proxy server. This attribute was added in vSphere API 6.7 Only :class:`set` if proxy requires username. :type password: :class:`str` or ``None`` :param password: Password for proxy server. This attribute was added in vSphere API 6.7 Only :class:`set` if proxy requires password. :type enabled: :class:`bool` :param enabled: In the result of the ``#get`` and ``#list`` methods this attribute indicates whether proxying is enabled for a particular protocol. In the input to the ``test`` and ``set`` methods this attribute specifies whether proxying should be enabled for a particular protocol. This attribute was added in vSphere API 6.7 """ self.server = server self.port = port self.username = username self.password = password self.enabled = enabled VapiStruct.__init__(self) Config._set_binding_type( type.StructType( 'com.vmware.appliance.networking.proxy.config', { 'server': type.StringType(), 'port': type.IntegerType(), 'username': type.OptionalType(type.StringType()), 'password': type.OptionalType(type.SecretType()), 'enabled': type.BooleanType(), }, Config, False, None)) class TestResult(VapiStruct): """ The ``Proxy.TestResult`` class contains information about the test operation done on a proxy server. This class was added in vSphere API 6.7 .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, status=None, message=None, ): """ :type status: :class:`Proxy.ServerStatus` :param status: Status of the proxy server indicating whether the proxy server is reachable. This attribute was added in vSphere API 6.7 :type message: :class:`com.vmware.vapi.std_client.LocalizableMessage` :param message: Message associated with status. This attribute was added in vSphere API 6.7 """ self.status = status self.message = message VapiStruct.__init__(self) TestResult._set_binding_type( type.StructType( 'com.vmware.appliance.networking.proxy.test_result', { 'status': type.ReferenceType(__name__, 'Proxy.ServerStatus'), 'message': type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage'), }, TestResult, False, None)) def test( self, host, protocol, config, ): """ Tests a proxy configuration by testing the connection to the proxy server and test host. This method was added in vSphere API 6.7 :type host: :class:`str` :param host: A hostname, IPv4 or Ipv6 address. :type protocol: :class:`str` :param protocol: Protocol whose proxy is to be tested. :type config: :class:`Proxy.Config` :param config: Proxy configuration to test. :rtype: :class:`Proxy.TestResult` :return: Status of proxy settings. :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error. """ return self._invoke('test', { 'host': host, 'protocol': protocol, 'config': config, }) def set( self, protocol, config, ): """ Configures which proxy server to use for the specified protocol. This operation sets environment variables for using proxy. In order for this configuration to take effect a logout / service restart is required. This method was added in vSphere API 6.7 :type protocol: :class:`str` :param protocol: The protocol for which proxy should be set. :type config: :class:`Proxy.Config` :param config: Proxy configuration for the specific protocol. :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error. """ return self._invoke('set', { 'protocol': protocol, 'config': config, }) def delete( self, protocol, ): """ Deletes a proxy configuration for a specific protocol. This method was added in vSphere API 6.7 :type protocol: :class:`str` :param protocol: ID whose proxy is to be deleted. :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error. """ return self._invoke('delete', { 'protocol': protocol, }) def list(self): """ Gets proxy configuration for all configured protocols. This method was added in vSphere API 6.7 :rtype: :class:`dict` of :class:`Proxy.Protocol` and :class:`Proxy.Config` :return: Proxy configuration for all configured protocols. :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error. """ return self._invoke('list', None) def get( self, protocol, ): """ Gets the proxy configuration for a specific protocol. This method was added in vSphere API 6.7 :type protocol: :class:`str` :param protocol: The protocol whose proxy configuration is requested. :rtype: :class:`Proxy.Config` :return: Proxy configuration for a specific protocol. :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error. """ return self._invoke('get', { 'protocol': protocol, })
class Update(VapiInterface): """ ``Update`` class provides methods Performs update repository configuration. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _UpdateStub) class AutoUpdateNotification(Enum): """ ``Update.AutoUpdateNotification`` class Defines state for automatic update notification .. 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 :ref:`enumerated type description page <enumeration_description>`. """ disabled = None """ Automatic update notification is disabled. Disable periodically query the configured url for updates. """ enabled = None """ Automatic update notification is enabled. Enable periodically query the configured url for updates. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`AutoUpdateNotification` instance. """ Enum.__init__(string) AutoUpdateNotification._set_values([ AutoUpdateNotification('disabled'), AutoUpdateNotification('enabled'), ]) AutoUpdateNotification._set_binding_type( type.EnumType( 'com.vmware.appliance.techpreview.system.update.auto_update_notification', AutoUpdateNotification)) class UpdateDay(Enum): """ ``Update.UpdateDay`` class Defines days to query for updates .. 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 :ref:`enumerated type description page <enumeration_description>`. """ Monday = None """ query for updates on Monday """ Tuesday = None """ query for updates on Tuesday """ Friday = None """ query for updates on Friday """ Wednesday = None """ query for updates on Wednesday """ Thursday = None """ query for updates on Thursday """ Saturday = None """ query for updates on Saturday """ Sunday = None """ query for updates on Sunday """ Everyday = None """ query for updates everyday """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`UpdateDay` instance. """ Enum.__init__(string) UpdateDay._set_values([ UpdateDay('Monday'), UpdateDay('Tuesday'), UpdateDay('Friday'), UpdateDay('Wednesday'), UpdateDay('Thursday'), UpdateDay('Saturday'), UpdateDay('Sunday'), UpdateDay('Everyday'), ]) UpdateDay._set_binding_type( type.EnumType( 'com.vmware.appliance.techpreview.system.update.update_day', UpdateDay)) class UpdateStructSet(VapiStruct): """ ``Update.UpdateStructSet`` class Structure to set url update repository. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, current_url=None, check_updates=None, time=None, day=None, username=None, password=None, ): """ :type current_url: :class:`str` :param current_url: Current appliance update repository URL. Enter "default" to reset the url to the default url. :type check_updates: :class:`Update.AutoUpdateNotification` :param check_updates: Check for update at the pre-configured repository URL. :type time: :class:`str` :param time: time to query for updates Format: HH:MM:SS Military (24 hour) Time Format :type day: :class:`Update.UpdateDay` :param day: day to query for updates :type username: :class:`str` :param username: username for the url update repository :type password: :class:`str` :param password: password for the url update repository """ self.current_url = current_url self.check_updates = check_updates self.time = time self.day = day self.username = username self.password = password VapiStruct.__init__(self, { 'current_URL': 'current_url', }) UpdateStructSet._set_binding_type( type.StructType( 'com.vmware.appliance.techpreview.system.update.update_struct_set', { 'current_URL': type.StringType(), 'check_updates': type.ReferenceType(sys.modules[__name__], 'Update.AutoUpdateNotification'), 'time': type.StringType(), 'day': type.ReferenceType(sys.modules[__name__], 'Update.UpdateDay'), 'username': type.StringType(), 'password': type.SecretType(), }, UpdateStructSet, False, None)) class UpdateStructGet(VapiStruct): """ ``Update.UpdateStructGet`` class Structure to get url update repository. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, current_url=None, default_url=None, check_updates=None, time=None, day=None, latest_update_install_time=None, latest_update_query_time=None, username=None, password=None, ): """ :type current_url: :class:`str` :param current_url: Current appliance update repository URL. :type default_url: :class:`str` :param default_url: Default appliance update repository URL. :type check_updates: :class:`Update.AutoUpdateNotification` :param check_updates: Check for update at the pre-configured repository URL. :type time: :class:`str` :param time: time to query for updates Format: HH:MM:SS Military (24 hour) Time Format :type day: :class:`Update.UpdateDay` :param day: day to query for updates :type latest_update_install_time: :class:`str` :param latest_update_install_time: timestamp of latest update installation :type latest_update_query_time: :class:`str` :param latest_update_query_time: timestamp of latest query to update repository :type username: :class:`str` :param username: username for the url update repository :type password: :class:`str` :param password: password for the url update repository """ self.current_url = current_url self.default_url = default_url self.check_updates = check_updates self.time = time self.day = day self.latest_update_install_time = latest_update_install_time self.latest_update_query_time = latest_update_query_time self.username = username self.password = password VapiStruct.__init__(self, { 'current_URL': 'current_url', 'default_URL': 'default_url', }) UpdateStructGet._set_binding_type( type.StructType( 'com.vmware.appliance.techpreview.system.update.update_struct_get', { 'current_URL': type.StringType(), 'default_URL': type.StringType(), 'check_updates': type.ReferenceType(sys.modules[__name__], 'Update.AutoUpdateNotification'), 'time': type.StringType(), 'day': type.ReferenceType(sys.modules[__name__], 'Update.UpdateDay'), 'latest_update_install_time': type.StringType(), 'latest_update_query_time': type.StringType(), 'username': type.StringType(), 'password': type.StringType(), }, UpdateStructGet, False, None)) def set( self, config, ): """ Set update repository configuration. :type config: :class:`Update.UpdateStructSet` :param config: update related configuration :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('set', { 'config': config, }) def get(self): """ Get update repository configuration. :rtype: :class:`Update.UpdateStructGet` :return: update related configuration :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('get', None)
class Tls(VapiInterface): """ The ``Tls`` interface provides methods to replace Tls certificate. This class was added in vSphere API 6.7.2. """ _VAPI_SERVICE_ID = 'com.vmware.vcenter.certificate_management.vcenter.tls' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _TlsStub) class Info(VapiStruct): """ The ``Tls.Info`` class contains information from a TLS certificate. This class was added in vSphere API 6.7.2. .. tip:: The arguments are used to initialize data attributes with the same names. """ _canonical_to_pep_names = { 'is_CA': 'is_ca', } def __init__( self, version=None, serial_number=None, signature_algorithm=None, issuer_dn=None, valid_from=None, valid_to=None, subject_dn=None, thumbprint=None, is_ca=None, path_length_constraint=None, key_usage=None, extended_key_usage=None, subject_alternative_name=None, authority_information_access_uri=None, cert=None, ): """ :type version: :class:`long` :param version: Version (version number) value from the certificate. This attribute was added in vSphere API 6.7.2. :type serial_number: :class:`str` :param serial_number: SerialNumber value from the certificate. This attribute was added in vSphere API 6.7.2. :type signature_algorithm: :class:`str` :param signature_algorithm: Signature algorithm name from the certificate. This attribute was added in vSphere API 6.7.2. :type issuer_dn: :class:`str` :param issuer_dn: Issuer (issuer distinguished name) value from the certificate. This attribute was added in vSphere API 6.7.2. :type valid_from: :class:`datetime.datetime` :param valid_from: validFrom specify the start date of the certificate. This attribute was added in vSphere API 6.7.2. :type valid_to: :class:`datetime.datetime` :param valid_to: validTo specify the end date of the certificate. This attribute was added in vSphere API 6.7.2. :type subject_dn: :class:`str` :param subject_dn: Subject (subject distinguished name) value from the certificate. This attribute was added in vSphere API 6.7.2. :type thumbprint: :class:`str` :param thumbprint: Thumbprint value from the certificate. This attribute was added in vSphere API 6.7.2. :type is_ca: :class:`bool` :param is_ca: Certificate constraints isCA from the critical BasicConstraints extension, (OID = 2.5.29.19). This attribute was added in vSphere API 6.7.2. :type path_length_constraint: :class:`long` :param path_length_constraint: Certificate constraints path length from the critical BasicConstraints extension, (OID = 2.5.29.19). This attribute was added in vSphere API 6.7.2. :type key_usage: :class:`list` of :class:`str` :param key_usage: Collection of keyusage contained in the certificate. This attribute was added in vSphere API 6.7.2. :type extended_key_usage: :class:`list` of :class:`str` :param extended_key_usage: Collection of extended keyusage that contains details for which the certificate can be used for. This attribute was added in vSphere API 6.7.2. :type subject_alternative_name: :class:`list` of :class:`str` :param subject_alternative_name: Collection of subject alternative names. This attribute was added in vSphere API 6.7.2. :type authority_information_access_uri: :class:`list` of :class:`str` :param authority_information_access_uri: Collection of authority information access URI. This attribute was added in vSphere API 6.7.2. :type cert: :class:`str` :param cert: TLS certificate in PEM format. This attribute was added in vSphere API 6.7.2. """ self.version = version self.serial_number = serial_number self.signature_algorithm = signature_algorithm self.issuer_dn = issuer_dn self.valid_from = valid_from self.valid_to = valid_to self.subject_dn = subject_dn self.thumbprint = thumbprint self.is_ca = is_ca self.path_length_constraint = path_length_constraint self.key_usage = key_usage self.extended_key_usage = extended_key_usage self.subject_alternative_name = subject_alternative_name self.authority_information_access_uri = authority_information_access_uri self.cert = cert VapiStruct.__init__(self) Info._set_binding_type( type.StructType( 'com.vmware.vcenter.certificate_management.vcenter.tls.info', { 'version': type.IntegerType(), 'serial_number': type.StringType(), 'signature_algorithm': type.StringType(), 'issuer_dn': type.StringType(), 'valid_from': type.DateTimeType(), 'valid_to': type.DateTimeType(), 'subject_dn': type.StringType(), 'thumbprint': type.StringType(), 'is_CA': type.BooleanType(), 'path_length_constraint': type.IntegerType(), 'key_usage': type.ListType(type.StringType()), 'extended_key_usage': type.ListType(type.StringType()), 'subject_alternative_name': type.ListType(type.StringType()), 'authority_information_access_uri': type.ListType(type.StringType()), 'cert': type.StringType(), }, Info, False, None)) class Spec(VapiStruct): """ The ``Tls.Spec`` class contains information for a Certificate and Private Key. This class was added in vSphere API 6.7.2. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, cert=None, key=None, ): """ :type cert: :class:`str` :param cert: Certificate string in PEM format. This attribute was added in vSphere API 6.7.2. :type key: :class:`str` or ``None`` :param key: Private key string in PEM format. This attribute was added in vSphere API 6.7.2. If None the private key from the certificate store will be used. It is required when replacing the certificate with a third party signed certificate. """ self.cert = cert self.key = key VapiStruct.__init__(self) Spec._set_binding_type( type.StructType( 'com.vmware.vcenter.certificate_management.vcenter.tls.spec', { 'cert': type.StringType(), 'key': type.OptionalType(type.SecretType()), }, Spec, False, None)) class ReplaceSpec(VapiStruct): """ The ``Tls.ReplaceSpec`` class contains information to generate a Private Key , CSR and hence VMCA signed machine SSL. This class was added in vSphere API 6.7.2. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, key_size=None, common_name=None, organization=None, organization_unit=None, locality=None, state_or_province=None, country=None, email_address=None, subject_alt_name=None, ): """ :type key_size: :class:`long` or ``None`` :param key_size: The size of the key to be used for public and private key generation. This attribute was added in vSphere API 6.7.2. If None the key size will be '2048'. :type common_name: :class:`str` or ``None`` :param common_name: The common name of the host for which certificate is generated. This attribute was added in vSphere API 6.7.2. If None will default to PNID of host. :type organization: :class:`str` :param organization: Organization field in certificate subject. This attribute was added in vSphere API 6.7.2. :type organization_unit: :class:`str` :param organization_unit: Organization unit field in certificate subject. This attribute was added in vSphere API 6.7.2. :type locality: :class:`str` :param locality: Locality field in certificate subject. This attribute was added in vSphere API 6.7.2. :type state_or_province: :class:`str` :param state_or_province: State field in certificate subject. This attribute was added in vSphere API 6.7.2. :type country: :class:`str` :param country: Country field in certificate subject. This attribute was added in vSphere API 6.7.2. :type email_address: :class:`str` :param email_address: Email field in Certificate extensions. This attribute was added in vSphere API 6.7.2. :type subject_alt_name: :class:`list` of :class:`str` or ``None`` :param subject_alt_name: SubjectAltName is list of Dns Names and Ip addresses. This attribute was added in vSphere API 6.7.2. If None PNID of host will be used as IPAddress or Hostname for certificate generation . """ self.key_size = key_size self.common_name = common_name self.organization = organization self.organization_unit = organization_unit self.locality = locality self.state_or_province = state_or_province self.country = country self.email_address = email_address self.subject_alt_name = subject_alt_name VapiStruct.__init__(self) ReplaceSpec._set_binding_type( type.StructType( 'com.vmware.vcenter.certificate_management.vcenter.tls.replace_spec', { 'key_size': type.OptionalType(type.IntegerType()), 'common_name': type.OptionalType(type.StringType()), 'organization': type.StringType(), 'organization_unit': type.StringType(), 'locality': type.StringType(), 'state_or_province': type.StringType(), 'country': type.StringType(), 'email_address': type.StringType(), 'subject_alt_name': type.OptionalType(type.ListType(type.StringType())), }, ReplaceSpec, False, None)) def set( self, spec, ): """ Replaces the rhttpproxy TLS certificate with the specified certificate. This method can be used in three scenarios : #. When the CSR is created and the private key is already stored, this method can replace the certificate. The certificate but not the private key and root certificate must be provided as input. #. When the certificate is signed by a third party certificate authority/VMCA and the root certificate of the third party certificate authority/VMCA is already one of the trusted roots in the trust store, this method can replace the certificate and private key. The certificate and the private key but not the root certificate must be provided as input. #. When the certificate is signed by a third party certificate authority and the root certificate of the third party certificate authority is not one of the trusted roots in the trust store, this method can replace the certificate, private key and root CA certificate. The certificate, private key and root certificate must be provided as input. After this method completes, the services using the certificate must be restarted for the new certificate to take effect. The above three scenarios are only supported from vsphere 7.0 onwards. This method was added in vSphere API 6.7.2. :type spec: :class:`Tls.Spec` :param spec: The information needed to replace the TLS certificate. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` If the private key is not present in the VECS store. :raise: :class:`com.vmware.vapi.std.errors_client.AlreadyExists` If the specified certificate thumbprint is the same as the existing TLS certificate thumbprint. :raise: :class:`com.vmware.vapi.std.errors_client.Error` If the system failed to replace the TLS certificate. """ return self._invoke('set', { 'spec': spec, }) def get(self): """ Returns the rhttpproxy TLS certificate. This method was added in vSphere API 6.7.2. :rtype: :class:`Tls.Info` :return: TLS certificate. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` if the rhttpproxy certificate is not present in VECS store. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if failed due to generic exception. """ return self._invoke('get', None) def renew( self, duration=None, ): """ Renews the TLS certificate for the given duration period. After this method completes, the services using the certificate must be restarted for the new certificate to take effect. This method was added in vSphere API 6.7.2. :type duration: :class:`long` or ``None`` :param duration: The duration (in days) of the new TLS certificate. The duration should be less than or equal to 730 days. If None, the duration will be 730 days (two years). :raise: :class:`com.vmware.vapi.std.errors_client.Unsupported` If the TLS certificate is not VMCA generated. :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` If the duration period specified is invalid. :raise: :class:`com.vmware.vapi.std.errors_client.Error` If the system failed to renew the TLS certificate. """ return self._invoke('renew', { 'duration': duration, })
class Configs(VapiInterface): """ ``Configs`` class provides methods to manage desired configuration specification of an appliance. """ _VAPI_SERVICE_ID = 'com.vmware.appliance.infraprofile.configs' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _ConfigsStub) self._VAPI_OPERATION_IDS = {} self._VAPI_OPERATION_IDS.update({'validate_task': 'validate$task'}) self._VAPI_OPERATION_IDS.update( {'import_profile_task': 'import_profile$task'}) class ValidationStatus(Enum): """ The ``Configs.ValidationStatus`` class defines possible values of status of profile spec. .. 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 :ref:`enumerated type description page <enumeration_description>`. """ VALID = None """ Profile spec is valid. """ INVALID = None """ Profile spec is invalid. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`ValidationStatus` instance. """ Enum.__init__(string) ValidationStatus._set_values([ ValidationStatus('VALID'), ValidationStatus('INVALID'), ]) ValidationStatus._set_binding_type( type.EnumType( 'com.vmware.appliance.infraprofile.configs.validation_status', ValidationStatus)) class ProfileInfo(VapiStruct): """ The ``Configs.ProfileInfo`` class defines the information about profile. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, name=None, info=None, ): """ :type name: :class:`str` :param name: Name of the profile which is also a profile identifier. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``com.vmware.infraprofile.profile``. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ``com.vmware.infraprofile.profile``. :type info: :class:`str` :param info: Description of the profile. """ self.name = name self.info = info VapiStruct.__init__(self) ProfileInfo._set_binding_type( type.StructType( 'com.vmware.appliance.infraprofile.configs.profile_info', { 'name': type.IdType(resource_types='com.vmware.infraprofile.profile'), 'info': type.StringType(), }, ProfileInfo, False, None)) class ProfilesSpec(VapiStruct): """ The ``Configs.ProfilesSpec`` class represents a spec information for export operation. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, encryption_key=None, description=None, profiles=None, ): """ :type encryption_key: :class:`str` or ``None`` :param encryption_key: Encryption Key to encrypt/decrypt profiles. If None encryption will not be used for the profile. :type description: :class:`str` or ``None`` :param description: Custom description provided by the user. If None description will be empty. :type profiles: :class:`set` of :class:`str` or ``None`` :param profiles: Profiles to be exported/imported. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: ``com.vmware.infraprofile.profile``. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: ``com.vmware.infraprofile.profile``. If None or empty, all profiles will be returned. """ self.encryption_key = encryption_key self.description = description self.profiles = profiles VapiStruct.__init__(self) ProfilesSpec._set_binding_type( type.StructType( 'com.vmware.appliance.infraprofile.configs.profiles_spec', { 'encryption_key': type.OptionalType(type.SecretType()), 'description': type.OptionalType(type.StringType()), 'profiles': type.OptionalType(type.SetType(type.IdType())), }, ProfilesSpec, False, None)) class ImportProfileSpec(VapiStruct): """ The ``Configs.ImportProfileSpec`` class represents a spec information for import and validate. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, config_spec=None, profile_spec=None, ): """ :type config_spec: :class:`str` :param config_spec: The JSON string representing the desired config specification. :type profile_spec: :class:`Configs.ProfilesSpec` or ``None`` :param profile_spec: The profile specification, if any only :class:`set` if there is a profilespec avaliable for this import profilespec. """ self.config_spec = config_spec self.profile_spec = profile_spec VapiStruct.__init__(self) ImportProfileSpec._set_binding_type( type.StructType( 'com.vmware.appliance.infraprofile.configs.import_profile_spec', { 'config_spec': type.StringType(), 'profile_spec': type.OptionalType( type.ReferenceType(__name__, 'Configs.ProfilesSpec')), }, ImportProfileSpec, False, None)) class ValidationResult(VapiStruct): """ The ``Configs.ValidationResult`` class contains attributes to describe result of validation of profile specification. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, status=None, notifications=None, ): """ :type status: :class:`Configs.ValidationStatus` :param status: Status of the Profile spec. :type notifications: :class:`Notifications` or ``None`` :param notifications: Notifications to the user Only :class:`set` if the notifications were reported by this particular validation. """ self.status = status self.notifications = notifications VapiStruct.__init__(self) ValidationResult._set_binding_type( type.StructType( 'com.vmware.appliance.infraprofile.configs.validation_result', { 'status': type.ReferenceType(__name__, 'Configs.ValidationStatus'), 'notifications': type.OptionalType(type.ReferenceType(__name__, 'Notifications')), }, ValidationResult, False, None)) def list(self): """ List all the profiles which are registered. :rtype: :class:`list` of :class:`Configs.ProfileInfo` :return: List of profiles with description are registered. :raise: :class:`com.vmware.vapi.std.errors_client.Error` If there is unknown internal error. The accompanying error message will give more details about the failure. :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` If the service is not available. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` If the caller is not authenticated. """ return self._invoke('list', None) def export( self, spec=None, ): """ Exports the desired profile specification. :type spec: :class:`Configs.ProfilesSpec` or ``None`` :param spec: information to export the profile. :rtype: :class:`str` :return: Configuration specification JSON in string format. :raise: :class:`com.vmware.vapi.std.errors_client.Error` If there is unknown internal error. The accompanying error message will give more details about the failure. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` If there is no profile associated. :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` If the service is not available. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` If the caller is not authenticated. """ return self._invoke('export', { 'spec': spec, }) def validate_task( self, spec, ): """ Validates the desired profile specification. :type spec: :class:`Configs.ImportProfileSpec` :param spec: information to validate the profile. :rtype: :class: `vmware.vapi.stdlib.client.task.Task` :return: Task instance :raise: :class:`com.vmware.vapi.std.errors_client.Error` If there is unknown internal error. The accompanying error message will give more details about the failure. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` If there is no profile associated. :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` If the service is not available. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` If the caller is not authenticated. """ task_id = self._invoke('validate$task', { 'spec': spec, }) task_svc = Tasks(self._config) task_instance = Task( task_id, task_svc, type.ReferenceType(__name__, 'Configs.ValidationResult')) return task_instance def import_profile_task( self, spec, ): """ Imports the desired profile specification. :type spec: :class:`Configs.ImportProfileSpec` :param spec: information to import the profile. :rtype: :class: `vmware.vapi.stdlib.client.task.Task` :return: Task instance :raise: :class:`com.vmware.vapi.std.errors_client.Error` If there is unknown internal error. The accompanying error message will give more details about the failure. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` If there is no profile associated. :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` If the service is not available. :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` If there is another operation in progress. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` If the caller is not authenticated. """ task_id = self._invoke('import_profile$task', { 'spec': spec, }) task_svc = Tasks(self._config) task_instance = Task(task_id, task_svc, type.StringType()) return task_instance
class Job(VapiInterface): """ ``Job`` class provides methods Performs restore operations """ _VAPI_SERVICE_ID = 'com.vmware.appliance.recovery.restore.job' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _JobStub) self._VAPI_OPERATION_IDS = {} class ReturnStatus(Enum): """ ``Job.ReturnStatus`` class Defines the state of precheck .. 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 :ref:`enumerated type description page <enumeration_description>`. """ FAIL = None """ Check failed """ WARNING = None """ Passed with warnings """ OK = None """ Check passed """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`ReturnStatus` instance. """ Enum.__init__(string) ReturnStatus._set_values([ ReturnStatus('FAIL'), ReturnStatus('WARNING'), ReturnStatus('OK'), ]) ReturnStatus._set_binding_type( type.EnumType( 'com.vmware.appliance.recovery.restore.job.return_status', ReturnStatus)) class LocationType(Enum): """ ``Job.LocationType`` class Defines type of all locations for backup/restore .. 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 :ref:`enumerated type description page <enumeration_description>`. """ FTP = None """ Destination is FTP server """ HTTP = None """ Destination is HTTP server """ FTPS = None """ Destination is FTPS server """ HTTPS = None """ Destination is HTTPS server """ SCP = None """ Destination is SSH server """ SFTP = None """ Destination is SFTP server """ NFS = None """ Destination is NFS server. This class attribute was added in vSphere API 6.7.2. """ SMB = None """ Destination is SMB server. This class attribute was added in vSphere API 6.7.2. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`LocationType` instance. """ Enum.__init__(string) LocationType._set_values([ LocationType('FTP'), LocationType('HTTP'), LocationType('FTPS'), LocationType('HTTPS'), LocationType('SCP'), LocationType('SFTP'), LocationType('NFS'), LocationType('SMB'), ]) LocationType._set_binding_type( type.EnumType( 'com.vmware.appliance.recovery.restore.job.location_type', LocationType)) class BackupRestoreProcessState(Enum): """ ``Job.BackupRestoreProcessState`` class Defines state of backup/restore process .. 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 :ref:`enumerated type description page <enumeration_description>`. """ FAILED = None """ Failed """ INPROGRESS = None """ In progress """ NONE = None """ Not started """ SUCCEEDED = None """ Completed successfully """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`BackupRestoreProcessState` instance. """ Enum.__init__(string) BackupRestoreProcessState._set_values([ BackupRestoreProcessState('FAILED'), BackupRestoreProcessState('INPROGRESS'), BackupRestoreProcessState('NONE'), BackupRestoreProcessState('SUCCEEDED'), ]) BackupRestoreProcessState._set_binding_type( type.EnumType( 'com.vmware.appliance.recovery.restore.job.backup_restore_process_state', BackupRestoreProcessState)) class LocalizableMessage(VapiStruct): """ ``Job.LocalizableMessage`` class Structure representing message .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, id=None, default_message=None, args=None, ): """ :type id: :class:`str` :param id: id in message bundle :type default_message: :class:`str` :param default_message: text in english :type args: :class:`list` of :class:`str` :param args: nested data """ self.id = id self.default_message = default_message self.args = args VapiStruct.__init__(self) LocalizableMessage._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.restore.job.localizable_message', { 'id': type.StringType(), 'default_message': type.StringType(), 'args': type.ListType(type.StringType()), }, LocalizableMessage, False, None)) class ReturnResult(VapiStruct): """ ``Job.ReturnResult`` class Structure representing precheck result .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, status=None, messages=None, ): """ :type status: :class:`Job.ReturnStatus` :param status: Check status :type messages: :class:`list` of :class:`Job.LocalizableMessage` :param messages: List of messages """ self.status = status self.messages = messages VapiStruct.__init__(self) ReturnResult._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.restore.job.return_result', { 'status': type.ReferenceType(__name__, 'Job.ReturnStatus'), 'messages': type.ListType( type.ReferenceType(__name__, 'Job.LocalizableMessage')), }, ReturnResult, False, None)) class RestoreRequest(VapiStruct): """ ``Job.RestoreRequest`` class Structure representing requested restore piece .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, backup_password=None, location_type=None, location=None, location_user=None, location_password=None, sso_admin_user_name=None, sso_admin_user_password=None, ignore_warnings=None, ): """ :type backup_password: :class:`str` or ``None`` :param backup_password: a password for a backup piece backupPassword If no password then the piece will not be decrypted :type location_type: :class:`Job.LocationType` :param location_type: a type of location :type location: :class:`str` :param location: path or url :type location_user: :class:`str` or ``None`` :param location_user: username for location locationUser User name for this location if login is required. :type location_password: :class:`str` or ``None`` :param location_password: password for location locationPassword Password for the specified user if login is required at this location. :type sso_admin_user_name: :class:`str` or ``None`` :param sso_admin_user_name: Administrators Username for SSO. This attribute was added in vSphere API 6.7. If None SSO authentication will not be used. If the vCenter Server is a management node or an embedded node, authentication is required. :type sso_admin_user_password: :class:`str` or ``None`` :param sso_admin_user_password: The password for SSO admin user. This attribute was added in vSphere API 6.7. If None SSO authentication will not be used. If the vCenter Server is a management node or an embedded node, authentication is required. :type ignore_warnings: :class:`bool` or ``None`` :param ignore_warnings: The flag to ignore warnings during restore. This attribute was added in vSphere API 6.7. If None, validation warnings will fail the restore operation """ self.backup_password = backup_password self.location_type = location_type self.location = location self.location_user = location_user self.location_password = location_password self.sso_admin_user_name = sso_admin_user_name self.sso_admin_user_password = sso_admin_user_password self.ignore_warnings = ignore_warnings VapiStruct.__init__(self) RestoreRequest._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.restore.job.restore_request', { 'backup_password': type.OptionalType(type.SecretType()), 'location_type': type.ReferenceType(__name__, 'Job.LocationType'), 'location': type.StringType(), 'location_user': type.OptionalType(type.StringType()), 'location_password': type.OptionalType(type.SecretType()), 'sso_admin_user_name': type.OptionalType(type.StringType()), 'sso_admin_user_password': type.OptionalType( type.SecretType()), 'ignore_warnings': type.OptionalType(type.BooleanType()), }, RestoreRequest, False, None)) class RestoreJobStatus(VapiStruct): """ ``Job.RestoreJobStatus`` class Structure representing backup restore status .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, state=None, messages=None, progress=None, ): """ :type state: :class:`Job.BackupRestoreProcessState` :param state: process state :type messages: :class:`list` of :class:`Job.LocalizableMessage` :param messages: list of messages :type progress: :class:`long` :param progress: percentage complete """ self.state = state self.messages = messages self.progress = progress VapiStruct.__init__(self) RestoreJobStatus._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.restore.job.restore_job_status', { 'state': type.ReferenceType(__name__, 'Job.BackupRestoreProcessState'), 'messages': type.ListType( type.ReferenceType(__name__, 'Job.LocalizableMessage')), 'progress': type.IntegerType(), }, RestoreJobStatus, False, None)) def cancel(self): """ Cancel the restore job :rtype: :class:`Job.ReturnResult` :return: RestoreJobStatus Structure :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('cancel', None) def create( self, piece, ): """ Initiate restore. :type piece: :class:`Job.RestoreRequest` :param piece: RestoreRequest Structure :rtype: :class:`Job.RestoreJobStatus` :return: RestoreJobStatus Structure :raise: :class:`com.vmware.vapi.std.errors_client.FeatureInUse` A backup or restore is already in progress :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` Restore is allowed only after deployment and before firstboot :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('create', { 'piece': piece, }) def get(self): """ See restore job progress/result. :rtype: :class:`Job.RestoreJobStatus` :return: RestoreJobStatus Structure :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('get', None)
class User(VapiInterface): """ ``User`` class provides methods Perform operations on local user account. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _UserStub) class UserAccountStatus(Enum): """ ``User.UserAccountStatus`` class Defines status of user accounts .. 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 :ref:`enumerated type description page <enumeration_description>`. """ disabled = None """ The user account is disabled. """ enabled = None """ The user account is enabled. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`UserAccountStatus` instance. """ Enum.__init__(string) UserAccountStatus._set_values([ UserAccountStatus('disabled'), UserAccountStatus('enabled'), ]) UserAccountStatus._set_binding_type( type.EnumType( 'com.vmware.appliance.techpreview.localaccounts.user.user_account_status', UserAccountStatus)) class UserPasswordStatus(Enum): """ ``User.UserPasswordStatus`` class Defines state of user password .. 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 :ref:`enumerated type description page <enumeration_description>`. """ notset = None """ No password has been set """ expired = None """ The password has expired. """ valid = None """ The password is still valid. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`UserPasswordStatus` instance. """ Enum.__init__(string) UserPasswordStatus._set_values([ UserPasswordStatus('notset'), UserPasswordStatus('expired'), UserPasswordStatus('valid'), ]) UserPasswordStatus._set_binding_type( type.EnumType( 'com.vmware.appliance.techpreview.localaccounts.user.user_password_status', UserPasswordStatus)) class UserRole(Enum): """ ``User.UserRole`` class Defines user roles for appliance .. 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 :ref:`enumerated type description page <enumeration_description>`. """ admin = None """ Able to configure the appliance. """ operator = None """ Able to read the appliance configuration. """ superAdmin = None """ Able to configure the appliance, manage local accounts and use the BASH shell """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`UserRole` instance. """ Enum.__init__(string) UserRole._set_values([ UserRole('admin'), UserRole('operator'), UserRole('superAdmin'), ]) UserRole._set_binding_type( type.EnumType( 'com.vmware.appliance.techpreview.localaccounts.user.user_role', UserRole)) class UserConfigGet(VapiStruct): """ ``User.UserConfigGet`` class Structure defines a user configuration for user.get API. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, username=None, role=None, fullname=None, status=None, passwordstatus=None, email=None, ): """ :type username: :class:`str` :param username: User login name :type role: :class:`User.UserRole` :param role: User roles :type fullname: :class:`str` :param fullname: User full name :type status: :class:`User.UserAccountStatus` :param status: Shows whether the user account is enabled or disabled. :type passwordstatus: :class:`User.UserPasswordStatus` :param passwordstatus: Shows whether the user account is still valid or expired. :type email: :class:`str` :param email: Email address of the local account. """ self.username = username self.role = role self.fullname = fullname self.status = status self.passwordstatus = passwordstatus self.email = email VapiStruct.__init__(self) UserConfigGet._set_binding_type( type.StructType( 'com.vmware.appliance.techpreview.localaccounts.user.user_config_get', { 'username': type.StringType(), 'role': type.ReferenceType(sys.modules[__name__], 'User.UserRole'), 'fullname': type.StringType(), 'status': type.ReferenceType(sys.modules[__name__], 'User.UserAccountStatus'), 'passwordstatus': type.ReferenceType(sys.modules[__name__], 'User.UserPasswordStatus'), 'email': type.StringType(), }, UserConfigGet, False, None)) class UserConfig(VapiStruct): """ ``User.UserConfig`` class Structure that defines a new user configuration for CLI. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, username=None, role=None, fullname=None, status=None, email=None, ): """ :type username: :class:`str` :param username: User login name :type role: :class:`User.UserRole` :param role: User roles :type fullname: :class:`str` :param fullname: User full name :type status: :class:`User.UserAccountStatus` :param status: Enabled status of the local account :type email: :class:`str` :param email: email of the local account """ self.username = username self.role = role self.fullname = fullname self.status = status self.email = email VapiStruct.__init__(self) UserConfig._set_binding_type( type.StructType( 'com.vmware.appliance.techpreview.localaccounts.user.user_config', { 'username': type.StringType(), 'role': type.ReferenceType(sys.modules[__name__], 'User.UserRole'), 'fullname': type.StringType(), 'status': type.ReferenceType(sys.modules[__name__], 'User.UserAccountStatus'), 'email': type.StringType(), }, UserConfig, False, None)) class NewUserConfig(VapiStruct): """ ``User.NewUserConfig`` class Structure that defines a new user configuration. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, username=None, role=None, password=None, fullname=None, email=None, ): """ :type username: :class:`str` :param username: User login name :type role: :class:`User.UserRole` or ``None`` :param role: User roles. The default role is operator. role Default role is operator :type password: :class:`str` :param password: User login password In Interactive mode, provide --password as part of the command, and enter the value on the prompt. When accessed remotely, provide --password value as part the command. :type fullname: :class:`str` or ``None`` :param fullname: User full name fullname Optional full name for a person :type email: :class:`str` or ``None`` :param email: Email address of the local account. email Optional email """ self.username = username self.role = role self.password = password self.fullname = fullname self.email = email VapiStruct.__init__(self) NewUserConfig._set_binding_type( type.StructType( 'com.vmware.appliance.techpreview.localaccounts.user.new_user_config', { 'username': type.StringType(), 'role': type.OptionalType( type.ReferenceType(sys.modules[__name__], 'User.UserRole')), 'password': type.SecretType(), 'fullname': type.OptionalType(type.StringType()), 'email': type.OptionalType(type.StringType()), }, NewUserConfig, False, None)) def delete( self, username, ): """ Delete a local user account. :type username: :class:`str` :param username: User login name. :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('delete', { 'username': username, }) def add( self, config, ): """ Create a new local user account. :type config: :class:`User.NewUserConfig` :param config: User configuration. :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('add', { 'config': config, }) def set( self, config, ): """ Update local user account properties role, full name, enabled status and password :type config: :class:`User.UserConfig` :param config: User configuration. :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('set', { 'config': config, }) def list(self): """ List of local accounts :rtype: :class:`list` of :class:`User.UserConfigGet` :return: User configuration. :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('list', None) def get( self, username, ): """ Get the local user account information. :type username: :class:`str` :param username: User login name. :rtype: :class:`User.UserConfigGet` :return: local user account information :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('get', { 'username': username, })
def __init__(self, config): # properties for create operation create_input_type = type.StructType('operation-input', {}) create_error_dict = { 'com.vmware.vapi.std.errors.unauthenticated': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'), 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), } create_input_value_validator_list = [] create_output_validator_list = [] create_rest_metadata = None # properties for delete operation delete_input_type = type.StructType('operation-input', {}) delete_error_dict = { 'com.vmware.vapi.std.errors.unauthenticated': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'), 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), } delete_input_value_validator_list = [] delete_output_validator_list = [] delete_rest_metadata = None # properties for get operation get_input_type = type.StructType('operation-input', {}) get_error_dict = { 'com.vmware.vapi.std.errors.unauthenticated': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'), 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), } get_input_value_validator_list = [] get_output_validator_list = [] get_rest_metadata = None operations = { 'create': { 'input_type': create_input_type, 'output_type': type.SecretType(), 'errors': create_error_dict, 'input_value_validator_list': create_input_value_validator_list, 'output_validator_list': create_output_validator_list, 'task_type': TaskType.NONE, }, 'delete': { 'input_type': delete_input_type, 'output_type': type.VoidType(), 'errors': delete_error_dict, 'input_value_validator_list': delete_input_value_validator_list, 'output_validator_list': delete_output_validator_list, 'task_type': TaskType.NONE, }, 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType(__name__, 'Session.Info'), 'errors': get_error_dict, 'input_value_validator_list': get_input_value_validator_list, 'output_validator_list': get_output_validator_list, 'task_type': TaskType.NONE, }, } rest_metadata = { 'create': create_rest_metadata, 'delete': delete_rest_metadata, 'get': get_rest_metadata, } ApiInterfaceStub.__init__(self, iface_name='com.vmware.cis.session', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=True)
class Links(VapiInterface): """ The ``Links`` class provides methods to create, delete, get information, and list hybrid links between the local and foreign Platform Service Controller (PSC). **Warning:** This class is available as technical preview. It may be changed in a future release. """ _VAPI_SERVICE_ID = 'com.vmware.vcenter.hvc.links' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _LinksStub) class Summary(VapiStruct): """ The ``Links.Summary`` class contains information about the hybrid link. **Warning:** This class is available as technical preview. It may be changed in a future release. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, link=None, display_name=None, ): """ :type link: :class:`str` :param link: Unique identifier for the link. **Warning:** This attribute is available as technical preview. It may be changed in a future release. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``com.vmware.vcenter.hvc.Links``. 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.hvc.Links``. :type display_name: :class:`str` :param display_name: The display name is set to the domain name which was set during create. **Warning:** This attribute is available as technical preview. It may be changed in a future release. """ self.link = link self.display_name = display_name VapiStruct.__init__(self) Summary._set_binding_type( type.StructType( 'com.vmware.vcenter.hvc.links.summary', { 'link': type.IdType(resource_types='com.vmware.vcenter.hvc.Links'), 'display_name': type.StringType(), }, Summary, False, None)) class CreateSpec(VapiStruct): """ The ``Links.CreateSpec`` class is the specification used for the hybrid link creation. **Warning:** This class is available as technical preview. It may be changed in a future release. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, psc_hostname=None, port=None, domain_name=None, username=None, password=None, ssl_thumbprint=None, admin_groups=None, ): """ :type psc_hostname: :class:`str` :param psc_hostname: The PSC hostname for the domain to be linked. **Warning:** This attribute is available as technical preview. It may be changed in a future release. :type port: :class:`str` or ``None`` :param port: The HTTPS port of the PSC to be linked. **Warning:** This attribute is available as technical preview. It may be changed in a future release. If None 443 will be used as default. :type domain_name: :class:`str` :param domain_name: The domain to which the PSC belongs. **Warning:** This attribute is available as technical preview. It may be changed in a future release. :type username: :class:`str` :param username: The administrator username of the PSC. **Warning:** This attribute is available as technical preview. It may be changed in a future release. :type password: :class:`str` :param password: The administrator password of the PSC. **Warning:** This attribute is available as technical preview. It may be changed in a future release. :type ssl_thumbprint: :class:`str` or ``None`` :param ssl_thumbprint: The ssl thumbprint of the server. **Warning:** This attribute is available as technical preview. It may be changed in a future release. if None no thumbprint is passed. :type admin_groups: :class:`set` of :class:`str` or ``None`` :param admin_groups: List of groups to be added to enable administrator access to. **Warning:** This attribute is available as technical preview. It may be changed in a future release. if None administrator access will not be set. """ self.psc_hostname = psc_hostname self.port = port self.domain_name = domain_name self.username = username self.password = password self.ssl_thumbprint = ssl_thumbprint self.admin_groups = admin_groups VapiStruct.__init__(self) CreateSpec._set_binding_type( type.StructType( 'com.vmware.vcenter.hvc.links.create_spec', { 'psc_hostname': type.StringType(), 'port': type.OptionalType(type.StringType()), 'domain_name': type.StringType(), 'username': type.StringType(), 'password': type.SecretType(), 'ssl_thumbprint': type.OptionalType(type.StringType()), 'admin_groups': type.OptionalType( type.SetType(type.StringType())), }, CreateSpec, False, None)) class CertificateInfo(VapiStruct): """ The ``Links.CertificateInfo`` class contains information about the SSL certificate for a destination PSC endpoint. **Warning:** This class is available as technical preview. It may be changed in a future release. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, ssl_thumbprint=None, ): """ :type ssl_thumbprint: :class:`str` :param ssl_thumbprint: The SHA-256 thumbprint of the SSL certificate for the destination PSC endpoint. **Warning:** This attribute is available as technical preview. It may be changed in a future release. """ self.ssl_thumbprint = ssl_thumbprint VapiStruct.__init__(self) CertificateInfo._set_binding_type( type.StructType('com.vmware.vcenter.hvc.links.certificate_info', { 'ssl_thumbprint': type.StringType(), }, CertificateInfo, False, None)) class Credentials(VapiStruct): """ The ``Links.Credentials`` class specifies user credentials to make a successful connection to remote endpoint. **Warning:** This class is available as technical preview. It may be changed in a future release. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, user_name=None, password=None, ): """ :type user_name: :class:`str` :param user_name: Name of the user to authenticate. **Warning:** This attribute is available as technical preview. It may be changed in a future release. :type password: :class:`str` :param password: Password for the user. **Warning:** This attribute is available as technical preview. It may be changed in a future release. """ self.user_name = user_name self.password = password VapiStruct.__init__(self) Credentials._set_binding_type( type.StructType('com.vmware.vcenter.hvc.links.credentials', { 'user_name': type.StringType(), 'password': type.SecretType(), }, Credentials, False, None)) def create( self, spec, ): """ Creates a new hybrid link between the local and foreign PSC. **Warning:** This method is available as technical preview. It may be changed in a future release. :type spec: :class:`Links.CreateSpec` :param spec: Specification for the new link to be created. :rtype: :class:`str` :return: The identifier of the newly linked domain. The return value will be an identifier for the resource type: ``com.vmware.vcenter.hvc.Links``. :raise: :class:`com.vmware.vapi.std.errors_client.AlreadyExists` If the link already exists. :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` If the values of any of the attributes of the ``spec`` parameter are not valid. :raise: :class:`com.vmware.vapi.std.errors_client.Unsupported` If the PSC or the VC version is not supported. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` If the user is not authorized. :raise: :class:`com.vmware.vapi.std.errors_client.UnverifiedPeer` If the SSL certificate of the foreign PSC cannot be validated by comparing with the thumbprint provided in :attr:`Links.CreateSpec.ssl_thumbprint` or if :attr:`Links.CreateSpec.ssl_thumbprint` is None. The value of the {\\\\@link UnverifiedPeer#data) attribute will be a class that contains all the attributes defined in :class:`Links.CertificateInfo`. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if the system reports an error while responding to the request. """ return self._invoke('create', { 'spec': spec, }) def delete( self, link, ): """ Deletes an existing hybrid link. **Warning:** This method is available as technical preview. It may be changed in a future release. :type link: :class:`str` :param link: Identifier of the hybrid link. The parameter must be an identifier for the resource type: ``com.vmware.vcenter.hvc.Links``. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` If the hybrid link associated with ``link`` does not exist. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` If the user is not authorized. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if the system reports an error while responding to the request. """ return self._invoke('delete', { 'link': link, }) def list(self): """ Enumerates the list of registered hybrid links. **Warning:** This method is available as technical preview. It may be changed in a future release. :rtype: :class:`list` of :class:`Links.Summary` :return: The :class:`list` of hybrid link information. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if the system reports an error while responding to the request. """ return self._invoke('list', None)
VapiStruct.__init__(self) ApplianceDeployment._set_binding_type( type.StructType( 'com.vmware.vcenter.lcm.common.appliance_deployment', { 'name': type.StringType(), 'size': type.OptionalType(type.ReferenceType(__name__, 'ApplianceSize')), 'thin_disk_mode': type.BooleanType(), 'disk_size': type.OptionalType(type.ReferenceType(__name__, 'StorageSize')), 'root_password': type.SecretType(), 'ova_info': type.OptionalType(type.ReferenceType(__name__, 'OvaInfo')), 'ceip_enabled': type.OptionalType(type.BooleanType()), }, ApplianceDeployment, False, None)) class Connection(VapiStruct): """ The ``Connection`` class contains information for deployment location .. tip:: The arguments are used to initialize data attributes with the same names. """
def __init__(self, config): # properties for create operation create_input_type = type.StructType('operation-input', {}) create_error_dict = { 'com.vmware.vapi.std.errors.unauthenticated': type.ReferenceType(com.vmware.vapi.std.errors_client, 'Unauthenticated'), 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType(com.vmware.vapi.std.errors_client, 'ServiceUnavailable'), } create_input_validator_list = [] create_output_validator_list = [] # properties for delete operation delete_input_type = type.StructType('operation-input', {}) delete_error_dict = { 'com.vmware.vapi.std.errors.unauthenticated': type.ReferenceType(com.vmware.vapi.std.errors_client, 'Unauthenticated'), 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType(com.vmware.vapi.std.errors_client, 'ServiceUnavailable'), } delete_input_validator_list = [] delete_output_validator_list = [] # properties for get operation get_input_type = type.StructType('operation-input', {}) get_error_dict = { 'com.vmware.vapi.std.errors.unauthenticated': type.ReferenceType(com.vmware.vapi.std.errors_client, 'Unauthenticated'), 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType(com.vmware.vapi.std.errors_client, 'ServiceUnavailable'), } get_input_validator_list = [] get_output_validator_list = [] operations = { 'create': { 'input_type': create_input_type, 'output_type': type.SecretType(), 'errors': create_error_dict, 'input_validator_list': create_input_validator_list, 'output_validator_list': create_output_validator_list, }, 'delete': { 'input_type': delete_input_type, 'output_type': type.VoidType(), 'errors': delete_error_dict, 'input_validator_list': delete_input_validator_list, 'output_validator_list': delete_output_validator_list, }, 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType(sys.modules[__name__], 'Session.Info'), 'errors': get_error_dict, 'input_validator_list': get_input_validator_list, 'output_validator_list': get_output_validator_list, }, } ApiInterfaceStub.__init__(self, iface_name='com.vmware.cis.session', config=config, operations=operations)
class Reports(VapiInterface): """ This class provides methods to download information generated from the hardware compatibility feature residing on the vCenter Appliance. """ _VAPI_SERVICE_ID = 'com.vmware.esx.hcl.reports' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _ReportsStub) self._VAPI_OPERATION_IDS = {} class Token(VapiStruct): """ The ``Reports.Token`` class contains information about the token required to be passed in the HTTP header in the HTTP GET request to generate the report. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, token=None, expiry=None, ): """ :type token: :class:`str` :param token: A one-time, short-lived token required in the HTTP header of the request to the url. This token needs to be passed in as a header with the name "session-id". :type expiry: :class:`datetime.datetime` :param expiry: Expiry time of the token """ self.token = token self.expiry = expiry VapiStruct.__init__(self) Token._set_binding_type( type.StructType('com.vmware.esx.hcl.reports.token', { 'token': type.SecretType(), 'expiry': type.DateTimeType(), }, Token, False, None)) class Location(VapiStruct): """ The ``Reports.Location`` class contains the URI location to download generated compatibility report, as well as a token required (as a header on the HTTP GET request) to get the report. The validity of the token is 5 minutes. After the token expires, any attempt to call the URI with said token will fail. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, url=None, report_token=None, ): """ :type url: :class:`str` :param url: Compatibility report download URL. :type report_token: :class:`Reports.Token` :param report_token: Information about the token required in the HTTP GET request to download the compatibility report. """ self.url = url self.report_token = report_token VapiStruct.__init__(self) Location._set_binding_type( type.StructType( 'com.vmware.esx.hcl.reports.location', { 'url': type.URIType(), 'report_token': type.ReferenceType(__name__, 'Reports.Token'), }, Location, False, None)) def get( self, report, ): """ Returns the location :class:`Reports.Location` information for downloading a compatibility report. :type report: :class:`str` :param report: identifier of hardware compatiblity report to be downloaded. The parameter must be an identifier for the resource type: ``com.vmware.esx.hcl.resources.CompatibilityReport``. :rtype: :class:`Reports.Location` :return: ``Reports.Location`` class which includes the URI to file, short lived token and expiry of the token in the :class:`Reports.Location` object. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` if there is no report for the given id. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the caller is not authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible` if the vCenter this API is executed on is not part of the Customer Experience Improvement Program (CEIP). :raise: :class:`com.vmware.vapi.std.errors_client.Error` If there is some unknown error. The accompanying error message will give more details about the failure. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if you do not have all of the privileges described as follows: * Method execution requires ``VcIntegrity.HardwareCompatibility.Read``. """ return self._invoke('get', { 'report': report, })
class Job(VapiInterface): """ The ``Job`` class provides methods to create and get the status of reconciliation job. This class was added in vSphere API 6.7 """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _JobStub) class Status(Enum): """ The ``Job.Status`` class defines the status values that can be reported for an operation. This enumeration was added in vSphere API 6.7 .. 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 :ref:`enumerated type description page <enumeration_description>`. """ NONE = None """ The operation is not running. This class attribute was added in vSphere API 6.7 """ RUNNING = None """ The operation is in progress. This class attribute was added in vSphere API 6.7 """ SUCCEEDED = None """ The operation completed successfully. This class attribute was added in vSphere API 6.7 """ FAILED = None """ The operation failed. This class attribute was added in vSphere API 6.7 """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`Status` instance. """ Enum.__init__(string) Status._set_values([ Status('NONE'), Status('RUNNING'), Status('SUCCEEDED'), Status('FAILED'), ]) Status._set_binding_type( type.EnumType( 'com.vmware.appliance.recovery.reconciliation.job.status', Status)) class CreateSpec(VapiStruct): """ The ``Job.CreateSpec`` class has the fields to request the start of reconciliation job. This class was added in vSphere API 6.7 .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, sso_admin_user_name=None, sso_admin_user_password=None, ignore_warnings=None, ): """ :type sso_admin_user_name: :class:`str` or ``None`` :param sso_admin_user_name: Administrators username for SSO. This attribute was added in vSphere API 6.7 If None SSO authentication will not be used. If the vCenter Server is a management node or an embedded node, authentication is required. :type sso_admin_user_password: :class:`str` or ``None`` :param sso_admin_user_password: Password for SSO admin user. This attribute was added in vSphere API 6.7 If None SSO authentication will not be used. If the vCenter Server is a management node or an embedded node, authentication is required. :type ignore_warnings: :class:`bool` or ``None`` :param ignore_warnings: Flag indicating whether warnings should be ignored during reconciliation. This attribute was added in vSphere API 6.7 If None, validation warnings will fail the reconciliation operation. """ self.sso_admin_user_name = sso_admin_user_name self.sso_admin_user_password = sso_admin_user_password self.ignore_warnings = ignore_warnings VapiStruct.__init__(self) CreateSpec._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.reconciliation.job.create_spec', { 'sso_admin_user_name': type.OptionalType(type.StringType()), 'sso_admin_user_password': type.OptionalType( type.SecretType()), 'ignore_warnings': type.OptionalType(type.BooleanType()), }, CreateSpec, False, None)) class Info(VapiStruct): """ The ``Job.Info`` class represents the reconciliation job information. It contains information related to current Status, any associated messages and progress as percentage. This class was added in vSphere API 6.7 .. tip:: The arguments are used to initialize data attributes with the same names. """ _validator_list = [ UnionValidator( 'status', { 'FAILED': [('error', False), ('start_time', True), ('end_time', True)], 'RUNNING': [('start_time', True)], 'SUCCEEDED': [('start_time', True), ('end_time', True)], 'NONE': [], }), ] def __init__( self, description=None, service=None, operation=None, parent=None, target=None, status=None, cancelable=None, error=None, start_time=None, end_time=None, messages=None, progress=None, ): """ :type description: :class:`com.vmware.vapi.std_client.LocalizableMessage` :param description: Description of the operation associated with the task. This attribute was added in vSphere API 6.7 :type service: :class:`str` :param service: Name of the service containing the operation. This attribute was added in vSphere API 6.7 When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``com.vmware.appliance.recovery.reconciliation.job``. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ``com.vmware.appliance.recovery.reconciliation.job``. :type operation: :class:`str` :param operation: Name of the operation associated with the task. This attribute was added in vSphere API 6.7 :type parent: :class:`str` or ``None`` :param parent: Parent of the current task. This attribute was added in vSphere API 6.7 When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``com.vmware.appliance.recovery.reconciliation.job``. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ``com.vmware.appliance.recovery.reconciliation.job``. This attribute will be None if the task has no parent. :type target: :class:`com.vmware.vapi.std_client.DynamicID` or ``None`` :param target: Identifier of the target resource the operation modifies. This attribute was added in vSphere API 6.7 This attribute will be None if the task has multiple targets or no target. :type status: :class:`Job.Status` :param status: Status of the operation associated with the task. This attribute was added in vSphere API 6.7 :type cancelable: :class:`bool` or ``None`` :param cancelable: Flag to indicate whether or not the operation can be cancelled. The value may change as the operation progresses. This attribute was added in vSphere API 6.7 If None, the operation cannot be canceled. :type error: :class:`Exception` or ``None`` :param error: Description of the error if the operation status is "FAILED". This attribute was added in vSphere API 6.7 If None the description of why the operation failed will be included in the result of the operation (see null). :type start_time: :class:`datetime.datetime` :param start_time: Time when the operation is started. This attribute was added in vSphere API 6.7 This attribute is optional and it is only relevant when the value of ``status`` is one of :attr:`Job.Status.RUNNING`, :attr:`Job.Status.SUCCEEDED`, or :attr:`Job.Status.FAILED`. :type end_time: :class:`datetime.datetime` :param end_time: Time when the operation is completed. This attribute was added in vSphere API 6.7 This attribute is optional and it is only relevant when the value of ``status`` is one of :attr:`Job.Status.SUCCEEDED` or :attr:`Job.Status.FAILED`. :type messages: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage` :param messages: A list of localized messages. This attribute was added in vSphere API 6.7 :type progress: :class:`long` :param progress: The progress of the job as a percentage. This attribute was added in vSphere API 6.7 """ self.description = description self.service = service self.operation = operation self.parent = parent self.target = target self.status = status self.cancelable = cancelable self.error = error self.start_time = start_time self.end_time = end_time self.messages = messages self.progress = progress VapiStruct.__init__(self) Info._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.reconciliation.job.info', { 'description': type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage'), 'service': type.IdType( resource_types= 'com.vmware.appliance.recovery.reconciliation.job'), 'operation': type.StringType(), 'parent': type.OptionalType(type.IdType()), 'target': type.OptionalType( type.ReferenceType('com.vmware.vapi.std_client', 'DynamicID')), 'status': type.ReferenceType(__name__, 'Job.Status'), 'cancelable': type.OptionalType(type.BooleanType()), 'error': type.OptionalType(type.AnyErrorType()), 'start_time': type.OptionalType(type.DateTimeType()), 'end_time': type.OptionalType(type.DateTimeType()), 'messages': type.ListType( type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage')), 'progress': type.IntegerType(), }, Info, False, None)) def create( self, spec, ): """ Initiate reconciliation. This method was added in vSphere API 6.7 :type spec: :class:`Job.CreateSpec` :param spec: CreateSpec Structure :rtype: :class:`Job.Info` :return: Info Structure :raise: :class:`com.vmware.vapi.std.errors_client.FeatureInUse` A backup or restore is already in progress. :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` Reconciliation is allowed only after restore has finished successfully. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if any error occurs during the execution of the operation. """ return self._invoke('create', { 'spec': spec, }) def get(self): """ Get reconciliation job progress/result. This method was added in vSphere API 6.7 :rtype: :class:`Job.Info` :return: Info Structure :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` if there is no running reconciliation job. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if any error occurs during the execution of the operation. """ return self._invoke('get', None)
class ClientCertificate(VapiInterface): """ The ``ClientCertificate`` interface provides methods to add and retrieve client certificate. This class was added in vSphere API 7.0.0.0. """ _VAPI_SERVICE_ID = 'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.providers.client_certificate' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _ClientCertificateStub) self._VAPI_OPERATION_IDS = {} self._VAPI_OPERATION_IDS.update({'create_task': 'create$task'}) self._VAPI_OPERATION_IDS.update({'get_task': 'get$task'}) self._VAPI_OPERATION_IDS.update({'update_task': 'update$task'}) class Info(VapiStruct): """ The ``ClientCertificate.Info`` class contains the client certificate used by the hosts in a cluster for authenticating with the Provider. This class was added in vSphere API 7.0.0.0. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, certificate=None, ): """ :type certificate: :class:`str` :param certificate: Public certificate. This attribute was added in vSphere API 7.0.0.0. """ self.certificate = certificate VapiStruct.__init__(self) Info._set_binding_type( type.StructType( 'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.providers.client_certificate.info', { 'certificate': type.StringType(), }, Info, False, None)) class UpdateSpec(VapiStruct): """ The ``ClientCertificate.UpdateSpec`` class contains attributes that describe the client certificate update for a Key Provider. This class was added in vSphere API 7.0.0.0. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, certificate=None, private_key=None, ): """ :type certificate: :class:`str` :param certificate: Public certificate used by every host in the cluster. This attribute was added in vSphere API 7.0.0.0. :type private_key: :class:`str` or ``None`` :param private_key: Private part of the certificate. This attribute was added in vSphere API 7.0.0.0. If None, the update request is for a public/private client certificate pair, not for a signed CSR. """ self.certificate = certificate self.private_key = private_key VapiStruct.__init__(self) UpdateSpec._set_binding_type( type.StructType( 'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.providers.client_certificate.update_spec', { 'certificate': type.StringType(), 'private_key': type.OptionalType(type.SecretType()), }, UpdateSpec, False, None)) def create_task( self, cluster, provider, ): """ Generate a new self signed client certificate. Existing client certificate is overwritten. The key server will use this certificate to validate the client connection. This method was added in vSphere API 7.0.0.0. :type cluster: :class:`str` :param cluster: Identifier of the cluster. The parameter must be an identifier for the resource type: ``ClusterComputeResource``. :type provider: :class:`str` :param provider: Identifier of the provider. The parameter must be an identifier for the resource type: ``com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.Provider``. :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` If cluster or provider id are empty. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` If the cluster or provider is not found. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` If the caller is not authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Error` If any other error occurs. """ task_id = self._invoke('create$task', { 'cluster': cluster, 'provider': provider, }) task_svc = Tasks(self._config) task_instance = Task(task_id, task_svc, type.VoidType()) return task_instance def get_task( self, cluster, provider, ): """ Return the existing client certificate. This method was added in vSphere API 7.0.0.0. :type cluster: :class:`str` :param cluster: Identifier of the cluster. The parameter must be an identifier for the resource type: ``ClusterComputeResource``. :type provider: :class:`str` :param provider: Identifier of the provider. The parameter must be an identifier for the resource type: ``com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.Provider``. :rtype: :class: `vmware.vapi.stdlib.client.task.Task` :return: Task instance :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` If cluster or provider id are empty. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` If the cluster or provider is not found. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` If the caller is not authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Error` If any other error occurs. """ task_id = self._invoke('get$task', { 'cluster': cluster, 'provider': provider, }) task_svc = Tasks(self._config) task_instance = Task( task_id, task_svc, type.ReferenceType(__name__, 'ClientCertificate.Info')) return task_instance def update_task( self, cluster, provider, spec, ): """ Update the client certificate. The key server will use this certificate to validate the client connection. If a client certificate already exists, it will be replaced. An optional private key can be specified if the certificate has already been provisioned.. This method was added in vSphere API 7.0.0.0. :type cluster: :class:`str` :param cluster: Identifier of the cluster. The parameter must be an identifier for the resource type: ``ClusterComputeResource``. :type provider: :class:`str` :param provider: Identifier of the provider. The parameter must be an identifier for the resource type: ``com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.Provider``. :type spec: :class:`ClientCertificate.UpdateSpec` :param spec: The update spec. :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` If the certificate or private key is invalid or cluster/provider id are empty. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` If the cluster or provider is not found. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` If the caller is not authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Error` If any other error occurs. """ task_id = self._invoke('update$task', { 'cluster': cluster, 'provider': provider, 'spec': spec, }) task_svc = Tasks(self._config) task_instance = Task(task_id, task_svc, type.VoidType()) return task_instance
class Backup(VapiInterface): """ ``Backup`` class provides methods Performs backup restore operations """ _VAPI_SERVICE_ID = 'com.vmware.appliance.recovery.backup' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _BackupStub) class ReturnStatus(Enum): """ ``Backup.ReturnStatus`` class Defines the state of precheck .. 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 :ref:`enumerated type description page <enumeration_description>`. """ FAIL = None """ Check failed """ WARNING = None """ Passed with warnings """ OK = None """ Check passed """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`ReturnStatus` instance. """ Enum.__init__(string) ReturnStatus._set_values([ ReturnStatus('FAIL'), ReturnStatus('WARNING'), ReturnStatus('OK'), ]) ReturnStatus._set_binding_type( type.EnumType('com.vmware.appliance.recovery.backup.return_status', ReturnStatus)) class LocationType(Enum): """ ``Backup.LocationType`` class Defines type of all locations for backup/restore .. 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 :ref:`enumerated type description page <enumeration_description>`. """ FTP = None """ Destination is FTP server """ HTTP = None """ Destination is HTTP server """ FTPS = None """ Destination is FTPS server """ HTTPS = None """ Destination is HTTPS server """ SCP = None """ Destination is SSH server """ SFTP = None """ Destination is SFTP server """ NFS = None """ Destination is NFS server. This class attribute was added in vSphere API 6.7.2. """ SMB = None """ Destination is SMB server. This class attribute was added in vSphere API 6.7.2. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`LocationType` instance. """ Enum.__init__(string) LocationType._set_values([ LocationType('FTP'), LocationType('HTTP'), LocationType('FTPS'), LocationType('HTTPS'), LocationType('SCP'), LocationType('SFTP'), LocationType('NFS'), LocationType('SMB'), ]) LocationType._set_binding_type( type.EnumType('com.vmware.appliance.recovery.backup.location_type', LocationType)) class LocalizableMessage(VapiStruct): """ ``Backup.LocalizableMessage`` class Structure representing message .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, id=None, default_message=None, args=None, ): """ :type id: :class:`str` :param id: id in message bundle :type default_message: :class:`str` :param default_message: text in english :type args: :class:`list` of :class:`str` :param args: nested data """ self.id = id self.default_message = default_message self.args = args VapiStruct.__init__(self) LocalizableMessage._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.backup.localizable_message', { 'id': type.StringType(), 'default_message': type.StringType(), 'args': type.ListType(type.StringType()), }, LocalizableMessage, False, None)) class ReturnResult(VapiStruct): """ ``Backup.ReturnResult`` class Structure representing precheck result .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, status=None, messages=None, ): """ :type status: :class:`Backup.ReturnStatus` :param status: Check status :type messages: :class:`list` of :class:`Backup.LocalizableMessage` :param messages: List of messages """ self.status = status self.messages = messages VapiStruct.__init__(self) ReturnResult._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.backup.return_result', { 'status': type.ReferenceType(__name__, 'Backup.ReturnStatus'), 'messages': type.ListType( type.ReferenceType(__name__, 'Backup.LocalizableMessage')), }, ReturnResult, False, None)) class BackupRequest(VapiStruct): """ ``Backup.BackupRequest`` class Structure representing requested backup piece .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, parts=None, backup_password=None, location_type=None, location=None, location_user=None, location_password=None, comment=None, ): """ :type parts: :class:`list` of :class:`str` :param parts: a list of optional parts. Run backup parts APIs to get list of optional parts and description :type backup_password: :class:`str` or ``None`` :param backup_password: a password for a backup piece The backupPassword must adhere to the following password requirements: At least 8 characters, cannot be more than 20 characters in length. At least 1 uppercase letter. At least 1 lowercase letter. At least 1 numeric digit. At least 1 special character (i.e. any character not in [0-9,a-z,A-Z]). Only visible ASCII characters (for example, no space). backupPassword If no password then the piece will not be encrypted :type location_type: :class:`Backup.LocationType` :param location_type: a type of location :type location: :class:`str` :param location: path or url :type location_user: :class:`str` or ``None`` :param location_user: username for location locationUser User name for this location if login is required. :type location_password: :class:`str` or ``None`` :param location_password: password for location locationPassword Password for the specified user if login is required at this location. :type comment: :class:`str` or ``None`` :param comment: Custom comment comment an optional comment """ self.parts = parts self.backup_password = backup_password self.location_type = location_type self.location = location self.location_user = location_user self.location_password = location_password self.comment = comment VapiStruct.__init__(self) BackupRequest._set_binding_type( type.StructType( 'com.vmware.appliance.recovery.backup.backup_request', { 'parts': type.ListType(type.StringType()), 'backup_password': type.OptionalType(type.SecretType()), 'location_type': type.ReferenceType(__name__, 'Backup.LocationType'), 'location': type.StringType(), 'location_user': type.OptionalType(type.StringType()), 'location_password': type.OptionalType(type.SecretType()), 'comment': type.OptionalType(type.StringType()), }, BackupRequest, False, None)) def validate( self, piece, ): """ Check for backup errors without starting backup. :type piece: :class:`Backup.BackupRequest` :param piece: BackupRequest Structure :rtype: :class:`Backup.ReturnResult` :return: ReturnResult Structure :raise: :class:`com.vmware.vapi.std.errors_client.FeatureInUse` A backup or restore is already in progress :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('validate', { 'piece': piece, })
def __init__(self, config): # properties for create operation create_input_type = type.StructType('operation-input', {}) create_error_dict = { 'com.vmware.vapi.std.errors.unauthenticated': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'), 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), } create_input_value_validator_list = [] create_output_validator_list = [] create_rest_metadata = OperationRestMetadata( http_method='POST', url_template='/session', path_variables={}, query_parameters={}, dispatch_parameters={}, header_parameters={}, dispatch_header_parameters={}) # properties for delete operation delete_input_type = type.StructType('operation-input', {}) delete_error_dict = { 'com.vmware.vapi.std.errors.unauthenticated': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'), 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), } delete_input_value_validator_list = [] delete_output_validator_list = [] delete_rest_metadata = OperationRestMetadata( http_method='DELETE', url_template='/session', path_variables={}, query_parameters={}, dispatch_parameters={}, header_parameters={}, dispatch_header_parameters={}) # properties for get operation get_input_type = type.StructType('operation-input', {}) get_error_dict = { 'com.vmware.vapi.std.errors.unauthenticated': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'), 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), } get_input_value_validator_list = [] get_output_validator_list = [] get_rest_metadata = OperationRestMetadata( http_method='GET', url_template='/session', path_variables={}, query_parameters={}, dispatch_parameters={}, header_parameters={}, dispatch_header_parameters={}) operations = { 'create': { 'input_type': create_input_type, 'output_type': type.SecretType(), 'errors': create_error_dict, 'input_value_validator_list': create_input_value_validator_list, 'output_validator_list': create_output_validator_list, 'task_type': TaskType.NONE, }, 'delete': { 'input_type': delete_input_type, 'output_type': type.VoidType(), 'errors': delete_error_dict, 'input_value_validator_list': delete_input_value_validator_list, 'output_validator_list': delete_output_validator_list, 'task_type': TaskType.NONE, }, 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType(__name__, 'Session.Info'), 'errors': get_error_dict, 'input_value_validator_list': get_input_value_validator_list, 'output_validator_list': get_output_validator_list, 'task_type': TaskType.NONE, }, } rest_metadata = { 'create': create_rest_metadata, 'delete': delete_rest_metadata, 'get': get_rest_metadata, } ApiInterfaceStub.__init__(self, iface_name='com.vmware.cis.session', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=True)