Esempio n. 1
0
    def __init__(self, config):
        # properties for lastcheck operation
        lastcheck_input_type = type.StructType('operation-input', {})
        lastcheck_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        lastcheck_input_value_validator_list = []
        lastcheck_output_validator_list = []
        lastcheck_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/appliance/health/system/lastcheck',
            path_variables={},
            query_parameters={})

        # properties for get operation
        get_input_type = type.StructType('operation-input', {})
        get_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/appliance/health/system',
            path_variables={},
            query_parameters={})

        operations = {
            'lastcheck': {
                'input_type': lastcheck_input_type,
                'output_type': type.DateTimeType(),
                'errors': lastcheck_error_dict,
                'input_value_validator_list':
                lastcheck_input_value_validator_list,
                'output_validator_list': lastcheck_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType(__name__,
                                                  'System.HealthLevel'),
                '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 = {
            'lastcheck': lastcheck_rest_metadata,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.appliance.health.system',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Esempio n. 2
0
    def __init__(self, config):
        # properties for lastcheck operation
        lastcheck_input_type = type.StructType('operation-input', {})
        lastcheck_error_dict = {
            'com.vmware.vapi.std.errors.error':
                type.ReferenceType(com.vmware.vapi.std.errors_client, 'Error'),

        }
        lastcheck_input_validator_list = [
        ]
        lastcheck_output_validator_list = [
        ]

        # properties for get operation
        get_input_type = type.StructType('operation-input', {})
        get_error_dict = {
            'com.vmware.vapi.std.errors.error':
                type.ReferenceType(com.vmware.vapi.std.errors_client, 'Error'),

        }
        get_input_validator_list = [
        ]
        get_output_validator_list = [
        ]

        operations = {
            'lastcheck': {
                'input_type': lastcheck_input_type,
                'output_type': type.DateTimeType(),
                'errors': lastcheck_error_dict,
                'input_validator_list': lastcheck_input_validator_list,
                'output_validator_list': lastcheck_output_validator_list,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType(sys.modules[__name__], 'System.HealthLevel'),
                '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.appliance.health.system',
                                  config=config,
                                  operations=operations)
Esempio n. 3
0
class Compliance(VapiInterface):
    """
    The Compliance class provides methods that return the compliance status of
    virtual machine entities(virtual machine home directory and virtual disks)
    that specify storage policy requirements. This class was added in vSphere
    API 6.7.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.storage.policy.compliance'
    """
    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, _ComplianceStub)

    class Status(Enum):
        """
        The ``Compliance.Status`` class defines the storage compliance status of a
        virtual machine and its applicable entities. 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>`.
        """
        COMPLIANT = None
        """
        Entity is in compliance. This class attribute was added in vSphere API 6.7.

        """
        NON_COMPLIANT = None
        """
        Entity is out of compliance. This class attribute was added in vSphere API
        6.7.

        """
        UNKNOWN_COMPLIANCE = None
        """
        Compliance status of the entity is not known. This class attribute was
        added in vSphere API 6.7.

        """
        NOT_APPLICABLE = None
        """
        Compliance computation is not applicable for this entity because it does
        not have any storage requirements that apply to the datastore on which it
        is placed. This class attribute was added in vSphere API 6.7.

        """
        OUT_OF_DATE = None
        """
        The Compliance status becomes out-of-date when the profile associated with
        the entity is edited but not applied. The compliance status remains
        out-of-date until the edited policy is applied to the entity. 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('COMPLIANT'),
        Status('NON_COMPLIANT'),
        Status('UNKNOWN_COMPLIANCE'),
        Status('NOT_APPLICABLE'),
        Status('OUT_OF_DATE'),
    ])
    Status._set_binding_type(
        type.EnumType('com.vmware.vcenter.vm.storage.policy.compliance.status',
                      Status))

    class VmComplianceInfo(VapiStruct):
        """
        The ``Compliance.VmComplianceInfo`` class contains information about
        storage policy compliance associated with a virtual machine. 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,
            check_time=None,
            policy=None,
            failure_cause=None,
        ):
            """
            :type  status: :class:`Compliance.Status`
            :param status: Status of the compliance operation. This attribute was added in
                vSphere API 6.7.
            :type  check_time: :class:`datetime.datetime`
            :param check_time: Date and time of the most recent compliance check. This attribute
                was added in vSphere API 6.7.
            :type  policy: :class:`str` or ``None``
            :param policy: Identifier of the storage policy associated with the virtual
                machine. 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.vcenter.StoragePolicy``. 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.StoragePolicy``.
                If None SPBM is unable to retrieve or determine the associated
                policy, :attr:`Compliance.VmComplianceInfo.failure_cause` is set in
                such casses.
            :type  failure_cause: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param failure_cause: The exception that caused the compliance check to fail. There can
                be more than one cause, since a policy can contain capabilities
                from multiple providers. If empty, it implies no failures while
                retrieving compliance. This attribute was added in vSphere API 6.7.
            """
            self.status = status
            self.check_time = check_time
            self.policy = policy
            self.failure_cause = failure_cause
            VapiStruct.__init__(self)

    VmComplianceInfo._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.vm.storage.policy.compliance.vm_compliance_info',
            {
                'status':
                type.ReferenceType(__name__, 'Compliance.Status'),
                'check_time':
                type.DateTimeType(),
                'policy':
                type.OptionalType(type.IdType()),
                'failure_cause':
                type.ListType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
            }, VmComplianceInfo, False, None))

    class Info(VapiStruct):
        """
        The ``Compliance.Info`` class contains information about the storage policy
        compliance of a virtual machine, including information about it's home
        directory and/or it's virtual disks. 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,
            overall_compliance=None,
            vm_home=None,
            disks=None,
        ):
            """
            :type  overall_compliance: :class:`Compliance.Status`
            :param overall_compliance: The overall compliance status of the virtual machine and all it's
                entities. This attribute was added in vSphere API 6.7.
            :type  vm_home: :class:`Compliance.VmComplianceInfo` or ``None``
            :param vm_home: The storage policy compliance information
                :class:`Compliance.VmComplianceInfo` for the virtual machine's home
                directory. This attribute was added in vSphere API 6.7.
                If None the virtual machine home directory has no storage policy
                association.
            :type  disks: :class:`dict` of :class:`str` and :class:`Compliance.VmComplianceInfo`
            :param disks: The compliance information :class:`Compliance.VmComplianceInfo` for
                the virtual machine's virtual disks that are currently associated
                with a storage policy. This attribute was added in vSphere API 6.7.
                When clients pass a value of this class as a parameter, the key in
                the attribute :class:`dict` must be an identifier for the resource
                type: ``com.vmware.vcenter.vm.hardware.Disk``. When methods return
                a value of this class as a return value, the key in the attribute
                :class:`dict` will be an identifier for the resource type:
                ``com.vmware.vcenter.vm.hardware.Disk``.
            """
            self.overall_compliance = overall_compliance
            self.vm_home = vm_home
            self.disks = disks
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.vm.storage.policy.compliance.info', {
                'overall_compliance':
                type.ReferenceType(__name__, 'Compliance.Status'),
                'vm_home':
                type.OptionalType(
                    type.ReferenceType(__name__,
                                       'Compliance.VmComplianceInfo')),
                'disks':
                type.MapType(
                    type.IdType(),
                    type.ReferenceType(__name__,
                                       'Compliance.VmComplianceInfo')),
            }, Info, False, None))

    class CheckSpec(VapiStruct):
        """
        The ``Compliance.CheckSpec`` class contains attributes used to specify the
        entities on which the storage policy compliance check is to be invoked.
        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,
            vm_home=None,
            disks=None,
        ):
            """
            :type  vm_home: :class:`bool`
            :param vm_home: Invoke compliance check on the virtual machine home directory if
                set to true. This attribute was added in vSphere API 6.7.
            :type  disks: :class:`set` of :class:`str` or ``None``
            :param disks: Identifiers of the virtual machine's virtual disks for which
                compliance should be checked. This attribute was added in vSphere
                API 6.7.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vcenter.vm.hardware.Disk``. When methods return a
                value of this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.vcenter.vm.hardware.Disk``.
                If None or empty, compliance check is invoked on all the associated
                disks.
            """
            self.vm_home = vm_home
            self.disks = disks
            VapiStruct.__init__(self)

    CheckSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.vm.storage.policy.compliance.check_spec', {
                'vm_home': type.BooleanType(),
                'disks': type.OptionalType(type.SetType(type.IdType())),
            }, CheckSpec, False, None))

    def get(
        self,
        vm,
    ):
        """
        Returns the cached storage policy compliance information of a virtual
        machine. This method was added in vSphere API 6.7.

        :type  vm: :class:`str`
        :param vm: Virtual machine identifier.
            The parameter must be an identifier for the resource type:
            ``VirtualMachine``.
        :rtype: :class:`Compliance.Info` or ``None``
        :return: Virtual machine storage policy compliance Info
            :class:`Compliance.Info`.
            If None, neither the virtual machine home directory nor any of it's
            virtual disks are associated with a storage policy.
        :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.ServiceUnavailable` 
            if the system is unable to communicate with a service to complete
            the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user cannot be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have the required privileges.
        """
        return self._invoke('get', {
            'vm': vm,
        })

    def check(
        self,
        vm,
        check_spec=None,
    ):
        """
        Returns the storage policy Compliance :class:`Compliance.Info` of a
        virtual machine after explicitly re-computing compliance check. This
        method was added in vSphere API 6.7.

        :type  vm: :class:`str`
        :param vm: Virtual machine identifier.
            The parameter must be an identifier for the resource type:
            ``VirtualMachine``.
        :type  check_spec: :class:`Compliance.CheckSpec` or ``None``
        :param check_spec: Parameter specifies the entities on which storage policy compliance
            check is to be invoked. The storage compliance Info
            :class:`Compliance.Info` is returned.
            If None, the behavior is equivalent to a
            :class:`Compliance.CheckSpec` with CheckSpec#vmHome set to true and
            CheckSpec#disks populated with all disks attached to the virtual
            machine.
        :rtype: :class:`Compliance.Info` or ``None``
        :return: Virtual machine storage policy compliance ``Compliance.Info`` class
            .
            If None, neither the virtual machine home directory nor any of it's
            virtual disks are associated with a storage policy.
        :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.ServiceUnavailable` 
            if the system is unable to communicate with a service necessary to
            complete the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user cannot be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have the required privileges.
        """
        return self._invoke('check', {
            'vm': vm,
            'check_spec': check_spec,
        })
Esempio n. 4
0
class CustomizationSpecs(VapiInterface):
    """
    The ``CustomizationSpecs`` class provides methods to manage guest
    customization specifications in the vCenter Server. This class was added in
    vSphere API 6.7.1.
    """
    RESOURCE_TYPE = "com.vmware.vcenter.guest.CustomizationSpec"
    """
    The resource type for a vCenter guest customization specification. This class
    attribute was added in vSphere API 6.7.1.

    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.guest.customization_specs'
    """
    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, _CustomizationSpecsStub)

    class OsType(Enum):
        """
        The ``CustomizationSpecs.OsType`` class defines the types of guest
        operating systems for which guest customization is supported. This
        enumeration was added in vSphere API 6.7.1.

        .. 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>`.
        """
        WINDOWS = None
        """
        A customization specification for a Windows guest operating system. This
        class attribute was added in vSphere API 6.7.1.

        """
        LINUX = None
        """
        A customization specification for a Linux guest operating system. This
        class attribute was added in vSphere API 6.7.1.

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`OsType` instance.
            """
            Enum.__init__(string)

    OsType._set_values([
        OsType('WINDOWS'),
        OsType('LINUX'),
    ])
    OsType._set_binding_type(
        type.EnumType('com.vmware.vcenter.guest.customization_specs.os_type',
                      OsType))

    class FilterSpec(VapiStruct):
        """
        The ``CustomizationSpecs.FilterSpec`` class contains attributes used to
        filter the results when listing guest customization specifications (see
        :func:`CustomizationSpecs.list`). If multiple attributes are specified,
        only guest customization specifications matching all of the attributes
        match the filter. This class was added in vSphere API 6.7.1.

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

        _canonical_to_pep_names = {
            'OS_type': 'os_type',
        }

        def __init__(
            self,
            names=None,
            os_type=None,
        ):
            """
            :type  names: :class:`set` of :class:`str` or ``None``
            :param names: Names that guest customization specifications must have to match
                the filter (see :attr:`CustomizationSpecs.Summary.name`). This
                attribute was added in vSphere API 6.7.1.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vcenter.guest.CustomizationSpec``. When methods return
                a value of this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.vcenter.guest.CustomizationSpec``.
                If None or empty, guest customization specifications with any name
                match the filter.
            :type  os_type: :class:`CustomizationSpecs.OsType` or ``None``
            :param os_type: Guest operating system type that guest customization specifications
                must have to match the filter (see
                :attr:`CustomizationSpecs.Summary.os_type`). This attribute was
                added in vSphere API 6.7.1.
                If None, guest customization specifications with any guest
                operating system type match the filter.
            """
            self.names = names
            self.os_type = os_type
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.guest.customization_specs.filter_spec', {
                'names':
                type.OptionalType(type.SetType(type.IdType())),
                'OS_type':
                type.OptionalType(
                    type.ReferenceType(__name__, 'CustomizationSpecs.OsType')),
            }, FilterSpec, False, None))

    class Summary(VapiStruct):
        """
        The ``CustomizationSpecs.Summary`` class contains commonly used information
        about a guest customization specification. This class was added in vSphere
        API 6.7.1.

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

        _canonical_to_pep_names = {
            'OS_type': 'os_type',
        }

        def __init__(
            self,
            name=None,
            description=None,
            os_type=None,
            last_modified=None,
        ):
            """
            :type  name: :class:`str`
            :param name: Name of the guest customization specification. This attribute was
                added in vSphere API 6.7.1.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.guest.CustomizationSpec``. 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.guest.CustomizationSpec``.
            :type  description: :class:`str`
            :param description: Description of the guest customization specification. This
                attribute was added in vSphere API 6.7.1.
            :type  os_type: :class:`CustomizationSpecs.OsType`
            :param os_type: Guest operating system type for which that this guest customization
                specification applies. This attribute was added in vSphere API
                6.7.1.
            :type  last_modified: :class:`datetime.datetime`
            :param last_modified: Date and tme when this guest customization specification was last
                modified. This attribute was added in vSphere API 6.7.1.
            """
            self.name = name
            self.description = description
            self.os_type = os_type
            self.last_modified = last_modified
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.guest.customization_specs.summary', {
                'name':
                type.IdType(
                    resource_types='com.vmware.vcenter.guest.CustomizationSpec'
                ),
                'description':
                type.StringType(),
                'OS_type':
                type.ReferenceType(__name__, 'CustomizationSpecs.OsType'),
                'last_modified':
                type.DateTimeType(),
            }, Summary, False, None))

    def list(
        self,
        filter=None,
    ):
        """
        Returns information about at most 1000 visible (subject to permission
        checks) guest customization specifications in vCenter matching the
        :class:`CustomizationSpecs.FilterSpec`. This method was added in
        vSphere API 6.7.1.

        :type  filter: :class:`CustomizationSpecs.FilterSpec` or ``None``
        :param filter: Specification of matching guest customization specifications for
            which information should be returned.
            If None, the behavior is equivalent to a
            :class:`CustomizationSpecs.FilterSpec` with all attributes None
            which means all guest customization specifications match the
            filter.
        :rtype: :class:`list` of :class:`CustomizationSpecs.Summary`
        :return: Commonly used information about the guest customization
            specifications matching the :class:`CustomizationSpecs.FilterSpec`.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the :attr:`CustomizationSpecs.FilterSpec.os_type` attribute
            contains a value that is not supported by the server.
        :raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource` 
            if more than 1000 guest customization specifications match the
            :class:`CustomizationSpecs.FilterSpec`.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            if the system is unable to communicate with a service to complete
            the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user doesn't have the required privileges.
        """
        return self._invoke('list', {
            'filter': filter,
        })
