예제 #1
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'resource_id':
                type.IdType(resource_types='com.vmware.vapi.resource'),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
        }
        list_input_validator_list = []
        list_output_validator_list = []

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.SetType(type.IdType()),
                'errors': list_error_dict,
                'input_validator_list': list_input_validator_list,
                'output_validator_list': list_output_validator_list,
            },
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vapi.metadata.metamodel.resource.model',
            config=config,
            operations=operations)
예제 #2
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'service_id': type.IdType(resource_types='com.vmware.vapi.service'),
        })
        list_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        list_input_value_validator_list = [
        ]
        list_output_validator_list = [
        ]
        list_rest_metadata = None

        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'service_id': type.IdType(resource_types='com.vmware.vapi.service'),
            'operation_id': type.IdType(resource_types='com.vmware.vapi.operation'),
        })
        get_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        get_input_value_validator_list = [
        ]
        get_output_validator_list = [
        ]
        get_rest_metadata = None

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.SetType(type.IdType()),
                'errors': list_error_dict,
                'input_value_validator_list': list_input_value_validator_list,
                'output_validator_list': list_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType(__name__, 'Operation.Info'),
                'errors': get_error_dict,
                'input_value_validator_list': get_input_value_validator_list,
                'output_validator_list': get_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'list': list_rest_metadata,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.vapi.std.introspection.operation',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=True)
예제 #3
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'service_id':
            type.IdType(resource_types='com.vmware.vapi.service'),
        })
        list_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
        }
        list_input_validator_list = []
        list_output_validator_list = []

        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'service_id':
                type.IdType(resource_types='com.vmware.vapi.service'),
                'operation_id':
                type.IdType(resource_types='com.vmware.vapi.operation'),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
        }
        get_input_validator_list = []
        get_output_validator_list = []

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.SetType(type.IdType()),
                'errors': list_error_dict,
                'input_validator_list': list_input_validator_list,
                'output_validator_list': list_output_validator_list,
            },
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType(sys.modules[__name__], 'Operation.Info'),
                'errors':
                get_error_dict,
                'input_validator_list':
                get_input_validator_list,
                'output_validator_list':
                get_output_validator_list,
            },
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vapi.std.introspection.operation',
            config=config,
            operations=operations)
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'resource_id':
                type.IdType(resource_types='com.vmware.vapi.resource'),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vapi/metadata/metamodel/resource/{resourceId}/model',
            path_variables={
                'resourceId': 'resourceId',
            },
            query_parameters={},
            dispatch_parameters={},
            header_parameters={},
            dispatch_header_parameters={})

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.SetType(type.IdType()),
                'errors': list_error_dict,
                'input_value_validator_list': list_input_value_validator_list,
                'output_validator_list': list_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'list': list_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vapi.metadata.metamodel.resource.model',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
예제 #5
0
    def __init__(self, config):
        # properties for add operation
        add_input_type = type.StructType('operation-input', {
            'group_name': type.StringType(),
        })
        add_error_dict = {
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        add_input_value_validator_list = []
        add_output_validator_list = []
        add_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/hvc/management/administrators',
            path_variables={},
            query_parameters={})

        # properties for remove operation
        remove_input_type = type.StructType('operation-input', {
            'group_name': type.StringType(),
        })
        remove_error_dict = {
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        remove_input_value_validator_list = []
        remove_output_validator_list = []
        remove_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/hvc/management/administrators',
            path_variables={},
            query_parameters={})

        # properties for set operation
        set_input_type = type.StructType(
            'operation-input', {
                'group_names': type.SetType(type.StringType()),
            })
        set_error_dict = {
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        set_input_value_validator_list = []
        set_output_validator_list = []
        set_rest_metadata = OperationRestMetadata(
            http_method='PUT',
            url_template='/hvc/management/administrators',
            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='/hvc/management/administrators',
            path_variables={},
            query_parameters={})

        operations = {
            'add': {
                'input_type': add_input_type,
                'output_type': type.VoidType(),
                'errors': add_error_dict,
                'input_value_validator_list': add_input_value_validator_list,
                'output_validator_list': add_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'remove': {
                'input_type': remove_input_type,
                'output_type': type.VoidType(),
                'errors': remove_error_dict,
                'input_value_validator_list':
                remove_input_value_validator_list,
                'output_validator_list': remove_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'set': {
                'input_type': set_input_type,
                'output_type': type.VoidType(),
                'errors': set_error_dict,
                'input_value_validator_list': set_input_value_validator_list,
                'output_validator_list': set_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.SetType(type.StringType()),
                '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 = {
            'add': add_rest_metadata,
            'remove': remove_rest_metadata,
            'set': set_rest_metadata,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vcenter.hvc.management.administrators',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
class Nodes(VapiInterface):
    """
    The ``Nodes`` interface provides methods to retrieve vCenter and Platform
    Services Controller nodes information in the topology. This class was added
    in vSphere API 6.7.2.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.topology.nodes'
    """
    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, _NodesStub)

    class ApplianceType(Enum):
        """
        The ``Nodes.ApplianceType`` class defines values for valid appliance types
        for the vCenter and Platform Services Controller node. See
        :class:`Nodes.Info`. This enumeration was added in vSphere API 6.7.2.

        .. 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>`.
        """
        VCSA_EMBEDDED = None
        """
        vCenter Server Appliance with an embedded Platform Services Controller.
        This class attribute was added in vSphere API 6.7.2.

        """
        VCSA_EXTERNAL = None
        """
        vCenter Server Appliance with an external Platform Services Controller.
        This class attribute was added in vSphere API 6.7.2.

        """
        PSC_EXTERNAL = None
        """
        An external Platform Services Controller. 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:`ApplianceType` instance.
            """
            Enum.__init__(string)

    ApplianceType._set_values([
        ApplianceType('VCSA_EMBEDDED'),
        ApplianceType('VCSA_EXTERNAL'),
        ApplianceType('PSC_EXTERNAL'),
    ])
    ApplianceType._set_binding_type(
        type.EnumType('com.vmware.vcenter.topology.nodes.appliance_type',
                      ApplianceType))

    class Info(VapiStruct):
        """
        The ``Nodes.Info`` class contains vCenter or Platform Services Controller
        node details. This class was added in vSphere API 6.7.2.

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

        _validator_list = [
            UnionValidator(
                'type', {
                    'VCSA_EMBEDDED': [('replication_partners', True)],
                    'PSC_EXTERNAL': [('replication_partners', True)],
                    'VCSA_EXTERNAL': [('client_affinity', True)],
                }),
        ]

        def __init__(
            self,
            domain=None,
            type=None,
            replication_partners=None,
            client_affinity=None,
        ):
            """
            :type  domain: :class:`str`
            :param domain: Domain name of the node. This attribute was added in vSphere API
                6.7.2.
            :type  type: :class:`Nodes.ApplianceType`
            :param type: Appliance type of the node. This attribute was added in vSphere API
                6.7.2.
            :type  replication_partners: :class:`list` of :class:`str`
            :param replication_partners: List of replication partners' node identifiers. Identifiers can be
                either IP address or DNS resolvable name of the partner node. This
                attribute was added in vSphere API 6.7.2.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vcenter.VCenter.name``. When methods return a value of
                this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.vcenter.VCenter.name``.
                This attribute is optional and it is only relevant when the value
                of ``type`` is one of :attr:`Nodes.ApplianceType.VCSA_EMBEDDED` or
                :attr:`Nodes.ApplianceType.PSC_EXTERNAL`.
            :type  client_affinity: :class:`str`
            :param client_affinity: Identifier of the affinitized Platform Services Controller node.
                Identifier can be either IP address or DNS resolvable name of the
                affinitized node. This attribute was added in vSphere API 6.7.2.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.VCenter.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.vcenter.VCenter.name``.
                This attribute is optional and it is only relevant when the value
                of ``type`` is :attr:`Nodes.ApplianceType.VCSA_EXTERNAL`.
            """
            self.domain = domain
            self.type = type
            self.replication_partners = replication_partners
            self.client_affinity = client_affinity
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.topology.nodes.info', {
                'domain':
                type.StringType(),
                'type':
                type.ReferenceType(__name__, 'Nodes.ApplianceType'),
                'replication_partners':
                type.OptionalType(type.ListType(type.IdType())),
                'client_affinity':
                type.OptionalType(type.IdType()),
            }, Info, False, None))

    class Summary(VapiStruct):
        """
        The ``Nodes.Summary`` class contains commonly used information of vCenter
        or Platform Services Controller node. This class was added in vSphere API
        6.7.2.

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

        _validator_list = [
            UnionValidator(
                'type', {
                    'VCSA_EMBEDDED': [('replication_partners', True)],
                    'PSC_EXTERNAL': [('replication_partners', True)],
                    'VCSA_EXTERNAL': [('client_affinity', True)],
                }),
        ]

        def __init__(
            self,
            node=None,
            type=None,
            replication_partners=None,
            client_affinity=None,
        ):
            """
            :type  node: :class:`str`
            :param node: Identifier for the vCenter or Platform Services Controller node.
                Identifier can be either IP address or DNS resolvable name of the
                node. This attribute was added in vSphere API 6.7.2.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.VCenter.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.vcenter.VCenter.name``.
            :type  type: :class:`Nodes.ApplianceType`
            :param type: Appliance type of the node. This attribute was added in vSphere API
                6.7.2.
            :type  replication_partners: :class:`list` of :class:`str`
            :param replication_partners: List of replication partners' node identifiers. Identifiers can be
                either IP address or DNS resolvable name of the partner node. This
                attribute was added in vSphere API 6.7.2.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vcenter.VCenter.name``. When methods return a value of
                this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.vcenter.VCenter.name``.
                This attribute is optional and it is only relevant when the value
                of ``type`` is one of :attr:`Nodes.ApplianceType.VCSA_EMBEDDED` or
                :attr:`Nodes.ApplianceType.PSC_EXTERNAL`.
            :type  client_affinity: :class:`str`
            :param client_affinity: Identifier of the affinitized Platform Services Controller node.
                Identifier can be either IP address or DNS resolvable name of the
                affinitized node. This attribute was added in vSphere API 6.7.2.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.VCenter.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.vcenter.VCenter.name``.
                This attribute is optional and it is only relevant when the value
                of ``type`` is :attr:`Nodes.ApplianceType.VCSA_EXTERNAL`.
            """
            self.node = node
            self.type = type
            self.replication_partners = replication_partners
            self.client_affinity = client_affinity
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.topology.nodes.summary', {
                'node':
                type.IdType(resource_types='com.vmware.vcenter.VCenter.name'),
                'type':
                type.ReferenceType(__name__, 'Nodes.ApplianceType'),
                'replication_partners':
                type.OptionalType(type.ListType(type.IdType())),
                'client_affinity':
                type.OptionalType(type.IdType()),
            }, Summary, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``Nodes.FilterSpec`` class contains attribute used to filter the
        results when listing vCenter and Platform Services Controller nodes (see
        :func:`Nodes.list`). 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,
            types=None,
        ):
            """
            :type  types: :class:`set` of :class:`Nodes.ApplianceType` or ``None``
            :param types: Types of the appliance that a vCenter and Platform Services
                Controller node must be to match the filter (see
                :class:`Nodes.ApplianceType`. This attribute was added in vSphere
                API 6.7.2.
                If None or empty, node of any ApplianceType match the filter.
            """
            self.types = types
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.topology.nodes.filter_spec', {
                'types':
                type.OptionalType(
                    type.SetType(
                        type.ReferenceType(__name__, 'Nodes.ApplianceType'))),
            }, FilterSpec, False, None))

    def list(
        self,
        filter=None,
    ):
        """
        Returns information about all vCenter and Platform Services Controller
        nodes matching the :class:`Nodes.FilterSpec`. This method was added in
        vSphere API 6.7.2.

        :type  filter: :class:`Nodes.FilterSpec` or ``None``
        :param filter: Specification of matching vCenter and Platform Services Controller
            nodes for which information should be returned.
            If None, the behavior is equivalent to a :class:`Nodes.FilterSpec`
            with all attributes None which means all nodes match the filter.
        :rtype: :class:`list` of :class:`Nodes.Summary`
        :return: commonly used information for all vCenter and Platform Services
            Controller nodes matching the :class:`Nodes.FilterSpec`.
        :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.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the :attr:`Nodes.FilterSpec.types` attribute contains a value
            that is not supported.
        """
        return self._invoke('list', {
            'filter': filter,
        })

    def get(
        self,
        node,
    ):
        """
        Retrieve details for a given identifier of the vCenter or Platform
        Services Controller node. This method was added in vSphere API 6.7.2.

        :type  node: :class:`str`
        :param node: Identifier of the vCenter or Platform Services Controller node.
            Identifier can be either IP address or DNS resolvable name of the
            node.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.VCenter.name``.
        :rtype: :class:`Nodes.Info`
        :return: vCenter or Platform Services Controller node details with
            replication partners and client affinity information as applicable.
            See :class:`Nodes.Info`.
        :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.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
             if a node doesn't exist for given node identifier.
        """
        return self._invoke('get', {
            'node': node,
        })
class ReplicationStatus(VapiInterface):
    """
    The ``ReplicationStatus`` interface provides methods to retrieve
    replication status information of vCenter and Platform Services Controller
    nodes of type VCSA_EMBEDDED/PSC_EXTERNAL (see :attr:`Nodes.Info.type`).
    This class was added in vSphere API 6.7.2.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.topology.replication_status'
    """
    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, _ReplicationStatusStub)

    class Summary(VapiStruct):
        """
        The ``ReplicationStatus.Summary`` class contains replication information of
        partner vCenter or Platform Services Controller node of type
        VCSA_EMBEDDED/PSC_EXTERNAL (see :attr:`Nodes.Info.type`). 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,
            node=None,
            replication_partner=None,
            partner_available=None,
            status_available=None,
            replicating=None,
            change_lag=None,
        ):
            """
            :type  node: :class:`str`
            :param node: Identifier for the vCenter or Platform Services Controller node.
                Identifier can be either IP address or DNS resolvable name of the
                node. This attribute was added in vSphere API 6.7.2.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.VCenter.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.vcenter.VCenter.name``.
            :type  replication_partner: :class:`str`
            :param replication_partner: Identifier for the vCenter or Platform Services Controller
                replication partner. Identifier can be either IP address or DNS
                resolvable name of the replication partner. This attribute was
                added in vSphere API 6.7.2.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.VCenter.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.vcenter.VCenter.name``.
            :type  partner_available: :class:`bool`
            :param partner_available: Indicates if the VMware Directory Service on partner is reachable
                or not. This attribute was added in vSphere API 6.7.2.
            :type  status_available: :class:`bool`
            :param status_available: Indicates if the replication status for the node with respect to
                replication partner can be retrieved or not. This attribute was
                added in vSphere API 6.7.2.
            :type  replicating: :class:`bool` or ``None``
            :param replicating: Indicates if node is processing replication changes from the
                replication partner. This attribute was added in vSphere API 6.7.2.
                This attribute will be None if the partner host or replication
                status is not available, i.e, if
                :attr:`ReplicationStatus.Summary.partner_available` or
                :attr:`ReplicationStatus.Summary.status_available` is false.
            :type  change_lag: :class:`long` or ``None``
            :param change_lag: Number of replication changes node is behind the replication
                partner. This attribute was added in vSphere API 6.7.2.
                This attribute will be None if the partner host or replication
                status is not available, i.e, if
                :attr:`ReplicationStatus.Summary.partner_available` or
                :attr:`ReplicationStatus.Summary.status_available` is false.
            """
            self.node = node
            self.replication_partner = replication_partner
            self.partner_available = partner_available
            self.status_available = status_available
            self.replicating = replicating
            self.change_lag = change_lag
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.topology.replication_status.summary', {
                'node':
                type.IdType(resource_types='com.vmware.vcenter.VCenter.name'),
                'replication_partner':
                type.IdType(resource_types='com.vmware.vcenter.VCenter.name'),
                'partner_available':
                type.BooleanType(),
                'status_available':
                type.BooleanType(),
                'replicating':
                type.OptionalType(type.BooleanType()),
                'change_lag':
                type.OptionalType(type.IntegerType()),
            }, Summary, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``ReplicationStatus.FilterSpec`` class contains attribute used to
        filter the results when listing replication status for the vCenter and
        Platform Services Controller nodes (see :func:`ReplicationStatus.list`) of
        type VCSA_EMBEDDED/PSC_EXTERNAL (see :attr:`Nodes.Info.type`). 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,
            nodes=None,
        ):
            """
            :type  nodes: :class:`set` of :class:`str` or ``None``
            :param nodes: Identifier that a vCenter and Platform Services Controller node
                must have to match the filter. (see
                :attr:`ReplicationStatus.Summary.node`). This attribute was added
                in vSphere API 6.7.2.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vcenter.VCenter.name``. When methods return a value of
                this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.vcenter.VCenter.name``.
                If None or empty, all vCenter and Platform Services Controller
                nodes of type VCSA_EMBEDDED/PSC_EXTERNAL match the filter.
            """
            self.nodes = nodes
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.topology.replication_status.filter_spec', {
                'nodes': type.OptionalType(type.SetType(type.IdType())),
            }, FilterSpec, False, None))

    def list(
        self,
        filter=None,
    ):
        """
        Returns the replication information of vCenter and Platform Services
        Controller nodes of type VCSA_EMBEDDED/PSC_EXTERNAL (see
        :attr:`Nodes.Info.type`) matching the
        :class:`ReplicationStatus.FilterSpec`. This method was added in vSphere
        API 6.7.2.

        :type  filter: :class:`ReplicationStatus.FilterSpec` or ``None``
        :param filter: Specification of matching vCenter and Platform Services Controller
            nodes for which information should be returned.
            If None, the behavior is equivalent to a
            :class:`ReplicationStatus.FilterSpec` with all attributes None
            which means all vCenter and Platform Services Controller nodes of
            type VCSA_EMBEDDED/PSC_EXTERNAL match the filter.
        :rtype: :class:`list` of :class:`ReplicationStatus.Summary`
        :return: Commonly used replication information about vCenter and Platform
            Services Controller nodes matching the
            :class:`ReplicationStatus.FilterSpec`.
        :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.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the :attr:`ReplicationStatus.FilterSpec.nodes` attribute
            contains a invalid value.
        """
        return self._invoke('list', {
            'filter': filter,
        })
예제 #8
0
class Service(VapiInterface):
    """
    The :class:`Service` service provides operations to retrieve information
    about the services exposed by a vAPI provider. A provider is a container
    that exposes one or more vAPI services.
    """
    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, _ServiceStub)

    class Info(VapiStruct):
        """
        Information about a vAPI service

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            operations=None,
        ):
            """
            :type  operations: :class:`set` of :class:`str`
            :param operations: Set of identifiers of operations present in the service
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vapi.operation``. When methods return a value of this
                class as a return value, the attribute will contain identifiers for
                the resource type: ``com.vmware.vapi.operation``.
            """
            self.operations = operations
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType('com.vmware.vapi.std.introspection.service.info', {
            'operations': type.SetType(type.IdType()),
        }, Info, False, None))

    def list(self):
        """
        Returns the set of service identifiers.


        :rtype: :class:`set` of :class:`str`
        :return: set of service identifiers
            The return value will contain identifiers for the resource type:
            ``com.vmware.vapi.service``.
        """
        return self._invoke('list', None)

    def get(
        self,
        id,
    ):
        """
        Returns the :class:`Service.Info` for the specified service

        :type  id: :class:`str`
        :param id: service identifier
            The parameter must be an identifier for the resource type:
            ``com.vmware.vapi.service``.
        :rtype: :class:`Service.Info`
        :return: :class:`Service.Info` for the specified service
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If the service identifier does not exist
        """
        return self._invoke('get', {
            'id': id,
        })