Esempio n. 5
0
class Details(VapiInterface):
    """
    The ``Details`` class provides methods to get the details about backup
    jobs. This class was added in vSphere API 6.7.
    """

    _VAPI_SERVICE_ID = 'com.vmware.appliance.recovery.backup.job.details'
    """
    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, _DetailsStub)

    class Type(Enum):
        """
        The ``Details.Type`` class defines the type of backup job. 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>`.
        """
        SCHEDULED = None
        """
        Job type is Scheduled. This class attribute was added in vSphere API 6.7.

        """
        MANUAL = None
        """
        Job type is Manual. 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:`Type` instance.
            """
            Enum.__init__(string)

    Type._set_values([
        Type('SCHEDULED'),
        Type('MANUAL'),
    ])
    Type._set_binding_type(
        type.EnumType('com.vmware.appliance.recovery.backup.job.details.type',
                      Type))

    class Info(VapiStruct):
        """
        The ``Details.Info`` class contains information about a backup job. 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', {
                    'SUCCEEDED': [('duration', True), ('size', True),
                                  ('progress', True), ('start_time', True),
                                  ('end_time', True)],
                    'FAILED': [('duration', True), ('size', True),
                               ('progress', True), ('error', False),
                               ('start_time', True), ('end_time', True)],
                    'RUNNING': [('duration', True), ('size', True),
                                ('progress', True), ('start_time', True)],
                    'BLOCKED': [('start_time', True)],
                    'PENDING': [],
                }),
        ]

        def __init__(
            self,
            location=None,
            duration=None,
            size=None,
            progress=None,
            location_user=None,
            type=None,
            messages=None,
            build=None,
            description=None,
            service=None,
            operation=None,
            parent=None,
            target=None,
            status=None,
            cancelable=None,
            error=None,
            start_time=None,
            end_time=None,
            user=None,
        ):
            """
            :type  location: :class:`str`
            :param location: URL of the backup location. This attribute was added in vSphere API
                6.7.
            :type  duration: :class:`long`
            :param duration: Time in seconds since the backup job was started or the time it
                took to complete the backup job. 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:`com.vmware.cis.task_client.Status.SUCCEEDED`,
                :attr:`com.vmware.cis.task_client.Status.FAILED`, or
                :attr:`com.vmware.cis.task_client.Status.RUNNING`.
            :type  size: :class:`long`
            :param size: Size of the backup data transferred to remote location. 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:`com.vmware.cis.task_client.Status.SUCCEEDED`,
                :attr:`com.vmware.cis.task_client.Status.FAILED`, or
                :attr:`com.vmware.cis.task_client.Status.RUNNING`.
            :type  progress: :class:`com.vmware.cis.task_client.Progress`
            :param progress: Progress of the job. 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:`com.vmware.cis.task_client.Status.SUCCEEDED`,
                :attr:`com.vmware.cis.task_client.Status.FAILED`, or
                :attr:`com.vmware.cis.task_client.Status.RUNNING`.
            :type  location_user: :class:`str`
            :param location_user: The username for the remote backup location. This attribute was
                added in vSphere API 6.7.
            :type  type: :class:`Details.Type`
            :param type: Type of the backup job. Indicates whether the backup was started
                manually or as a scheduled backup. This attribute was added in
                vSphere API 6.7.
            :type  messages: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param messages: List of any info/warning/error messages returned by the backup job.
                This attribute was added in vSphere API 6.7.
            :type  build: :class:`Details.BuildInfo`
            :param build: Information about the build of the appliance. This attribute was
                added in vSphere API 6.7.2.
                This attribute is optional because it was added in a newer version
                than its parent node.
            :type  description: :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param description: Description of the operation associated with the task.
            :type  service: :class:`str`
            :param service: Identifier of the service containing the operation.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vapi.service``. When methods return a value of this
                class as a return value, the attribute will be an identifier for
                the resource type: ``com.vmware.vapi.service``.
            :type  operation: :class:`str`
            :param operation: Identifier of the operation associated with the task.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vapi.operation``. When methods return a value of this
                class as a return value, the attribute will be an identifier for
                the resource type: ``com.vmware.vapi.operation``.
            :type  parent: :class:`str` or ``None``
            :param parent: Parent of the current task.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.cis.task``. When methods return a value of this class
                as a return value, the attribute will be an identifier for the
                resource type: ``com.vmware.cis.task``.
                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 created by the operation or an existing
                one the operation performed on.
                This attribute will be None if the operation has no target or
                multiple targets.
            :type  status: :class:`com.vmware.cis.task_client.Status`
            :param status: Status of the operation associated with the task.
            :type  cancelable: :class:`bool`
            :param cancelable: Flag to indicate whether or not the operation can be cancelled. The
                value may change as the operation progresses.
            :type  error: :class:`Exception` or ``None``
            :param error: Description of the error if the operation status is "FAILED".
                If None the description of why the operation failed will be
                included in the result of the operation (see
                :attr:`com.vmware.cis.task_client.Info.result`).
            :type  start_time: :class:`datetime.datetime`
            :param start_time: Time when the operation is started.
                This attribute is optional and it is only relevant when the value
                of ``status`` is one of
                :attr:`com.vmware.cis.task_client.Status.RUNNING`,
                :attr:`com.vmware.cis.task_client.Status.BLOCKED`,
                :attr:`com.vmware.cis.task_client.Status.SUCCEEDED`, or
                :attr:`com.vmware.cis.task_client.Status.FAILED`.
            :type  end_time: :class:`datetime.datetime`
            :param end_time: Time when the operation is completed.
                This attribute is optional and it is only relevant when the value
                of ``status`` is one of
                :attr:`com.vmware.cis.task_client.Status.SUCCEEDED` or
                :attr:`com.vmware.cis.task_client.Status.FAILED`.
            :type  user: :class:`str` or ``None``
            :param user: Name of the user who performed the operation.
                This attribute will be None if the operation is performed by the
                system.
            """
            self.location = location
            self.duration = duration
            self.size = size
            self.progress = progress
            self.location_user = location_user
            self.type = type
            self.messages = messages
            self.build = build
            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.user = user
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.backup.job.details.info', {
                'location':
                type.URIType(),
                'duration':
                type.OptionalType(type.IntegerType()),
                'size':
                type.OptionalType(type.IntegerType()),
                'progress':
                type.OptionalType(
                    type.ReferenceType('com.vmware.cis.task_client',
                                       'Progress')),
                'location_user':
                type.StringType(),
                'type':
                type.ReferenceType(__name__, 'Details.Type'),
                'messages':
                type.ListType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
                'build':
                type.OptionalType(
                    type.ReferenceType(__name__, 'Details.BuildInfo')),
                'description':
                type.ReferenceType('com.vmware.vapi.std_client',
                                   'LocalizableMessage'),
                'service':
                type.IdType(resource_types='com.vmware.vapi.service'),
                'operation':
                type.IdType(resource_types='com.vmware.vapi.operation'),
                'parent':
                type.OptionalType(type.IdType()),
                'target':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'DynamicID')),
                'status':
                type.ReferenceType('com.vmware.cis.task_client', 'Status'),
                'cancelable':
                type.BooleanType(),
                'error':
                type.OptionalType(type.AnyErrorType()),
                'start_time':
                type.OptionalType(type.DateTimeType()),
                'end_time':
                type.OptionalType(type.DateTimeType()),
                'user':
                type.OptionalType(type.StringType()),
            }, Info, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``Details.FilterSpec`` class contains attributes used to filter the
        results when listing backup jobs details (see :func:`Details.list`). 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,
            jobs=None,
        ):
            """
            :type  jobs: :class:`set` of :class:`str` or ``None``
            :param jobs: Identifiers of backup jobs that can match the filter. This
                attribute was added in vSphere API 6.7.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.appliance.recovery.backup.job``. When methods return a
                value of this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.appliance.recovery.backup.job``.
                If None the filter will match all the backup jobs.
            """
            self.jobs = jobs
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.backup.job.details.filter_spec', {
                'jobs': type.OptionalType(type.SetType(type.IdType())),
            }, FilterSpec, False, None))

    class BuildInfo(VapiStruct):
        """
        The ``Details.BuildInfo`` class contains information about the build of the
        appliance. 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,
            version_name=None,
            version=None,
            build_number=None,
        ):
            """
            :type  version_name: :class:`str`
            :param version_name: Appliance product type, for example 6.8.2 GA. This attribute was
                added in vSphere API 6.7.2.
            :type  version: :class:`str`
            :param version: Appliance version, for example 6.8.2.10000. This attribute was
                added in vSphere API 6.7.2.
            :type  build_number: :class:`str`
            :param build_number: Build Number of the appliance. This attribute was added in vSphere
                API 6.7.2.
            """
            self.version_name = version_name
            self.version = version
            self.build_number = build_number
            VapiStruct.__init__(self)

    BuildInfo._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.backup.job.details.build_info', {
                'version_name': type.StringType(),
                'version': type.StringType(),
                'build_number': type.StringType(),
            }, BuildInfo, False, None))

    def list(
        self,
        filter=None,
    ):
        """
        Returns detailed information about the current and historical backup
        jobs. This method was added in vSphere API 6.7.

        :type  filter: :class:`Details.FilterSpec` or ``None``
        :param filter: Specification of matching backup jobs for which information should
            be returned.
            If None, the behavior is equivalent to :class:`Details.FilterSpec`
            with all attributes None which means all the backup jobs match the
            filter.
        :rtype: :class:`dict` of :class:`str` and :class:`Details.Info`
        :return: Map of backup job identifier to Info Structure.
            The key in the return value :class:`dict` will be an identifier for
            the resource type: ``com.vmware.appliance.recovery.backup.job``.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any error occurs during the execution of the operation.
        """
        return self._invoke('list', {
            'filter': filter,
        })
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,
        })
Esempio n. 7
0
class PrecheckReport(VapiInterface):
    """
    The ``PrecheckReport`` class generates precheck report for a vCenter Server
    instance against a target update version.
    """
    RESOURCE_TYPE = "com.vmware.vcenter.lcm.report"
    """
    Resource type for precheck report

    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.lcm.update.precheck_report'
    """
    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, _PrecheckReportStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update({'create_task': 'create$task'})

    class ReportSummary(VapiStruct):
        """
        The ``Summary`` Class contains the summary of precheck report.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            error_count=None,
            warning_count=None,
        ):
            """
            :type  error_count: :class:`long`
            :param error_count: Number of errors detected by precheck process
            :type  warning_count: :class:`long`
            :param warning_count: Number of warnings detected by precheck process
            """
            self.error_count = error_count
            self.warning_count = warning_count
            VapiStruct.__init__(self)

    ReportSummary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.update.precheck_report.report_summary', {
                'error_count': type.IntegerType(),
                'warning_count': type.IntegerType(),
            }, ReportSummary, False, None))

    class Report(VapiStruct):
        """
        The ``PrecheckReport.Report`` class contains estimates of how long it will
        take an update as well as a list of possible warnings and errors with
        applying the update.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            date_created=None,
            estimated_time_to_update=None,
            issues=None,
            summary=None,
        ):
            """
            :type  date_created: :class:`datetime.datetime`
            :param date_created: Time when this precheck report was generated
            :type  estimated_time_to_update: :class:`long` or ``None``
            :param estimated_time_to_update: Rough estimate of time to update vCenter Server in minutes.
                This attribute will be None if the precheck failed.
            :type  issues: :class:`com.vmware.vcenter.lcm_client.Notifications` or ``None``
            :param issues: Lists of the issues and warnings
                This attribute will be None if the precehck is successful.
            :type  summary: :class:`PrecheckReport.ReportSummary`
            :param summary: A summary of the report consist of count of warnings and errors
                returned by running the precheck.
            """
            self.date_created = date_created
            self.estimated_time_to_update = estimated_time_to_update
            self.issues = issues
            self.summary = summary
            VapiStruct.__init__(self)

    Report._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.update.precheck_report.report', {
                'date_created':
                type.DateTimeType(),
                'estimated_time_to_update':
                type.OptionalType(type.IntegerType()),
                'issues':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vcenter.lcm_client',
                                       'Notifications')),
                'summary':
                type.ReferenceType(__name__, 'PrecheckReport.ReportSummary'),
            }, Report, False, None))

    class Result(VapiStruct):
        """
        The ``PrecheckReport.Result`` class contains the precheck report and a link
        to download the CSV report.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            report=None,
            csv_report=None,
        ):
            """
            :type  report: :class:`PrecheckReport.Report`
            :param report: The report generated by running the precheck.
            :type  csv_report: :class:`str` or ``None``
            :param csv_report: The identifier of CSV formatted precheck report. null provides
                location where the CSV report can be downloaded from based on the
                ``csvReport``.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.lcm.report``. 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.lcm.report``.
                None in case of ``errors`` reported in
                :attr:`PrecheckReport.Report.issues`.
            """
            self.report = report
            self.csv_report = csv_report
            VapiStruct.__init__(self)

    Result._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.update.precheck_report.result', {
                'report': type.ReferenceType(__name__,
                                             'PrecheckReport.Report'),
                'csv_report': type.OptionalType(type.IdType()),
            }, Result, False, None))

    def create_task(
        self,
        version,
    ):
        """
        Creates a vCenter Server pre-update compatibility check report for the
        pending update version. The report can be exported and downloaded in
        CSV format. 
        
        The result of this operation can be queried by calling the null method
        where ``task`` is the response of this operation.

        :type  version: :class:`str`
        :param version: Pending update version for which pre-update compatibility check
            will be executed.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.lcm.update.pending``.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if there is no pending update assosiated with the ``version`` in
            the system.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if a precheck is already in progress.
        :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 error.
        """
        task_id = self._invoke('create$task', {
            'version': version,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ReferenceType(__name__, 'PrecheckReport.Result'))
        return task_instance
Esempio n. 8
0
class Reports(VapiInterface):
    """
    The ``Report`` class provides an method to download the report generated by
    the interop and precheck operations. To download a report, you must use the
    ``get`` method. A ``Report.Location`` class represents the location of the
    file which has ``Report.Token`` class which represents the token ID
    (\\\\@name String) and the expiration time of the token
    ``Report.Token.expiry`` DateTime. ``Report.Location`` class also has the
    URI for the file which needs to be downloaded.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.lcm.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
        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.vcenter.lcm.reports.token', {
            'token': type.StringType(),
            'expiry': type.DateTimeType(),
        }, Token, False, None))

    class Location(VapiStruct):
        """
        The ``Reports.Location`` class contains the URI location to download the
        report from, as well as a token required (as a header on the HTTP request)
        to get the bundle. The validity of the token is 5 minutes as best attempt.
        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,
            uri=None,
            download_file_token=None,
        ):
            """
            :type  uri: :class:`str`
            :param uri: Report Download URI.
            :type  download_file_token: :class:`Reports.Token`
            :param download_file_token: Information about the token required in the HTTP GET request to
                retrieve the report
            """
            self.uri = uri
            self.download_file_token = download_file_token
            VapiStruct.__init__(self)

    Location._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.reports.location', {
                'uri':
                type.URIType(),
                'download_file_token':
                type.ReferenceType(__name__, 'Reports.Token'),
            }, Location, False, None))

    def get(
        self,
        report,
    ):
        """
        Returns the location :class:`Reports.Location` information for
        downloading the report for the specified file name. 
        
         Retrieving a report involves two steps: 
        
        * Step 1: Invoke the :func:`Reports.get` method to provision a token
          and a URI.
        * Step 2: Make an HTTP GET request by using the URI and the token
          returned in step 1 to retrieve the report.
        
         
        
         The HTTP GET request will: 
        
        * Return 401 (Not Authorized) if the download URI is recognized, but
          the token is invalid, 404 if the URL is not recognized otherwise return
          200 (OK)
        * Provide the CSV contents as the output of the request. The API
          accepts the file name as input, reads the contents of that CSV file,
          and returns this text as the result of the API.

        :type  report: :class:`str`
        :param report: 
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.lcm.report``.
        :rtype: :class:`Reports.Location`
        :return: 
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If there is no file associated with ``report`` in the system.
        :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.
        """
        return self._invoke('get', {
            'report': report,
        })
Esempio n. 9
0
class Session(VapiInterface):
    """
    The ``Session`` class allows API clients to manage session tokens including
    creating, deleting and obtaining information about sessions. 
    
     
    
    * The :func:`Session.create` method creates session token in exchange for
      another authentication token.
    * The :func:`Session.delete` method invalidates a session token.
    * The :func:`Session.get` retrieves information about a session token.
    
     
    
    The call to the :func:`Session.create` method is part of the overall
    authentication process for API clients. For example, the sequence of steps
    for establishing a session with SAML token is: 
    
    * Connect to lookup service.
    * Discover the secure token service (STS) endpoint URL.
    * Connect to the secure token service to obtain a SAML token.
    * Authenticate to the lookup service using the obtained SAML token.
    * Discover the API endpoint URL from lookup service.
    * Call the :func:`Session.create` method. The :func:`Session.create` call
      must include the SAML token.
    
     
    
    See the programming guide and samples for additional information about
    establishing API sessions. 
    
     **Execution Context and Security Context** 
    
    To use session based authentication a client should supply the session
    token obtained through the :func:`Session.create` method. The client should
    add the session token in the security context when using SDK classes.
    Clients using the REST API should supply the session token as a HTTP
    header. 
    
     **Session Lifetime** 
    
    A session begins with call to the :func:`Session.create` method to exchange
    a SAML token for a API session token. A session ends under the following
    circumstances: 
    
    * Call to the :func:`Session.delete` method.
    * The session expires. Session expiration may be caused by one of the
      following situations: 
    
    * Client inactivity - For a particular session identified by client
      requests that specify the associated session ID, the lapsed time since the
      last request exceeds the maximum interval between requests.
    * Unconditional or absolute session expiration time: At the beginning of
      the session, the session logic uses the SAML token and the system
      configuration to calculate absolute expiration time.
    
     
    
    When a session ends, the authentication logic will reject any subsequent
    client requests that specify that session. Any operations in progress will
    continue to completion. 
    
     **Error Handling** 
    
     The :class:`Session` returns the following exceptions: 
    
    * :class:`com.vmware.vapi.std.errors_client.Unauthenticated` exception for
      any exceptions related to the request.
    * :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` exception
      for all exceptions caused by internal service failure.
    """
    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, _SessionStub)

    class Info(VapiStruct):
        """
        Represents data associated with an API session.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            user=None,
            created_time=None,
            last_accessed_time=None,
        ):
            """
            :type  user: :class:`str`
            :param user: Fully qualified name of the end user that created the session, for
                example Administrator\\\\@vsphere.local. A typical use case for
                this information is in Graphical User Interfaces (GUI) or logging
                systems to visualize the identity of the current user.
            :type  created_time: :class:`datetime.datetime`
            :param created_time: Time when the session was created.
            :type  last_accessed_time: :class:`datetime.datetime`
            :param last_accessed_time: Last time this session was used by passing the session key for
                invoking an API.
            """
            self.user = user
            self.created_time = created_time
            self.last_accessed_time = last_accessed_time
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.cis.session.info', {
                'user': type.StringType(),
                'created_time': type.DateTimeType(),
                'last_accessed_time': type.DateTimeType(),
            }, Info, False, None))

    def create(self):
        """
        Creates a session with the API. This is the equivalent of login. This
        method exchanges user credentials supplied in the security context for
        a session identifier that is to be used for authenticating subsequent
        calls. To authenticate subsequent calls clients are expected to include
        the session key.


        :rtype: :class:`str`
        :return: Newly created session identifier to be used for authenticating
            further requests.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the session creation fails due to request specific issues. Due
            to the security nature of the API the details of the error are not
            disclosed. 
            
            Please check the following preconditions if using a SAML token to
            authenticate: 
            
            * the supplied token is delegate-able.
            * the time of client and server system are synchronized.
            * the token supplied is valid.
            * if bearer tokens are used check that system configuration allows
              the API endpoint to accept such tokens.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            if session creation fails due to server specific issues, for
            example connection to a back end component is failing. Due to the
            security nature of this API further details will not be disclosed
            in the exception. Please refer to component health information,
            administrative logs and product specific documentation for possible
            causes.
        """
        return self._invoke('create', None)

    def delete(self):
        """
        Terminates the validity of a session token. This is the equivalent of
        log out. 
        
         A session identifier is expected as part of the request. 


        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the session id is missing from the request or the corresponding
            session object cannot be found.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            if session deletion fails due to server specific issues, for
            example connection to a back end component is failing. Due to the
            security nature of this API further details will not be disclosed
            in the exception. Please refer to component health information,
            administrative logs and product specific documentation for possible
            causes.
        """
        return self._invoke('delete', None)

    def get(self):
        """
        Returns information about the current session. This method expects a
        valid session identifier to be supplied. 
        
        A side effect of invoking this method may be a change to the session's
        last accessed time to the current time if this is supported by the
        session implementation. Invoking any other method in the API will also
        update the session's last accessed time. 
        
        This API is meant to serve the needs of various front end projects that
        may want to display the name of the user. Examples of this include
        various web based user interfaces and logging facilities.


        :rtype: :class:`Session.Info`
        :return: Information about the session.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the session id is missing from the request or the corresponding
            session object cannot be found.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            if session retrieval fails due to server specific issues e.g.
            connection to back end component is failing. Due to the security
            nature of this API further details will not be disclosed in the
            error. Please refer to component health information, administrative
            logs and product specific documentation for possible causes.
        """
        return self._invoke('get', None)
Esempio n. 10
0
class Versions(VapiInterface):
    """
    The ``Versions`` class provides methods to get component versions from the
    sync'ed and imported depots.
    """

    _VAPI_SERVICE_ID = 'com.vmware.esx.settings.depot_content.components.versions'
    """
    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, _VersionsStub)
        self._VAPI_OPERATION_IDS = {}

    class CategoryType(Enum):
        """
        The ``Versions.CategoryType`` class defines possible values of categories
        for a component.

        .. 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>`.
        """
        SECURITY = None
        """
        Security

        """
        ENHANCEMENT = None
        """
        Enhancement

        """
        BUGFIX = None
        """
        Bugfix

        """
        RECALL = None
        """
        Recall

        """
        RECALL_FIX = None
        """
        Recall-fix

        """
        INFO = None
        """
        Info

        """
        MISC = None
        """
        Misc

        """
        GENERAL = None
        """
        General

        """

        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`CategoryType` instance.
            """
            Enum.__init__(string)

    CategoryType._set_values([
        CategoryType('SECURITY'),
        CategoryType('ENHANCEMENT'),
        CategoryType('BUGFIX'),
        CategoryType('RECALL'),
        CategoryType('RECALL_FIX'),
        CategoryType('INFO'),
        CategoryType('MISC'),
        CategoryType('GENERAL'),
    ])
    CategoryType._set_binding_type(type.EnumType(
        'com.vmware.esx.settings.depot_content.components.versions.category_type',
        CategoryType))


    class UrgencyType(Enum):
        """
        The ``Versions.UrgencyType`` class defines possible values of urgencies for
        a component.

        .. 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>`.
        """
        CRITICAL = None
        """
        Critical

        """
        IMPORTANT = None
        """
        Important

        """
        MODERATE = None
        """
        Moderate

        """
        LOW = None
        """
        Low

        """
        GENERAL = None
        """
        General

        """

        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`UrgencyType` instance.
            """
            Enum.__init__(string)

    UrgencyType._set_values([
        UrgencyType('CRITICAL'),
        UrgencyType('IMPORTANT'),
        UrgencyType('MODERATE'),
        UrgencyType('LOW'),
        UrgencyType('GENERAL'),
    ])
    UrgencyType._set_binding_type(type.EnumType(
        'com.vmware.esx.settings.depot_content.components.versions.urgency_type',
        UrgencyType))


    class Info(VapiStruct):
        """
        The ``Versions.Info`` class defines the information regarding a component
        version.

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




        def __init__(self,
                     display_name=None,
                     vendor=None,
                     display_version=None,
                     summary=None,
                     description=None,
                     category=None,
                     urgency=None,
                     kb=None,
                     contact=None,
                     release_date=None,
                    ):
            """
            :type  display_name: :class:`str`
            :param display_name: Display name of the component.
            :type  vendor: :class:`str`
            :param vendor: Vendor of the component.
            :type  display_version: :class:`str`
            :param display_version: Human readable version of the component.
            :type  summary: :class:`str`
            :param summary: Summary of the component version.
            :type  description: :class:`str`
            :param description: Discription of the component version.
            :type  category: :class:`Versions.CategoryType`
            :param category: Category of the component version.
            :type  urgency: :class:`Versions.UrgencyType`
            :param urgency: Urgency of the component version.
            :type  kb: :class:`str`
            :param kb: Link to kb article related to this the component version.
            :type  contact: :class:`str`
            :param contact: Contact email for the component version.
            :type  release_date: :class:`datetime.datetime`
            :param release_date: Release date of the component version.
            """
            self.display_name = display_name
            self.vendor = vendor
            self.display_version = display_version
            self.summary = summary
            self.description = description
            self.category = category
            self.urgency = urgency
            self.kb = kb
            self.contact = contact
            self.release_date = release_date
            VapiStruct.__init__(self)


    Info._set_binding_type(type.StructType(
        'com.vmware.esx.settings.depot_content.components.versions.info', {
            'display_name': type.StringType(),
            'vendor': type.StringType(),
            'display_version': type.StringType(),
            'summary': type.StringType(),
            'description': type.StringType(),
            'category': type.ReferenceType(__name__, 'Versions.CategoryType'),
            'urgency': type.ReferenceType(__name__, 'Versions.UrgencyType'),
            'kb': type.URIType(),
            'contact': type.StringType(),
            'release_date': type.DateTimeType(),
        },
        Info,
        False,
        None))



    def get(self,
            name,
            version,
            ):
        """
        Returns information about a given component version in the depot.

        :type  name: :class:`str`
        :param name: Name of the component
            The parameter must be an identifier for the resource type:
            ``com.vmware.esx.settings.component``.
        :type  version: :class:`str`
        :param version: Version of the component
        :rtype: :class:`Versions.Info`
        :return: Information about the given component
        :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 component with given version 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.ServiceUnavailable` 
            If the service is not available.
        :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.lifecycleSettings.Read``.
        """
        return self._invoke('get',
                            {
                            'name': name,
                            'version': version,
                            })
Esempio n. 11
0
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,
        })
Esempio n. 12
0
class Monitoring(VapiInterface):
    """
    ``Monitoring`` class provides methods Get and list monitoring data for
    requested item.
    """
    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, _MonitoringStub)

    class FunctionType(Enum):
        """
        ``Monitoring.FunctionType`` class Defines aggregation function

        .. 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>`.
        """
        COUNT = None
        """
        Aggregation takes count per period (sum)

        """
        MAX = None
        """
        Aggregation takes maximums per period

        """
        AVG = None
        """
        Aggregation takes average per period

        """
        MIN = None
        """
        Aggregation takes minimums per period

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`FunctionType` instance.
            """
            Enum.__init__(string)

    FunctionType._set_values([
        FunctionType('COUNT'),
        FunctionType('MAX'),
        FunctionType('AVG'),
        FunctionType('MIN'),
    ])
    FunctionType._set_binding_type(
        type.EnumType('com.vmware.appliance.monitoring.function_type',
                      FunctionType))

    class IntervalType(Enum):
        """
        ``Monitoring.IntervalType`` class Defines interval between the values in
        hours and mins, for which aggregation will apply

        .. 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>`.
        """
        MINUTES30 = None
        """
        Thirty minutes interval between values. One week is 336 values.

        """
        HOURS2 = None
        """
        Two hours interval between values. One month has 360 values.

        """
        MINUTES5 = None
        """
        Five minutes interval between values (finest). One day would have 288
        values, one week is 2016.

        """
        DAY1 = None
        """
        24 hours interval between values. One year has 365 values.

        """
        HOURS6 = None
        """
        Six hour interval between values. One quarter is 360 values.

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`IntervalType` instance.
            """
            Enum.__init__(string)

    IntervalType._set_values([
        IntervalType('MINUTES30'),
        IntervalType('HOURS2'),
        IntervalType('MINUTES5'),
        IntervalType('DAY1'),
        IntervalType('HOURS6'),
    ])
    IntervalType._set_binding_type(
        type.EnumType('com.vmware.appliance.monitoring.interval_type',
                      IntervalType))

    class MonitoredItemData(VapiStruct):
        """
        ``Monitoring.MonitoredItemData`` class Structure representing monitored
        item data.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            name=None,
            interval=None,
            function=None,
            start_time=None,
            end_time=None,
            data=None,
        ):
            """
            :type  name: :class:`str`
            :param name: Monitored item IDs Ex: CPU, MEMORY, STORAGE_TOTAL
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.appliance.monitoring``. 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.monitoring``.
            :type  interval: :class:`Monitoring.IntervalType`
            :param interval: interval between values in hours, minutes
            :type  function: :class:`Monitoring.FunctionType`
            :param function: aggregation function
            :type  start_time: :class:`datetime.datetime`
            :param start_time: Starting time
            :type  end_time: :class:`datetime.datetime`
            :param end_time: Ending time
            :type  data: :class:`list` of :class:`str`
            :param data: list of values
            """
            self.name = name
            self.interval = interval
            self.function = function
            self.start_time = start_time
            self.end_time = end_time
            self.data = data
            VapiStruct.__init__(self)

    MonitoredItemData._set_binding_type(
        type.StructType(
            'com.vmware.appliance.monitoring.monitored_item_data', {
                'name':
                type.IdType(resource_types='com.vmware.appliance.monitoring'),
                'interval':
                type.ReferenceType(sys.modules[__name__],
                                   'Monitoring.IntervalType'),
                'function':
                type.ReferenceType(sys.modules[__name__],
                                   'Monitoring.FunctionType'),
                'start_time':
                type.DateTimeType(),
                'end_time':
                type.DateTimeType(),
                'data':
                type.ListType(type.StringType()),
            }, MonitoredItemData, False, None))

    class MonitoredItemDataRequest(VapiStruct):
        """
        ``Monitoring.MonitoredItemDataRequest`` class Structure representing
        requested monitored item data.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            names=None,
            interval=None,
            function=None,
            start_time=None,
            end_time=None,
        ):
            """
            :type  names: :class:`list` of :class:`str`
            :param names: monitored item IDs Ex: CPU, MEMORY
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.appliance.monitoring``. When methods return a value of
                this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.appliance.monitoring``.
            :type  interval: :class:`Monitoring.IntervalType`
            :param interval: interval between values in hours, minutes
            :type  function: :class:`Monitoring.FunctionType`
            :param function: aggregation function
            :type  start_time: :class:`datetime.datetime`
            :param start_time: Starting time
            :type  end_time: :class:`datetime.datetime`
            :param end_time: Ending time
            """
            self.names = names
            self.interval = interval
            self.function = function
            self.start_time = start_time
            self.end_time = end_time
            VapiStruct.__init__(self)

    MonitoredItemDataRequest._set_binding_type(
        type.StructType(
            'com.vmware.appliance.monitoring.monitored_item_data_request', {
                'names':
                type.ListType(type.IdType()),
                'interval':
                type.ReferenceType(sys.modules[__name__],
                                   'Monitoring.IntervalType'),
                'function':
                type.ReferenceType(sys.modules[__name__],
                                   'Monitoring.FunctionType'),
                'start_time':
                type.DateTimeType(),
                'end_time':
                type.DateTimeType(),
            }, MonitoredItemDataRequest, False, None))

    class MonitoredItem(VapiStruct):
        """
        ``Monitoring.MonitoredItem`` class Structure representing requested
        monitored item data.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            id=None,
            name=None,
            units=None,
            category=None,
            instance=None,
            description=None,
        ):
            """
            :type  id: :class:`str`
            :param id: monitored item ID Ex: CPU, MEMORY
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.appliance.monitoring``. 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.monitoring``.
            :type  name: :class:`str`
            :param name: monitored item name Ex: "Network write speed"
            :type  units: :class:`str`
            :param units: Y-axis label EX: "Mbps", "%"
            :type  category: :class:`str`
            :param category: category Ex: network, storage etc
            :type  instance: :class:`str`
            :param instance: instance name Ex: eth0
            :type  description: :class:`str`
            :param description: monitored item description Ex:
                com.vmware.applmgmt.mon.descr.net.rx.packetRate.eth0
            """
            self.id = id
            self.name = name
            self.units = units
            self.category = category
            self.instance = instance
            self.description = description
            VapiStruct.__init__(self)

    MonitoredItem._set_binding_type(
        type.StructType(
            'com.vmware.appliance.monitoring.monitored_item', {
                'id':
                type.IdType(resource_types='com.vmware.appliance.monitoring'),
                'name': type.StringType(),
                'units': type.StringType(),
                'category': type.StringType(),
                'instance': type.StringType(),
                'description': type.StringType(),
            }, MonitoredItem, False, None))

    def query(
        self,
        item,
    ):
        """
        Get monitoring data.

        :type  item: :class:`Monitoring.MonitoredItemDataRequest`
        :param item: MonitoredItemDataRequest Structure
        :rtype: :class:`list` of :class:`Monitoring.MonitoredItemData`
        :return: list of MonitoredItemData structure
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('query', {
            'item': item,
        })

    def list(self):
        """
        Get monitored items list


        :rtype: :class:`list` of :class:`Monitoring.MonitoredItem`
        :return: list of names
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('list', None)

    def get(
        self,
        stat_id,
    ):
        """
        Get monitored item info

        :type  stat_id: :class:`str`
        :param stat_id: statistic item id
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.monitoring``.
        :rtype: :class:`Monitoring.MonitoredItem`
        :return: MonitoredItem structure
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('get', {
            'stat_id': stat_id,
        })
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,
        })
Esempio n. 14
0
class Components(VapiInterface):
    """
    The ``Components`` class provides methods to get Components from the
    sync'ed and imported depots.
    """
    RESOURCE_TYPE = "com.vmware.esx.settings.component"
    """
    Resource type for add-on resource

    """

    _VAPI_SERVICE_ID = 'com.vmware.esx.settings.depot_content.components'
    """
    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, _ComponentsStub)
        self._VAPI_OPERATION_IDS = {}

    class CategoryType(Enum):
        """
        The ``Components.CategoryType`` class defines possible values of categories
        for a component.

        .. 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>`.
        """
        SECURITY = None
        """
        Security

        """
        ENHANCEMENT = None
        """
        Enhancement

        """
        BUGFIX = None
        """
        Bugfix

        """
        RECALL = None
        """
        Recall

        """
        RECALL_FIX = None
        """
        Recall-fix

        """
        INFO = None
        """
        Info

        """
        MISC = None
        """
        Misc

        """
        GENERAL = None
        """
        General

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`CategoryType` instance.
            """
            Enum.__init__(string)

    CategoryType._set_values([
        CategoryType('SECURITY'),
        CategoryType('ENHANCEMENT'),
        CategoryType('BUGFIX'),
        CategoryType('RECALL'),
        CategoryType('RECALL_FIX'),
        CategoryType('INFO'),
        CategoryType('MISC'),
        CategoryType('GENERAL'),
    ])
    CategoryType._set_binding_type(
        type.EnumType(
            'com.vmware.esx.settings.depot_content.components.category_type',
            CategoryType))

    class UrgencyType(Enum):
        """
        The ``Components.UrgencyType`` class defines possible values of urgencies
        for a component.

        .. 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>`.
        """
        CRITICAL = None
        """
        Critical

        """
        IMPORTANT = None
        """
        Important

        """
        MODERATE = None
        """
        Moderate

        """
        LOW = None
        """
        Low

        """
        GENERAL = None
        """
        General

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`UrgencyType` instance.
            """
            Enum.__init__(string)

    UrgencyType._set_values([
        UrgencyType('CRITICAL'),
        UrgencyType('IMPORTANT'),
        UrgencyType('MODERATE'),
        UrgencyType('LOW'),
        UrgencyType('GENERAL'),
    ])
    UrgencyType._set_binding_type(
        type.EnumType(
            'com.vmware.esx.settings.depot_content.components.urgency_type',
            UrgencyType))

    class ComponentBundleType(Enum):
        """
        The ``Components.ComponentBundleType`` class defines possible ways
        components are bundled.

        .. 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>`.
        """
        INDEPENDENT = None
        """
        Components not bundled in base-images or add-ons

        """
        BASE_IMAGE = None
        """
        Components bundled in base-images

        """
        ADD_ON = None
        """
        Components bundled in add-ons

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`ComponentBundleType` instance.
            """
            Enum.__init__(string)

    ComponentBundleType._set_values([
        ComponentBundleType('INDEPENDENT'),
        ComponentBundleType('BASE_IMAGE'),
        ComponentBundleType('ADD_ON'),
    ])
    ComponentBundleType._set_binding_type(
        type.EnumType(
            'com.vmware.esx.settings.depot_content.components.component_bundle_type',
            ComponentBundleType))

    class Summary(VapiStruct):
        """
        The ``Components.Summary`` class defines the summary information regarding
        a component.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            name=None,
            display_name=None,
            vendor=None,
            versions=None,
        ):
            """
            :type  name: :class:`str`
            :param name: Name of the Component.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.esx.settings.component``. When methods return a value
                of this class as a return value, the attribute will be an
                identifier for the resource type:
                ``com.vmware.esx.settings.component``.
            :type  display_name: :class:`str`
            :param display_name: Display name of the component.
            :type  vendor: :class:`str`
            :param vendor: Vendor of the component.
            :type  versions: :class:`list` of :class:`Components.ComponentVersionSummary`
            :param versions: Summary information about the versions of this component. These are
                sorted by the version.
            """
            self.name = name
            self.display_name = display_name
            self.vendor = vendor
            self.versions = versions
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.depot_content.components.summary', {
                'name':
                type.IdType(
                    resource_types='com.vmware.esx.settings.component'),
                'display_name':
                type.StringType(),
                'vendor':
                type.StringType(),
                'versions':
                type.ListType(
                    type.ReferenceType(__name__,
                                       'Components.ComponentVersionSummary')),
            }, Summary, False, None))

    class ComponentVersionSummary(VapiStruct):
        """
        The ``Components.ComponentVersionSummary`` class defines the summary
        information regarding a version of a component.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            version=None,
            display_version=None,
            summary=None,
            category=None,
            urgency=None,
            kb=None,
            release_date=None,
        ):
            """
            :type  version: :class:`str`
            :param version: Version of the component.
            :type  display_version: :class:`str`
            :param display_version: Human readable version of the component.
            :type  summary: :class:`str`
            :param summary: Summary of the component version.
            :type  category: :class:`Components.CategoryType`
            :param category: Category of the component version.
            :type  urgency: :class:`Components.UrgencyType`
            :param urgency: Urgency of the component version.
            :type  kb: :class:`str`
            :param kb: Link to kb article related to this the component version.
            :type  release_date: :class:`datetime.datetime`
            :param release_date: Release date of the component version.
            """
            self.version = version
            self.display_version = display_version
            self.summary = summary
            self.category = category
            self.urgency = urgency
            self.kb = kb
            self.release_date = release_date
            VapiStruct.__init__(self)

    ComponentVersionSummary._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.depot_content.components.component_version_summary',
            {
                'version': type.StringType(),
                'display_version': type.StringType(),
                'summary': type.StringType(),
                'category': type.ReferenceType(__name__,
                                               'Components.CategoryType'),
                'urgency': type.ReferenceType(__name__,
                                              'Components.UrgencyType'),
                'kb': type.URIType(),
                'release_date': type.DateTimeType(),
            }, ComponentVersionSummary, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``Components.FilterSpec`` class contains attributes used to filter the
        results when listing components, see :func:`Components.list`).

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            vendors=None,
            names=None,
            versions=None,
            min_version=None,
            bundle_types=None,
        ):
            """
            :type  vendors: :class:`set` of :class:`str` or ``None``
            :param vendors: Vendors that a component must have to match the filter.
                If None or empty, components with any vendor name match the filter.
            :type  names: :class:`set` of :class:`str` or ``None``
            :param names: Names that a component must have to match the filter.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.esx.settings.component``. When methods return a value
                of this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.esx.settings.component``.
                If None or empty, components with any name will match the filter.
            :type  versions: :class:`set` of :class:`str` or ``None``
            :param versions: Versions that a component must have to match the filter.
                If None or empty, components with any version will match the
                filter.
            :type  min_version: :class:`str` or ``None``
            :param min_version: Minimum version of the component that can match the filter.
                If :class:`set`, only components with version greater than or equal
                to the given version match the filter.
            :type  bundle_types: :class:`set` of :class:`Components.ComponentBundleType` or ``None``
            :param bundle_types: Component bundle types that a component must have to match the
                filter.
                If None or empty, all components will match the filter.
            """
            self.vendors = vendors
            self.names = names
            self.versions = versions
            self.min_version = min_version
            self.bundle_types = bundle_types
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.depot_content.components.filter_spec', {
                'vendors':
                type.OptionalType(type.SetType(type.StringType())),
                'names':
                type.OptionalType(type.SetType(type.IdType())),
                'versions':
                type.OptionalType(type.SetType(type.StringType())),
                'min_version':
                type.OptionalType(type.StringType()),
                'bundle_types':
                type.OptionalType(
                    type.SetType(
                        type.ReferenceType(__name__,
                                           'Components.ComponentBundleType'))),
            }, FilterSpec, False, None))

    def list(
        self,
        filter=None,
    ):
        """
        Returns a list of currently available components in the depot.

        :type  filter: :class:`Components.FilterSpec` or ``None``
        :param filter: The specification of matching components.
            If None, the behavior is equivalent to a
            :class:`Components.FilterSpec` with all attributes None, which
            means ALL components match the filter.
        :rtype: :class:`list` of :class:`Components.Summary`
        :return: List of components in the depot.
        :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.
        :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.lifecycleSettings.Read``.
        """
        return self._invoke('list', {
            'filter': filter,
        })
Esempio n. 15
0
class BaseImages(VapiInterface):
    """
    The ``BaseImages`` class provides methods to get base-images from the
    sync'ed and imported depots.
    """
    RESOURCE_TYPE = "com.vmware.esx.settings.base_image"
    """
    Resource type for add-on resource

    """

    _VAPI_SERVICE_ID = 'com.vmware.esx.settings.depot_content.base_images'
    """
    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, _BaseImagesStub)
        self._VAPI_OPERATION_IDS = {}

    class CategoryType(Enum):
        """
        The ``BaseImages.CategoryType`` class defines possible values of categories
        for a base-image.

        .. 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>`.
        """
        SECURITY = None
        """
        Security

        """
        ENHANCEMENT = None
        """
        Enhancement

        """
        BUGFIX = None
        """
        Bugfix

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`CategoryType` instance.
            """
            Enum.__init__(string)

    CategoryType._set_values([
        CategoryType('SECURITY'),
        CategoryType('ENHANCEMENT'),
        CategoryType('BUGFIX'),
    ])
    CategoryType._set_binding_type(
        type.EnumType(
            'com.vmware.esx.settings.depot_content.base_images.category_type',
            CategoryType))

    class Summary(VapiStruct):
        """
        The ``BaseImages.Summary`` class defines the summary information regarding
        a base-image.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            display_name=None,
            version=None,
            display_version=None,
            summary=None,
            category=None,
            kb=None,
            release_date=None,
        ):
            """
            :type  display_name: :class:`str`
            :param display_name: Display name of the base-image.
            :type  version: :class:`str`
            :param version: Version of the base-image.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.esx.settings.base_image``. When methods return a value
                of this class as a return value, the attribute will be an
                identifier for the resource type:
                ``com.vmware.esx.settings.base_image``.
            :type  display_version: :class:`str`
            :param display_version: Human readable version of the base-image.
            :type  summary: :class:`str`
            :param summary: Summary of the base-image.
            :type  category: :class:`BaseImages.CategoryType`
            :param category: Category of the base-image.
            :type  kb: :class:`str`
            :param kb: Link to kb article related to this the base-image.
            :type  release_date: :class:`datetime.datetime`
            :param release_date: Release date of the base-image.
            """
            self.display_name = display_name
            self.version = version
            self.display_version = display_version
            self.summary = summary
            self.category = category
            self.kb = kb
            self.release_date = release_date
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.depot_content.base_images.summary', {
                'display_name':
                type.StringType(),
                'version':
                type.IdType(
                    resource_types='com.vmware.esx.settings.base_image'),
                'display_version':
                type.StringType(),
                'summary':
                type.StringType(),
                'category':
                type.ReferenceType(__name__, 'BaseImages.CategoryType'),
                'kb':
                type.URIType(),
                'release_date':
                type.DateTimeType(),
            }, Summary, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``BaseImages.FilterSpec`` class contains attributes used to filter the
        results when listing base-images, see :func:`BaseImages.list`).

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            min_version=None,
        ):
            """
            :type  min_version: :class:`str` or ``None``
            :param min_version: Minimum version of a base-image that can match the filter.
                If :class:`set`, only base-images with version greater than or
                equal to this version will be returned.
            """
            self.min_version = min_version
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.depot_content.base_images.filter_spec', {
                'min_version': type.OptionalType(type.StringType()),
            }, FilterSpec, False, None))

    def list(
        self,
        filter=None,
    ):
        """
        Returns a list of currently available base-images in the depot.

        :type  filter: :class:`BaseImages.FilterSpec` or ``None``
        :param filter: The specification of matching base-images.
            If None, the behavior is equivalent to a
            :class:`BaseImages.FilterSpec` with all attributes None, which
            means all base-images match the filter.
        :rtype: :class:`list` of :class:`BaseImages.Summary`
        :return: List of base-images in the depot. These will be sorted by the
            version of the base-image.
        :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.
        :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.lifecycleSettings.Read``.
        """
        return self._invoke('list', {
            'filter': filter,
        })
Esempio n. 16
0
class Harbor(VapiInterface):
    """
    The ``Harbor`` class provides methods to manage the lifecycle of an
    integrated Harbor container registry in vCenter.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.content.registries.harbor'
    """
    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, _HarborStub)
        self._VAPI_OPERATION_IDS = {}

    class StorageSpec(VapiStruct):
        """
        The ``Harbor.StorageSpec`` class contains the specification required to
        configure storage associated with a Harbor registry. In this version,
        Harbor registry is created in Kubernetes environment, information in this
        class will result in storage quotas on a Kubernetes namespace.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            policy=None,
            limit=None,
        ):
            """
            :type  policy: :class:`str`
            :param policy: Identifier of the storage policy.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``SpsStorageProfile``. When methods return a value of this class as
                a return value, the attribute will be an identifier for the
                resource type: ``SpsStorageProfile``.
            :type  limit: :class:`long` or ``None``
            :param limit: The maximum amount of storage (in mebibytes) which can be utilized
                by the registry for this specification.
                If None, a default limit of 204800 mebibytes will be set as the
                registry's storage capacity.
            """
            self.policy = policy
            self.limit = limit
            VapiStruct.__init__(self)

    StorageSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.content.registries.harbor.storage_spec', {
                'policy': type.IdType(resource_types='SpsStorageProfile'),
                'limit': type.OptionalType(type.IntegerType()),
            }, StorageSpec, False, None))

    class StorageInfo(VapiStruct):
        """
        The ``Harbor.StorageInfo`` class contains the detailed information about
        storage used by the Harbor registry.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            policy=None,
            capacity=None,
            used=None,
        ):
            """
            :type  policy: :class:`str`
            :param policy: Identifier of the storage policy.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``SpsStorageProfile``. When methods return a value of this class as
                a return value, the attribute will be an identifier for the
                resource type: ``SpsStorageProfile``.
            :type  capacity: :class:`long`
            :param capacity: Total capacity for the registry storage (in mebibytes). This is the
                storage limit set on the Harbor registry. If a storage limit was
                not set on the registry, the default registry capacity - 204800
                mebibytes is used.
            :type  used: :class:`long`
            :param used: Overall storage used by the registry (in mebibytes). This is the
                sum of used storage associated with storage policies configured for
                the registry.
            """
            self.policy = policy
            self.capacity = capacity
            self.used = used
            VapiStruct.__init__(self)

    StorageInfo._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.content.registries.harbor.storage_info', {
                'policy': type.IdType(resource_types='SpsStorageProfile'),
                'capacity': type.IntegerType(),
                'used': type.IntegerType(),
            }, StorageInfo, False, None))

    class GarbageCollection(VapiStruct):
        """
        The ``Harbor.GarbageCollection`` class contains garbage collection
        configuration for the Harbor registry.

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

        _validator_list = [
            UnionValidator(
                'type', {
                    'WEEKLY': [('day_of_week', True), ('hour', True),
                               ('minute', True)],
                    'DAILY': [('hour', True), ('minute', True)],
                    'NONE': [],
                }),
        ]

        def __init__(
            self,
            type=None,
            day_of_week=None,
            hour=None,
            minute=None,
        ):
            """
            :type  type: :class:`Recurrence`
            :param type: Frequency of garbage collection.
            :type  day_of_week: :class:`DayOfWeek`
            :param day_of_week: Day of the week when garbage collection should run.
                This attribute is optional and it is only relevant when the value
                of ``type`` is :attr:`Recurrence.WEEKLY`.
            :type  hour: :class:`long`
            :param hour: Hour at which garbage collection should run.
                This attribute is optional and it is only relevant when the value
                of ``type`` is one of :attr:`Recurrence.DAILY` or
                :attr:`Recurrence.WEEKLY`.
            :type  minute: :class:`long`
            :param minute: Minute at which garbage collection should run.
                This attribute is optional and it is only relevant when the value
                of ``type`` is one of :attr:`Recurrence.DAILY` or
                :attr:`Recurrence.WEEKLY`.
            """
            self.type = type
            self.day_of_week = day_of_week
            self.hour = hour
            self.minute = minute
            VapiStruct.__init__(self)

    GarbageCollection._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.content.registries.harbor.garbage_collection',
            {
                'type':
                type.ReferenceType(__name__, 'Recurrence'),
                'day_of_week':
                type.OptionalType(type.ReferenceType(__name__, 'DayOfWeek')),
                'hour':
                type.OptionalType(type.IntegerType()),
                'minute':
                type.OptionalType(type.IntegerType()),
            }, GarbageCollection, False, None))

    class CreateSpec(VapiStruct):
        """
        The ``Harbor.CreateSpec`` class contains the specification required to
        create a Harbor registry.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            cluster=None,
            garbage_collection=None,
            storage=None,
        ):
            """
            :type  cluster: :class:`str` or ``None``
            :param cluster: Identifier of the cluster hosting the registry.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``ClusterComputeResource``. When methods return a value of this
                class as a return value, the attribute will be an identifier for
                the resource type: ``ClusterComputeResource``.
                If None, registry will not be created on a specified cluster. This
                is required in current version, since Harbor can only be created on
                a cluster with Kubernetes enabled.
            :type  garbage_collection: :class:`Harbor.GarbageCollection` or ``None``
            :param garbage_collection: Garbage collection configuration for the Harbor registry.
                If None, a default configuration is set, Recurrence#WEEKLY,
                DayOfWeek#SATURDAY, GarbageCollection#hour is 2,
                GarbageCollection#minute is 0.
            :type  storage: :class:`list` of :class:`Harbor.StorageSpec`
            :param storage: Storage associated with the Harbor registry. The list contains only
                one storage backing in this version.
            """
            self.cluster = cluster
            self.garbage_collection = garbage_collection
            self.storage = storage
            VapiStruct.__init__(self)

    CreateSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.content.registries.harbor.create_spec', {
                'cluster':
                type.OptionalType(type.IdType()),
                'garbage_collection':
                type.OptionalType(
                    type.ReferenceType(__name__, 'Harbor.GarbageCollection')),
                'storage':
                type.ListType(
                    type.ReferenceType(__name__, 'Harbor.StorageSpec')),
            }, CreateSpec, False, None))

    class Summary(VapiStruct):
        """
        The ``Harbor.Summary`` class contains basic information about a running
        Harbor registry.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            cluster=None,
            registry=None,
            version=None,
            ui_access_url=None,
        ):
            """
            :type  cluster: :class:`str` or ``None``
            :param cluster: Identifier of the cluster.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``ClusterComputeResource``. When methods return a value of this
                class as a return value, the attribute will be an identifier for
                the resource type: ``ClusterComputeResource``.
                If None, container registry is not created on the cluster specified
                by :attr:`Harbor.CreateSpec.cluster`.
            :type  registry: :class:`str`
            :param registry: Identifier of the registry.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.content.Registry``. When methods return a
                value of this class as a return value, the attribute will be an
                identifier for the resource type:
                ``com.vmware.vcenter.content.Registry``.
            :type  version: :class:`str`
            :param version: Version of the registry.
            :type  ui_access_url: :class:`str`
            :param ui_access_url: URL to access the UI of the registry.
            """
            self.cluster = cluster
            self.registry = registry
            self.version = version
            self.ui_access_url = ui_access_url
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.content.registries.harbor.summary', {
                'cluster':
                type.OptionalType(type.IdType()),
                'registry':
                type.IdType(
                    resource_types='com.vmware.vcenter.content.Registry'),
                'version':
                type.StringType(),
                'ui_access_url':
                type.URIType(),
            }, Summary, False, None))

    class Info(VapiStruct):
        """
        The ``Harbor.Info`` class contains detailed information about a running
        Harbor registry.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            cluster=None,
            namespace=None,
            version=None,
            creation_time=None,
            ui_access_url=None,
            cert_chain=None,
            garbage_collection=None,
            storage=None,
            health=None,
        ):
            """
            :type  cluster: :class:`str` or ``None``
            :param cluster: Identifier of the cluster.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``ClusterComputeResource``. When methods return a value of this
                class as a return value, the attribute will be an identifier for
                the resource type: ``ClusterComputeResource``.
                If None, container registry is not created on the cluster specified
                by :attr:`Harbor.CreateSpec.cluster`.
            :type  namespace: :class:`str` or ``None``
            :param namespace: Identifier of the Harbor namespace in case it is created in a
                Kubernetes environment.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``NamespaceInstance``. When methods return a value of this class as
                a return value, the attribute will be an identifier for the
                resource type: ``NamespaceInstance``.
                If None, no Kubernetes namespace is created for the Harbor.
            :type  version: :class:`str`
            :param version: Version of the registry.
            :type  creation_time: :class:`datetime.datetime`
            :param creation_time: The date and time when the harbor registry was created.
            :type  ui_access_url: :class:`str`
            :param ui_access_url: URL to access the UI of the registry.
            :type  cert_chain: :class:`list` of :class:`str`
            :param cert_chain: Harbor certificate chain in base64 format.
            :type  garbage_collection: :class:`Harbor.GarbageCollection`
            :param garbage_collection: Garbage collection information for the registry.
            :type  storage: :class:`list` of :class:`Harbor.StorageInfo`
            :param storage: Storage information associated with the registry.
            :type  health: :class:`Health.Info`
            :param health: Health status of the container registry.
            """
            self.cluster = cluster
            self.namespace = namespace
            self.version = version
            self.creation_time = creation_time
            self.ui_access_url = ui_access_url
            self.cert_chain = cert_chain
            self.garbage_collection = garbage_collection
            self.storage = storage
            self.health = health
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.content.registries.harbor.info', {
                'cluster':
                type.OptionalType(type.IdType()),
                'namespace':
                type.OptionalType(type.IdType()),
                'version':
                type.StringType(),
                'creation_time':
                type.DateTimeType(),
                'ui_access_url':
                type.URIType(),
                'cert_chain':
                type.ListType(type.StringType()),
                'garbage_collection':
                type.ReferenceType(__name__, 'Harbor.GarbageCollection'),
                'storage':
                type.ListType(
                    type.ReferenceType(__name__, 'Harbor.StorageInfo')),
                'health':
                type.ReferenceType(__name__, 'Health.Info'),
            }, Info, False, None))

    def create(
        self,
        spec,
        client_token=None,
    ):
        """
        Creates a Harbor registry in the cluster.

        :type  client_token: :class:`str` or ``None``
        :param client_token: A unique token generated on the client for each creation request.
            The token should be a universally unique identifier (UUID), for
            example: ``b8a2a2e3-2314-43cd-a871-6ede0f429751``. This token can
            be used to guarantee idempotent creation.
            If not specified, creation is not idempotent.
        :type  spec: :class:`Harbor.CreateSpec`
        :param spec: Specification for creating the Harbor registry.
        :rtype: :class:`str`
        :return: Identifier of the deployed registry.
            The return value will be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry``.
        :raise: :class:`com.vmware.vapi.std.errors_client.AlreadyExists` 
            if a Harbor already exists in the associated cluster.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if resources/objects could not be located.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unsupported` 
            if :attr:`Harbor.CreateSpec.cluster` does not have vSphere
            namespace enabled.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if ``spec`` contains any errors.
        :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have ContentLibrary.ManageRegistry and/or
            CertificateAuthority.Manage privilege, or user does not have
            ContentLibrary.ManageClusterRegistryResource privilege on
            :attr:`Harbor.CreateSpec.cluster`.
        """
        return self._invoke('create', {
            'client_token': client_token,
            'spec': spec,
        })

    def delete(
        self,
        registry,
    ):
        """
        Delete the Harbor registry in the cluster. All Harbor projects,
        repositories and images will be deleted upon Harbor registry deletion.

        :type  registry: :class:`str`
        :param registry: Identifier of the registry.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if a registry specified by ``registry`` could not be found.
        :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have ContentLibrary.ManageRegistry privilege.
        """
        return self._invoke('delete', {
            'registry': registry,
        })

    def get(
        self,
        registry,
    ):
        """
        Get detailed information of the Harbor registry.

        :type  registry: :class:`str`
        :param registry: Identifier of the registry.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry``.
        :rtype: :class:`Harbor.Info`
        :return: Information about the registry.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if a Harbor registry specified by ``registry`` could not be found.
        :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have System.Read privilege.
        """
        return self._invoke('get', {
            'registry': registry,
        })

    def list(self):
        """
        Returns basic information of all Harbor registries.


        :rtype: :class:`list` of :class:`Harbor.Summary`
        :return: The list of basic information of all Harbor registries.
        :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have System.Read privilege.
        """
        return self._invoke('list', None)
Esempio n. 17
0
class CompatibilityReport(VapiInterface):
    """
    This class provides methods to generate hardware compatibility report for a
    given ESXi host against a specific ESXi release.
    """

    _VAPI_SERVICE_ID = 'com.vmware.esx.hcl.hosts.compatibility_report'
    """
    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, _CompatibilityReportStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update({'create_task': 'create$task'})

    class BiosConstraint(VapiStruct):
        """
        This ``CompatibilityReport.BiosConstraint`` class contains attributes that
        describe the BIOS that is supported for the given server and ESXi release.

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




        def __init__(self,
                     bios=None,
                     notes=None,
                    ):
            """
            :type  bios: :class:`com.vmware.esx.hcl_client.Firmware`
            :param bios: The BIOS information about the constraint.
            :type  notes: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param notes: Any information that should be taken into account when reviewing
                the BIOS constraint.
            """
            self.bios = bios
            self.notes = notes
            VapiStruct.__init__(self)


    BiosConstraint._set_binding_type(type.StructType(
        'com.vmware.esx.hcl.hosts.compatibility_report.bios_constraint', {
            'bios': type.ReferenceType('com.vmware.esx.hcl_client', 'Firmware'),
            'notes': type.ListType(type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage')),
        },
        BiosConstraint,
        False,
        None))


    class ServerCompatibility(VapiStruct):
        """
        This ``CompatibilityReport.ServerCompatibility`` class contains attributes
        that provide the compatibility information for a server model, cpu and
        BIOS.

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




        def __init__(self,
                     bios_constraints=None,
                     cpu_series=None,
                     supported_releases=None,
                     vcg_link=None,
                     notes=None,
                    ):
            """
            :type  bios_constraints: :class:`list` of :class:`CompatibilityReport.BiosConstraint` or ``None``
            :param bios_constraints: Lists the BIOS constraints that the target ESXi release has for
                this server.
                If None no constraints are present as server is either not
                compatible or compatibility information is not found.
            :type  cpu_series: :class:`str`
            :param cpu_series: The CPU series name.
            :type  supported_releases: :class:`list` of :class:`str` or ``None``
            :param supported_releases: Provides information about supported releases for this entry.
                If None server is compatible with the given target release.
            :type  vcg_link: :class:`str`
            :param vcg_link: Provides link to the VMware Compatibility Guide for further
                information on the compatibility.
            :type  notes: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage` or ``None``
            :param notes: Information that needs to be taken into account when considering
                this server hardware compatibility.
                Only :class:`set` if there is any information reported.
            """
            self.bios_constraints = bios_constraints
            self.cpu_series = cpu_series
            self.supported_releases = supported_releases
            self.vcg_link = vcg_link
            self.notes = notes
            VapiStruct.__init__(self)


    ServerCompatibility._set_binding_type(type.StructType(
        'com.vmware.esx.hcl.hosts.compatibility_report.server_compatibility', {
            'bios_constraints': type.OptionalType(type.ListType(type.ReferenceType(__name__, 'CompatibilityReport.BiosConstraint'))),
            'cpu_series': type.StringType(),
            'supported_releases': type.OptionalType(type.ListType(type.StringType())),
            'vcg_link': type.URIType(),
            'notes': type.OptionalType(type.ListType(type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage'))),
        },
        ServerCompatibility,
        False,
        None))


    class ServerHclInfo(VapiStruct):
        """
        This ``CompatibilityReport.ServerHclInfo`` class contains attributes that
        describe the server of a ESXi host and its compatibility information.

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




        def __init__(self,
                     server=None,
                     matches=None,
                     model_compatibility=None,
                    ):
            """
            :type  server: :class:`com.vmware.esx.hcl_client.Server`
            :param server: Information about the server.
            :type  matches: :class:`list` of :class:`CompatibilityReport.ServerCompatibility`
            :param matches: Provides information about possible compatibility matches for the
                given server. 
                
                There could be multiple matches returned as there are several
                possible matches in the Compatibility data.
            :type  model_compatibility: :class:`com.vmware.esx.hcl_client.CompatibilityStatus`
            :param model_compatibility: Shows if the server model is compatible with given target ESXi
                release.
            """
            self.server = server
            self.matches = matches
            self.model_compatibility = model_compatibility
            VapiStruct.__init__(self)


    ServerHclInfo._set_binding_type(type.StructType(
        'com.vmware.esx.hcl.hosts.compatibility_report.server_hcl_info', {
            'server': type.ReferenceType('com.vmware.esx.hcl_client', 'Server'),
            'matches': type.ListType(type.ReferenceType(__name__, 'CompatibilityReport.ServerCompatibility')),
            'model_compatibility': type.ReferenceType('com.vmware.esx.hcl_client', 'CompatibilityStatus'),
        },
        ServerHclInfo,
        False,
        None))


    class DeviceConstraint(VapiStruct):
        """
        This ``CompatibilityReport.DeviceConstraint`` class contains attributes
        that describe pair of driver and firmware that are supported for a given
        PCI device and ESXi release.

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




        def __init__(self,
                     driver=None,
                     firmware=None,
                     notes=None,
                    ):
            """
            :type  driver: :class:`com.vmware.esx.hcl_client.Driver`
            :param driver: The driver information about the constraint.
            :type  firmware: :class:`com.vmware.esx.hcl_client.Firmware` or ``None``
            :param firmware: The firmware information about the constraint.
                If None there is no firmware restriction on the driver to work with
                that release.
            :type  notes: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param notes: Any information that should be taken into account when reviewing
                the device constraint.
            """
            self.driver = driver
            self.firmware = firmware
            self.notes = notes
            VapiStruct.__init__(self)


    DeviceConstraint._set_binding_type(type.StructType(
        'com.vmware.esx.hcl.hosts.compatibility_report.device_constraint', {
            'driver': type.ReferenceType('com.vmware.esx.hcl_client', 'Driver'),
            'firmware': type.OptionalType(type.ReferenceType('com.vmware.esx.hcl_client', 'Firmware')),
            'notes': type.ListType(type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage')),
        },
        DeviceConstraint,
        False,
        None))


    class DeviceHclInfo(VapiStruct):
        """
        This ``CompatibilityReport.DeviceHclInfo`` class contains attributes that
        describe a PCI device of a given ESXi host and its compatibility
        information. 
        
        If there are multiple PCI devices of the same type on the host each one
        will be listed in separate instance of this class.

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




        def __init__(self,
                     compatibility=None,
                     device=None,
                     device_constraints=None,
                     supported_releases=None,
                     vcg_link=None,
                     notes=None,
                    ):
            """
            :type  compatibility: :class:`com.vmware.esx.hcl_client.CompatibilityStatus`
            :param compatibility: Indicates compatibility status of the PCI device.
            :type  device: :class:`com.vmware.esx.hcl_client.PCIDevice`
            :param device: Information about the PCI device.
            :type  device_constraints: :class:`list` of :class:`CompatibilityReport.DeviceConstraint` or ``None``
            :param device_constraints: Lists the constraints the target ESXi release has for this PCI
                device
                If None no constraints are present as PCI device is either not
                compatible or compatibility information is not found.
            :type  supported_releases: :class:`list` of :class:`str` or ``None``
            :param supported_releases: Provides information about supported releases for this device.
                If None device is compatible with the given target release.
            :type  vcg_link: :class:`str` or ``None``
            :param vcg_link: Provides link to the VMware Compatibility Guide for further
                information on the compatibility.
                If None there is no VMware Compatibility link available as this is
                device used by VSAN.
            :type  notes: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage` or ``None``
            :param notes: Information that needs to be taken into account when considering
                this device hcl.
                Only :class:`set` if there is any information reported.
            """
            self.compatibility = compatibility
            self.device = device
            self.device_constraints = device_constraints
            self.supported_releases = supported_releases
            self.vcg_link = vcg_link
            self.notes = notes
            VapiStruct.__init__(self)


    DeviceHclInfo._set_binding_type(type.StructType(
        'com.vmware.esx.hcl.hosts.compatibility_report.device_hcl_info', {
            'compatibility': type.ReferenceType('com.vmware.esx.hcl_client', 'CompatibilityStatus'),
            'device': type.ReferenceType('com.vmware.esx.hcl_client', 'PCIDevice'),
            'device_constraints': type.OptionalType(type.ListType(type.ReferenceType(__name__, 'CompatibilityReport.DeviceConstraint'))),
            'supported_releases': type.OptionalType(type.ListType(type.StringType())),
            'vcg_link': type.OptionalType(type.URIType()),
            'notes': type.OptionalType(type.ListType(type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage'))),
        },
        DeviceHclInfo,
        False,
        None))


    class HclReport(VapiStruct):
        """
        This ``CompatibilityReport.HclReport`` represents the hardware
        compatibility report generated for a specific host and target ESXi release.

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




        def __init__(self,
                     host=None,
                     target_release=None,
                     server_hcl=None,
                     devices_hcl=None,
                     generated_at=None,
                     notifications=None,
                    ):
            """
            :type  host: :class:`str`
            :param host: FQDN identifying the ESXi host that the report refers to.
            :type  target_release: :class:`str`
            :param target_release: Indicates for which ESXi release the report is generated.
            :type  server_hcl: :class:`CompatibilityReport.ServerHclInfo`
            :param server_hcl: Lists compatibility information for the ESXi's server part.
            :type  devices_hcl: :class:`list` of :class:`CompatibilityReport.DeviceHclInfo` or ``None``
            :param devices_hcl: Lists compatibility information for discoverable PCI devices of the
                host.
                If None the server is not compatible with the requested release and
                the PCI devices cannot be checked.
            :type  generated_at: :class:`datetime.datetime`
            :param generated_at: Specifies the time the report was generated.
            :type  notifications: :class:`com.vmware.esx.hcl_client.Notifications`
            :param notifications: Notifications returned by the operation.
            """
            self.host = host
            self.target_release = target_release
            self.server_hcl = server_hcl
            self.devices_hcl = devices_hcl
            self.generated_at = generated_at
            self.notifications = notifications
            VapiStruct.__init__(self)


    HclReport._set_binding_type(type.StructType(
        'com.vmware.esx.hcl.hosts.compatibility_report.hcl_report', {
            'host': type.URIType(),
            'target_release': type.StringType(),
            'server_hcl': type.ReferenceType(__name__, 'CompatibilityReport.ServerHclInfo'),
            'devices_hcl': type.OptionalType(type.ListType(type.ReferenceType(__name__, 'CompatibilityReport.DeviceHclInfo'))),
            'generated_at': type.DateTimeType(),
            'notifications': type.ReferenceType('com.vmware.esx.hcl_client', 'Notifications'),
        },
        HclReport,
        False,
        None))


    class Result(VapiStruct):
        """
        The ``CompatibilityReport.Result`` class contains the result of hardware
        compatibility report creation operation.

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




        def __init__(self,
                     report=None,
                     identifier=None,
                    ):
            """
            :type  report: :class:`CompatibilityReport.HclReport`
            :param report: The hardware compatibility report.
            :type  identifier: :class:`str` or ``None``
            :param identifier: The identifier of the compatibility report. 
                
                :func:`com.vmware.esx.hcl_client.Reports.get` provides location
                where a file based report based on the
                ``CompatibilityReport.HclReport`` can be downloaded using this
                identifier.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.esx.hcl.resources.CompatibilityReport``. When methods
                return a value of this class as a return value, the attribute will
                be an identifier for the resource type:
                ``com.vmware.esx.hcl.resources.CompatibilityReport``.
                None in case of error reported in
                :attr:`CompatibilityReport.HclReport.notifications`.
            """
            self.report = report
            self.identifier = identifier
            VapiStruct.__init__(self)


    Result._set_binding_type(type.StructType(
        'com.vmware.esx.hcl.hosts.compatibility_report.result', {
            'report': type.ReferenceType(__name__, 'CompatibilityReport.HclReport'),
            'identifier': type.OptionalType(type.IdType()),
        },
        Result,
        False,
        None))


    class Spec(VapiStruct):
        """
        The ``CompatibilityReport.Spec`` class contains attributes to describe the
        input configuration for an ESXi's compatibility report generation.

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




        def __init__(self,
                     release=None,
                    ):
            """
            :type  release: :class:`str`
            :param release: A target ESXi release which will be used to generate a
                compatibility report. Releases that can be used to generate report
                can be found using :func:`CompatibilityReleases.list`
            """
            self.release = release
            VapiStruct.__init__(self)


    Spec._set_binding_type(type.StructType(
        'com.vmware.esx.hcl.hosts.compatibility_report.spec', {
            'release': type.StringType(),
        },
        Spec,
        False,
        None))




    def create_task(self,
               host,
               spec=None,
               ):
        """
        Generates hardware compatibility report for a specified ESXi host
        against specific ESXi release.
        
        The result of this operation can be queried by calling the
        cis/tasks/{task-id} where the task-id is the response of this
        operation.

        :type  host: :class:`str`
        :param host: Contains the MoID identifying the ESXi host.
            The parameter must be an identifier for the resource type:
            ``HostSystem``.
        :type  spec: :class:`CompatibilityReport.Spec` or ``None``
        :param spec: Specifies the input parameters for generating compatibility report.
            If None host compatibility will be checked against the current
            release of the ESXi.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if no host with the given MoID can be found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the caller is not authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unsupported` 
            if the provided host is not supported.
        :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.NotAllowedInCurrentState` 
            if there is no compatibility data on the vCenter executing the
            operation.
        :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.
        """
        task_id = self._invoke('create$task',
                                {
                                'host': host,
                                'spec': spec,
                                })
        task_svc = Tasks(self._config)
        task_instance = Task(task_id, task_svc, type.ReferenceType(__name__, 'CompatibilityReport.Result'))
        return task_instance

    def get(self,
            host,
            ):
        """
        Returns the last generated hardware compatibility report for the given
        host.

        :type  host: :class:`str`
        :param host: 
            The parameter must be an identifier for the resource type:
            ``HostSystem``.
        :rtype: :class:`CompatibilityReport.Result`
        :return: 
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if there is no report generated for the given host. This operation
            does not check if the host id is valid or it exists.
        :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.
        """
        return self._invoke('get',
                            {
                            'host': host,
                            })
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,
                            })
Esempio n. 19
0
            Only :class:`set` for warnings and errors.
        """
        self.notification = notification
        self.time = time
        self.message = message
        self.resolution = resolution
        VapiStruct.__init__(self)


Notification._set_binding_type(
    type.StructType(
        'com.vmware.appliance.infraprofile.notification', {
            'notification':
            type.IdType(resource_types='com.vmware.infraprofile.notification'),
            'time':
            type.OptionalType(type.DateTimeType()),
            'message':
            type.ReferenceType('com.vmware.vapi.std_client',
                               'LocalizableMessage'),
            'resolution':
            type.OptionalType(
                type.ReferenceType('com.vmware.vapi.std_client',
                                   'LocalizableMessage')),
        }, Notification, False, None))


class Notifications(VapiStruct):
    """
    The ``Notifications`` class contains info/warning/error messages that can
    be reported be the task.
Esempio n. 20
0
class InteropReport(VapiInterface):
    """
    The ``InteropReport`` interface provides methods to report the
    interoperability between a vCenter Server release version and the other
    installed VMware products registered in the vCenter Server instance.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.lcm.discovery.interop_report'
    """
    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, _InteropReportStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update({'create_task': 'create$task'})

    class ReleaseInfo(VapiStruct):
        """
        The ``InteropReport.ReleaseInfo`` class contains a product release
        information.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            version=None,
            note=None,
        ):
            """
            :type  version: :class:`str`
            :param version: The version of the release.
            :type  note: :class:`str` or ``None``
            :param note: A link to the release notes of the release.
                None if the release notes are not available.
            """
            self.version = version
            self.note = note
            VapiStruct.__init__(self)

    ReleaseInfo._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.discovery.interop_report.release_info', {
                'version': type.StringType(),
                'note': type.OptionalType(type.URIType()),
            }, ReleaseInfo, False, None))

    class ReportRow(VapiStruct):
        """
        The ``InteropReport.ReportRow`` class contains the interoperability between
        a given product and the target product.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            product=None,
            compatible=None,
            compatible_releases=None,
        ):
            """
            :type  product: :class:`Product`
            :param product: The product to compare to the target product.
            :type  compatible: :class:`bool`
            :param compatible: Defines whether the product is compatible against the target
                product.
            :type  compatible_releases: :class:`list` of :class:`InteropReport.ReleaseInfo`
            :param compatible_releases: A list of compatible releases of the product with the target
                product.
            """
            self.product = product
            self.compatible = compatible
            self.compatible_releases = compatible_releases
            VapiStruct.__init__(self)

    ReportRow._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.discovery.interop_report.report_row', {
                'product':
                type.ReferenceType(__name__, 'Product'),
                'compatible':
                type.BooleanType(),
                'compatible_releases':
                type.ListType(
                    type.ReferenceType(__name__, 'InteropReport.ReleaseInfo')),
            }, ReportRow, False, None))

    class ReportSummary(VapiStruct):
        """
        The ``InteropReport.ReportSummary`` class contains a summary of the
        :attr:`InteropReport.Report.products`. It consists of the count of
        compatible and incompatible products to the target product.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            compatible_count=None,
            incompatible_count=None,
        ):
            """
            :type  compatible_count: :class:`long`
            :param compatible_count: Number of compatible products.
            :type  incompatible_count: :class:`long`
            :param incompatible_count: Number of incompatible products.
            """
            self.compatible_count = compatible_count
            self.incompatible_count = incompatible_count
            VapiStruct.__init__(self)

    ReportSummary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.discovery.interop_report.report_summary', {
                'compatible_count': type.IntegerType(),
                'incompatible_count': type.IntegerType(),
            }, ReportSummary, False, None))

    class Report(VapiStruct):
        """
        The ``InteropReport.Report`` class contains the interoperability report
        between the target product and the other registered products in the vCenter
        Server instance.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            date_created=None,
            target_product=None,
            products=None,
            issues=None,
            summary=None,
        ):
            """
            :type  date_created: :class:`datetime.datetime`
            :param date_created: Time when the report is created.
            :type  target_product: :class:`Product`
            :param target_product: A product against the other products are compared to. Only vCenter
                Server is supported.
            :type  products: :class:`list` of :class:`InteropReport.ReportRow`
            :param products: Interoperability matrix for the supplied target product and the
                other registered products.
            :type  issues: :class:`com.vmware.vcenter.lcm_client.Notifications` or ``None``
            :param issues: Lists of issues encountered during report creation.
                :class:`set` if any issues encountered.
            :type  summary: :class:`InteropReport.ReportSummary`
            :param summary: A summary of the interoperability matrix.
            """
            self.date_created = date_created
            self.target_product = target_product
            self.products = products
            self.issues = issues
            self.summary = summary
            VapiStruct.__init__(self)

    Report._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.discovery.interop_report.report', {
                'date_created':
                type.DateTimeType(),
                'target_product':
                type.ReferenceType(__name__, 'Product'),
                'products':
                type.ListType(
                    type.ReferenceType(__name__, 'InteropReport.ReportRow')),
                'issues':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vcenter.lcm_client',
                                       'Notifications')),
                'summary':
                type.ReferenceType(__name__, 'InteropReport.ReportSummary'),
            }, Report, False, None))

    class Result(VapiStruct):
        """
        The ``InteropReport.Result`` class contains the result of interoperability
        report creation operation.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            report=None,
            csv_report=None,
        ):
            """
            :type  report: :class:`InteropReport.Report`
            :param report: The interoperability report.
            :type  csv_report: :class:`str` or ``None``
            :param csv_report: The identifier of CSV formatted interopability report. 
                
                com.vmware.vcenter.lcm.report.Report#get provides location where
                the CSV report can be downloaded from based on the ``csvReport``.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.lcm.report``. 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.lcm.report``.
                None in case of ``errors`` reported in
                :attr:`InteropReport.Report.issues`.
            """
            self.report = report
            self.csv_report = csv_report
            VapiStruct.__init__(self)

    Result._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.discovery.interop_report.result', {
                'report': type.ReferenceType(__name__, 'InteropReport.Report'),
                'csv_report': type.OptionalType(type.IdType()),
            }, Result, False, None))

    class Spec(VapiStruct):
        """
        Configuration of report generation.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            target_version=None,
        ):
            """
            :type  target_version: :class:`str`
            :param target_version: The vCenter Server version. 
                
                It is used for checking against the other products registered with
                that instance of vCenter Server.
            """
            self.target_version = target_version
            VapiStruct.__init__(self)

    Spec._set_binding_type(
        type.StructType('com.vmware.vcenter.lcm.discovery.interop_report.spec',
                        {
                            'target_version': type.StringType(),
                        }, Spec, False, None))

    def create_task(
        self,
        spec=None,
    ):
        """
        Creates interoperability report between a vCenter Server release
        version and all registered products with the vCenter Server instance. 
        
        The result of this operation can be queried by calling the
        com.vmware.cis.Tasks#get method where ``task`` is the response of this
        operation.

        :type  spec: :class:`InteropReport.Spec` or ``None``
        :param spec: 
            Specifies the target version against this interoperability check
            report will be generated. If None the report will be generated for
            the currently installed version of the vCenter server.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :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.
        """
        task_id = self._invoke('create$task', {
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ReferenceType(__name__, 'InteropReport.Result'))
        return task_instance
Esempio n. 21
0
class Archive(VapiInterface):
    """
    The ``Archive`` class provides methods to get the backup information. This
    class was added in vSphere API 6.7.
    """

    _VAPI_SERVICE_ID = 'com.vmware.appliance.recovery.backup.system_name.archive'
    """
    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, _ArchiveStub)
        self._VAPI_OPERATION_IDS = {}

    class Info(VapiStruct):
        """
        The ``Archive.Info`` class represents backup archive information. 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,
            timestamp=None,
            location=None,
            parts=None,
            version=None,
            system_name=None,
            comment=None,
        ):
            """
            :type  timestamp: :class:`datetime.datetime`
            :param timestamp: Time when this backup was completed. This attribute was added in
                vSphere API 6.7.
            :type  location: :class:`str`
            :param location: Backup location URL. This attribute was added in vSphere API 6.7.
            :type  parts: :class:`list` of :class:`str`
            :param parts: List of parts included in the backup. This attribute was added in
                vSphere API 6.7.
            :type  version: :class:`str`
            :param version: The version of the appliance represented by the backup. This
                attribute was added in vSphere API 6.7.
            :type  system_name: :class:`str`
            :param system_name: The system name identifier of the appliance represented by the
                backup. 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.backup.system_name``. 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.backup.system_name``.
            :type  comment: :class:`str`
            :param comment: Custom comment added by the user for this backup. This attribute
                was added in vSphere API 6.7.
            """
            self.timestamp = timestamp
            self.location = location
            self.parts = parts
            self.version = version
            self.system_name = system_name
            self.comment = comment
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.backup.system_name.archive.info', {
                'timestamp':
                type.DateTimeType(),
                'location':
                type.URIType(),
                'parts':
                type.ListType(type.StringType()),
                'version':
                type.StringType(),
                'system_name':
                type.IdType(
                    resource_types=
                    'com.vmware.appliance.recovery.backup.system_name'),
                'comment':
                type.StringType(),
            }, Info, False, None))

    class Summary(VapiStruct):
        """
        The ``Archive.Summary`` class contains commonly used information about a
        backup archive. 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,
            archive=None,
            timestamp=None,
            version=None,
            comment=None,
        ):
            """
            :type  archive: :class:`str`
            :param archive: Backup archive identifier. 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.backup.system_name.archive``. 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.backup.system_name.archive``.
            :type  timestamp: :class:`datetime.datetime`
            :param timestamp: Time when this backup was started. This attribute was added in
                vSphere API 6.7.
            :type  version: :class:`str`
            :param version: The version of the appliance represented by the backup archive.
                This attribute was added in vSphere API 6.7.
            :type  comment: :class:`str`
            :param comment: Custom comment added by the user for this backup. This attribute
                was added in vSphere API 6.7.
            """
            self.archive = archive
            self.timestamp = timestamp
            self.version = version
            self.comment = comment
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.backup.system_name.archive.summary',
            {
                'archive':
                type.IdType(
                    resource_types=
                    'com.vmware.appliance.recovery.backup.system_name.archive'
                ),
                'timestamp':
                type.DateTimeType(),
                'version':
                type.StringType(),
                'comment':
                type.StringType(),
            }, Summary, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``Archive.FilterSpec`` class contains attributes used to filter the
        results when listing backup archives (see :func:`Archive.list`). If
        multiple attributes are specified, only backup archives matching all of the
        attributes match the filter. 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,
            start_timestamp=None,
            end_timestamp=None,
            comment_substring=None,
            max_results=None,
        ):
            """
            :type  start_timestamp: :class:`datetime.datetime` or ``None``
            :param start_timestamp: Backup must have been taken on or after this time to match the
                filter. This attribute was added in vSphere API 6.7.
                If None the filter will match oldest backups.
            :type  end_timestamp: :class:`datetime.datetime` or ``None``
            :param end_timestamp: Backup must have been taken on or before this time to match the
                filter. This attribute was added in vSphere API 6.7.
                If None the filter will match most recent backups.
            :type  comment_substring: :class:`str` or ``None``
            :param comment_substring: Backup comment must contain this :class:`str` to match the filter.
                This attribute was added in vSphere API 6.7.
                If None the filter will match backups with any comment.
            :type  max_results: :class:`long` or ``None``
            :param max_results: Limit result to a max count of most recent backups. This attribute
                was added in vSphere API 6.7.
                If None it defaults to 128.
            """
            self.start_timestamp = start_timestamp
            self.end_timestamp = end_timestamp
            self.comment_substring = comment_substring
            self.max_results = max_results
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.backup.system_name.archive.filter_spec',
            {
                'start_timestamp': type.OptionalType(type.DateTimeType()),
                'end_timestamp': type.OptionalType(type.DateTimeType()),
                'comment_substring': type.OptionalType(type.StringType()),
                'max_results': type.OptionalType(type.IntegerType()),
            }, FilterSpec, False, None))

    def get(
        self,
        spec,
        system_name,
        archive,
    ):
        """
        Returns the information for backup corresponding to given backup
        location and system name. This method was added in vSphere API 6.7.

        :type  spec: :class:`com.vmware.appliance.recovery.backup_client.LocationSpec`
        :param spec: LocationSpec Structure.
        :type  system_name: :class:`str`
        :param system_name: System name identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.recovery.backup.system_name``.
        :type  archive: :class:`str`
        :param archive: Archive identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.recovery.backup.system_name.archive``.
        :rtype: :class:`Archive.Info`
        :return: Info Structure.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if backup does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any error occurs during the execution of the operation.
        """
        return self._invoke('get', {
            'spec': spec,
            'system_name': system_name,
            'archive': archive,
        })

    def list(
        self,
        loc_spec,
        system_name,
        filter_spec,
    ):
        """
        Returns information about backup archives corresponding to given backup
        location and system name, which match the :class:`Archive.FilterSpec`.
        This method was added in vSphere API 6.7.

        :type  loc_spec: :class:`com.vmware.appliance.recovery.backup_client.LocationSpec`
        :param loc_spec: LocationSpec Structure.
        :type  system_name: :class:`str`
        :param system_name: System name identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.recovery.backup.system_name``.
        :type  filter_spec: :class:`Archive.FilterSpec`
        :param filter_spec: Specification of matching backups for which information should be
            returned.
        :rtype: :class:`list` of :class:`Archive.Summary`
        :return: Commonly used information about the backup archives.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if combination of ``loc_spec`` and system name does not refer to an
            existing location on the backup server.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any error occurs during the execution of the operation.
        """
        return self._invoke(
            'list', {
                'loc_spec': loc_spec,
                'system_name': system_name,
                'filter_spec': filter_spec,
            })