예제 #9
0
class Kms(VapiInterface):
    """
    The ``Kms`` class contains information necessary to connect to the hosts
    running Key Provider Service. This class was added in vSphere API 7.0.0.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.trusted_infrastructure.trust_authority_hosts.kms'
    """
    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, _KmsStub)
        self._VAPI_OPERATION_IDS = {}

    class SummaryType(Enum):
        """
        The connection information could include the certificates or be a shorter
        summary. This enumeration was added in vSphere API 7.0.0.

        .. 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>`.
        """
        FULL = None
        """
        The full connection information, including certificates. This class
        attribute was added in vSphere API 7.0.0.

        """
        NORMAL = None
        """
        A summary containing only the hostname, port, and the group which
        determines the Attestation Services this Key Provider Service can
        communicate with. This class attribute was added in vSphere API 7.0.0.

        """
        BRIEF = None
        """
        A brief summary, containing only the hostname for the Key Provider Service.
        This class attribute was added in vSphere API 7.0.0.

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

    SummaryType._set_values([
        SummaryType('FULL'),
        SummaryType('NORMAL'),
        SummaryType('BRIEF'),
    ])
    SummaryType._set_binding_type(
        type.EnumType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_hosts.kms.summary_type',
            SummaryType))

    class Summary(VapiStruct):
        """
        The ``Kms.Summary`` class contains all the stored information about a Key
        Provider Service. This class was added in vSphere API 7.0.0.

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

        _validator_list = [
            UnionValidator(
                'summary_type', {
                    'BRIEF': [('host', True), ('address', True)],
                    'NORMAL': [('host', True), ('address', True),
                               ('group', True), ('cluster', True)],
                    'FULL': [('host', True), ('address', True),
                             ('group', True), ('cluster', True),
                             ('trusted_CA', True)],
                }),
        ]

        _canonical_to_pep_names = {
            'trusted_CA': 'trusted_ca',
        }

        def __init__(
            self,
            summary_type=None,
            host=None,
            address=None,
            group=None,
            cluster=None,
            trusted_ca=None,
        ):
            """
            :type  summary_type: :class:`Kms.SummaryType`
            :param summary_type: Defines the verbosity of the summary. This attribute was added in
                vSphere API 7.0.0.
            :type  host: :class:`str`
            :param host: The trusted ESX on which the service runs. This attribute was added
                in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``HostSystem``. When methods return a value of this class as a
                return value, the attribute will be an identifier for the resource
                type: ``HostSystem``.
                This attribute is optional and it is only relevant when the value
                of ``summaryType`` is one of :attr:`Kms.SummaryType.BRIEF`,
                :attr:`Kms.SummaryType.NORMAL`, or :attr:`Kms.SummaryType.FULL`.
            :type  address: :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress`
            :param address: The service's address. This attribute was added in vSphere API
                7.0.0.
                This attribute is optional and it is only relevant when the value
                of ``summaryType`` is one of :attr:`Kms.SummaryType.BRIEF`,
                :attr:`Kms.SummaryType.NORMAL`, or :attr:`Kms.SummaryType.FULL`.
            :type  group: :class:`str`
            :param group: The group ID determines which Attestation Service instances this
                Key Provider Service can communicate with. This attribute was added
                in vSphere API 7.0.0.
                This attribute is optional and it is only relevant when the value
                of ``summaryType`` is one of :attr:`Kms.SummaryType.NORMAL` or
                :attr:`Kms.SummaryType.FULL`.
            :type  cluster: :class:`str`
            :param cluster: The opaque string identifier of the cluster in which the Key
                Provider Service is part of. This attribute was added in vSphere
                API 7.0.0.
                This attribute is optional and it is only relevant when the value
                of ``summaryType`` is one of :attr:`Kms.SummaryType.NORMAL` or
                :attr:`Kms.SummaryType.FULL`.
            :type  trusted_ca: :class:`com.vmware.vcenter.trusted_infrastructure_client.X509CertChain`
            :param trusted_ca: The service's TLS certificate chain. This attribute was added in
                vSphere API 7.0.0.
                This attribute is optional and it is only relevant when the value
                of ``summaryType`` is :attr:`Kms.SummaryType.FULL`.
            """
            self.summary_type = summary_type
            self.host = host
            self.address = address
            self.group = group
            self.cluster = cluster
            self.trusted_ca = trusted_ca
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_hosts.kms.summary',
            {
                'summary_type':
                type.ReferenceType(__name__, 'Kms.SummaryType'),
                'host':
                type.OptionalType(type.IdType()),
                'address':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.vcenter.trusted_infrastructure_client',
                        'NetworkAddress')),
                'group':
                type.OptionalType(type.StringType()),
                'cluster':
                type.OptionalType(type.StringType()),
                'trusted_CA':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.vcenter.trusted_infrastructure_client',
                        'X509CertChain')),
            }, Summary, False, None))

    class Info(VapiStruct):
        """
        The ``Kms.Info`` class contains all the stored information about a Key
        Provider Service. This class was added in vSphere API 7.0.0.

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

        _canonical_to_pep_names = {
            'trusted_CA': 'trusted_ca',
        }

        def __init__(
            self,
            host=None,
            address=None,
            group=None,
            cluster=None,
            trusted_ca=None,
        ):
            """
            :type  host: :class:`str`
            :param host: The trusted ESX on which the service runs. This attribute was added
                in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``HostSystem``. When methods return a value of this class as a
                return value, the attribute will be an identifier for the resource
                type: ``HostSystem``.
            :type  address: :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress`
            :param address: The service's address. This attribute was added in vSphere API
                7.0.0.
            :type  group: :class:`str`
            :param group: The group ID determines which Attestation Service instances this
                Key Provider Service can communicate with. This attribute was added
                in vSphere API 7.0.0.
            :type  cluster: :class:`str`
            :param cluster: The opaque string identifier of the cluster in which the Key
                Provider Service is part of. This attribute was added in vSphere
                API 7.0.0.
            :type  trusted_ca: :class:`com.vmware.vcenter.trusted_infrastructure_client.X509CertChain`
            :param trusted_ca: The service's TLS certificate chain. This attribute was added in
                vSphere API 7.0.0.
            """
            self.host = host
            self.address = address
            self.group = group
            self.cluster = cluster
            self.trusted_ca = trusted_ca
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_hosts.kms.info',
            {
                'host':
                type.IdType(resource_types='HostSystem'),
                'address':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'NetworkAddress'),
                'group':
                type.StringType(),
                'cluster':
                type.StringType(),
                'trusted_CA':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'X509CertChain'),
            }, Info, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``Kms.FilterSpec`` class contains the data necessary for identifying a
        Key Provider Service. This class was added in vSphere API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            hosts=None,
            clusters=None,
            address=None,
            groups=None,
        ):
            """
            :type  hosts: :class:`set` of :class:`str` or ``None``
            :param hosts: A set of host IDs by which to filter the services. This attribute
                was added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``HostSystem``. When methods return a value of this class as a
                return value, the attribute will contain identifiers for the
                resource type: ``HostSystem``.
                If None, the services will not be filtered by the hosts on which
                they run.
            :type  clusters: :class:`set` of :class:`str` or ``None``
            :param clusters: A set of cluster IDs by which to filter the services. This
                attribute was added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``ClusterComputeResource``. When methods return a value of this
                class as a return value, the attribute will contain identifiers for
                the resource type: ``ClusterComputeResource``.
                If None, the services will not be filtered by the clusters on which
                they run.
            :type  address: :class:`list` of :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress` or ``None``
            :param address: The service's address. This attribute was added in vSphere API
                7.0.0.
                If None, the services will not be filtered by address.
            :type  groups: :class:`set` of :class:`str` or ``None``
            :param groups: The group determines reports issued by which Attestation Service
                instances this Key Provider Service can accept. This attribute was
                added in vSphere API 7.0.0.
                If None, the services will not be filtered by groupId.
            """
            self.hosts = hosts
            self.clusters = clusters
            self.address = address
            self.groups = groups
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_hosts.kms.filter_spec',
            {
                'hosts':
                type.OptionalType(type.SetType(type.IdType())),
                'clusters':
                type.OptionalType(type.SetType(type.IdType())),
                'address':
                type.OptionalType(
                    type.ListType(
                        type.ReferenceType(
                            'com.vmware.vcenter.trusted_infrastructure_client',
                            'NetworkAddress'))),
                'groups':
                type.OptionalType(type.SetType(type.StringType())),
            }, FilterSpec, False, None))

    def get(
        self,
        host,
    ):
        """
        Returns the connection info about the Key Provider Service running on
        the specified host. This method was added in vSphere API 7.0.0.

        :type  host: :class:`str`
        :param host: \\\\@{link com.vmware.vcenter.Host} id.
            The parameter must be an identifier for the resource type:
            ``HostSystem``.
        :rtype: :class:`Kms.Info`
        :return: The :class:`Kms.Info` instance which contains the information
            necessary to connect to the Key Provider Service.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if service's TLS certificate chain is not valid.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if ``host`` doesn't match to any Host.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible` 
            if connection to ``host`` failed.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``TrustedAdmin.ReadTrustedHosts``.
            * The resource ``HostSystem`` referenced by the parameter ``host``
              requires ``System.View``.
        """
        return self._invoke('get', {
            'host': host,
        })

    def list(
        self,
        spec=None,
        projection=None,
    ):
        """
        Returns a list of the hosts running a Key Provider Service matching the
        specified :class:`Kms.FilterSpec`. This method was added in vSphere API
        7.0.0.

        :type  spec: :class:`Kms.FilterSpec` or ``None``
        :param spec: Return details about Key Provider Services matching the filter.
            If {\\\\@term.unset} return all registered Key Provider Services.
        :type  projection: :class:`Kms.SummaryType` or ``None``
        :param projection: The type of the returned summary - brief, normal, or full.
            If {\\\\@term.unset} a normal projection will be used.
        :rtype: :class:`list` of :class:`Kms.Summary`
        :return: List of :class:`Kms.Summary` of Key Provider Services.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the response data will exceed the message limit.
        :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 you do not have all of the privileges described as follows: 
            
            * Method execution requires ``TrustedAdmin.ReadTrustedHosts``.
            * The resource ``HostSystem`` referenced by the attribute
              :attr:`Kms.FilterSpec.hosts` requires ``System.View``.
            * The resource ``ClusterComputeResource`` referenced by the
              attribute :attr:`Kms.FilterSpec.clusters` requires ``System.View``.
        """
        return self._invoke('list', {
            'spec': spec,
            'projection': projection,
        })
예제 #10
0
class Compliance(VapiInterface):
    """
    The Compliance class provides methods related to all the associated
    entities of given compliance statuses. This class was added in vSphere API
    6.7.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.storage.policies.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)
        self._VAPI_OPERATION_IDS = {}

    class Status(Enum):
        """
        This enumeration defines the set of status values for a compliance
        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>`.
        """
        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 = 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 requirement that apply to the object-based datastore
        on which the entity is placed. This class attribute was added in vSphere
        API 6.7.

        """
        OUT_OF_DATE = None
        """
        Compliance status becomes out of date when the profile associated with the
        entity is edited and not applied. The compliance status will remain out of
        date until the latest 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'),
        Status('NOT_APPLICABLE'),
        Status('OUT_OF_DATE'),
    ])
    Status._set_binding_type(
        type.EnumType('com.vmware.vcenter.storage.policies.compliance.status',
                      Status))

    class Summary(VapiStruct):
        """
        Provides the details of a virtual machine and its associated entities which
        match the given compliance statuses. 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=None,
            vm_home=None,
            disks=None,
        ):
            """
            :type  vm: :class:`str`
            :param vm: Identifier of 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:
                ``VirtualMachine``. When methods return a value of this class as a
                return value, the attribute will be an identifier for the resource
                type: ``VirtualMachine``.
            :type  vm_home: :class:`Compliance.Status` or ``None``
            :param vm_home: Compliance status of the virtual machine home. This attribute was
                added in vSphere API 6.7.
                If None or empty, vmHome is not associated with a storage policy.
            :type  disks: (:class:`dict` of :class:`str` and :class:`Compliance.Status`) or ``None``
            :param disks: List of the virtual hard disk. 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``.
                If None or empty, virtual machine entity does not have any disks or
                its disks are not associated with a storage policy.
            """
            self.vm = vm
            self.vm_home = vm_home
            self.disks = disks
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.storage.policies.compliance.summary', {
                'vm':
                type.IdType(resource_types='VirtualMachine'),
                'vm_home':
                type.OptionalType(
                    type.ReferenceType(__name__, 'Compliance.Status')),
                'disks':
                type.OptionalType(
                    type.MapType(
                        type.IdType(),
                        type.ReferenceType(__name__, 'Compliance.Status'))),
            }, Summary, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``Compliance.FilterSpec`` class contains complianceStatus used to
        filter the results when listing entities (see :func:`Compliance.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,
            status=None,
        ):
            """
            :type  status: :class:`set` of :class:`Compliance.Status`
            :param status: Compliance Status that a virtual machine must have to match the
                filter. This attribute was added in vSphere API 6.7.
            """
            self.status = status
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.storage.policies.compliance.filter_spec', {
                'status':
                type.SetType(type.ReferenceType(__name__,
                                                'Compliance.Status')),
            }, FilterSpec, False, None))

    def list(
        self,
        filter,
    ):
        """
        Returns compliance information about entities matching the filter
        :class:`Compliance.FilterSpec`. Entities without storage policy
        association are not returned. This method was added in vSphere API 6.7.

        :type  filter: :class:`Compliance.FilterSpec`
        :param filter: compliance status of matching entities for which information should
            be returned.
        :rtype: :class:`list` of :class:`Compliance.Summary`
        :return: compliance information about entities matching the filter
            :class:`Compliance.FilterSpec`.
        :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.InvalidArgument` 
            if the :attr:`Compliance.FilterSpec.status` attribute contains a
            value that is not supported by the server.
        :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,
        })