Esempio n. 22
0
            notification.
        """
        self.id = id
        self.time = time
        self.message = message
        self.resolution = resolution
        VapiStruct.__init__(self)


Notification._set_binding_type(
    type.StructType(
        'com.vmware.esx.hcl.notification', {
            'id':
            type.StringType(),
            'time':
            type.DateTimeType(),
            'message':
            type.ReferenceType('com.vmware.vapi.std_client',
                               'LocalizableMessage'),
            'resolution':
            type.OptionalType(
                type.ReferenceType('com.vmware.vapi.std_client',
                                   'LocalizableMessage')),
        }, Notification, False, None))


class Notifications(VapiStruct):
    """
    The ``Notifications`` class contains info/warning/error messages that can
    be reported be the task.
Esempio n. 23
0
class Clusters(VapiInterface):
    """
    The ``Clusters`` class provides methods to upgrade the vSphere clusters.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.namespace_management.software.clusters'
    """
    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, _ClustersStub)
        self._VAPI_OPERATION_IDS = {}

    class State(Enum):
        """
        The ``Clusters.State`` class describes the state of the upgrade.

        .. 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>`.
        """
        PENDING = None
        """
        Upgrade is in progress.

        """
        READY = None
        """
        Cluster is ready when there is no upgrade or upgrade is completed.

        """
        ERROR = None
        """
        Upgrade failed and need user intervention.

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`State` instance.
            """
            Enum.__init__(string)

    State._set_values([
        State('PENDING'),
        State('READY'),
        State('ERROR'),
    ])
    State._set_binding_type(
        type.EnumType(
            'com.vmware.vcenter.namespace_management.software.clusters.state',
            State))

    class Result(VapiStruct):
        """
        The ``Clusters.Result`` class contains the result of batch upgrade method.

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

        _validator_list = [
            UnionValidator('res', {
                'REJECTED': [('exception', True)],
                'STARTED': [],
            }),
        ]

        def __init__(
            self,
            res=None,
            exception=None,
        ):
            """
            :type  res: :class:`Clusters.Result.Res`
            :param res: The result of batch upgrade method.
            :type  exception: :class:`Exception`
            :param exception: Exception when cluster pre-check failed during upgrade invocation.
                This attribute is optional and it is only relevant when the value
                of ``res`` is :attr:`Clusters.Result.Res.REJECTED`.
            """
            self.res = res
            self.exception = exception
            VapiStruct.__init__(self)

        class Res(Enum):
            """
            The ``Clusters.Result.Res`` class represents the upgrade invocation result
            for each cluster.

            .. 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>`.
            """
            STARTED = None
            """
            Upgrade is started.

            """
            REJECTED = None
            """
            Upgrade is rejected. This implies pre-check failed when invoking upgrade of
            the cluster.

            """
            def __init__(self, string):
                """
                :type  string: :class:`str`
                :param string: String value for the :class:`Res` instance.
                """
                Enum.__init__(string)

        Res._set_values([
            Res('STARTED'),
            Res('REJECTED'),
        ])
        Res._set_binding_type(
            type.EnumType(
                'com.vmware.vcenter.namespace_management.software.clusters.result.res',
                Res))

    Result._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.namespace_management.software.clusters.result',
            {
                'res': type.ReferenceType(__name__, 'Clusters.Result.Res'),
                'exception': type.OptionalType(type.AnyErrorType()),
            }, Result, False, None))

    class UpgradeSpec(VapiStruct):
        """
        The ``Clusters.UpgradeSpec`` class contains the specification required to
        upgrade a cluster.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            desired_version=None,
            ignore_precheck_warnings=None,
        ):
            """
            :type  desired_version: :class:`str`
            :param desired_version: Version number the cluster is going to be upgraded to.
            :type  ignore_precheck_warnings: :class:`bool` or ``None``
            :param ignore_precheck_warnings: If true, the upgrade workflow will ignore any pre-check warnings
                and proceed with the upgrade.
                If None, the upgrade workflow will not ignore pre-check warnings
                and fail the upgrade. It is equivalent to setting the value to
                false. The workflow adopts a conservative approach of failing the
                upgrade if None to solely let the user decide whether to force the
                upgrade despite the warnings.
            """
            self.desired_version = desired_version
            self.ignore_precheck_warnings = ignore_precheck_warnings
            VapiStruct.__init__(self)

    UpgradeSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.namespace_management.software.clusters.upgrade_spec',
            {
                'desired_version': type.StringType(),
                'ignore_precheck_warnings': type.OptionalType(
                    type.BooleanType()),
            }, UpgradeSpec, False, None))

    class Summary(VapiStruct):
        """
        The ``Clusters.Summary`` class contains basic information about the cluster
        upgrade related information.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            cluster=None,
            cluster_name=None,
            current_version=None,
            available_versions=None,
            last_upgraded_date=None,
            desired_version=None,
            state=None,
        ):
            """
            :type  cluster: :class:`str`
            :param cluster: Identifier for the cluster.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``ClusterComputeResource``. When methods return a value of this
                class as a return value, the attribute will be an identifier for
                the resource type: ``ClusterComputeResource``.
            :type  cluster_name: :class:`str`
            :param cluster_name: Name of the cluster.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``ClusterComputeResource.name``. When methods return a value of
                this class as a return value, the attribute will be an identifier
                for the resource type: ``ClusterComputeResource.name``.
            :type  current_version: :class:`str`
            :param current_version: Current version of the cluster.
            :type  available_versions: :class:`list` of :class:`str`
            :param available_versions: Set of versions available for upgrade.
            :type  last_upgraded_date: :class:`datetime.datetime` or ``None``
            :param last_upgraded_date: Date of last successful upgrade.
                If None, the cluster has not yet been upgraded.
            :type  desired_version: :class:`str` or ``None``
            :param desired_version: Desired version the cluster will be upgraded to.
                If None, the cluster upgrade is not in progress.
            :type  state: :class:`Clusters.State`
            :param state: Current state of the upgrade.
            """
            self.cluster = cluster
            self.cluster_name = cluster_name
            self.current_version = current_version
            self.available_versions = available_versions
            self.last_upgraded_date = last_upgraded_date
            self.desired_version = desired_version
            self.state = state
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.namespace_management.software.clusters.summary',
            {
                'cluster':
                type.IdType(resource_types='ClusterComputeResource'),
                'cluster_name':
                type.IdType(resource_types='ClusterComputeResource.name'),
                'current_version':
                type.StringType(),
                'available_versions':
                type.ListType(type.StringType()),
                'last_upgraded_date':
                type.OptionalType(type.DateTimeType()),
                'desired_version':
                type.OptionalType(type.StringType()),
                'state':
                type.ReferenceType(__name__, 'Clusters.State'),
            }, Summary, False, None))

    class Info(VapiStruct):
        """
        The ``Clusters.Info`` class contains detailed information about the cluster
        upgrade status and related information.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            current_version=None,
            available_versions=None,
            last_upgraded_date=None,
            messages=None,
            state=None,
            upgrade_status=None,
        ):
            """
            :type  current_version: :class:`str`
            :param current_version: Current version of the cluster.
            :type  available_versions: :class:`list` of :class:`str`
            :param available_versions: Set of available versions can be upgraded to.
            :type  last_upgraded_date: :class:`datetime.datetime` or ``None``
            :param last_upgraded_date: Date of last successful upgrade.
                If None, the cluster has not yet been upgraded.
            :type  messages: :class:`list` of :class:`Clusters.Message`
            :param messages: Current set of messages associated with the cluster version.
            :type  state: :class:`Clusters.State`
            :param state: Current state of the upgrade.
            :type  upgrade_status: :class:`Clusters.UpgradeStatus` or ``None``
            :param upgrade_status: Information about upgrade in progress.
                If None, the cluster upgrade is not in progress.
            """
            self.current_version = current_version
            self.available_versions = available_versions
            self.last_upgraded_date = last_upgraded_date
            self.messages = messages
            self.state = state
            self.upgrade_status = upgrade_status
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.namespace_management.software.clusters.info', {
                'current_version':
                type.StringType(),
                'available_versions':
                type.ListType(type.StringType()),
                'last_upgraded_date':
                type.OptionalType(type.DateTimeType()),
                'messages':
                type.ListType(type.ReferenceType(__name__,
                                                 'Clusters.Message')),
                'state':
                type.ReferenceType(__name__, 'Clusters.State'),
                'upgrade_status':
                type.OptionalType(
                    type.ReferenceType(__name__, 'Clusters.UpgradeStatus')),
            }, Info, False, None))

    class UpgradeStatus(VapiStruct):
        """
        The ``Clusters.UpgradeStatus`` class contains detailed information about
        the cluster when upgraded is in progress.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            desired_version=None,
            messages=None,
            progress=None,
        ):
            """
            :type  desired_version: :class:`str` or ``None``
            :param desired_version: Desired version the cluster will be upgraded to.
                If None, the cluster upgrade is not in progress.
            :type  messages: :class:`list` of :class:`Clusters.Message`
            :param messages: Current set of messages associated with the upgrade state.
            :type  progress: :class:`Clusters.UpgradeProgress` or ``None``
            :param progress: Information about upgrade progess.
                If None, the cluster upgrade is not in progress.
            """
            self.desired_version = desired_version
            self.messages = messages
            self.progress = progress
            VapiStruct.__init__(self)

    UpgradeStatus._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.namespace_management.software.clusters.upgrade_status',
            {
                'desired_version':
                type.OptionalType(type.StringType()),
                'messages':
                type.ListType(type.ReferenceType(__name__,
                                                 'Clusters.Message')),
                'progress':
                type.OptionalType(
                    type.ReferenceType(__name__, 'Clusters.UpgradeProgress')),
            }, UpgradeStatus, False, None))

    class UpgradeProgress(VapiStruct):
        """
        The ``Clusters.UpgradeProgress`` class contains detailed information about
        the cluster upgrade progess.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            total=None,
            completed=None,
            message=None,
        ):
            """
            :type  total: :class:`long`
            :param total: Total amount of the work for the operation. The work here
                represents the number of master nodes in the cluster need to be
                upgraded.
            :type  completed: :class:`long`
            :param completed: The amount of work completed for the operation. The value can only
                be incremented. The number or master nodes which upgrade completed.
            :type  message: :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param message: Message about the work progress.
            """
            self.total = total
            self.completed = completed
            self.message = message
            VapiStruct.__init__(self)

    UpgradeProgress._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.namespace_management.software.clusters.upgrade_progress',
            {
                'total':
                type.IntegerType(),
                'completed':
                type.IntegerType(),
                'message':
                type.ReferenceType('com.vmware.vapi.std_client',
                                   'LocalizableMessage'),
            }, UpgradeProgress, False, None))

    class Message(VapiStruct):
        """
        The ``Clusters.Message`` class contains the information about the object
        configuration.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            severity=None,
            details=None,
        ):
            """
            :type  severity: :class:`Clusters.Message.Severity`
            :param severity: Type of the message.
            :type  details: :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param details: Details about the message.
            """
            self.severity = severity
            self.details = details
            VapiStruct.__init__(self)

        class Severity(Enum):
            """
            The ``Clusters.Message.Severity`` class represents the severity of the
            message.

            .. 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>`.
            """
            INFO = None
            """
            Informational message. This may be accompanied by vCenter event.

            """
            WARNING = None
            """
            Warning message. This may be accompanied by vCenter event.

            """
            ERROR = None
            """
            Error message. This is accompanied by vCenter event and/or alarm.

            """
            def __init__(self, string):
                """
                :type  string: :class:`str`
                :param string: String value for the :class:`Severity` instance.
                """
                Enum.__init__(string)

        Severity._set_values([
            Severity('INFO'),
            Severity('WARNING'),
            Severity('ERROR'),
        ])
        Severity._set_binding_type(
            type.EnumType(
                'com.vmware.vcenter.namespace_management.software.clusters.message.severity',
                Severity))

    Message._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.namespace_management.software.clusters.message',
            {
                'severity':
                type.ReferenceType(__name__, 'Clusters.Message.Severity'),
                'details':
                type.ReferenceType('com.vmware.vapi.std_client',
                                   'LocalizableMessage'),
            }, Message, False, None))

    def upgrade(
        self,
        cluster,
        spec,
    ):
        """
        Upgrade the cluster to a specific version. This operation upgrades the
        components on control plane VMs and worker plane hosts based on the
        selected version. Before upgrading, this operation performs pre-checks
        and sets the evaluation response in Info.UpgradeStatus.messages with
        various Message.Severity levels. Depending on the severity, the upgrade
        may or may not proceed beyond prechecks. Here is a list of severities
        and corresponding behavior: - ERROR: Upgrade does not proceed beyond
        precheck operation - WARNING: Upgrade proceeds beyond precheck
        operation only if UpgradeSpec.ignorePrecheckWarnings is set to true -
        INFO: Upgrade proceeds beyond precheck operation uninterrupted

        :type  cluster: :class:`str`
        :param cluster: Identifier for the cluster which will be upgraded.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`Clusters.UpgradeSpec`
        :param spec: Specification for upgrading the cluster.
        :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.Unsupported` 
            if pre-check failed of the cluster.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if cluster could not be located.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have Namespaces.Manage privilege.
        """
        return self._invoke('upgrade', {
            'cluster': cluster,
            'spec': spec,
        })

    def upgrade_multiple(
        self,
        specs,
    ):
        """
        Upgrade a set of clusters to its corresponding specific version.

        :type  specs: :class:`dict` of :class:`str` and :class:`Clusters.UpgradeSpec`
        :param specs: Specifications for upgrading selected clusters.
            The key in the parameter :class:`dict` must be an identifier for
            the resource type: ``ClusterComputeResource``.
        :rtype: :class:`dict` of :class:`str` and :class:`Clusters.Result`
        :return: Pre-check result when invoking upgrade for each cluster.
            The key in the return value :class:`dict` will be an identifier for
            the resource type: ``ClusterComputeResource``.
        :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have Namespaces.Manage privilege on all
            specified clusters.
        """
        return self._invoke('upgrade_multiple', {
            'specs': specs,
        })

    def get(
        self,
        cluster,
    ):
        """
        Returns upgrade related information of a specific cluster.

        :type  cluster: :class:`str`
        :param cluster: Identifier for the cluster which will be upgraded.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :rtype: :class:`Clusters.Info`
        :return: Information about the upgrade of the specified WCP enabled cluster.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if cluster could not be located.
        :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have System.Read privilege.
        """
        return self._invoke('get', {
            'cluster': cluster,
        })

    def list(self):
        """
        Returns upgrade related information about all WCP enabled clusters.


        :rtype: :class:`list` of :class:`Clusters.Summary`
        :return: List of upgrade summary of all WCP enabled clusters.
        :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have System.Read privilege.
        """
        return self._invoke('list', None)
Esempio n. 24
0
class CompatibilityData(VapiInterface):
    """
    This class provides methods to update the local compatibility data residing
    on the vCenter Appliance or to get information about the said data. The
    information in the data is generic VMware compatibility information for
    servers and devices.
    """

    _VAPI_SERVICE_ID = 'com.vmware.esx.hcl.compatibility_data'
    """
    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, _CompatibilityDataStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update({'update_task': 'update$task'})

    class Status(VapiStruct):
        """
        The ``CompatibilityData.Status`` class contains attributes to describe the
        information available for the compatibility data.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            updated_at=None,
            notifications=None,
        ):
            """
            :type  updated_at: :class:`datetime.datetime`
            :param updated_at: Indicates when the data was last updated.
            :type  notifications: :class:`Notifications`
            :param notifications: Notifications returned by the operation.
            """
            self.updated_at = updated_at
            self.notifications = notifications
            VapiStruct.__init__(self)

    Status._set_binding_type(
        type.StructType(
            'com.vmware.esx.hcl.compatibility_data.status', {
                'updated_at': type.DateTimeType(),
                'notifications': type.ReferenceType(__name__, 'Notifications'),
            }, Status, False, None))

    def get(self):
        """
        Provides information about the compatibility data located on the
        vCenter Appliance.


        :rtype: :class:`CompatibilityData.Status`
        :return: Information about the compatibility data.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if there is no compatibility data on the vCenter executing the
            operation.
        :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', None)

    def update_task(self):
        """
        Replaces the local compatibility data with the latest version found
        from VMware official source.


        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if there is compatibility data update in progress.
        :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.
        """
        task_id = self._invoke('update$task', None)
        task_svc = Tasks(self._config)
        task_instance = Task(task_id, task_svc, type.VoidType())
        return task_instance
Esempio n. 25
0
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)
Esempio n. 26
0
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,
        })
Esempio n. 27
0
class Pending(VapiInterface):
    """
    The ``Pending`` class provides method for listing pending minor or major
    updates of vCenter Server.
    """
    RESOURCE_TYPE = "com.vmware.vcenter.lcm.update.pending"
    """
    Resource type for pending update

    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.lcm.update.pending'
    """
    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, _PendingStub)
        self._VAPI_OPERATION_IDS = {}

    class SeverityType(Enum):
        """
        Level of severity for applying a given patch or update.

        .. 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>`.
        """
        CRITICAL = None
        """
        Vulnerabilities that can be exploited by an unauthenticated attacker from
        the Internet or those that break the guest/host Operating System isolation.

        """
        IMPORTANT = None
        """
        Vulnerabilities that are not rated critical but whose exploitation results
        in the complete compromise of confidentiality and/or integrity of user data
        and/or processing resources through user assistance or by authenticated
        attackers.

        """
        MODERATE = None
        """
        Vulnerabilities where the ability to exploit is mitigated to a significant
        degree by configuration or difficulty of exploitation, but in certain
        deployment scenarios could still lead to the compromise of confidentiality,
        integrity, or availability of user data and/or processing resources.

        """
        LOW = None
        """
        All other issues that may or maynot have a security impact. Vulnerabilities
        where exploitation is believed to be extremely difficult, or where
        successful exploitation would have minimal impact.

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`SeverityType` instance.
            """
            Enum.__init__(string)

    SeverityType._set_values([
        SeverityType('CRITICAL'),
        SeverityType('IMPORTANT'),
        SeverityType('MODERATE'),
        SeverityType('LOW'),
    ])
    SeverityType._set_binding_type(
        type.EnumType('com.vmware.vcenter.lcm.update.pending.severity_type',
                      SeverityType))

    class Category(Enum):
        """
        The ``Pending.Category`` class defines the type of payload this release has
        on top of previous release

        .. 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>`.
        """
        SECURITY = None
        """
        Fixes vulnerabilities, doesn't change functionality

        """
        FIX = None
        """
        Fixes bugs/vulnerabilities, doesn't change functionality

        """
        UPDATE = None
        """
        Changes product functionality

        """
        UPGRADE = None
        """
        Introduces new features, significantly changes product functionality

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`Category` instance.
            """
            Enum.__init__(string)

    Category._set_values([
        Category('SECURITY'),
        Category('FIX'),
        Category('UPDATE'),
        Category('UPGRADE'),
    ])
    Category._set_binding_type(
        type.EnumType('com.vmware.vcenter.lcm.update.pending.category',
                      Category))

    class UpdateType(Enum):
        """
        The ``Pending.UpdateType`` class defines update type

        .. 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>`.
        """
        PATCH = None
        """
        Fixes bugs/vulnerabilities, doesn't change functionality

        """
        UPDATE = None
        """
        Changes product functionality

        """
        UPGRADE = None
        """
        Introduces new features, significantly changes product functionality

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`UpdateType` instance.
            """
            Enum.__init__(string)

    UpdateType._set_values([
        UpdateType('PATCH'),
        UpdateType('UPDATE'),
        UpdateType('UPGRADE'),
    ])
    UpdateType._set_binding_type(
        type.EnumType('com.vmware.vcenter.lcm.update.pending.update_type',
                      UpdateType))

    class Summary(VapiStruct):
        """
        The ``Pending.Summary`` class contains basic information about the vCenter
        patch/update/upgrade

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

        _canonical_to_pep_names = {
            'execute_URL': 'execute_url',
        }

        def __init__(
            self,
            pending_update=None,
            version=None,
            release_date=None,
            severity=None,
            build=None,
            update_type=None,
            category=None,
            reboot_required=None,
            execute_url=None,
            release_notes=None,
        ):
            """
            :type  pending_update: :class:`str`
            :param pending_update: Identifier of the given vSphere update
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.lcm.update.pending``. 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.lcm.update.pending``.
            :type  version: :class:`str`
            :param version: Version of the vSphere update or patch
            :type  release_date: :class:`datetime.datetime`
            :param release_date: Release date of the vSphere update or patch
            :type  severity: :class:`Pending.SeverityType`
            :param severity: Severity of the issues fixed in the vSphere update or patch
            :type  build: :class:`str`
            :param build: Build number of the vCenter Release
            :type  update_type: :class:`Pending.UpdateType`
            :param update_type: Type of the Release based on the current vCenter version
            :type  category: :class:`Pending.Category`
            :param category: Category of the release based on features bundled on top of
                previous release
            :type  reboot_required: :class:`bool`
            :param reboot_required: Flag to suggest a reboot after the release is applied
            :type  execute_url: :class:`str`
            :param execute_url: VAMI or ISO URL for update or upgrade execute phase redirection
            :type  release_notes: :class:`list` of :class:`str`
            :param release_notes: List of URI pointing to patch or update release notes
            """
            self.pending_update = pending_update
            self.version = version
            self.release_date = release_date
            self.severity = severity
            self.build = build
            self.update_type = update_type
            self.category = category
            self.reboot_required = reboot_required
            self.execute_url = execute_url
            self.release_notes = release_notes
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.update.pending.summary', {
                'pending_update':
                type.IdType(
                    resource_types='com.vmware.vcenter.lcm.update.pending'),
                'version':
                type.StringType(),
                'release_date':
                type.DateTimeType(),
                'severity':
                type.ReferenceType(__name__, 'Pending.SeverityType'),
                'build':
                type.StringType(),
                'update_type':
                type.ReferenceType(__name__, 'Pending.UpdateType'),
                'category':
                type.ReferenceType(__name__, 'Pending.Category'),
                'reboot_required':
                type.BooleanType(),
                'execute_URL':
                type.URIType(),
                'release_notes':
                type.ListType(type.URIType()),
            }, Summary, False, None))

    class ListResult(VapiStruct):
        """
        The ``Pending.ListResult`` class contains information about the pending
        patch/updates for the given vCenter server.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            last_check_time=None,
            update_count=None,
            upgrade_count=None,
            updates=None,
            issues=None,
        ):
            """
            :type  last_check_time: :class:`datetime.datetime`
            :param last_check_time: Time when the software depo was last checked.
            :type  update_count: :class:`long` or ``None``
            :param update_count: Number of pending updates
                Only :class:`set` if there are available updates
            :type  upgrade_count: :class:`long` or ``None``
            :param upgrade_count: Number of pending upgrades
                Only :class:`set` if there are available upgrades
            :type  updates: :class:`list` of :class:`Pending.Summary`
            :param updates: List of pending update details
            :type  issues: :class:`com.vmware.vcenter.lcm_client.Notifications` or ``None``
            :param issues: Lists of issues encountered during pending updates retrieval.
                :class:`set` if any issues encountered.
            """
            self.last_check_time = last_check_time
            self.update_count = update_count
            self.upgrade_count = upgrade_count
            self.updates = updates
            self.issues = issues
            VapiStruct.__init__(self)

    ListResult._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.update.pending.list_result', {
                'last_check_time':
                type.DateTimeType(),
                'update_count':
                type.OptionalType(type.IntegerType()),
                'upgrade_count':
                type.OptionalType(type.IntegerType()),
                'updates':
                type.ListType(type.ReferenceType(__name__, 'Pending.Summary')),
                'issues':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vcenter.lcm_client',
                                       'Notifications')),
            }, ListResult, False, None))

    class Info(VapiStruct):
        """
        The ``Pending.Info`` class contains detailed information about the vCenter
        patch/update.

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

        _canonical_to_pep_names = {
            'execute_URL': 'execute_url',
        }

        def __init__(
            self,
            description=None,
            pending_update=None,
            version=None,
            release_date=None,
            severity=None,
            build=None,
            update_type=None,
            category=None,
            reboot_required=None,
            execute_url=None,
            release_notes=None,
        ):
            """
            :type  description: :class:`str`
            :param description: Description of the vSphere update
            :type  pending_update: :class:`str`
            :param pending_update: Identifier of the given vSphere update
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.lcm.update.pending``. 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.lcm.update.pending``.
            :type  version: :class:`str`
            :param version: Version of the vSphere update or patch
            :type  release_date: :class:`datetime.datetime`
            :param release_date: Release date of the vSphere update or patch
            :type  severity: :class:`Pending.SeverityType`
            :param severity: Severity of the issues fixed in the vSphere update or patch
            :type  build: :class:`str`
            :param build: Build number of the vCenter Release
            :type  update_type: :class:`Pending.UpdateType`
            :param update_type: Type of the Release based on the current vCenter version
            :type  category: :class:`Pending.Category`
            :param category: Category of the release based on features bundled on top of
                previous release
            :type  reboot_required: :class:`bool`
            :param reboot_required: Flag to suggest a reboot after the release is applied
            :type  execute_url: :class:`str`
            :param execute_url: VAMI or ISO URL for update or upgrade execute phase redirection
            :type  release_notes: :class:`list` of :class:`str`
            :param release_notes: List of URI pointing to patch or update release notes
            """
            self.description = description
            self.pending_update = pending_update
            self.version = version
            self.release_date = release_date
            self.severity = severity
            self.build = build
            self.update_type = update_type
            self.category = category
            self.reboot_required = reboot_required
            self.execute_url = execute_url
            self.release_notes = release_notes
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.update.pending.info', {
                'description':
                type.StringType(),
                'pending_update':
                type.IdType(
                    resource_types='com.vmware.vcenter.lcm.update.pending'),
                'version':
                type.StringType(),
                'release_date':
                type.DateTimeType(),
                'severity':
                type.ReferenceType(__name__, 'Pending.SeverityType'),
                'build':
                type.StringType(),
                'update_type':
                type.ReferenceType(__name__, 'Pending.UpdateType'),
                'category':
                type.ReferenceType(__name__, 'Pending.Category'),
                'reboot_required':
                type.BooleanType(),
                'execute_URL':
                type.URIType(),
                'release_notes':
                type.ListType(type.URIType()),
            }, Info, False, None))

    def list(self):
        """
        Lists all available minor and major updates.


        :rtype: :class:`Pending.ListResult`
        :return: Information about the pending patch/updates for the given vCenter
            server
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :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 error.
        """
        return self._invoke('list', None)

    def get(
        self,
        version,
    ):
        """
        Gets detailed update information.

        :type  version: :class:`str`
        :param version: A version identified the update
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.lcm.update.pending``.
        :rtype: :class:`Pending.Info`
        :return: A detailed information about the particular vCenter patch/update
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if there is no pending update assosiated with the ``version`` in
            the system.
        :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 error.
        """
        return self._invoke('get', {
            'version': version,
        })