class Policies(VapiInterface):
    """
    The ``Policies`` class provides methods for managing the storage policies.
    This class was added in vSphere API 6.7.
    """
    RESOURCE_TYPE = "com.vmware.vcenter.StoragePolicy"
    """
    Resource type for vAPI metadata policy. This class attribute was added in
    vSphere API 6.7.

    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.storage.policies'
    """
    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, _PoliciesStub)

    class FilterSpec(VapiStruct):
        """
        The ``Policies.FilterSpec`` class contains attributes used to filter the
        results when listing the storage policies (see :func:`Policies.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,
                     policies=None,
                    ):
            """
            :type  policies: :class:`set` of :class:`str` or ``None``
            :param policies: Identifiers of storage policies 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.vcenter.StoragePolicy``. When methods return a value
                of this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.vcenter.StoragePolicy``.
                If None or empty, storage policies with any identifiers match the
                filter.
            """
            self.policies = policies
            VapiStruct.__init__(self)


    FilterSpec._set_binding_type(type.StructType(
        'com.vmware.vcenter.storage.policies.filter_spec', {
            'policies': type.OptionalType(type.SetType(type.IdType())),
        },
        FilterSpec,
        False,
        None))


    class Summary(VapiStruct):
        """
        The ``Policies.Summary`` class contains commonly used information about a
        storage policy. 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,
                     policy=None,
                     name=None,
                     description=None,
                    ):
            """
            :type  policy: :class:`str`
            :param policy: Identifier of the storage policy. 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``.
            :type  name: :class:`str`
            :param name: Name of the storage policy. This attribute was added in vSphere API
                6.7.
            :type  description: :class:`str`
            :param description: Description of the storage policy. This attribute was added in
                vSphere API 6.7.
            """
            self.policy = policy
            self.name = name
            self.description = description
            VapiStruct.__init__(self)


    Summary._set_binding_type(type.StructType(
        'com.vmware.vcenter.storage.policies.summary', {
            'policy': type.IdType(resource_types='com.vmware.vcenter.StoragePolicy'),
            'name': type.StringType(),
            'description': type.StringType(),
        },
        Summary,
        False,
        None))


    class CompatibleDatastoreInfo(VapiStruct):
        """
        The ``Policies.CompatibleDatastoreInfo`` class contains compatible
        datastore's 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,
                     datastore=None,
                    ):
            """
            :type  datastore: :class:`str`
            :param datastore: Identifier of the datastore. 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:
                ``Datastore``. When methods return a value of this class as a
                return value, the attribute will be an identifier for the resource
                type: ``Datastore``.
            """
            self.datastore = datastore
            VapiStruct.__init__(self)


    CompatibleDatastoreInfo._set_binding_type(type.StructType(
        'com.vmware.vcenter.storage.policies.compatible_datastore_info', {
            'datastore': type.IdType(resource_types='Datastore'),
        },
        CompatibleDatastoreInfo,
        False,
        None))


    class CompatibilityInfo(VapiStruct):
        """
        The ``Policies.CompatibilityInfo`` class contains info about a list of
        datastores compatible with a specific storage policy. 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,
                     compatible_datastores=None,
                    ):
            """
            :type  compatible_datastores: :class:`list` of :class:`Policies.CompatibleDatastoreInfo`
            :param compatible_datastores: Info about a list of datastores compatible with a specific storage
                policy. This attribute was added in vSphere API 6.7.
            """
            self.compatible_datastores = compatible_datastores
            VapiStruct.__init__(self)


    CompatibilityInfo._set_binding_type(type.StructType(
        'com.vmware.vcenter.storage.policies.compatibility_info', {
            'compatible_datastores': type.ListType(type.ReferenceType(__name__, 'Policies.CompatibleDatastoreInfo')),
        },
        CompatibilityInfo,
        False,
        None))



    def list(self,
             filter=None,
             ):
        """
        Returns information about at most 1024 visible (subject to permission
        checks) storage solicies availabe in vCenter. These storage policies
        can be used for provisioning virtual machines or disks. This method was
        added in vSphere API 6.7.

        :type  filter: :class:`Policies.FilterSpec` or ``None``
        :param filter: Specification of matching storage policies for which information
            should be returned.
            If None, the behavior is equivalent to a
            :class:`Policies.FilterSpec` with all attributes None which means
            all storage policies match the filter
        :rtype: :class:`list` of :class:`Policies.Summary`
        :return: Commonly used Information about the storage policies.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the :class:`Policies.FilterSpec` contains a value that is not
            supported by the server.
        :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.
        :raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource` 
            if more than 1024 storage policies exist.
        """
        return self._invoke('list',
                            {
                            'filter': filter,
                            })

    def check_compatibility(self,
                            policy,
                            datastores,
                            ):
        """
        Returns datastore compatibility summary about a specific storage
        policy. This method was added in vSphere API 6.7.

        :type  policy: :class:`str`
        :param policy: The storage policy identifier
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.StoragePolicy``.
        :type  datastores: :class:`set` of :class:`str`
        :param datastores: Datastores used to check compatibility against a storage policy.
            The number of datastores is limited to 1024.
            The parameter must contain identifiers for the resource type:
            ``Datastore``.
        :rtype: :class:`Policies.CompatibilityInfo`
        :return: datastore compatibility summary about a specific 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.NotFound` 
            if the storage policy specified does not exist.
        :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.
        :raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource` 
            if input more than 1024 datastores.
        """
        return self._invoke('check_compatibility',
                            {
                            'policy': policy,
                            'datastores': datastores,
                            })
예제 #12
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {})
        list_error_dict = {}
        list_input_value_validator_list = [
        ]
        list_output_validator_list = [
        ]
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vapi/std/introspection/service',
            path_variables={
            },
            query_parameters={
            },
            dispatch_parameters={
            },
            header_parameters={
            },
            dispatch_header_parameters={
            }
        )

        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'id': type.IdType(resource_types='com.vmware.vapi.service'),
        })
        get_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        get_input_value_validator_list = [
        ]
        get_output_validator_list = [
        ]
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vapi/std/introspection/service/{id}',
            path_variables={
                'id': 'id',
            },
            query_parameters={
            },
            dispatch_parameters={
            },
            header_parameters={
            },
            dispatch_header_parameters={
            }
        )

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.SetType(type.IdType()),
                'errors': list_error_dict,
                'input_value_validator_list': list_input_value_validator_list,
                'output_validator_list': list_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType(__name__, 'Service.Info'),
                'errors': get_error_dict,
                'input_value_validator_list': get_input_value_validator_list,
                'output_validator_list': get_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'list': list_rest_metadata,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.vapi.std.introspection.service',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=True)
예제 #13
0
class Configs(VapiInterface):
    """
    ``Configs`` class provides methods to manage desired configuration
    specification of an appliance.
    """

    _VAPI_SERVICE_ID = 'com.vmware.appliance.infraprofile.configs'
    """
    Identifier of the service in canonical form.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _ConfigsStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update({'validate_task': 'validate$task'})
        self._VAPI_OPERATION_IDS.update(
            {'import_profile_task': 'import_profile$task'})

    class ValidationStatus(Enum):
        """
        The ``Configs.ValidationStatus`` class defines possible values of status of
        profile spec.

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

        """
        INVALID = None
        """
        Profile spec is invalid.

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

    ValidationStatus._set_values([
        ValidationStatus('VALID'),
        ValidationStatus('INVALID'),
    ])
    ValidationStatus._set_binding_type(
        type.EnumType(
            'com.vmware.appliance.infraprofile.configs.validation_status',
            ValidationStatus))

    class ProfileInfo(VapiStruct):
        """
        The ``Configs.ProfileInfo`` class defines the information about profile.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            name=None,
            info=None,
        ):
            """
            :type  name: :class:`str`
            :param name: Name of the profile which is also a profile identifier.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.infraprofile.profile``. When methods return a value of
                this class as a return value, the attribute will be an identifier
                for the resource type: ``com.vmware.infraprofile.profile``.
            :type  info: :class:`str`
            :param info: Description of the profile.
            """
            self.name = name
            self.info = info
            VapiStruct.__init__(self)

    ProfileInfo._set_binding_type(
        type.StructType(
            'com.vmware.appliance.infraprofile.configs.profile_info', {
                'name':
                type.IdType(resource_types='com.vmware.infraprofile.profile'),
                'info':
                type.StringType(),
            }, ProfileInfo, False, None))

    class ProfilesSpec(VapiStruct):
        """
        The ``Configs.ProfilesSpec`` class represents a spec information for export
        operation.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            encryption_key=None,
            description=None,
            profiles=None,
        ):
            """
            :type  encryption_key: :class:`str` or ``None``
            :param encryption_key: Encryption Key to encrypt/decrypt profiles.
                If None encryption will not be used for the profile.
            :type  description: :class:`str` or ``None``
            :param description: Custom description provided by the user.
                If None description will be empty.
            :type  profiles: :class:`set` of :class:`str` or ``None``
            :param profiles: Profiles to be exported/imported.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.infraprofile.profile``. When methods return a value of
                this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.infraprofile.profile``.
                If None or empty, all profiles will be returned.
            """
            self.encryption_key = encryption_key
            self.description = description
            self.profiles = profiles
            VapiStruct.__init__(self)

    ProfilesSpec._set_binding_type(
        type.StructType(
            'com.vmware.appliance.infraprofile.configs.profiles_spec', {
                'encryption_key': type.OptionalType(type.SecretType()),
                'description': type.OptionalType(type.StringType()),
                'profiles': type.OptionalType(type.SetType(type.IdType())),
            }, ProfilesSpec, False, None))

    class ImportProfileSpec(VapiStruct):
        """
        The ``Configs.ImportProfileSpec`` class represents a spec information for
        import and validate.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            config_spec=None,
            profile_spec=None,
        ):
            """
            :type  config_spec: :class:`str`
            :param config_spec: The JSON string representing the desired config specification.
            :type  profile_spec: :class:`Configs.ProfilesSpec` or ``None``
            :param profile_spec: The profile specification, if any
                only :class:`set` if there is a profilespec avaliable for this
                import profilespec.
            """
            self.config_spec = config_spec
            self.profile_spec = profile_spec
            VapiStruct.__init__(self)

    ImportProfileSpec._set_binding_type(
        type.StructType(
            'com.vmware.appliance.infraprofile.configs.import_profile_spec', {
                'config_spec':
                type.StringType(),
                'profile_spec':
                type.OptionalType(
                    type.ReferenceType(__name__, 'Configs.ProfilesSpec')),
            }, ImportProfileSpec, False, None))

    class ValidationResult(VapiStruct):
        """
        The ``Configs.ValidationResult`` class contains attributes to describe
        result of validation of profile specification.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            status=None,
            notifications=None,
        ):
            """
            :type  status: :class:`Configs.ValidationStatus`
            :param status: Status of the Profile spec.
            :type  notifications: :class:`Notifications` or ``None``
            :param notifications: Notifications to the user
                Only :class:`set` if the notifications were reported by this
                particular validation.
            """
            self.status = status
            self.notifications = notifications
            VapiStruct.__init__(self)

    ValidationResult._set_binding_type(
        type.StructType(
            'com.vmware.appliance.infraprofile.configs.validation_result', {
                'status':
                type.ReferenceType(__name__, 'Configs.ValidationStatus'),
                'notifications':
                type.OptionalType(type.ReferenceType(__name__,
                                                     'Notifications')),
            }, ValidationResult, False, None))

    def list(self):
        """
        List all the profiles which are registered.


        :rtype: :class:`list` of :class:`Configs.ProfileInfo`
        :return: List of profiles with description are registered.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If there is unknown internal error. The accompanying error message
            will give more details about the failure.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            If the service is not available.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            If the caller is not authenticated.
        """
        return self._invoke('list', None)

    def export(
        self,
        spec=None,
    ):
        """
        Exports the desired profile specification.

        :type  spec: :class:`Configs.ProfilesSpec` or ``None``
        :param spec: 
            information to export the profile.
        :rtype: :class:`str`
        :return: Configuration specification JSON in string format.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If there is unknown internal error. The accompanying error message
            will give more details about the failure.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If there is no profile associated.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            If the service is not available.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            If the caller is not authenticated.
        """
        return self._invoke('export', {
            'spec': spec,
        })

    def validate_task(
        self,
        spec,
    ):
        """
        Validates the desired profile specification.

        :type  spec: :class:`Configs.ImportProfileSpec`
        :param spec: information to validate the profile.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If there is unknown internal error. The accompanying error message
            will give more details about the failure.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If there is no profile associated.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            If the service is not available.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            If the caller is not authenticated.
        """
        task_id = self._invoke('validate$task', {
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ReferenceType(__name__, 'Configs.ValidationResult'))
        return task_instance

    def import_profile_task(
        self,
        spec,
    ):
        """
        Imports the desired profile specification.

        :type  spec: :class:`Configs.ImportProfileSpec`
        :param spec: information to import the profile.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If there is unknown internal error. The accompanying error message
            will give more details about the failure.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If there is no profile associated.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            If the service is not available.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            If there is another operation in progress.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            If the caller is not authenticated.
        """
        task_id = self._invoke('import_profile$task', {
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(task_id, task_svc, type.StringType())
        return task_instance
예제 #14
0
class BaseImages(VapiInterface):
    """
    The ``BaseImages`` class provides methods to manage trusted instances of
    ESX software on a cluster level. This class was added in vSphere API 7.0.0.
    """
    RESOURCE_TYPE = "com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage"
    """
    Resource type for ESX base image. This class attribute was added in vSphere API
    7.0.0.

    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.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 = {}
        self._VAPI_OPERATION_IDS.update(
            {'import_from_imgdb_task': 'import_from_imgdb$task'})
        self._VAPI_OPERATION_IDS.update({'list_task': 'list$task'})
        self._VAPI_OPERATION_IDS.update({'delete_task': 'delete$task'})
        self._VAPI_OPERATION_IDS.update({'get_task': 'get$task'})

    class Health(Enum):
        """
        The ``BaseImages.Health`` class is indicator for the consistency of the
        hosts status in the cluster. This enumeration was added in vSphere API
        7.0.0.

        .. 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
        """
        No status available. This class attribute was added in vSphere API 7.0.0.

        """
        OK = None
        """
        Each host in the cluster is in consistent state with the rest hosts in the
        cluster. This class attribute was added in vSphere API 7.0.0.

        """
        WARNING = None
        """
        Attestation is funtioning, however there is an issue that requires
        attention. This class attribute was added in vSphere API 7.0.0.

        """
        ERROR = None
        """
        Not all hosts in the cluster are in consistent state. This class attribute
        was added in vSphere API 7.0.0.

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

    Health._set_values([
        Health('NONE'),
        Health('OK'),
        Health('WARNING'),
        Health('ERROR'),
    ])
    Health._set_binding_type(
        type.EnumType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.base_images.health',
            Health))

    class Summary(VapiStruct):
        """
        The ``BaseImages.Summary`` class contains information that summarizes an
        ESX base image. This class was added in vSphere API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            version=None,
            display_name=None,
            health=None,
        ):
            """
            :type  version: :class:`str`
            :param version: A unique ESX version number. This attribute was added in vSphere
                API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage``.
                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.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage``.
            :type  display_name: :class:`str`
            :param display_name: A unique ESX version formatted for display. This attribute was
                added in vSphere API 7.0.0.
            :type  health: :class:`BaseImages.Health`
            :param health: A health indicator which indicates whether each host in the cluster
                has this version of the ESX base image. This attribute was added in
                vSphere API 7.0.0.
            """
            self.version = version
            self.display_name = display_name
            self.health = health
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.base_images.summary',
            {
                'version':
                type.IdType(
                    resource_types=
                    'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage'
                ),
                'display_name':
                type.StringType(),
                'health':
                type.ReferenceType(__name__, 'BaseImages.Health'),
            }, Summary, False, None))

    class Info(VapiStruct):
        """
        The ``BaseImages.Info`` class contains information that describes an ESX
        base image. This class was added in vSphere API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            display_name=None,
            health=None,
            details=None,
        ):
            """
            :type  display_name: :class:`str`
            :param display_name: A unique ESX version formatted for display. This attribute was
                added in vSphere API 7.0.0.
            :type  health: :class:`BaseImages.Health`
            :param health: A health indicator which indicates whether each host in the cluster
                has this version of the ESX base image. This attribute was added in
                vSphere API 7.0.0.
            :type  details: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param details: Details regarding the health. 
                
                When the ``BaseImages.Health`` is not :attr:`BaseImages.Health.OK`
                or :attr:`BaseImages.Health.NONE`, this member will provide an
                actionable description of the issues present.. This attribute was
                added in vSphere API 7.0.0.
            """
            self.display_name = display_name
            self.health = health
            self.details = details
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.base_images.info',
            {
                'display_name':
                type.StringType(),
                'health':
                type.ReferenceType(__name__, 'BaseImages.Health'),
                'details':
                type.ListType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
            }, Info, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``BaseImages.FilterSpec`` class contains the data necessary for
        identifying a Trust Authority Host in a cluster. This class was added in
        vSphere API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            version=None,
            display_name=None,
            health=None,
        ):
            """
            :type  version: :class:`set` of :class:`str` or ``None``
            :param version: Search criteria by ESX base image version numbers. This attribute
                was added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage``.
                When methods return a value of this class as a return value, the
                attribute will contain identifiers for the resource type:
                ``com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage``.
                version if {\\\\@term.unset} return all ESX version numbers.
            :type  display_name: :class:`set` of :class:`str` or ``None``
            :param display_name: Search criteria by ESX base image version version numbers. This
                attribute was added in vSphere API 7.0.0.
                displayName if {\\\\@term.unset} return all ESX display version
                numbers.
            :type  health: :class:`set` of :class:`BaseImages.Health` or ``None``
            :param health: Search criteria by health indicator. This attribute was added in
                vSphere API 7.0.0.
                health if {\\\\@term.unset} return all health indicators.
            """
            self.version = version
            self.display_name = display_name
            self.health = health
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.base_images.filter_spec',
            {
                'version':
                type.OptionalType(type.SetType(type.IdType())),
                'display_name':
                type.OptionalType(type.SetType(type.StringType())),
                'health':
                type.OptionalType(
                    type.SetType(
                        type.ReferenceType(__name__, 'BaseImages.Health'))),
            }, FilterSpec, False, None))

    def import_from_imgdb_task(
        self,
        cluster,
        imgdb,
    ):
        """
        Import ESX metadata as a new trusted base image to each host in the
        cluster. 
        
        Import a boot_imgdb.tgz file which contains metadata that describes a
        trusted ESX base image. A boot_imgdb.tgz file can be downloaded from a
        representative host.. This method was added in vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The id of the cluster on which the operation will be executed.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  imgdb: :class:`str`
        :param imgdb: ESX metadata on a cluster level.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.AlreadyExists` 
            if ESX metadata for the same version has already been added.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the imgdb is invalid or cluster id is empty.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the cluster is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the caller is not authenticated.
        """
        task_id = self._invoke('import_from_imgdb$task', {
            'cluster': cluster,
            'imgdb': imgdb,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.IdType(
                resource_types=
                'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage'
            ))
        return task_instance

    def list_task(
        self,
        cluster,
        spec=None,
    ):
        """
        Return a list of trusted ESX base images. This method was added in
        vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The id of the cluster on which the operation will be executed.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`BaseImages.FilterSpec` or ``None``
        :param spec: The search specification.
            if {\\\\@term.unset} return all information.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the cluster id is empty.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the cluster is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the caller is not authenticated.
        """
        task_id = self._invoke('list$task', {
            'cluster': cluster,
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ListType(type.ReferenceType(__name__, 'BaseImages.Summary')))
        return task_instance

    def delete_task(
        self,
        cluster,
        version,
    ):
        """
        Remove a trusted ESX base image of each ESX in the cluster. This method
        was added in vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The id of the cluster on which the operation will be executed.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  version: :class:`str`
        :param version: The ESX base image version.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage``.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the version is invalid or the cluster id is empty.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the version or cluster is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the caller is not authenticated.
        """
        task_id = self._invoke('delete$task', {
            'cluster': cluster,
            'version': version,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(task_id, task_svc, type.VoidType())
        return task_instance

    def get_task(
        self,
        cluster,
        version,
    ):
        """
        Get the trusted ESX base version details. This method was added in
        vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The id of the cluster on which the operation will be executed.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  version: :class:`str`
        :param version: The ESX base image version.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage``.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the version is invalid or the cluster id is empty.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the version or cluster is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the caller is not authenticated.
        """
        task_id = self._invoke('get$task', {
            'cluster': cluster,
            'version': version,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(task_id, task_svc,
                             type.ReferenceType(__name__, 'BaseImages.Info'))
        return task_instance
class Packages(VapiInterface):
    """
    The ``Packages`` class provides methods to manage a host's Hardware Support
    Package (HSP) configuration.
    """

    _VAPI_SERVICE_ID = 'com.vmware.esx.settings.hardware_support.managers.packages'
    """
    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, _PackagesStub)
        self._VAPI_OPERATION_IDS = {}

    class HardwareSupportPackageInfo(VapiStruct):
        """
        The ``Packages.HardwareSupportPackageInfo`` class contains attributes that
        describe a particular 3rd party Hardware Support Package (HSP)

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            pkg=None,
            version=None,
            description=None,
            supported_releases=None,
        ):
            """
            :type  pkg: :class:`str`
            :param pkg: Name of the Hardware Support Package (e.g. "Jan. 2018 Release" or
                "Latest Hardware Support Package for Frobozz GenX hardware")
                selected
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.esx.setting.hardware_support.package``. 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.setting.hardware_support.package``.
            :type  version: :class:`str`
            :param version: Version of the Hardware Support Package (e.g. "20180128.1" or
                "v42") selected
            :type  description: :class:`str`
            :param description: Description of the Hardware Support Package (HSP) (e.g. for use in
                help bubble)
            :type  supported_releases: :class:`set` of :class:`str`
            :param supported_releases: Supported vSphere releases
            """
            self.pkg = pkg
            self.version = version
            self.description = description
            self.supported_releases = supported_releases
            VapiStruct.__init__(self)

    HardwareSupportPackageInfo._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.hardware_support.managers.packages.hardware_support_package_info',
            {
                'pkg':
                type.IdType(resource_types=
                            'com.vmware.esx.setting.hardware_support.package'),
                'version':
                type.StringType(),
                'description':
                type.StringType(),
                'supported_releases':
                type.SetType(type.StringType()),
            }, HardwareSupportPackageInfo, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``Packages.FilterSpec`` class contains attributes used to filter the
        results when listing OEM Hardware Support Packages (HSPs), see
        :func:`Packages.list`).

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            base_image_version=None,
        ):
            """
            :type  base_image_version: :class:`str` or ``None``
            :param base_image_version: vSphere release version the Hardware Support Package (HSP) must
                support to match the filter. Only Hardware Support Packages (HSPs)
                compatible with the vSphere release version specified in
                'baseImageVersion' will be returned. The 'baseImageVersion'
                parameter should be a full numeric base image version string (e.g.
                "7.1.0-2.3.436234"). Future implementations may support version
                specification by prefix (e.g. "7.1" to specify all updates and
                builds of 7.1) or other forms of specification (e.g. ">=7.0").
                Hardware Support Pacakges (HSPs) may be advertised as supporting
                truncated version strings to indicate the remainder is wildcarded.
                Matching is on the specified substring only, so a bundle supporting
                "7.1.0-2" would match a 'release' parameter of "7.1.0-2.3.436234"
                as well as "7.1.0-2.1.4133564" and "7.1.0-1.0.355667" but not
                "7.1.0-3.0.63445" or any base image version starting with "7.2".
                Note that we require compatible base image versions be specified at
                least down to the update version (i.e. "7.0" is insufficiently
                constrained)
                If None, all packages will be returned, regardless of base image
                version.
            """
            self.base_image_version = base_image_version
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.hardware_support.managers.packages.filter_spec',
            {
                'base_image_version': type.OptionalType(type.StringType()),
            }, FilterSpec, False, None))

    def list(
        self,
        manager,
        filter=None,
    ):
        """
        Returns the list of available Hardware Support Packages (HSPs) for a
        particular host, as specified by its Hardware Support Manager (HSM)

        :type  manager: :class:`str`
        :param manager: Identifier for the Hardware Support Manager (HSM).
            The parameter must be an identifier for the resource type:
            ``com.vmware.esx.setting.hardware_support.manager``.
        :type  filter: :class:`Packages.FilterSpec` or ``None``
        :param filter: Specification of Hardware Support Packages (HSPs) to be returned
            If None, the behavior is equivalent to a
            :class:`Packages.FilterSpec` with all attributes None, which means
            all HSPs match the filter.
        :rtype: :class:`list` of :class:`Packages.HardwareSupportPackageInfo`
        :return: List of available Hardware Support Packages (HSPs) for given
            manager
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If there is some unknown internal error. The accompanying error
            message will give more details about the failure.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If there is no Hardware Support Manager (HSM) with the specified
            name
        :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. named ``manager`` in the
            system.
        :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', {
            'manager': manager,
            'filter': filter,
        })
예제 #16
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,
        })
예제 #17
0
class Services(VapiInterface):
    """
    The ``Services`` class manages the Key Provider Service instances a Trusted
    Cluster is configured to use. This class was added in vSphere API 7.0.0.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.trusted_infrastructure.trusted_clusters.kms.services'
    """
    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, _ServicesStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update({'create_task': 'create$task'})
        self._VAPI_OPERATION_IDS.update({'delete_task': 'delete$task'})

    class Summary(VapiStruct):
        """
        The ``Services.Summary`` class contains basic information about a
        registered Key Provider Service instance that is configured for a cluster.
        This class was added in vSphere API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            service=None,
            address=None,
            group=None,
            trust_authority_cluster=None,
        ):
            """
            :type  service: :class:`str`
            :param service: The service's unique identifier. This attribute was added in
                vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.trusted_infrastructure.kms.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.vcenter.trusted_infrastructure.kms.Service``.
            :type  address: :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress`
            :param address: The service's address. This attribute was added in vSphere API
                7.0.0.
            :type  group: :class:`str`
            :param group: The group determines the Attestation Service instances this Key
                Provider Service can accept reports from. This attribute was added
                in vSphere API 7.0.0.
            :type  trust_authority_cluster: :class:`str`
            :param trust_authority_cluster: The cluster specifies the Trust Authority Cluster this Key Provider
                Service belongs to. This attribute was added in vSphere API 7.0.0.
            """
            self.service = service
            self.address = address
            self.group = group
            self.trust_authority_cluster = trust_authority_cluster
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trusted_clusters.kms.services.summary',
            {
                'service':
                type.IdType(
                    resource_types=
                    'com.vmware.vcenter.trusted_infrastructure.kms.Service'),
                'address':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'NetworkAddress'),
                'group':
                type.StringType(),
                'trust_authority_cluster':
                type.StringType(),
            }, Summary, False, None))

    class Info(VapiStruct):
        """
        The ``Services.Info`` class contains all the stored information about a
        registered Key Provider Service instance that is configured for a cluster.
        This class was added in vSphere API 7.0.0.

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

        _canonical_to_pep_names = {
            'trusted_CA': 'trusted_ca',
        }

        def __init__(
            self,
            address=None,
            trusted_ca=None,
            group=None,
            trust_authority_cluster=None,
        ):
            """
            :type  address: :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress`
            :param address: The service's address. This attribute was added in vSphere API
                7.0.0.
            :type  trusted_ca: :class:`com.vmware.vcenter.trusted_infrastructure_client.X509CertChain`
            :param trusted_ca: The service's TLS certificate chain. This attribute was added in
                vSphere API 7.0.0.
            :type  group: :class:`str`
            :param group: The group determines the Attestation Service instances this Key
                Provider Service can accept reports from. This attribute was added
                in vSphere API 7.0.0.
            :type  trust_authority_cluster: :class:`str`
            :param trust_authority_cluster: The cluster specifies the Trust Authority Cluster this Key Provider
                Service belongs to. This attribute was added in vSphere API 7.0.0.
            """
            self.address = address
            self.trusted_ca = trusted_ca
            self.group = group
            self.trust_authority_cluster = trust_authority_cluster
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trusted_clusters.kms.services.info',
            {
                'address':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'NetworkAddress'),
                'trusted_CA':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'X509CertChain'),
                'group':
                type.StringType(),
                'trust_authority_cluster':
                type.StringType(),
            }, Info, False, None))

    class CreateSpec(VapiStruct):
        """
        The ``Services.CreateSpec`` class contains the data necessary for
        configuring a registered Key Provider Service instance with a cluster in
        the environment. This class was added in vSphere API 7.0.0.

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

        _validator_list = [
            UnionValidator(
                'type', {
                    'SERVICE': [('service', True)],
                    'CLUSTER': [('trust_authority_cluster', True)],
                }),
        ]

        def __init__(
            self,
            type=None,
            service=None,
            trust_authority_cluster=None,
        ):
            """
            :type  type: :class:`Services.CreateSpec.SourceType`
            :param type: Source of truth for the configuration of the Key Provider Service.
                This attribute was added in vSphere API 7.0.0.
            :type  service: :class:`str`
            :param service: The service's unique ID. This attribute was added in vSphere API
                7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.trusted_infrastructure.kms.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.vcenter.trusted_infrastructure.kms.Service``.
                This attribute is optional and it is only relevant when the value
                of ``type`` is :attr:`Services.CreateSpec.SourceType.SERVICE`.
            :type  trust_authority_cluster: :class:`str`
            :param trust_authority_cluster: The attestation cluster's unique ID. This attribute was added in
                vSphere API 7.0.0.
                This attribute is optional and it is only relevant when the value
                of ``type`` is :attr:`Services.CreateSpec.SourceType.CLUSTER`.
            """
            self.type = type
            self.service = service
            self.trust_authority_cluster = trust_authority_cluster
            VapiStruct.__init__(self)

        class SourceType(Enum):
            """
            The ``Services.CreateSpec.SourceType`` class specifies source of truth the
            Key Provider Service will use for its configuration. This enumeration was
            added in vSphere API 7.0.0.

            .. 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>`.
            """
            SERVICE = None
            """
            The Key Provider Service will be configured based on an ID of an specific
            Key Provider Service. This class attribute was added in vSphere API 7.0.0.

            """
            CLUSTER = None
            """
            The Key Provider Service will be configured based on an ID of a whole
            attestation cluster. This class attribute was added in vSphere API 7.0.0.

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

        SourceType._set_values([
            SourceType('SERVICE'),
            SourceType('CLUSTER'),
        ])
        SourceType._set_binding_type(
            type.EnumType(
                'com.vmware.vcenter.trusted_infrastructure.trusted_clusters.kms.services.create_spec.source_type',
                SourceType))

    CreateSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trusted_clusters.kms.services.create_spec',
            {
                'type':
                type.ReferenceType(__name__, 'Services.CreateSpec.SourceType'),
                'service':
                type.OptionalType(type.IdType()),
                'trust_authority_cluster':
                type.OptionalType(type.StringType()),
            }, CreateSpec, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``Services.FilterSpec`` class contains the data necessary for
        identifying a Key Provider service instance. This class was added in
        vSphere API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            services=None,
            address=None,
            group=None,
            trust_authority_cluster=None,
        ):
            """
            :type  services: :class:`set` of :class:`str` or ``None``
            :param services: A set of IDs by which to filter the services. This attribute was
                added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vcenter.trusted_infrastructure.kms.Service``. When
                methods return a value of this class as a return value, the
                attribute will contain identifiers for the resource type:
                ``com.vmware.vcenter.trusted_infrastructure.kms.Service``.
                If None, the services will not be filtered by ID.
            :type  address: :class:`list` of :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress` or ``None``
            :param address: The service's address. This attribute was added in vSphere API
                7.0.0.
                If None, the services will not be filtered by address.
            :type  group: :class:`set` of :class:`str` or ``None``
            :param group: The group determines the Attestation Service instances this Key
                Provider Service can accept reports from. This attribute was added
                in vSphere API 7.0.0.
                If None, the services will not be filtered by group.
            :type  trust_authority_cluster: :class:`set` of :class:`str` or ``None``
            :param trust_authority_cluster: The cluster specifies the Trust Authority Cluster this Key Provider
                Service instance belongs to. This attribute was added in vSphere
                API 7.0.0.
                If None, the services will not be filtered by
                trustAuthorityCluster.
            """
            self.services = services
            self.address = address
            self.group = group
            self.trust_authority_cluster = trust_authority_cluster
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trusted_clusters.kms.services.filter_spec',
            {
                'services':
                type.OptionalType(type.SetType(type.IdType())),
                'address':
                type.OptionalType(
                    type.ListType(
                        type.ReferenceType(
                            'com.vmware.vcenter.trusted_infrastructure_client',
                            'NetworkAddress'))),
                'group':
                type.OptionalType(type.SetType(type.StringType())),
                'trust_authority_cluster':
                type.OptionalType(type.SetType(type.StringType())),
            }, FilterSpec, False, None))

    def list(
        self,
        cluster,
        spec=None,
    ):
        """
        Returns basic information about all configured Key Provider Service
        instances used by this cluster. This method was added in vSphere API
        7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The ID of the cluster.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`Services.FilterSpec` or ``None``
        :param spec: Only return services matching the filters.
            If {\\\\@term.unset} return all services.
        :rtype: :class:`list` of :class:`Services.Summary`
        :return: basic information about all configured Key Provider Service
            instances used by this cluster
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the cluster ID is invalid.
        :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 you do not have all of the privileges described as follows: 
            
            * Method execution requires ``TrustedAdmin.ReadTrustedHosts``.
            * The resource ``ClusterComputeResource`` referenced by the
              parameter ``cluster`` requires ``System.View``.
        """
        return self._invoke('list', {
            'cluster': cluster,
            'spec': spec,
        })

    def get(
        self,
        cluster,
        service,
    ):
        """
        Returns detailed information about the given Key Provider Service
        instance used by the given cluster. This method was added in vSphere
        API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The ID of the cluster.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  service: :class:`str`
        :param service: The ID of the service.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.trusted_infrastructure.kms.Service``.
        :rtype: :class:`Services.Info`
        :return: Detailed information about the given Key Provider Service instance
            used by the given cluster.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the cluster or the service ID is invalid.
        :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 you do not have all of the privileges described as follows: 
            
            * Method execution requires ``TrustedAdmin.ReadTrustedHosts``.
            * The resource ``ClusterComputeResource`` referenced by the
              parameter ``cluster`` requires ``System.View``.
        """
        return self._invoke('get', {
            'cluster': cluster,
            'service': service,
        })

    def create_task(
        self,
        cluster,
        spec,
    ):
        """
        Configures the cluster to use a the given registered Key Provider
        Service. This method was added in vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The ID of the cluster.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`Services.CreateSpec`
        :param spec: Describes the registered instance of the Key Provider Service
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.AlreadyExists` 
            if the Key Provider Service is already configured for this cluster
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            for any other error.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the CreateSpec is not valid.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the cluster ID is not valid.
        :raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource` 
            if all the hosts in the cluster do not have VMware vSphere Trust
            Authority enabled license.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        """
        task_id = self._invoke('create$task', {
            'cluster': cluster,
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.IdType(
                resource_types=
                'com.vmware.vcenter.trusted_infrastructure.kms.Service'))
        return task_instance

    def delete_task(
        self,
        cluster,
        service,
    ):
        """
        Removes the Key Provider Service instance from the configuration of the
        given cluster. This method was added in vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: the unique ID of the cluster.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  service: :class:`str`
        :param service: the registered Key Provider Service instance unique identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.trusted_infrastructure.kms.Service``.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the Key Provider Service instance or the cluster are not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        """
        task_id = self._invoke('delete$task', {
            'cluster': cluster,
            'service': service,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(task_id, task_svc, type.VoidType())
        return task_instance
class TrustAuthorityClusters(VapiInterface):
    """
    The ``TrustAuthorityClusters`` class manages all the Trust Authority
    Components on each Trust Authority Host in the cluster. The
    ``TrustAuthorityClusters`` class transforms a ClusterComputeResource into
    Trust Authority Cluster and vice versa. This class was added in vSphere API
    7.0.0.0.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.trusted_infrastructure.trust_authority_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, _TrustAuthorityClustersStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update({'update_task': 'update$task'})

    class State(Enum):
        """
        The ``TrustAuthorityClusters.State`` class defines the states of the
        :class:`TrustAuthorityClusters`. This enumeration was added in vSphere API
        7.0.0.0.

        .. 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>`.
        """
        ENABLE = None
        """
        The :class:`TrustAuthorityClusters` is enabled. This class attribute was
        added in vSphere API 7.0.0.0.

        """
        DISABLE = None
        """
        The :class:`TrustAuthorityClusters` is disabled. This class attribute was
        added in vSphere API 7.0.0.0.

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

    State._set_values([
        State('ENABLE'),
        State('DISABLE'),
    ])
    State._set_binding_type(
        type.EnumType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.state',
            State))

    class Summary(VapiStruct):
        """
        The ``TrustAuthorityClusters.Summary`` class contains information about
        :class:`TrustAuthorityClusters` id and state. This class was added in
        vSphere API 7.0.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            cluster=None,
            state=None,
        ):
            """
            :type  cluster: :class:`str`
            :param cluster: Identifies the cluster. This attribute was added in vSphere API
                7.0.0.0.
                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  state: :class:`TrustAuthorityClusters.State`
            :param state: The state of the :class:`TrustAuthorityClusters`. This attribute
                was added in vSphere API 7.0.0.0.
            """
            self.cluster = cluster
            self.state = state
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.summary',
            {
                'cluster':
                type.IdType(resource_types='ClusterComputeResource'),
                'state':
                type.ReferenceType(__name__, 'TrustAuthorityClusters.State'),
            }, Summary, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``TrustAuthorityClusters.FilterSpec`` class contains the data necessary
        for identifying a :class:`TrustAuthorityClusters`. This class was added in
        vSphere API 7.0.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            cluster=None,
            state=None,
        ):
            """
            :type  cluster: :class:`set` of :class:`str` or ``None``
            :param cluster: Identifies the cluster. This attribute was added in vSphere API
                7.0.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``ClusterComputeResource``. When methods return a value of this
                class as a return value, the attribute will contain identifiers for
                the resource type: ``ClusterComputeResource``.
                cluster If {\\\\@term.unset} return all Trust Authority Clusters.
            :type  state: :class:`set` of :class:`TrustAuthorityClusters.State` or ``None``
            :param state: The state of the :class:`TrustAuthorityClusters`. This attribute
                was added in vSphere API 7.0.0.0.
                state If {\\\\@term.unset} return all Trust Authority Clusters.
            """
            self.cluster = cluster
            self.state = state
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.filter_spec',
            {
                'cluster':
                type.OptionalType(type.SetType(type.IdType())),
                'state':
                type.OptionalType(
                    type.SetType(
                        type.ReferenceType(__name__,
                                           'TrustAuthorityClusters.State'))),
            }, FilterSpec, False, None))

    class UpdateSpec(VapiStruct):
        """
        The ``TrustAuthorityClusters.UpdateSpec`` class contains the data necessary
        for update of a :class:`TrustAuthorityClusters`. This class was added in
        vSphere API 7.0.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            state=None,
        ):
            """
            :type  state: :class:`TrustAuthorityClusters.State` or ``None``
            :param state: The state of the :class:`TrustAuthorityClusters`. This attribute
                was added in vSphere API 7.0.0.0.
                state If {\\\\@term.unset} no operation is performed.
            """
            self.state = state
            VapiStruct.__init__(self)

    UpdateSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.update_spec',
            {
                'state':
                type.OptionalType(
                    type.ReferenceType(__name__,
                                       'TrustAuthorityClusters.State')),
            }, UpdateSpec, False, None))

    class Info(VapiStruct):
        """
        The ``TrustAuthorityClusters.Info`` class contains the data necessary for
        retrieving the :class:`TrustAuthorityClusters` info. This class was added
        in vSphere API 7.0.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            cluster=None,
            state=None,
        ):
            """
            :type  cluster: :class:`str`
            :param cluster: Identifies the cluster. This attribute was added in vSphere API
                7.0.0.0.
                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  state: :class:`TrustAuthorityClusters.State`
            :param state: The state of the cluster. This attribute was added in vSphere API
                7.0.0.0.
            """
            self.cluster = cluster
            self.state = state
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.info',
            {
                'cluster':
                type.IdType(resource_types='ClusterComputeResource'),
                'state':
                type.ReferenceType(__name__, 'TrustAuthorityClusters.State'),
            }, Info, False, None))

    def update_task(
        self,
        cluster,
        spec,
    ):
        """
        Updates the state of a cluster. This method was added in vSphere API
        7.0.0.0.

        :type  cluster: :class:`str`
        :param cluster: Cluster id.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`TrustAuthorityClusters.UpdateSpec`
        :param spec: The specification for update of a cluster.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if ``spec`` doesn't match to any cluster compute resource.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        """
        task_id = self._invoke('update$task', {
            'cluster': cluster,
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(task_id, task_svc, type.VoidType())
        return task_instance

    def get(
        self,
        cluster,
    ):
        """
        Get the result of the last Update operation which matches the cluster
        id. This method was added in vSphere API 7.0.0.0.

        :type  cluster: :class:`str`
        :param cluster: Cluster id.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :rtype: :class:`TrustAuthorityClusters.Info`
        :return: The :class:`TrustAuthorityClusters.Info` instance which contains
            information about the state of the cluster.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if ``cluster`` doesn't match to any ClusterComputeResource.
        :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 you do not have all of the privileges described as follows: 
            
            * Method execution requires ``TrustedAdmin.ReadTrustedHosts``.
            * The resource ``ClusterComputeResource`` referenced by the
              parameter ``cluster`` requires ``System.View``.
        """
        return self._invoke('get', {
            'cluster': cluster,
        })

    def list(
        self,
        spec=None,
    ):
        """
        Returns a list of clusters for this vCenter instance which matches the
        :class:`TrustAuthorityClusters.FilterSpec`. This method was added in
        vSphere API 7.0.0.0.

        :type  spec: :class:`TrustAuthorityClusters.FilterSpec` or ``None``
        :param spec: Return only clusters matching the specified filters.
            If {\\\\@term.unset} return all clusters.
        :rtype: :class:`list` of :class:`TrustAuthorityClusters.Summary`
        :return: List of :class:`TrustAuthorityClusters.Summary` for a
            :class:`TrustAuthorityClusters`.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :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 you do not have all of the privileges described as follows: 
            
            * Method execution requires ``TrustedAdmin.ReadTrustedHosts``.
            * The resource ``ClusterComputeResource`` referenced by the
              attribute :attr:`TrustAuthorityClusters.FilterSpec.cluster`
              requires ``System.View``.
        """
        return self._invoke('list', {
            'spec': spec,
        })
예제 #19
0
class Links(VapiInterface):
    """
    The ``Links`` class provides methods to create, delete, get information,
    and list hybrid links between the local and foreign Platform Service
    Controller (PSC). **Warning:** This class is available as technical
    preview. It may be changed in a future release.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.hvc.links'
    """
    Identifier of the service in canonical form.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _LinksStub)

    class Summary(VapiStruct):
        """
        The ``Links.Summary`` class contains information about the hybrid link.
        **Warning:** This class is available as technical preview. It may be
        changed in a future release.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            link=None,
            display_name=None,
        ):
            """
            :type  link: :class:`str`
            :param link: Unique identifier for the link. **Warning:** This attribute is
                available as technical preview. It may be changed in a future
                release.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.hvc.Links``. When methods return a value of
                this class as a return value, the attribute will be an identifier
                for the resource type: ``com.vmware.vcenter.hvc.Links``.
            :type  display_name: :class:`str`
            :param display_name: The display name is set to the domain name which was set during
                create. **Warning:** This attribute is available as technical
                preview. It may be changed in a future release.
            """
            self.link = link
            self.display_name = display_name
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.hvc.links.summary', {
                'link':
                type.IdType(resource_types='com.vmware.vcenter.hvc.Links'),
                'display_name': type.StringType(),
            }, Summary, False, None))

    class CreateSpec(VapiStruct):
        """
        The ``Links.CreateSpec`` class is the specification used for the hybrid
        link creation. **Warning:** This class is available as technical preview.
        It may be changed in a future release.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            psc_hostname=None,
            port=None,
            domain_name=None,
            username=None,
            password=None,
            ssl_thumbprint=None,
            admin_groups=None,
        ):
            """
            :type  psc_hostname: :class:`str`
            :param psc_hostname: The PSC hostname for the domain to be linked. **Warning:** This
                attribute is available as technical preview. It may be changed in a
                future release.
            :type  port: :class:`str` or ``None``
            :param port: The HTTPS port of the PSC to be linked. **Warning:** This attribute
                is available as technical preview. It may be changed in a future
                release.
                If None 443 will be used as default.
            :type  domain_name: :class:`str`
            :param domain_name: The domain to which the PSC belongs. **Warning:** This attribute is
                available as technical preview. It may be changed in a future
                release.
            :type  username: :class:`str`
            :param username: The administrator username of the PSC. **Warning:** This attribute
                is available as technical preview. It may be changed in a future
                release.
            :type  password: :class:`str`
            :param password: The administrator password of the PSC. **Warning:** This attribute
                is available as technical preview. It may be changed in a future
                release.
            :type  ssl_thumbprint: :class:`str` or ``None``
            :param ssl_thumbprint: The ssl thumbprint of the server. **Warning:** This attribute is
                available as technical preview. It may be changed in a future
                release.
                if None no thumbprint is passed.
            :type  admin_groups: :class:`set` of :class:`str` or ``None``
            :param admin_groups: List of groups to be added to enable administrator access to.
                **Warning:** This attribute is available as technical preview. It
                may be changed in a future release.
                if None administrator access will not be set.
            """
            self.psc_hostname = psc_hostname
            self.port = port
            self.domain_name = domain_name
            self.username = username
            self.password = password
            self.ssl_thumbprint = ssl_thumbprint
            self.admin_groups = admin_groups
            VapiStruct.__init__(self)

    CreateSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.hvc.links.create_spec', {
                'psc_hostname': type.StringType(),
                'port': type.OptionalType(type.StringType()),
                'domain_name': type.StringType(),
                'username': type.StringType(),
                'password': type.SecretType(),
                'ssl_thumbprint': type.OptionalType(type.StringType()),
                'admin_groups': type.OptionalType(
                    type.SetType(type.StringType())),
            }, CreateSpec, False, None))

    class CertificateInfo(VapiStruct):
        """
        The ``Links.CertificateInfo`` class contains information about the SSL
        certificate for a destination PSC endpoint. **Warning:** This class is
        available as technical preview. It may be changed in a future release.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            ssl_thumbprint=None,
        ):
            """
            :type  ssl_thumbprint: :class:`str`
            :param ssl_thumbprint: The SHA-256 thumbprint of the SSL certificate for the destination
                PSC endpoint. **Warning:** This attribute is available as technical
                preview. It may be changed in a future release.
            """
            self.ssl_thumbprint = ssl_thumbprint
            VapiStruct.__init__(self)

    CertificateInfo._set_binding_type(
        type.StructType('com.vmware.vcenter.hvc.links.certificate_info', {
            'ssl_thumbprint': type.StringType(),
        }, CertificateInfo, False, None))

    class Credentials(VapiStruct):
        """
        The ``Links.Credentials`` class specifies user credentials to make a
        successful connection to remote endpoint. **Warning:** This class is
        available as technical preview. It may be changed in a future release.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            user_name=None,
            password=None,
        ):
            """
            :type  user_name: :class:`str`
            :param user_name: Name of the user to authenticate. **Warning:** This attribute is
                available as technical preview. It may be changed in a future
                release.
            :type  password: :class:`str`
            :param password: Password for the user. **Warning:** This attribute is available as
                technical preview. It may be changed in a future release.
            """
            self.user_name = user_name
            self.password = password
            VapiStruct.__init__(self)

    Credentials._set_binding_type(
        type.StructType('com.vmware.vcenter.hvc.links.credentials', {
            'user_name': type.StringType(),
            'password': type.SecretType(),
        }, Credentials, False, None))

    def create(
        self,
        spec,
    ):
        """
        Creates a new hybrid link between the local and foreign PSC.
        **Warning:** This method is available as technical preview. It may be
        changed in a future release.

        :type  spec: :class:`Links.CreateSpec`
        :param spec: Specification for the new link to be created.
        :rtype: :class:`str`
        :return: The identifier of the newly linked domain.
            The return value will be an identifier for the resource type:
            ``com.vmware.vcenter.hvc.Links``.
        :raise: :class:`com.vmware.vapi.std.errors_client.AlreadyExists` 
            If the link already exists.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            If the values of any of the attributes of the ``spec`` parameter
            are not valid.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unsupported` 
            If the PSC or the VC version is not supported.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            If the user is not authorized.
        :raise: :class:`com.vmware.vapi.std.errors_client.UnverifiedPeer` 
            If the SSL certificate of the foreign PSC cannot be validated by
            comparing with the thumbprint provided in
            :attr:`Links.CreateSpec.ssl_thumbprint` or if
            :attr:`Links.CreateSpec.ssl_thumbprint` is None. The value of the
            {\\\\@link UnverifiedPeer#data) attribute will be a class that
            contains all the attributes defined in
            :class:`Links.CertificateInfo`.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if the system reports an error while responding to the request.
        """
        return self._invoke('create', {
            'spec': spec,
        })

    def delete(
        self,
        link,
    ):
        """
        Deletes an existing hybrid link. **Warning:** This method is available
        as technical preview. It may be changed in a future release.

        :type  link: :class:`str`
        :param link: Identifier of the hybrid link.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.hvc.Links``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If the hybrid link associated with ``link`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            If the user is not authorized.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if the system reports an error while responding to the request.
        """
        return self._invoke('delete', {
            'link': link,
        })

    def list(self):
        """
        Enumerates the list of registered hybrid links. **Warning:** This
        method is available as technical preview. It may be changed in a future
        release.


        :rtype: :class:`list` of :class:`Links.Summary`
        :return: The :class:`list` of hybrid link information.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if the system reports an error while responding to the request.
        """
        return self._invoke('list', None)