Esempio n. 28
0
class Versions(VapiInterface):
    """
    The ``Versions`` class provides methods to get versions of base-images from
    the sync'ed and imported depots.
    """

    _VAPI_SERVICE_ID = 'com.vmware.esx.settings.depot_content.base_images.versions'
    """
    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, _VersionsStub)
        self._VAPI_OPERATION_IDS = {}

    class CategoryType(Enum):
        """
        The ``Versions.CategoryType`` class defines possible values of categories
        for a base-image.

        .. 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>`.
        """
        SECURITY = None
        """
        Security

        """
        ENHANCEMENT = None
        """
        Enhancement

        """
        BUGFIX = None
        """
        Bugfix

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`CategoryType` instance.
            """
            Enum.__init__(string)

    CategoryType._set_values([
        CategoryType('SECURITY'),
        CategoryType('ENHANCEMENT'),
        CategoryType('BUGFIX'),
    ])
    CategoryType._set_binding_type(
        type.EnumType(
            'com.vmware.esx.settings.depot_content.base_images.versions.category_type',
            CategoryType))

    class ComponentVersionInfo(VapiStruct):
        """
        The ``Versions.ComponentVersionInfo`` class defines the information
        regarding a component present inbase-image.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            name=None,
            display_name=None,
            version=None,
            display_version=None,
        ):
            """
            :type  name: :class:`str`
            :param name: Identifier of the component.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.esx.settings.component``. When methods return a value
                of this class as a return value, the attribute will be an
                identifier for the resource type:
                ``com.vmware.esx.settings.component``.
            :type  display_name: :class:`str`
            :param display_name: Display name of the component.
            :type  version: :class:`str`
            :param version: Version of the component.
            :type  display_version: :class:`str`
            :param display_version: Human readable version of the base-image.
            """
            self.name = name
            self.display_name = display_name
            self.version = version
            self.display_version = display_version
            VapiStruct.__init__(self)

    ComponentVersionInfo._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.depot_content.base_images.versions.component_version_info',
            {
                'name':
                type.IdType(
                    resource_types='com.vmware.esx.settings.component'),
                'display_name':
                type.StringType(),
                'version':
                type.StringType(),
                'display_version':
                type.StringType(),
            }, ComponentVersionInfo, False, None))

    class Info(VapiStruct):
        """
        The ``Versions.Info`` class defines the information regarding a base-image.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            display_name=None,
            version=None,
            display_version=None,
            summary=None,
            description=None,
            category=None,
            kb=None,
            release_date=None,
            components=None,
        ):
            """
            :type  display_name: :class:`str`
            :param display_name: Display name of the base-image.
            :type  version: :class:`str`
            :param version: Version of the base-image.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.esx.settings.base_image``. When methods return a value
                of this class as a return value, the attribute will be an
                identifier for the resource type:
                ``com.vmware.esx.settings.base_image``.
            :type  display_version: :class:`str`
            :param display_version: Human readable version of the base-image.
            :type  summary: :class:`str`
            :param summary: Summary of the base-image.
            :type  description: :class:`str`
            :param description: Discription of the base-image.
            :type  category: :class:`Versions.CategoryType`
            :param category: Category of the base-image.
            :type  kb: :class:`str`
            :param kb: Link to kb article related to this the base-image.
            :type  release_date: :class:`datetime.datetime`
            :param release_date: Release date of the base-image.
            :type  components: :class:`list` of :class:`Versions.ComponentVersionInfo`
            :param components: List of components in this base-image.
            """
            self.display_name = display_name
            self.version = version
            self.display_version = display_version
            self.summary = summary
            self.description = description
            self.category = category
            self.kb = kb
            self.release_date = release_date
            self.components = components
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.depot_content.base_images.versions.info',
            {
                'display_name':
                type.StringType(),
                'version':
                type.IdType(
                    resource_types='com.vmware.esx.settings.base_image'),
                'display_version':
                type.StringType(),
                'summary':
                type.StringType(),
                'description':
                type.StringType(),
                'category':
                type.ReferenceType(__name__, 'Versions.CategoryType'),
                'kb':
                type.URIType(),
                'release_date':
                type.DateTimeType(),
                'components':
                type.ListType(
                    type.ReferenceType(__name__,
                                       'Versions.ComponentVersionInfo')),
            }, Info, False, None))

    def get(
        self,
        version,
    ):
        """
        Returns information about a given base-image version in the depot.

        :type  version: :class:`str`
        :param version: Version of the base-image
        :rtype: :class:`Versions.Info`
        :return: Information about the given base-image
        :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 base-image with given version is not found.
        :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.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``VcIntegrity.lifecycleSettings.Read``.
        """
        return self._invoke('get', {
            'version': version,
        })
        self.end_time = end_time
        self.user = user
        VapiStruct.__init__(self)


CommonInfo._set_binding_type(type.StructType(
    'com.vmware.cis.task.common_info', {
        'description': type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage'),
        'service': type.IdType(resource_types='com.vmware.vapi.service'),
        'operation': type.IdType(resource_types='com.vmware.vapi.operation'),
        'parent': type.OptionalType(type.IdType()),
        'target': type.OptionalType(type.ReferenceType('com.vmware.vapi.std_client', 'DynamicID')),
        'status': type.ReferenceType(__name__, 'Status'),
        'cancelable': type.BooleanType(),
        'error': type.OptionalType(type.AnyErrorType()),
        'start_time': type.OptionalType(type.DateTimeType()),
        'end_time': type.OptionalType(type.DateTimeType()),
        'user': type.OptionalType(type.StringType()),
    },
    CommonInfo,
    False,
    None))



class Info(VapiStruct):
    """
    The ``Info`` class contains information about a task.

    .. tip::
        The arguments are used to initialize data attributes with the same
Esempio n. 30
0
class Projects(VapiInterface):
    """
    The ``Projects`` class provides methods for managing the lifecycle of
    Harbor project that stores and distributes container repositories and
    images.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.content.registries.harbor.projects'
    """
    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, _ProjectsStub)
        self._VAPI_OPERATION_IDS = {}

    class Scope(Enum):
        """
        The ``Projects.Scope`` class in a project defines access levels of the
        project.

        .. note::
            This class represents an enumerated type in the interface language
            definition. The class contains class attributes which represent the
            values in the current version of the enumerated type. Newer versions of
            the enumerated type may contain new values. To use new values of the
            enumerated type in communication with a server that supports the newer
            version of the API, you instantiate this class. See :ref:`enumerated
            type description page <enumeration_description>`.
        """
        PUBLIC = None
        """
        A Harbor project can be accessed by everyone.

        """
        PRIVATE = None
        """
        A Harbor project can only be accessed by assigned users.

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`Scope` instance.
            """
            Enum.__init__(string)

    Scope._set_values([
        Scope('PUBLIC'),
        Scope('PRIVATE'),
    ])
    Scope._set_binding_type(
        type.EnumType(
            'com.vmware.vcenter.content.registries.harbor.projects.scope',
            Scope))

    class ConfigStatus(Enum):
        """
        The ``Projects.ConfigStatus`` class describes the status of reaching the
        desired configuration state for the Harbor project.

        .. note::
            This class represents an enumerated type in the interface language
            definition. The class contains class attributes which represent the
            values in the current version of the enumerated type. Newer versions of
            the enumerated type may contain new values. To use new values of the
            enumerated type in communication with a server that supports the newer
            version of the API, you instantiate this class. See :ref:`enumerated
            type description page <enumeration_description>`.
        """
        PENDING = None
        """
        Harbor project is being created or the configuration is being applied to
        the project.

        """
        REMOVING = None
        """
        The configuration is being removed and Harbor project is being deleted.

        """
        ERROR = None
        """
        Failed to create Harbor project or apply the configuration to the project,
        user intervention needed.

        """
        READY = None
        """
        Harbor project is created or configured correctly.

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`ConfigStatus` instance.
            """
            Enum.__init__(string)

    ConfigStatus._set_values([
        ConfigStatus('PENDING'),
        ConfigStatus('REMOVING'),
        ConfigStatus('ERROR'),
        ConfigStatus('READY'),
    ])
    ConfigStatus._set_binding_type(
        type.EnumType(
            'com.vmware.vcenter.content.registries.harbor.projects.config_status',
            ConfigStatus))

    class CreateSpec(VapiStruct):
        """
        The ``Projects.CreateSpec`` class defines the information required to
        create a Harbor project.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            name=None,
            scope=None,
        ):
            """
            :type  name: :class:`str`
            :param name: Name of the Harbor project. Should be between 2-63 characters long
                alphanumeric string and may contain the following characters:
                a-z,0-9, and '-'. Must be starting with characters or numbers, with
                the '-' character allowed anywhere except the first or last
                character.
            :type  scope: :class:`Projects.Scope`
            :param scope: Access type of a Harbor project.
            """
            self.name = name
            self.scope = scope
            VapiStruct.__init__(self)

    CreateSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.content.registries.harbor.projects.create_spec',
            {
                'name': type.StringType(),
                'scope': type.ReferenceType(__name__, 'Projects.Scope'),
            }, CreateSpec, False, None))

    class Summary(VapiStruct):
        """
        The ``Projects.Summary`` class contains basic information about a Harbor
        project.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            project=None,
            name=None,
            scope=None,
        ):
            """
            :type  project: :class:`str`
            :param project: Identifier of the harbor project.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.content.Registry.Harbor.Project``. When
                methods return a value of this class as a return value, the
                attribute will be an identifier for the resource type:
                ``com.vmware.vcenter.content.Registry.Harbor.Project``.
            :type  name: :class:`str`
            :param name: Name of the Harbor project. Should be between 2-63 characters long
                alphanumeric string and may contain the following characters:
                a-z,0-9, and '-'. Must be starting with characters or numbers, with
                the '-' character allowed anywhere except the first or last
                character.
            :type  scope: :class:`Projects.Scope`
            :param scope: Access type of a Harbor project.
            """
            self.project = project
            self.name = name
            self.scope = scope
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.content.registries.harbor.projects.summary', {
                'project':
                type.IdType(
                    resource_types=
                    'com.vmware.vcenter.content.Registry.Harbor.Project'),
                'name':
                type.StringType(),
                'scope':
                type.ReferenceType(__name__, 'Projects.Scope'),
            }, Summary, False, None))

    class Info(VapiStruct):
        """
        The ``Projects.Info`` class contains detailed information about a Harbor
        project.

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

        _validator_list = [
            UnionValidator(
                'config_status', {
                    'READY': [('update_time', True), ('access_url', True)],
                    'ERROR': [('message', True)],
                    'PENDING': [],
                    'REMOVING': [],
                }),
        ]

        def __init__(
            self,
            name=None,
            config_status=None,
            scope=None,
            creation_time=None,
            update_time=None,
            access_url=None,
            message=None,
        ):
            """
            :type  name: :class:`str`
            :param name: Name of the Harbor project. Should be between 2-63 characters long
                alphanumeric string and may contain the following characters:
                a-z,0-9, and '-'. Must be starting with characters or numbers, with
                the '-' character allowed anywhere except the first or last
                character.
            :type  config_status: :class:`Projects.ConfigStatus`
            :param config_status: The status of the Harbor project.
            :type  scope: :class:`Projects.Scope`
            :param scope: The access type of a Harbor project.
            :type  creation_time: :class:`datetime.datetime`
            :param creation_time: The date and time when the harbor project creation API was
                triggered and project identifier generated.
            :type  update_time: :class:`datetime.datetime`
            :param update_time: The date and time when the harbor project purge API was triggered.
                In case no purge was triggered, ``updateTime`` is same as
                ``creationTime``.
                This attribute is optional and it is only relevant when the value
                of ``configStatus`` is :attr:`Projects.ConfigStatus.READY`.
            :type  access_url: :class:`str`
            :param access_url: URL to access the harbor project through docker client.
                This attribute is optional and it is only relevant when the value
                of ``configStatus`` is :attr:`Projects.ConfigStatus.READY`.
            :type  message: :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param message: Details about the ERROR project status.
                This attribute is optional and it is only relevant when the value
                of ``configStatus`` is :attr:`Projects.ConfigStatus.ERROR`.
            """
            self.name = name
            self.config_status = config_status
            self.scope = scope
            self.creation_time = creation_time
            self.update_time = update_time
            self.access_url = access_url
            self.message = message
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.content.registries.harbor.projects.info', {
                'name':
                type.StringType(),
                'config_status':
                type.ReferenceType(__name__, 'Projects.ConfigStatus'),
                'scope':
                type.ReferenceType(__name__, 'Projects.Scope'),
                'creation_time':
                type.DateTimeType(),
                'update_time':
                type.OptionalType(type.DateTimeType()),
                'access_url':
                type.OptionalType(type.URIType()),
                'message':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
            }, Info, False, None))

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

        :type  registry: :class:`str`
        :param registry: Identifier of the Registry.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry``.
        :type  spec: :class:`Projects.CreateSpec`
        :param spec: Information used to create the Harbor project.
        :rtype: :class:`str`
        :return: Identifier of the newly created Harbor project.
            The return value will be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry.Harbor.Project``.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if ``spec`` contains any error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if Harbor registry is being deleted.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if a registry specified by ``registry`` could not be found.
        :raise: :class:`com.vmware.vapi.std.errors_client.AlreadyExists` 
            if a project with the same name already exists in the registry. In
            vSphere 7.0, the existing project could have been created
            automatically when a namespace with the same name is created.
        :raise: :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have ContentLibrary.ManageRegistryProject
            privilege.
        """
        return self._invoke('create', {
            'registry': registry,
            'spec': spec,
        })

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

        :type  registry: :class:`str`
        :param registry: Identifier of the registry.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry``.
        :type  project: :class:`str`
        :param project: Identifier of the Harbor project.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry.Harbor.Project``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if Harbor registry is being deleted.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if ``registry`` or ``project`` cannot be found. In vSphere 7.0, the
            existing project could have been deleted automatically when a
            namespace with the same name is deleted.
        :raise: :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have ContentLibrary.ManageRegistryProject
            privilege.
        """
        return self._invoke('delete', {
            'registry': registry,
            'project': project,
        })

    def get(
        self,
        registry,
        project,
    ):
        """
        Returns detailed information about the specified Harbor project.

        :type  registry: :class:`str`
        :param registry: Identifier of the registry.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry``.
        :type  project: :class:`str`
        :param project: Identifier of the Harbor project.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry.Harbor.Project``.
        :rtype: :class:`Projects.Info`
        :return: Detailed information about the specified Harbor project.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if ``registry`` or ``project`` cannot be found.
        :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have System.Read privilege.
        """
        return self._invoke('get', {
            'registry': registry,
            'project': project,
        })

    def list(
        self,
        registry,
    ):
        """
        Returns basic information of all projects in a Harbor registry.

        :type  registry: :class:`str`
        :param registry: Identifier of the registry.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry``.
        :rtype: :class:`list` of :class:`Projects.Summary`
        :return: The list of summary information of all Harbor projects.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if ``registry`` cannot be found.
        :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have System.Read privilege.
        """
        return self._invoke('list', {
            'registry': registry,
        })

    def purge(
        self,
        registry,
        project,
    ):
        """
        Remove all repositories, images and members in the project. Storage
        space of deleted images in the project will be reclaimed through next
        scheduled Harbor registry garbage collection.

        :type  registry: :class:`str`
        :param registry: Registry identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry``.
        :type  project: :class:`str`
        :param project: Identifier of the Harbor project.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.content.Registry.Harbor.Project``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if ``registry`` or ``project`` cannot be found.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if Harbor registry is being deleted or the project is not in
            :attr:`Projects.ConfigStatus.READY` status.
        :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.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have ContentLibrary.ManageRegistryProject
            privilege.
        """
        return self._invoke('purge', {
            'registry': registry,
            'project': project,
        })