예제 #20
0
        self._capability = capability
        self.name = name
        self.description = description
        VapiStruct.__init__(self)

    @property
    def capability(self):
        """
        Return the discriminator value
        """
        return self._capability

CreateSpec._set_binding_type(type.StructType(
    'com.vmware.vcenter.compute.policies.capabilities.cluster_scale_in_ignore_vm_capabilities.create_spec', {
        'vm_tag': type.IdType(resource_types='com.vmware.cis.tagging.Tag:VirtualMachine'),
        'vm_capabilities': type.SetType(type.IdType()),
        'capability': type.IdType(resource_types='com.vmware.vcenter.compute.policies.Capability'),
        'name': type.StringType(),
        'description': type.StringType(),
    },
    CreateSpec,
    False,
    None))



class Info(VapiStruct):
    """
    The ``Info`` class contains information about a policy to ignore virtual
    machine capabilities when scaling-in a cluster, see
    :func:`com.vmware.vcenter.compute_client.Policies.get`. When considering
예제 #21
0
class Services(VapiInterface):
    """
    The ``Services`` class contains information about the registered instances
    of the Key Provider Service in vCenter. This class was added in vSphere API
    7.0.0.
    """
    RESOURCE_TYPE = "com.vmware.vcenter.trusted_infrastructure.kms.Service"
    """
    The resource type for the Key Provider Service instance. This class attribute
    was added in vSphere API 7.0.0.

    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.trusted_infrastructure.kms.services'
    """
    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, _ServicesStub)
        self._VAPI_OPERATION_IDS = {}

    class Summary(VapiStruct):
        """
        The ``Services.Summary`` class contains basic information about a
        registered Key Provider Service instance. This class was added in vSphere
        API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            service=None,
            address=None,
            group=None,
            trust_authority_cluster=None,
        ):
            """
            :type  service: :class:`str`
            :param service: The service's unique identifier. This attribute was added in
                vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.trusted_infrastructure.kms.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.vcenter.trusted_infrastructure.kms.Service``.
            :type  address: :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress`
            :param address: The service's address. This attribute was added in vSphere API
                7.0.0.
            :type  group: :class:`str`
            :param group: The group determines the Attestation Service instances this Key
                Provider Service can accept reports from. This attribute was added
                in vSphere API 7.0.0.
            :type  trust_authority_cluster: :class:`str`
            :param trust_authority_cluster: The cluster specifies the Trust Authority Cluster this Key Provider
                service belongs to. This attribute was added in vSphere API 7.0.0.
            """
            self.service = service
            self.address = address
            self.group = group
            self.trust_authority_cluster = trust_authority_cluster
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.kms.services.summary', {
                'service':
                type.IdType(
                    resource_types=
                    'com.vmware.vcenter.trusted_infrastructure.kms.Service'),
                'address':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'NetworkAddress'),
                'group':
                type.StringType(),
                'trust_authority_cluster':
                type.StringType(),
            }, Summary, False, None))

    class Info(VapiStruct):
        """
        The ``Services.Info`` class contains all the stored information about a
        registered Key Provider Service instance. This class was added in vSphere
        API 7.0.0.

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

        _canonical_to_pep_names = {
            'trusted_CA': 'trusted_ca',
        }

        def __init__(
            self,
            address=None,
            trusted_ca=None,
            group=None,
            trust_authority_cluster=None,
        ):
            """
            :type  address: :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress`
            :param address: The service's address. This attribute was added in vSphere API
                7.0.0.
            :type  trusted_ca: :class:`com.vmware.vcenter.trusted_infrastructure_client.X509CertChain`
            :param trusted_ca: The service's TLS certificate chain. This attribute was added in
                vSphere API 7.0.0.
            :type  group: :class:`str`
            :param group: The group determines the Attestation Service instances this Key
                Provider Service can accept reports from. This attribute was added
                in vSphere API 7.0.0.
            :type  trust_authority_cluster: :class:`str`
            :param trust_authority_cluster: The cluster specifies the Trust Authority Cluster this Key Provider
                Service belongs to. This attribute was added in vSphere API 7.0.0.
            """
            self.address = address
            self.trusted_ca = trusted_ca
            self.group = group
            self.trust_authority_cluster = trust_authority_cluster
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.kms.services.info', {
                'address':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'NetworkAddress'),
                'trusted_CA':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'X509CertChain'),
                'group':
                type.StringType(),
                'trust_authority_cluster':
                type.StringType(),
            }, Info, False, None))

    class CreateSpec(VapiStruct):
        """
        The ``Services.CreateSpec`` class contains the data necessary for
        registering a Key Provider Service instance to the environment. This class
        was added in vSphere API 7.0.0.

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

        _canonical_to_pep_names = {
            'trusted_CA': 'trusted_ca',
        }

        def __init__(
            self,
            address=None,
            trusted_ca=None,
            group=None,
            trust_authority_cluster=None,
        ):
            """
            :type  address: :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress`
            :param address: The service's address. This attribute was added in vSphere API
                7.0.0.
            :type  trusted_ca: :class:`com.vmware.vcenter.trusted_infrastructure_client.X509CertChain`
            :param trusted_ca: The service's TLS certificate chain. This attribute was added in
                vSphere API 7.0.0.
            :type  group: :class:`str`
            :param group: The group determines the Attestation Service instances this Key
                Provider service can accept reports from. This attribute was added
                in vSphere API 7.0.0.
            :type  trust_authority_cluster: :class:`str`
            :param trust_authority_cluster: The cluster specifies the Trust Authority Cluster this Key Provider
                Service belongs to. This attribute was added in vSphere API 7.0.0.
            """
            self.address = address
            self.trusted_ca = trusted_ca
            self.group = group
            self.trust_authority_cluster = trust_authority_cluster
            VapiStruct.__init__(self)

    CreateSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.kms.services.create_spec',
            {
                'address':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'NetworkAddress'),
                'trusted_CA':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'X509CertChain'),
                'group':
                type.StringType(),
                'trust_authority_cluster':
                type.StringType(),
            }, CreateSpec, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``Services.FilterSpec`` class contains the data necessary for
        identifying a Key Provider Service instance. This class was added in
        vSphere API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            services=None,
            address=None,
            group=None,
            trust_authority_cluster=None,
        ):
            """
            :type  services: :class:`set` of :class:`str` or ``None``
            :param services: A set of IDs by which to filter the services. This attribute was
                added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vcenter.trusted_infrastructure.kms.Service``. When
                methods return a value of this class as a return value, the
                attribute will contain identifiers for the resource type:
                ``com.vmware.vcenter.trusted_infrastructure.kms.Service``.
                If None, the services will not be filtered by ID.
            :type  address: :class:`list` of :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress` or ``None``
            :param address: A set of address by which to filter. This attribute was added in
                vSphere API 7.0.0.
                If None, the services will not be filtered by address.
            :type  group: :class:`set` of :class:`str` or ``None``
            :param group: The group determines the Attestation Service instances this Key
                Provider Service can accept reports from. This attribute was added
                in vSphere API 7.0.0.
                If None, the Services will not be filtered by group.
            :type  trust_authority_cluster: :class:`set` of :class:`str` or ``None``
            :param trust_authority_cluster: The cluster specifies the Trust Authority Cluster this Key Provider
                Service belongs to. This attribute was added in vSphere API 7.0.0.
                If None, the Services will not be filtered by
                trustAuthorityCluster.
            """
            self.services = services
            self.address = address
            self.group = group
            self.trust_authority_cluster = trust_authority_cluster
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.kms.services.filter_spec',
            {
                'services':
                type.OptionalType(type.SetType(type.IdType())),
                'address':
                type.OptionalType(
                    type.ListType(
                        type.ReferenceType(
                            'com.vmware.vcenter.trusted_infrastructure_client',
                            'NetworkAddress'))),
                'group':
                type.OptionalType(type.SetType(type.StringType())),
                'trust_authority_cluster':
                type.OptionalType(type.SetType(type.StringType())),
            }, FilterSpec, False, None))

    def list(
        self,
        spec=None,
    ):
        """
        Returns basic information about all registered Key Provider Service
        instances in this vCenter. This method was added in vSphere API 7.0.0.

        :type  spec: :class:`Services.FilterSpec` or ``None``
        :param spec: Return only services matching the specified filters.
            If {\\\\@term.unset} return all services.
        :rtype: :class:`list` of :class:`Services.Summary`
        :return: Basic information about all registered Key Provider Service
            instances in this vCenter.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if an error occurred while getting the data.
        :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 you do not have all of the privileges described as follows: 
            
            * Method execution requires ``TrustedAdmin.ReadTrustedHosts``.
        """
        return self._invoke('list', {
            'spec': spec,
        })

    def get(
        self,
        service,
    ):
        """
        Returns the detailed information about a registered Key Provider
        Service instance in this vCenter. This method was added in vSphere API
        7.0.0.

        :type  service: :class:`str`
        :param service: the Key Provider Service instance unique identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.trusted_infrastructure.kms.Service``.
        :rtype: :class:`Services.Info`
        :return: Detailed information about the specified Key Provider Service
            instance.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if an error occurred while getting the data.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if there is no Key Provider Service instance with the specified ID.
        :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 you do not have all of the privileges described as follows: 
            
            * Method execution requires ``TrustedAdmin.ReadTrustedHosts``.
        """
        return self._invoke('get', {
            'service': service,
        })

    def create(
        self,
        spec,
    ):
        """
        Registers a Key Provider Service instance in this vCenter. This method
        was added in vSphere API 7.0.0.

        :type  spec: :class:`Services.CreateSpec`
        :param spec: The CreateSpec for the new service.
        :rtype: :class:`str`
        :return: ID of the newly registered Key Provider Service instance.
            The return value will be an identifier for the resource type:
            ``com.vmware.vcenter.trusted_infrastructure.kms.Service``.
        :raise: :class:`com.vmware.vapi.std.errors_client.AlreadyExists` 
            if there is already a Key Provider Service instance with the same
            Address.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the CreateSpec contains invalid data.
        :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 you do not have all of the privileges described as follows: 
            
            * Method execution requires ``TrustedAdmin.ManageTrustedHosts``.
        """
        return self._invoke('create', {
            'spec': spec,
        })

    def delete(
        self,
        service,
    ):
        """
        Removes a currently registered Key Provider Service instance from this
        vCenter. This method was added in vSphere API 7.0.0.

        :type  service: :class:`str`
        :param service: the Key Provider Service instance unique identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.trusted_infrastructure.kms.Service``.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if an error occurred while deleting the service.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the Key Provider Service instance is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy` 
            if the Key Provider Service instance is used by a configuration on
            a cluster level.
        :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 you do not have all of the privileges described as follows: 
            
            * Method execution requires ``TrustedAdmin.ManageTrustedHosts``.
        """
        return self._invoke('delete', {
            'service': service,
        })
예제 #22
0
class TagUsage(VapiInterface):
    """
    The ``TagUsage`` class provides methods to query which tags are used by
    policies. **Warning:** This class is available as technical preview. It may
    be changed in a future release.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.compute.policies.tag_usage'
    """
    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, _TagUsageStub)

    class Summary(VapiStruct):
        """
        The ``TagUsage.Summary`` class contains common information about a tag used
        by a policy. **Warning:** This class is available as technical preview. It
        may be changed in a future release.

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




        def __init__(self,
                     policy=None,
                     tag_type=None,
                     tag=None,
                     tag_name=None,
                     category_name=None,
                    ):
            """
            :type  policy: :class:`str`
            :param policy: Identifier of the policy that uses the tag indicated by
                :attr:`TagUsage.Summary.tag`. **Warning:** This attribute is
                available as technical preview. It may be changed in a future
                release.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.compute.Policy``. 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.compute.Policy``.
            :type  tag_type: :class:`str`
            :param tag_type: Identifier of the tag type used by the policy indicated by
                :attr:`TagUsage.Summary.policy`. **Warning:** This attribute is
                available as technical preview. It may be changed in a future
                release.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vapi.resource``. 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.resource``.
            :type  tag: :class:`str`
            :param tag: Identifier of the tag used by the policy indicated by
                :attr:`TagUsage.Summary.policy`. **Warning:** This attribute is
                available as technical preview. It may be changed in a future
                release.
                When clients pass a value of this class as a parameter, the
                attribute ``tagType`` must contain the actual resource type. When
                methods return a value of this class as a return value, the
                attribute ``tagType`` will contain the actual resource type.
            :type  tag_name: :class:`str`
            :param tag_name: Name of the tag used by the policy indicated by
                :attr:`TagUsage.Summary.policy`. **Warning:** This attribute is
                available as technical preview. It may be changed in a future
                release.
            :type  category_name: :class:`str`
            :param category_name: Name of the category that has :attr:`TagUsage.Summary.tag`.
                **Warning:** This attribute is available as technical preview. It
                may be changed in a future release.
            """
            self.policy = policy
            self.tag_type = tag_type
            self.tag = tag
            self.tag_name = tag_name
            self.category_name = category_name
            VapiStruct.__init__(self)


    Summary._set_binding_type(type.StructType(
        'com.vmware.vcenter.compute.policies.tag_usage.summary', {
            'policy': type.IdType(resource_types='com.vmware.vcenter.compute.Policy'),
            'tag_type': type.IdType(resource_types='com.vmware.vapi.resource'),
            'tag': type.IdType(resource_types=[], resource_type_field_name="tag_type"),
            'tag_name': type.StringType(),
            'category_name': type.StringType(),
        },
        Summary,
        False,
        None))


    class FilterSpec(VapiStruct):
        """
        The ``TagUsage.FilterSpec`` class contains attributes used to filter the
        results when listing the tags used by policies as available in this vCenter
        server (see :func:`TagUsage.list`). If multiple attributes are specified,
        only the tags used by policies that match an element of each attribute
        match the filter. **Warning:** This class is available as technical
        preview. It may be changed in a future release.

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




        def __init__(self,
                     policies=None,
                     tags=None,
                     tag_types=None,
                    ):
            """
            :type  policies: :class:`set` of :class:`str` or ``None``
            :param policies: Identifiers that compute policies must have to match the filter.
                **Warning:** This attribute is available as technical preview. It
                may be changed in a future release.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vcenter.compute.Policy``. When methods return a value
                of this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.vcenter.compute.Policy``.
                If None or empty, then tags used by any policy match this filter.
            :type  tags: :class:`set` of :class:`str` or ``None``
            :param tags: Identifiers that tags must have to match the filter. **Warning:**
                This attribute is available as technical preview. It may be changed
                in a future release.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.cis.tagging.Tag``. When methods return a value of this
                class as a return value, the attribute will contain identifiers for
                the resource type: ``com.vmware.cis.tagging.Tag``.
                If None or empty, then tags with any tag identifier match this
                filter.
            :type  tag_types: :class:`set` of :class:`str` or ``None``
            :param tag_types: Identifiers that tag types must have to match the filter.
                **Warning:** This attribute is available as technical preview. It
                may be changed in a future release.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vapi.resource``. When methods return a value of this
                class as a return value, the attribute will contain identifiers for
                the resource type: ``com.vmware.vapi.resource``.
                If None or empty, then tags of any type match this filter.
            """
            self.policies = policies
            self.tags = tags
            self.tag_types = tag_types
            VapiStruct.__init__(self)


    FilterSpec._set_binding_type(type.StructType(
        'com.vmware.vcenter.compute.policies.tag_usage.filter_spec', {
            'policies': type.OptionalType(type.SetType(type.IdType())),
            'tags': type.OptionalType(type.SetType(type.IdType())),
            'tag_types': type.OptionalType(type.SetType(type.IdType())),
        },
        FilterSpec,
        False,
        None))



    def list(self,
             filter=None,
             ):
        """
        Returns information about the tags used by policies available in this
        vCenter server matching the :class:`TagUsage.FilterSpec`. **Warning:**
        This method is available as technical preview. It may be changed in a
        future release.

        :type  filter: :class:`TagUsage.FilterSpec` or ``None``
        :param filter: Specification for matching tags used by policies.
            If None, the behavior is equivalent to a
            :class:`TagUsage.FilterSpec` with all attributes None, which means
            all tags used by policies match the filter.
        :rtype: :class:`list` of :class:`TagUsage.Summary`
        :return: The list of tags used by policies available on this vCenter server
            matching the :class:`TagUsage.FilterSpec`.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user doesn't have the required privileges.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``System.Read``.
        """
        return self._invoke('list',
                            {
                            'filter': filter,
                            })
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'filter': type.OptionalType(type.ReferenceType(__name__, 'Policies.FilterSpec')),
        })
        list_error_dict = {
            'com.vmware.vapi.std.errors.invalid_argument':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidArgument'),
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.unauthenticated':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.unable_to_allocate_resource':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'UnableToAllocateResource'),

        }
        list_input_value_validator_list = [
        ]
        list_output_validator_list = [
        ]
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vcenter/storage/policies',
            path_variables={
            },
            query_parameters={
            }
        )

        # properties for check_compatibility operation
        check_compatibility_input_type = type.StructType('operation-input', {
            'policy': type.IdType(resource_types='com.vmware.vcenter.StoragePolicy'),
            'datastores': type.SetType(type.IdType()),
        })
        check_compatibility_error_dict = {
            'com.vmware.vapi.std.errors.error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.unauthenticated':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.unable_to_allocate_resource':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'UnableToAllocateResource'),

        }
        check_compatibility_input_value_validator_list = [
        ]
        check_compatibility_output_validator_list = [
        ]
        check_compatibility_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/vcenter/storage/policies/{policy}',
            path_variables={
                'policy': 'policy',
            },
            query_parameters={
            }
        )

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.ListType(type.ReferenceType(__name__, 'Policies.Summary')),
                'errors': list_error_dict,
                'input_value_validator_list': list_input_value_validator_list,
                'output_validator_list': list_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'check_compatibility': {
                'input_type': check_compatibility_input_type,
                'output_type': type.ReferenceType(__name__, 'Policies.CompatibilityInfo'),
                'errors': check_compatibility_error_dict,
                'input_value_validator_list': check_compatibility_input_value_validator_list,
                'output_validator_list': check_compatibility_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'list': list_rest_metadata,
            'check_compatibility': check_compatibility_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.vcenter.storage.policies',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=True)
예제 #24
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,
        })
예제 #25
0
class ConsumerPrincipals(VapiInterface):
    """
    The ``ConsumerPrincipals`` class configures the token policies and STS
    trust necessary for the workload vCenter to query the trusted services for
    their status. This class was added in vSphere API 7.0.0.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.consumer_principals'
    """
    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, _ConsumerPrincipalsStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update({'create_task': 'create$task'})
        self._VAPI_OPERATION_IDS.update({'delete_task': 'delete$task'})
        self._VAPI_OPERATION_IDS.update({'get_task': 'get$task'})
        self._VAPI_OPERATION_IDS.update({'list_task': 'list$task'})

    class Health(Enum):
        """
        The ``ConsumerPrincipals.Health`` class defines the possible health states.
        This enumeration was added in vSphere API 7.0.0.

        .. 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
        """
        None. No status available. This class attribute was added in vSphere API
        7.0.0.

        """
        OK = None
        """
        OK. Health is normal. This class attribute was added in vSphere API 7.0.0.

        """
        WARNING = None
        """
        Warning. Health is normal, however there is an issue that requires
        attention. This class attribute was added in vSphere API 7.0.0.

        """
        ERROR = None
        """
        Error. Not healthy. This class attribute was added in vSphere API 7.0.0.

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

    Health._set_values([
        Health('NONE'),
        Health('OK'),
        Health('WARNING'),
        Health('ERROR'),
    ])
    Health._set_binding_type(
        type.EnumType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.consumer_principals.health',
            Health))

    class CreateSpec(VapiStruct):
        """
        The ``ConsumerPrincipals.CreateSpec`` class contains the information
        necessary to establish trust between a workload vCenter and a Trust
        Authority Host. This class was added in vSphere API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            certificates=None,
            issuer_alias=None,
            issuer=None,
            principal=None,
        ):
            """
            :type  certificates: :class:`list` of :class:`com.vmware.vcenter.trusted_infrastructure_client.X509CertChain`
            :param certificates: The certificates used by the vCenter STS to sign tokens. This
                attribute was added in vSphere API 7.0.0.
            :type  issuer_alias: :class:`str`
            :param issuer_alias: A user-friendly alias of the service which created and signed the
                security token. This attribute was added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.esx.authentication.trust.security-token-issuer``. 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.authentication.trust.security-token-issuer``.
            :type  issuer: :class:`str`
            :param issuer: The service which created and signed the security token. This
                attribute was added in vSphere API 7.0.0.
            :type  principal: :class:`com.vmware.vcenter.trusted_infrastructure_client.StsPrincipal`
            :param principal: The principal used by the vCenter to retrieve tokens. This
                attribute was added in vSphere API 7.0.0.
            """
            self.certificates = certificates
            self.issuer_alias = issuer_alias
            self.issuer = issuer
            self.principal = principal
            VapiStruct.__init__(self)

    CreateSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.consumer_principals.create_spec',
            {
                'certificates':
                type.ListType(
                    type.ReferenceType(
                        'com.vmware.vcenter.trusted_infrastructure_client',
                        'X509CertChain')),
                'issuer_alias':
                type.IdType(
                    resource_types=
                    'com.vmware.esx.authentication.trust.security-token-issuer'
                ),
                'issuer':
                type.StringType(),
                'principal':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'StsPrincipal'),
            }, CreateSpec, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``ConsumerPrincipals.FilterSpec`` class contains data which identifies
        a connection profile on the trusted vCenter. This class was added in
        vSphere API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            id=None,
            principals=None,
            issuer=None,
        ):
            """
            :type  id: :class:`set` of :class:`str` or ``None``
            :param id: The unqiue identifier of a connection profile. This attribute was
                added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.esx.authentication.clientprofile``. When methods
                return a value of this class as a return value, the attribute will
                contain identifiers for the resource type:
                ``com.vmware.esx.authentication.clientprofile``.
                If None, no filtration will be performed by ID.
            :type  principals: :class:`list` of :class:`com.vmware.vcenter.trusted_infrastructure_client.StsPrincipal` or ``None``
            :param principals: The principal used by the vCenter to retrieve tokens. This
                attribute was added in vSphere API 7.0.0.
                If None, no filtration will be performed by principals.
            :type  issuer: :class:`set` of :class:`str` or ``None``
            :param issuer: The service which created and signed the security token. This
                attribute was added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.esx.authentication.trust.security-token-issuer``. When
                methods return a value of this class as a return value, the
                attribute will contain identifiers for the resource type:
                ``com.vmware.esx.authentication.trust.security-token-issuer``.
                If None, no filtration will be performed by issuer.
            """
            self.id = id
            self.principals = principals
            self.issuer = issuer
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.consumer_principals.filter_spec',
            {
                'id':
                type.OptionalType(type.SetType(type.IdType())),
                'principals':
                type.OptionalType(
                    type.ListType(
                        type.ReferenceType(
                            'com.vmware.vcenter.trusted_infrastructure_client',
                            'StsPrincipal'))),
                'issuer':
                type.OptionalType(type.SetType(type.IdType())),
            }, FilterSpec, False, None))

    class Info(VapiStruct):
        """
        The ``ConsumerPrincipals.Info`` class contains the information necessary to
        establish trust between a workload vCenter and a Trust Authority Host. This
        class was added in vSphere API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            id=None,
            principal=None,
            issuer_alias=None,
            issuer=None,
            certificates=None,
            health=None,
            message=None,
        ):
            """
            :type  id: :class:`str`
            :param id: The unqiue identifier of a connection profile. This attribute was
                added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.esx.authentication.clientprofile``. 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.authentication.clientprofile``.
            :type  principal: :class:`com.vmware.vcenter.trusted_infrastructure_client.StsPrincipal`
            :param principal: The principal used by the vCenter to retrieve tokens. Currently
                this is the vCenter solution user. This attribute was added in
                vSphere API 7.0.0.
            :type  issuer_alias: :class:`str`
            :param issuer_alias: A user-friendly alias of the service which created and signed the
                security token. This attribute was added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.esx.authentication.trust.security-token-issuer``. 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.authentication.trust.security-token-issuer``.
            :type  issuer: :class:`str`
            :param issuer: The service which created and signed the security token. This
                attribute was added in vSphere API 7.0.0.
            :type  certificates: :class:`list` of :class:`com.vmware.vcenter.trusted_infrastructure_client.X509CertChain`
            :param certificates: The certificates used by the vCenter STS to sign tokens. This
                attribute was added in vSphere API 7.0.0.
            :type  health: :class:`ConsumerPrincipals.Health`
            :param health: The consistency of the profile across the hosts in the cluster.
                This attribute was added in vSphere API 7.0.0.
            :type  message: :class:`com.vmware.vapi.std_client.LocalizableMessage` or ``None``
            :param message: A localizable message describing the health of the profile. This
                attribute was added in vSphere API 7.0.0.
                If None, the certificates won't be updated.
            """
            self.id = id
            self.principal = principal
            self.issuer_alias = issuer_alias
            self.issuer = issuer
            self.certificates = certificates
            self.health = health
            self.message = message
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.consumer_principals.info',
            {
                'id':
                type.IdType(
                    resource_types='com.vmware.esx.authentication.clientprofile'
                ),
                'principal':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'StsPrincipal'),
                'issuer_alias':
                type.IdType(
                    resource_types=
                    'com.vmware.esx.authentication.trust.security-token-issuer'
                ),
                'issuer':
                type.StringType(),
                'certificates':
                type.ListType(
                    type.ReferenceType(
                        'com.vmware.vcenter.trusted_infrastructure_client',
                        'X509CertChain')),
                'health':
                type.ReferenceType(__name__, 'ConsumerPrincipals.Health'),
                'message':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
            }, Info, False, None))

    class Summary(VapiStruct):
        """
        The ``ConsumerPrincipals.Summary`` class contains a summary of the
        information necessary to establish trust between a workload vCenter and a
        Trust Authority Host. This class was added in vSphere API 7.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            id=None,
            principal=None,
            issuer_alias=None,
            issuer=None,
        ):
            """
            :type  id: :class:`str`
            :param id: The unqiue identifier of a connection profile. This attribute was
                added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.esx.authentication.clientprofile``. 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.authentication.clientprofile``.
            :type  principal: :class:`com.vmware.vcenter.trusted_infrastructure_client.StsPrincipal`
            :param principal: The principal used by the vCenter to retrieve tokens. Currently
                this is the vCenter solution user. This attribute was added in
                vSphere API 7.0.0.
            :type  issuer_alias: :class:`str`
            :param issuer_alias: A user-friendly alias of the service which created and signed the
                security token. This attribute was added in vSphere API 7.0.0.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.esx.authentication.trust.security-token-issuer``. 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.authentication.trust.security-token-issuer``.
            :type  issuer: :class:`str`
            :param issuer: The service which created and signed the security token. This
                attribute was added in vSphere API 7.0.0.
            """
            self.id = id
            self.principal = principal
            self.issuer_alias = issuer_alias
            self.issuer = issuer
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.consumer_principals.summary',
            {
                'id':
                type.IdType(
                    resource_types='com.vmware.esx.authentication.clientprofile'
                ),
                'principal':
                type.ReferenceType(
                    'com.vmware.vcenter.trusted_infrastructure_client',
                    'StsPrincipal'),
                'issuer_alias':
                type.IdType(
                    resource_types=
                    'com.vmware.esx.authentication.trust.security-token-issuer'
                ),
                'issuer':
                type.StringType(),
            }, Summary, False, None))

    def create_task(
        self,
        cluster,
        spec,
    ):
        """
        Creates a profile with the specified connection information on all
        hosts from a Trust Authority Cluster. This method was added in vSphere
        API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The ID of the Trust Authority Cluster to configure.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`ConsumerPrincipals.CreateSpec`
        :param spec: The CreateSpec specifying the connection information.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.AlreadyExists` 
            if a profile for the issuer already exists.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if there is no such cluster.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        """
        task_id = self._invoke('create$task', {
            'cluster': cluster,
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.IdType(
                resource_types='com.vmware.esx.authentication.clientprofile'))
        return task_instance

    def delete_task(
        self,
        cluster,
        profile,
    ):
        """
        Removes the read-only policy configured on ESX for a specific
        principal. This method was added in vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The ID of the Trust Authority Cluster to configure.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  profile: :class:`str`
        :param profile: The ID of the connection profile to modify.
            The parameter must be an identifier for the resource type:
            ``com.vmware.esx.authentication.clientprofile``.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if there is no profile configured with that ID.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        """
        task_id = self._invoke('delete$task', {
            'cluster': cluster,
            'profile': profile,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(task_id, task_svc, type.VoidType())
        return task_instance

    def get_task(
        self,
        cluster,
        profile,
    ):
        """
        Retrieve information for a specific profile. This method was added in
        vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The ID of the Trust Authority Cluster on which the profile is
            configured.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  profile: :class:`str`
        :param profile: The ID of the profile.
            The parameter must be an identifier for the resource type:
            ``com.vmware.esx.authentication.clientprofile``.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if there is no profile configured with that ID.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        """
        task_id = self._invoke('get$task', {
            'cluster': cluster,
            'profile': profile,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ReferenceType(__name__, 'ConsumerPrincipals.Info'))
        return task_instance

    def list_task(
        self,
        cluster,
        spec=None,
    ):
        """
        Lists all policies configured on a specific cluster. This method was
        added in vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The ID of the Trust Authority Cluster on which the profile is
            configured.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`ConsumerPrincipals.FilterSpec` or ``None``
        :param spec: A FilterSpec specifying the profiles to be listed.
            If {\\\\@term.unset} return all policies.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if there is no profile configured with that ID.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        """
        task_id = self._invoke('list$task', {
            'cluster': cluster,
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ListType(
                type.ReferenceType(__name__, 'ConsumerPrincipals.Summary')))
        return task_instance
class CurrentPeerCertificates(VapiInterface):
    """
    Retrieves the list of TLS certificates used by peer key servers. Those are
    meant for review. Following approval these certificates should be added as
    trusted certificates in the :class:`TrustedPeerCertificates` class. This
    class was added in vSphere API 7.0.0.0.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.providers.current_peer_certificates'
    """
    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, _CurrentPeerCertificatesStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update({'list_task': 'list$task'})

    class Summary(VapiStruct):
        """
        The ``CurrentPeerCertificates.Summary`` class contains a summary of the
        current key server certificates. This class was added in vSphere API
        7.0.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            server_name=None,
            certificate=None,
            error_messages=None,
            trusted=None,
        ):
            """
            :type  server_name: :class:`str`
            :param server_name: Name of the server. This attribute was added in vSphere API
                7.0.0.0.
            :type  certificate: :class:`str` or ``None``
            :param certificate: Server certificate. This attribute was added in vSphere API
                7.0.0.0.
                If None, the certificate cannot be retrieved from the remote
                system, and :attr:`CurrentPeerCertificates.Summary.trusted` is
                undefined. See
                :attr:`CurrentPeerCertificates.Summary.error_messages` for details.
            :type  error_messages: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param error_messages: Server certificate retrieval errors. 
                
                Specifies error details when retrieving the remote server
                certificate fails. This list will be empty when
                :attr:`CurrentPeerCertificates.Summary.certificate` is
                :class:`set`.. This attribute was added in vSphere API 7.0.0.0.
            :type  trusted: :class:`bool`
            :param trusted: whether server certificate is already trusted . This attribute was
                added in vSphere API 7.0.0.0.
            """
            self.server_name = server_name
            self.certificate = certificate
            self.error_messages = error_messages
            self.trusted = trusted
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.providers.current_peer_certificates.summary',
            {
                'server_name':
                type.StringType(),
                'certificate':
                type.OptionalType(type.StringType()),
                'error_messages':
                type.ListType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
                'trusted':
                type.BooleanType(),
            }, Summary, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``CurrentPeerCertificates.FilterSpec`` class contains attributes used
        to filter the results when listing remote server certificates. This class
        was added in vSphere API 7.0.0.0.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            server_names=None,
            trusted=None,
        ):
            """
            :type  server_names: :class:`set` of :class:`str` or ``None``
            :param server_names: Names that key server must have to match the filter (see
                :attr:`CurrentPeerCertificates.Summary.server_name`). This
                attribute was added in vSphere API 7.0.0.0.
                If None or empty, key servers with any name match the filter.
            :type  trusted: :class:`bool` or ``None``
            :param trusted: Trust status that server certificates must have to match the filter
                (see :attr:`CurrentPeerCertificates.Summary.trusted`). This
                attribute was added in vSphere API 7.0.0.0.
                If None, trusted and untrusted server certificates match the
                filter.
            """
            self.server_names = server_names
            self.trusted = trusted
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.providers.current_peer_certificates.filter_spec',
            {
                'server_names': type.OptionalType(
                    type.SetType(type.StringType())),
                'trusted': type.OptionalType(type.BooleanType()),
            }, FilterSpec, False, None))

    def list_task(
        self,
        cluster,
        provider,
        spec=None,
    ):
        """
        Return the remote server certificates. 
        
        Contacts the configured key servers and attempts to retrieve their
        certificates. These certificates might not yet be trusted. 
        
        If the returned certificates are to be considered trustworthy, then it
        must be added to the list of trusted server certificates by adding to
        the certificates returned by :func:`TrustedPeerCertificates.get` and
        invoking :func:`TrustedPeerCertificates.update` with the updated
        :class:`list` of certificates.. This method was added in vSphere API
        7.0.0.0.

        :type  cluster: :class:`str`
        :param cluster: Identifier of the cluster.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  provider: :class:`str`
        :param provider: Identifier of the provider.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.Provider``.
        :type  spec: :class:`CurrentPeerCertificates.FilterSpec` or ``None``
        :param spec: Filter spec.
            If None, the behavior is equivalent to a
            :class:`CurrentPeerCertificates.FilterSpec` with all attributes
            None
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            If the cluster or provider id is empty.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If the cluster or provider is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            If the caller is not authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            For any other error.
        """
        task_id = self._invoke('list$task', {
            'cluster': cluster,
            'provider': provider,
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ListType(
                type.ReferenceType(__name__,
                                   'CurrentPeerCertificates.Summary')))
        return task_instance
예제 #27
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,
        })
예제 #28
0
class VM(VapiInterface):
    """
    The ``VM`` class provides methods related to query virtual machines of
    given compliance statuses. 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, _VMStub)

    class Status(Enum):
        """
        The {\\\\@Status} class defines he valid compliance status values for a
        virtual machine or virtual disk. 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
        """
        The virtual machine or virtual disk is in compliance. This class attribute
        was added in vSphere API 6.7

        """
        NON_COMPLIANT = None
        """
        The virtual machine or virtual disk is in not in compliance. This class
        attribute was added in vSphere API 6.7

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

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

        """
        OUT_OF_DATE = None
        """
        Compliance status becomes out of date when the profile associated with the
        virtual machine or disk is edited and not applied. The compliance status
        will remain out of date until the latest policy is applied. 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.storage.policies.compliance.VM.status',
            Status))

    class Info(VapiStruct):
        """
        Provides the compliance details of a virtual machine and its associated
        entities which match the given compliance statuses. 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:`VM.Status` or ``None``
            :param vm_home: Compliance status of the virtual machine home. This attribute was
                added in vSphere API 6.7
                If None or empty, virtual machine home is not associated with a
                storage policy.
            :type  disks: :class:`dict` of :class:`str` and :class:`VM.Status`
            :param disks: A Map of virtual disks and their compliance status If empty, the
                virtual machine does not have any disks or its disks are not
                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.vm_home = vm_home
            self.disks = disks
            VapiStruct.__init__(self)

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

    class FilterSpec(VapiStruct):
        """
        The ``VM.FilterSpec`` class contains Status used to filter the results when
        listing virtual machines (see :func:`VM.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,
            status=None,
            vms=None,
        ):
            """
            :type  status: :class:`set` of :class:`VM.Status`
            :param status: Compliance Status that a virtual machine must have to match the
                filter. Atleast one status must be specified. This attribute was
                added in vSphere API 6.7
            :type  vms: :class:`set` of :class:`str` or ``None``
            :param vms: Identifiers of virtual machines 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:
                ``VirtualMachine``. When methods return a value of this class as a
                return value, the attribute will contain identifiers for the
                resource type: ``VirtualMachine``.
                If None or empty, virtual machines with any identifier matches the
                filter
            """
            self.status = status
            self.vms = vms
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.storage.policies.compliance.VM.filter_spec', {
                'status': type.SetType(
                    type.ReferenceType(__name__, 'VM.Status')),
                'vms': type.OptionalType(type.SetType(type.IdType())),
            }, FilterSpec, False, None))

    def list(
        self,
        filter,
    ):
        """
        Returns compliance information about at most 1000 virtual machines
        matching the filter :class:`VM.FilterSpec`. If there are no virtual
        machines matching the :class:`VM.FilterSpec` an empty List is returned.
        Virtual machines without storage policy association are not returned.
        This method was added in vSphere API 6.7

        :type  filter: :class:`VM.FilterSpec`
        :param filter: compliance status of matching virtual machines for which
            information should be returned.
        :rtype: :class:`dict` of :class:`str` and :class:`VM.Info`
        :return: compliance information about virtual machines matching the filter
            :class:`VM.FilterSpec`.
            The key in the return value :class:`dict` will be an identifier for
            the resource type: ``VirtualMachine``.
        :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.InvalidArgument` 
            if the :attr:`VM.FilterSpec.status` attribute contains a value that
            is not supported by the server.
        :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 does not have the required privileges.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unsupported` 
            if the API is invoked against vCenter Server version is less than
            6.5
        :raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource` 
            If more than 1000 results match the :class:`VM.FilterSpec`
        """
        return self._invoke('list', {
            'filter': filter,
        })
class File(VapiInterface):
    """
    The ``File`` class provides methods for accessing files within an update
    session. 
    
    After an update session is created against a library item, the ``File``
    class can be used to make changes to the underlying library item metadata
    as well as the content of the files. The following changes can be made: 
    
    * deleting an existing file within the library item. This deletes both the
      metadata and the content.
    * updating an existing file with new content.
    * adding a new file to the library item.
    
     
    
    The above changes are not applied or visible until the session is
    completed. See
    :class:`com.vmware.content.library.item_client.UpdateSession`.
    """

    _VAPI_SERVICE_ID = 'com.vmware.content.library.item.updatesession.file'
    """
    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, _FileStub)

    class SourceType(Enum):
        """
        The ``File.SourceType`` class defines how the file content is retrieved.

        .. 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
        """
        No source type has been requested.

        """
        PUSH = None
        """
        The client is uploading content using HTTP(S) PUT requests.

        """
        PULL = None
        """
        The server is pulling content from a URL. The URL scheme can be ``http``,
        ``https``, ``file``, or ``ds``.

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

    SourceType._set_values([
        SourceType('NONE'),
        SourceType('PUSH'),
        SourceType('PULL'),
    ])
    SourceType._set_binding_type(
        type.EnumType(
            'com.vmware.content.library.item.updatesession.file.source_type',
            SourceType))

    class AddSpec(VapiStruct):
        """
        The ``File.AddSpec`` class describes the properties of the file to be
        uploaded.

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

        _validator_list = [
            UnionValidator('source_type', {
                'PULL': [('source_endpoint', True)],
                'NONE': [],
                'PUSH': [],
            }),
        ]

        def __init__(
            self,
            name=None,
            source_type=None,
            source_endpoint=None,
            size=None,
            checksum_info=None,
        ):
            """
            :type  name: :class:`str`
            :param name: The name of the file being uploaded.
            :type  source_type: :class:`File.SourceType`
            :param source_type: The source type (NONE, PUSH, PULL) from which the file content will
                be retrieved.
            :type  source_endpoint: :class:`com.vmware.content.library.item_client.TransferEndpoint`
            :param source_endpoint: Location from which the Content Library Service will fetch the
                file, rather than requiring a client to upload the file.
                This attribute is optional and it is only relevant when the value
                of ``sourceType`` is :attr:`File.SourceType.PULL`.
            :type  size: :class:`long` or ``None``
            :param size: The file size, in bytes.
                If None, the server will not verify it received the correct size.
            :type  checksum_info: :class:`com.vmware.content.library.item_client.File.ChecksumInfo` or ``None``
            :param checksum_info: The checksum of the file. If specified, the server will verify the
                checksum once the file is received. If there is a mismatch, the
                upload will fail. For ova files, this value should not be set.
                If None, the server will not verify the checksum.
            """
            self.name = name
            self.source_type = source_type
            self.source_endpoint = source_endpoint
            self.size = size
            self.checksum_info = checksum_info
            VapiStruct.__init__(self)

    AddSpec._set_binding_type(
        type.StructType(
            'com.vmware.content.library.item.updatesession.file.add_spec', {
                'name':
                type.StringType(),
                'source_type':
                type.ReferenceType(__name__, 'File.SourceType'),
                'source_endpoint':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.content.library.item_client',
                        'TransferEndpoint')),
                'size':
                type.OptionalType(type.IntegerType()),
                'checksum_info':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.content.library.item_client',
                        'File.ChecksumInfo')),
            }, AddSpec, False, None))

    class Info(VapiStruct):
        """
        The ``File.Info`` class defines the uploaded file.

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

        _validator_list = [
            UnionValidator(
                'source_type', {
                    'PULL': [('source_endpoint', True)],
                    'PUSH': [('upload_endpoint', True)],
                    'NONE': [],
                }),
        ]

        def __init__(
            self,
            name=None,
            source_type=None,
            size=None,
            checksum_info=None,
            source_endpoint=None,
            upload_endpoint=None,
            bytes_transferred=None,
            status=None,
            error_message=None,
            keep_in_storage=None,
        ):
            """
            :type  name: :class:`str`
            :param name: The name of the file.
            :type  source_type: :class:`File.SourceType`
            :param source_type: The source type (NONE, PUSH, PULL) from which the file is being
                retrieved. This may be :attr:`File.SourceType.NONE` if the file is
                not being changed.
            :type  size: :class:`long` or ``None``
            :param size: The file size, in bytes as received by the server. This attribute
                is guaranteed to be set when the server has completely received the
                file.
                This attribute won't be set until the file status is
                :attr:`com.vmware.content.library.item_client.TransferStatus.READY`.
            :type  checksum_info: :class:`com.vmware.content.library.item_client.File.ChecksumInfo` or ``None``
            :param checksum_info: The checksum information of the file received by the server.
                If None, the server does not verify the checksum.
            :type  source_endpoint: :class:`com.vmware.content.library.item_client.TransferEndpoint`
            :param source_endpoint: A source endpoint from which to retrieve the file.
                This attribute is optional and it is only relevant when the value
                of ``sourceType`` is :attr:`File.SourceType.PULL`.
            :type  upload_endpoint: :class:`com.vmware.content.library.item_client.TransferEndpoint`
            :param upload_endpoint: An upload endpoint to which the client can push the content.
                This attribute is optional and it is only relevant when the value
                of ``sourceType`` is :attr:`File.SourceType.PUSH`.
            :type  bytes_transferred: :class:`long`
            :param bytes_transferred: The number of bytes of this file that have been received by the
                server.
            :type  status: :class:`com.vmware.content.library.item_client.TransferStatus`
            :param status: The transfer status (WAITING_FOR_TRANSFER, TRANSFERRING, READY,
                VALIDATING, ERROR) of this file.
            :type  error_message: :class:`com.vmware.vapi.std_client.LocalizableMessage` or ``None``
            :param error_message: Details about the transfer error.
                An error message is set if the status is
                :attr:`com.vmware.content.library.item_client.TransferStatus.ERROR`.
            :type  keep_in_storage: :class:`bool` or ``None``
            :param keep_in_storage: Whether or not the file will be kept in storage upon update session
                completion. The flag is true for most files, and false for metadata
                files such as manifest and certificate file of update session with
                library item type OVF. Any file with
                :attr:`File.Info.keep_in_storage` set to false will not show up in
                the list of files returned from
                :func:`com.vmware.content.library.item_client.File.list` upon
                update session completion. This attribute was added in vSphere API
                6.8.
                If None, the file will be kept in storage upon update session
                completion.
            """
            self.name = name
            self.source_type = source_type
            self.size = size
            self.checksum_info = checksum_info
            self.source_endpoint = source_endpoint
            self.upload_endpoint = upload_endpoint
            self.bytes_transferred = bytes_transferred
            self.status = status
            self.error_message = error_message
            self.keep_in_storage = keep_in_storage
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.content.library.item.updatesession.file.info', {
                'name':
                type.StringType(),
                'source_type':
                type.ReferenceType(__name__, 'File.SourceType'),
                'size':
                type.OptionalType(type.IntegerType()),
                'checksum_info':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.content.library.item_client',
                        'File.ChecksumInfo')),
                'source_endpoint':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.content.library.item_client',
                        'TransferEndpoint')),
                'upload_endpoint':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.content.library.item_client',
                        'TransferEndpoint')),
                'bytes_transferred':
                type.IntegerType(),
                'status':
                type.ReferenceType('com.vmware.content.library.item_client',
                                   'TransferStatus'),
                'error_message':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
                'keep_in_storage':
                type.OptionalType(type.BooleanType()),
            }, Info, False, None))

    class ValidationError(VapiStruct):
        """
        The ``File.ValidationError`` class defines the validation error of a file
        in the session.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            name=None,
            error_message=None,
        ):
            """
            :type  name: :class:`str`
            :param name: The name of the file.
            :type  error_message: :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param error_message: A message indicating why the file was considered invalid.
            """
            self.name = name
            self.error_message = error_message
            VapiStruct.__init__(self)

    ValidationError._set_binding_type(
        type.StructType(
            'com.vmware.content.library.item.updatesession.file.validation_error',
            {
                'name':
                type.StringType(),
                'error_message':
                type.ReferenceType('com.vmware.vapi.std_client',
                                   'LocalizableMessage'),
            }, ValidationError, False, None))

    class ValidationResult(VapiStruct):
        """
        The ``File.ValidationResult`` class defines the result of validating the
        files in the session.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            has_errors=None,
            missing_files=None,
            invalid_files=None,
        ):
            """
            :type  has_errors: :class:`bool`
            :param has_errors: Whether the validation was succesful or not. In case of errors, the
                :attr:`File.ValidationResult.missing_files` and
                :attr:`File.ValidationResult.invalid_files` will contain at least
                one entry.
            :type  missing_files: :class:`set` of :class:`str`
            :param missing_files: A :class:`set` containing the names of the files that are required
                but the client hasn't added.
            :type  invalid_files: :class:`list` of :class:`File.ValidationError`
            :param invalid_files: A :class:`list` containing the files that have been identified as
                invalid and details about the error.
            """
            self.has_errors = has_errors
            self.missing_files = missing_files
            self.invalid_files = invalid_files
            VapiStruct.__init__(self)

    ValidationResult._set_binding_type(
        type.StructType(
            'com.vmware.content.library.item.updatesession.file.validation_result',
            {
                'has_errors':
                type.BooleanType(),
                'missing_files':
                type.SetType(type.StringType()),
                'invalid_files':
                type.ListType(
                    type.ReferenceType(__name__, 'File.ValidationError')),
            }, ValidationResult, False, None))

    def validate(
        self,
        update_session_id,
    ):
        """
        Validates the files in the update session with the referenced
        identifier and ensures all necessary files are received. In the case
        where a file is missing, this method will return its name in the
        :attr:`File.ValidationResult.missing_files` set. The user can add the
        missing files and try re-validating. For other type of errors,
        :attr:`File.ValidationResult.invalid_files` will contain the list of
        invalid files.

        :type  update_session_id: :class:`str`
        :param update_session_id:  Identifier of the update session to validate.
            The parameter must be an identifier for the resource type:
            ``com.vmware.content.library.item.UpdateSession``.
        :rtype: :class:`File.ValidationResult`
        :return: A validation result containing missing files or invalid files and
            the reason why they are invalid.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
             if no update session with the given identifier exists.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the update session is not in the
            :attr:`com.vmware.content.library.item_client.UpdateSessionModel.State.ACTIVE`
            state, or if some of the files that will be uploaded by the client
            aren't received correctly.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``System.Anonymous``.
        """
        return self._invoke('validate', {
            'update_session_id': update_session_id,
        })

    def add(
        self,
        update_session_id,
        file_spec,
    ):
        """
        Requests file content to be changed (either created, or updated).
        Depending on the source type of the file, this method will either
        return an upload endpoint where the client can push the content, or the
        server will pull from the provided source endpoint. If a file with the
        same name already exists in this session, this method will be used to
        update the content of the existing file. 
        
        When importing a file directly from storage, where the source endpoint
        is a file or datastore URI, you will need to have the
        ContentLibrary.ReadStorage privilege on the library item. If the file
        is located in the same directory as the library storage backing folder,
        the server will move the file instead of copying it, thereby allowing
        instantaneous import of files for efficient backup and restore
        scenarios. In all other cases, a copy is performed rather than a move.

        :type  update_session_id: :class:`str`
        :param update_session_id:  Identifier of the update session to be modified.
            The parameter must be an identifier for the resource type:
            ``com.vmware.content.library.item.UpdateSession``.
        :type  file_spec: :class:`File.AddSpec`
        :param file_spec: Specification for the file that needs to be added or updated. This
            includes whether the client wants to push the content or have the
            server pull it.
        :rtype: :class:`File.Info`
        :return: An :class:`File.Info` class containing upload links as well as
            server side state tracking the transfer of the file.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
             if the ``file_spec`` is invalid.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
             if the update session doesn't exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the caller doesn't have ContentLibrary.ReadStorage privilege on
            the library item of the update session and source type
            :attr:`File.SourceType.PULL` is requested for a file or datastore
            source endpoint (that is, not HTTP or HTTPs based endpoint).
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the content of the library item associated with the update
            session has been deleted from the storage backings (see null)
            associated with it.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if metadata files such as manifest and certificate file are added
            after the OVF descriptor file. This is applicable to update
            sessions with library item type OVF only. This error was added in
            vSphere 6.8.0.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``System.Anonymous``.
        """
        return self._invoke('add', {
            'update_session_id': update_session_id,
            'file_spec': file_spec,
        })

    def remove(
        self,
        update_session_id,
        file_name,
    ):
        """
        Requests a file to be removed. The file will only be effectively
        removed when the update session is completed.

        :type  update_session_id: :class:`str`
        :param update_session_id:  Identifier of the update session.
            The parameter must be an identifier for the resource type:
            ``com.vmware.content.library.item.UpdateSession``.
        :type  file_name: :class:`str`
        :param file_name:  Name of the file to be removed.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
             if the update session doesn't exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the file doesn't exist in the library item associated with the
            update session.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``System.Anonymous``.
        """
        return self._invoke('remove', {
            'update_session_id': update_session_id,
            'file_name': file_name,
        })

    def list(
        self,
        update_session_id,
    ):
        """
        Lists all files in the library item associated with the update session.

        :type  update_session_id: :class:`str`
        :param update_session_id:  Identifier of the update session.
            The parameter must be an identifier for the resource type:
            ``com.vmware.content.library.item.UpdateSession``.
        :rtype: :class:`list` of :class:`File.Info`
        :return: The :class:`list` of the files in the library item associated with
            the update session. This :class:`list` may be empty if the caller
            has removed all the files as part of this session (in which case
            completing the update session will result in an empty library
            item).
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
             if the update session doesn't exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``System.Anonymous``.
        """
        return self._invoke('list', {
            'update_session_id': update_session_id,
        })

    def get(
        self,
        update_session_id,
        file_name,
    ):
        """
        Retrieves information about a specific file in the snapshot of the
        library item at the time when the update session was created.

        :type  update_session_id: :class:`str`
        :param update_session_id:  Identifier of the update session.
            The parameter must be an identifier for the resource type:
            ``com.vmware.content.library.item.UpdateSession``.
        :type  file_name: :class:`str`
        :param file_name:  Name of the file.
        :rtype: :class:`File.Info`
        :return: Information about the file.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
             if the update session doesn't exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the file doesn't exist in the library item associated with the
            update session.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``System.Anonymous``.
        """
        return self._invoke('get', {
            'update_session_id': update_session_id,
            'file_name': file_name,
        })
예제 #30
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,
        })