Beispiel #1
0
class Device(VapiInterface):
    """
    The ``Device`` class provides methods for configuring the device order used
    when booting a virtual machine. 
    
    The boot order may be specified using a mixture of device classes and
    device instances, chosen from among the following: 
    
    * :attr:`Device.Type.CDROM`: Boot from a virtual CD-ROM drive; the device
      instance(s) will be chosen by the BIOS subsystem.
    * :attr:`Device.Type.FLOPPY`: Boot from a virtual floppy drive; the device
      instance(s) will be chosen by the BIOS subsystem.
    * :attr:`Device.Type.DISK`: Boot from a virtual disk device; the device
      instance is specified explicitly in :attr:`Device.Entry.disks` list, and
      multiple instances may be specified in the list.
    * :attr:`Device.Type.ETHERNET`: Boot from a virtual Ethernet adapter; the
      device instance is specified explicitly as :attr:`Device.Entry.nic`, and
      multiple adapters may be specified in the boot order list.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.hardware.boot.device'
    """
    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, _DeviceStub)
        self._VAPI_OPERATION_IDS = {}

    class Type(Enum):
        """
        The ``Device.Type`` class defines the valid device types that may be used
        as bootable devices.

        .. 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>`.
        """
        CDROM = None
        """
        Virtual CD-ROM device.

        """
        DISK = None
        """
        Virtual disk device.

        """
        ETHERNET = None
        """
        Virtual Ethernet adapter.

        """
        FLOPPY = None
        """
        Virtual floppy drive.

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

    Type._set_values([
        Type('CDROM'),
        Type('DISK'),
        Type('ETHERNET'),
        Type('FLOPPY'),
    ])
    Type._set_binding_type(
        type.EnumType('com.vmware.vcenter.vm.hardware.boot.device.type', Type))

    class EntryCreateSpec(VapiStruct):
        """
        The class ``Device.EntryCreateSpec`` specifies a list of bootable virtual
        device classes. When a VM is being created and a :class:`list` of
        ``Device.EntryCreateSpec`` is specified, the boot order of the specific
        device instances are not specified in this class. The boot order of the
        specific device instance will be the order in which the Ethernet and Disk
        devices appear in the ``nics`` and ``disks`` respectively.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            type=None,
        ):
            """
            :type  type: :class:`Device.Type`
            :param type: Virtual Boot device type.
            """
            self.type = type
            VapiStruct.__init__(self)

    EntryCreateSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.vm.hardware.boot.device.entry_create_spec', {
                'type': type.ReferenceType(__name__, 'Device.Type'),
            }, EntryCreateSpec, False, None))

    class Entry(VapiStruct):
        """
        The ``Device.Entry`` class specifies a bootable virtual device class or
        specific bootable virtual device(s).

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

        _validator_list = [
            UnionValidator(
                'type', {
                    'ETHERNET': [('nic', True)],
                    'DISK': [('disks', True)],
                    'CDROM': [],
                    'FLOPPY': [],
                }),
        ]

        def __init__(
            self,
            type=None,
            nic=None,
            disks=None,
        ):
            """
            :type  type: :class:`Device.Type`
            :param type: Virtual device type.
            :type  nic: :class:`str`
            :param nic: Virtual Ethernet device. Ethernet device to use as boot device for
                this entry.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.vm.hardware.Ethernet``. 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.vm.hardware.Ethernet``.
                This attribute is optional and it is only relevant when the value
                of ``type`` is :attr:`Device.Type.ETHERNET`.
            :type  disks: :class:`list` of :class:`str`
            :param disks: Virtual disk device. List of virtual disks in boot order.
                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``.
                This attribute is optional and it is only relevant when the value
                of ``type`` is :attr:`Device.Type.DISK`.
            """
            self.type = type
            self.nic = nic
            self.disks = disks
            VapiStruct.__init__(self)

    Entry._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.vm.hardware.boot.device.entry', {
                'type': type.ReferenceType(__name__, 'Device.Type'),
                'nic': type.OptionalType(type.IdType()),
                'disks': type.OptionalType(type.ListType(type.IdType())),
            }, Entry, False, None))

    def get(
        self,
        vm,
    ):
        """
        Returns an ordered list of boot devices for the virtual machine. If the
        :class:`list` is empty, the virtual machine uses a default boot
        sequence.

        :type  vm: :class:`str`
        :param vm: Virtual machine identifier.
            The parameter must be an identifier for the resource type:
            ``VirtualMachine``.
        :rtype: :class:`list` of :class:`Device.Entry`
        :return: Ordered list of configured boot devices.
        :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 virtual machine is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible` 
            if the virtual machine's configuration state cannot be accessed.
        :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('get', {
            'vm': vm,
        })

    def set(
        self,
        vm,
        devices,
    ):
        """
        Sets the virtual devices that will be used to boot the virtual machine.
        The virtual machine will check the devices in order, attempting to boot
        from each, until the virtual machine boots successfully. If the
        :class:`list` is empty, the virtual machine will use a default boot
        sequence. There should be no more than one instance of
        :class:`Device.Entry` for a given device type except
        :attr:`Device.Type.ETHERNET` in the :class:`list`.

        :type  vm: :class:`str`
        :param vm: Virtual machine identifier.
            The parameter must be an identifier for the resource type:
            ``VirtualMachine``.
        :type  devices: :class:`list` of :class:`Device.Entry`
        :param devices: Ordered list of boot devices.
        :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 virtual machine is not found, or if any of the specified
            virtual devices is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if a any of the CDROM, DISK, ETHERNET, FLOPPY values appears in
            more than one ``Device.Entry`` with the exception of
            :attr:`Device.Type.ETHERNET`, which may appear multiple times if
            the virtual machine has been configured with multiple Ethernet
            adapters.
        :raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy` 
            if the virtual machine is busy performing another operation.
        :raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible` 
            if the virtual machine's configuration state cannot be accessed.
        :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('set', {
            'vm': vm,
            'devices': devices,
        })
Beispiel #2
0
    def __init__(self, config):
        # properties for test operation
        test_input_type = type.StructType(
            'operation-input', {
                'send_test_message': type.OptionalType(type.BooleanType()),
            })
        test_error_dict = {}
        test_input_value_validator_list = []
        test_output_validator_list = []
        test_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/appliance/logging/forwarding?action=test',
            path_variables={},
            query_parameters={})

        # properties for set operation
        set_input_type = type.StructType(
            'operation-input', {
                'cfg_list':
                type.ListType(type.ReferenceType(__name__,
                                                 'Forwarding.Config')),
            })
        set_error_dict = {
            'com.vmware.vapi.std.errors.invalid_argument':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidArgument'),
            'com.vmware.vapi.std.errors.unable_to_allocate_resource':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'UnableToAllocateResource'),
            '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='/appliance/logging/forwarding',
            path_variables={},
            query_parameters={})

        # properties for get operation
        get_input_type = type.StructType('operation-input', {})
        get_error_dict = {}
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/appliance/logging/forwarding',
            path_variables={},
            query_parameters={})

        operations = {
            'test': {
                'input_type':
                test_input_type,
                'output_type':
                type.ListType(
                    type.ReferenceType(__name__,
                                       'Forwarding.ConnectionStatus')),
                'errors':
                test_error_dict,
                'input_value_validator_list':
                test_input_value_validator_list,
                'output_validator_list':
                test_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.ListType(type.ReferenceType(__name__,
                                                 'Forwarding.Config')),
                '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 = {
            'test': test_rest_metadata,
            'set': set_rest_metadata,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.appliance.logging.forwarding',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'org': type.StringType(),
                'sddc': type.StringType(),
                'edge_id': type.StringType(),
                'getlatest': type.OptionalType(type.BooleanType()),
                'detailed': type.OptionalType(type.BooleanType()),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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=
            '/vmc/api/orgs/{org}/sddcs/{sddc}/networks/4.0/edges/{edgeId}/status',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
                'edge_id': 'edgeId',
            },
            query_parameters={
                'getlatest': 'getlatest',
                'detailed': 'detailed',
            })

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.vmc.model_client',
                                   'EdgeStatus'),
                '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 = {
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vmc.orgs.sddcs.networks.edges.status',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
    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.ListType(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('com.vmware.vapi.metadata.metamodel_client',
                                   'OperationInfo'),
                '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.metadata.metamodel.service.operation',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Beispiel #5
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'node_id': type.StringType(),
            'interface_name': type.StringType(),
        })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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=
            '/api/v1/lldp/transport-nodes/{node-id}/interfaces/{interface-name}',
            path_variables={
                'node_id': 'node-id',
                'interface_name': 'interface-name',
            },
            query_parameters={},
            content_type='application/json')

        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'node_id': type.StringType(),
        })
        list_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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='/api/v1/lldp/transport-nodes/{node-id}/interfaces',
            path_variables={
                'node_id': 'node-id',
            },
            query_parameters={},
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'InterfaceNeighborProperties'),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'InterfaceNeighborPropertyListResult'),
                '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 = {
            'get': get_rest_metadata,
            'list': list_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.nsx.lldp.transport_nodes.interfaces',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
    def __init__(self, config):
        # properties for create operation
        create_input_type = type.StructType(
            'operation-input', {
                'tier1_id': type.StringType(),
                'locale_service_id': type.StringType(),
                'service_id': type.StringType(),
                'session_id': type.StringType(),
                'action': type.StringType(),
                'enforcement_point_path': type.OptionalType(type.StringType()),
            })
        create_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        create_input_value_validator_list = []
        create_output_validator_list = []
        create_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template=
            '/policy/api/v1/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/ipsec-vpn-services/{service-id}/sessions/{session-id}/statistics',
            path_variables={
                'tier1_id': 'tier-1-id',
                'locale_service_id': 'locale-service-id',
                'service_id': 'service-id',
                'session_id': 'session-id',
            },
            query_parameters={
                'action': 'action',
                'enforcement_point_path': 'enforcement_point_path',
            },
            content_type='application/json')

        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'tier1_id': type.StringType(),
                'locale_service_id': type.StringType(),
                'service_id': type.StringType(),
                'session_id': type.StringType(),
                'enforcement_point_path': type.OptionalType(type.StringType()),
                'source': type.OptionalType(type.StringType()),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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 = [HasFieldsOfValidator()]
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/policy/api/v1/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/ipsec-vpn-services/{service-id}/sessions/{session-id}/statistics',
            path_variables={
                'tier1_id': 'tier-1-id',
                'locale_service_id': 'locale-service-id',
                'service_id': 'service-id',
                'session_id': 'session-id',
            },
            query_parameters={
                'enforcement_point_path': 'enforcement_point_path',
                'source': 'source',
            },
            content_type='application/json')

        operations = {
            'create': {
                'input_type': create_input_type,
                'output_type': type.VoidType(),
                'errors': create_error_dict,
                'input_value_validator_list':
                create_input_value_validator_list,
                'output_validator_list': create_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'AggregateIPSecVpnSessionStatistics'),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'create': create_rest_metadata,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name=
            'com.vmware.nsx_policy.infra.tier_1s.locale_services.ipsec_vpn_services.sessions.statistics',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'domain_id': type.StringType(),
                'gateway_policy_id': type.StringType(),
                'enforcement_point_path': type.OptionalType(type.StringType()),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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=
            '/policy/api/v1/global-infra/domains/{domain-id}/gateway-policies/{gateway-policy-id}/statistics',
            path_variables={
                'domain_id': 'domain-id',
                'gateway_policy_id': 'gateway-policy-id',
            },
            query_parameters={
                'enforcement_point_path': 'enforcement_point_path',
            },
            content_type='application/json')

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'SecurityPolicyStatisticsListResult'),
                '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.nsx_policy.global_infra.domains.gateway_policies.statistics',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Beispiel #8
0
class Job(VapiInterface):
    """
    ``Job`` class provides methods Performs restore operations
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _JobStub)

    class ReturnStatus(Enum):
        """
        ``Job.ReturnStatus`` class Defines the state of precheck

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

        """
        WARNING = None
        """
        Passed with warnings

        """
        OK = None
        """
        Check passed

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

    ReturnStatus._set_values([
        ReturnStatus('FAIL'),
        ReturnStatus('WARNING'),
        ReturnStatus('OK'),
    ])
    ReturnStatus._set_binding_type(
        type.EnumType(
            'com.vmware.appliance.recovery.restore.job.return_status',
            ReturnStatus))

    class LocationType(Enum):
        """
        ``Job.LocationType`` class Defines type of all locations for backup/restore

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

        """
        HTTP = None
        """
        Destination is HTTP server

        """
        FTPS = None
        """
        Destination is FTPS server

        """
        HTTPS = None
        """
        Destination is HTTPS server

        """
        SCP = None
        """
        Destination is SSH server

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

    LocationType._set_values([
        LocationType('FTP'),
        LocationType('HTTP'),
        LocationType('FTPS'),
        LocationType('HTTPS'),
        LocationType('SCP'),
    ])
    LocationType._set_binding_type(
        type.EnumType(
            'com.vmware.appliance.recovery.restore.job.location_type',
            LocationType))

    class BackupRestoreProcessState(Enum):
        """
        ``Job.BackupRestoreProcessState`` class Defines state of backup/restore
        process

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

        """
        INPROGRESS = None
        """
        In progress

        """
        NONE = None
        """
        Not started

        """
        SUCCEEDED = None
        """
        Completed successfully

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

    BackupRestoreProcessState._set_values([
        BackupRestoreProcessState('FAILED'),
        BackupRestoreProcessState('INPROGRESS'),
        BackupRestoreProcessState('NONE'),
        BackupRestoreProcessState('SUCCEEDED'),
    ])
    BackupRestoreProcessState._set_binding_type(
        type.EnumType(
            'com.vmware.appliance.recovery.restore.job.backup_restore_process_state',
            BackupRestoreProcessState))

    class LocalizableMessage(VapiStruct):
        """
        ``Job.LocalizableMessage`` class Structure representing message

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            id=None,
            default_message=None,
            args=None,
        ):
            """
            :type  id: :class:`str`
            :param id: id in message bundle
            :type  default_message: :class:`str`
            :param default_message: text in english
            :type  args: :class:`list` of :class:`str`
            :param args: nested data
            """
            self.id = id
            self.default_message = default_message
            self.args = args
            VapiStruct.__init__(self)

    LocalizableMessage._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.restore.job.localizable_message', {
                'id': type.StringType(),
                'default_message': type.StringType(),
                'args': type.ListType(type.StringType()),
            }, LocalizableMessage, False, None))

    class ReturnResult(VapiStruct):
        """
        ``Job.ReturnResult`` class Structure representing precheck result

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            status=None,
            messages=None,
        ):
            """
            :type  status: :class:`Job.ReturnStatus`
            :param status: Check status
            :type  messages: :class:`list` of :class:`Job.LocalizableMessage`
            :param messages: List of messages
            """
            self.status = status
            self.messages = messages
            VapiStruct.__init__(self)

    ReturnResult._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.restore.job.return_result', {
                'status':
                type.ReferenceType(__name__, 'Job.ReturnStatus'),
                'messages':
                type.ListType(
                    type.ReferenceType(__name__, 'Job.LocalizableMessage')),
            }, ReturnResult, False, None))

    class RestoreRequest(VapiStruct):
        """
        ``Job.RestoreRequest`` class Structure representing requested restore piece

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            backup_password=None,
            location_type=None,
            location=None,
            location_user=None,
            location_password=None,
            sso_admin_user_name=None,
            sso_admin_user_password=None,
            ignore_warnings=None,
        ):
            """
            :type  backup_password: :class:`str` or ``None``
            :param backup_password: a password for a backup piece
                backupPassword If no password then the piece will not be decrypted
            :type  location_type: :class:`Job.LocationType`
            :param location_type: a type of location
            :type  location: :class:`str`
            :param location: path or url
            :type  location_user: :class:`str` or ``None``
            :param location_user: username for location
                locationUser User name for this location if login is required.
            :type  location_password: :class:`str` or ``None``
            :param location_password: password for location
                locationPassword Password for the specified user if login is
                required at this location.
            :type  sso_admin_user_name: :class:`str` or ``None``
            :param sso_admin_user_name: Administrators Username for SSO. This attribute was added in
                vSphere API 6.7
                If None SSO authentication will not be used. If the vCenter Server
                is a management node or an embedded node, authentication is
                required.
            :type  sso_admin_user_password: :class:`str` or ``None``
            :param sso_admin_user_password: The password for SSO admin user. This attribute was added in
                vSphere API 6.7
                If None SSO authentication will not be used. If the vCenter Server
                is a management node or an embedded node, authentication is
                required.
            :type  ignore_warnings: :class:`bool` or ``None``
            :param ignore_warnings: The flag to ignore warnings during restore. This attribute was
                added in vSphere API 6.7
                If None, validation warnings will fail the restore operation
            """
            self.backup_password = backup_password
            self.location_type = location_type
            self.location = location
            self.location_user = location_user
            self.location_password = location_password
            self.sso_admin_user_name = sso_admin_user_name
            self.sso_admin_user_password = sso_admin_user_password
            self.ignore_warnings = ignore_warnings
            VapiStruct.__init__(self)

    RestoreRequest._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.restore.job.restore_request', {
                'backup_password': type.OptionalType(type.SecretType()),
                'location_type': type.ReferenceType(__name__,
                                                    'Job.LocationType'),
                'location': type.StringType(),
                'location_user': type.OptionalType(type.StringType()),
                'location_password': type.OptionalType(type.SecretType()),
                'sso_admin_user_name': type.OptionalType(type.StringType()),
                'sso_admin_user_password': type.OptionalType(
                    type.SecretType()),
                'ignore_warnings': type.OptionalType(type.BooleanType()),
            }, RestoreRequest, False, None))

    class RestoreJobStatus(VapiStruct):
        """
        ``Job.RestoreJobStatus`` class Structure representing backup restore status

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            state=None,
            messages=None,
            progress=None,
        ):
            """
            :type  state: :class:`Job.BackupRestoreProcessState`
            :param state: process state
            :type  messages: :class:`list` of :class:`Job.LocalizableMessage`
            :param messages: list of messages
            :type  progress: :class:`long`
            :param progress: percentage complete
            """
            self.state = state
            self.messages = messages
            self.progress = progress
            VapiStruct.__init__(self)

    RestoreJobStatus._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.restore.job.restore_job_status', {
                'state':
                type.ReferenceType(__name__, 'Job.BackupRestoreProcessState'),
                'messages':
                type.ListType(
                    type.ReferenceType(__name__, 'Job.LocalizableMessage')),
                'progress':
                type.IntegerType(),
            }, RestoreJobStatus, False, None))

    def cancel(self):
        """
        Cancel the restore job


        :rtype: :class:`Job.ReturnResult`
        :return: RestoreJobStatus Structure
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('cancel', None)

    def create(
        self,
        piece,
    ):
        """
        Initiate restore.

        :type  piece: :class:`Job.RestoreRequest`
        :param piece: RestoreRequest Structure
        :rtype: :class:`Job.RestoreJobStatus`
        :return: RestoreJobStatus Structure
        :raise: :class:`com.vmware.vapi.std.errors_client.FeatureInUse` 
            A backup or restore is already in progress
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            Restore is allowed only after deployment and before firstboot
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('create', {
            'piece': piece,
        })

    def get(self):
        """
        See restore job progress/result.


        :rtype: :class:`Job.RestoreJobStatus`
        :return: RestoreJobStatus Structure
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('get', None)
Beispiel #9
0
    def __init__(self, config):
        # properties for cancel operation
        cancel_input_type = type.StructType('operation-input', {})
        cancel_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        cancel_input_value_validator_list = []
        cancel_output_validator_list = []
        cancel_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/appliance/recovery/restore/job/cancel',
            path_variables={},
            query_parameters={})

        # properties for create operation
        create_input_type = type.StructType(
            'operation-input', {
                'piece': type.ReferenceType(__name__, 'Job.RestoreRequest'),
            })
        create_error_dict = {
            'com.vmware.vapi.std.errors.feature_in_use':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'FeatureInUse'),
            'com.vmware.vapi.std.errors.not_allowed_in_current_state':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotAllowedInCurrentState'),
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        create_input_value_validator_list = []
        create_output_validator_list = []
        create_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/appliance/recovery/restore/job',
            path_variables={},
            query_parameters={})

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

        operations = {
            'cancel': {
                'input_type': cancel_input_type,
                'output_type': type.ReferenceType(__name__,
                                                  'Job.ReturnResult'),
                'errors': cancel_error_dict,
                'input_value_validator_list':
                cancel_input_value_validator_list,
                'output_validator_list': cancel_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'create': {
                'input_type': create_input_type,
                'output_type': type.ReferenceType(__name__,
                                                  'Job.RestoreJobStatus'),
                'errors': create_error_dict,
                'input_value_validator_list':
                create_input_value_validator_list,
                'output_validator_list': create_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType(__name__,
                                                  'Job.RestoreJobStatus'),
                '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 = {
            'cancel': cancel_rest_metadata,
            'create': create_rest_metadata,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.appliance.recovery.restore.job',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
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,
        })
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'service_reference_id': type.StringType(),
                'service_profile_id': type.StringType(),
                'enforcement_point_path': type.OptionalType(type.StringType()),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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=
            '/policy/api/v1/infra/service-references/{service-reference-id}/service-profiles/{service-profile-id}/group-associations',
            path_variables={
                'service_reference_id': 'service-reference-id',
                'service_profile_id': 'service-profile-id',
            },
            query_parameters={
                'enforcement_point_path': 'enforcement_point_path',
            },
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'ServiceProfileGroups'),
                '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 = {
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name=
            'com.vmware.nsx_policy.infra.service_references.service_profiles.group_associations',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
class BaseImages(VapiInterface):
    """
    The ``BaseImages`` class provides methods to get base-images from the
    sync'ed and imported depots.
    """
    RESOURCE_TYPE = "com.vmware.esx.settings.base_image"
    """
    Resource type for add-on resource

    """

    _VAPI_SERVICE_ID = 'com.vmware.esx.settings.depot_content.base_images'
    """
    Identifier of the service in canonical form.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _BaseImagesStub)
        self._VAPI_OPERATION_IDS = {}

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

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

        """
        ENHANCEMENT = None
        """
        Enhancement

        """
        BUGFIX = None
        """
        Bugfix

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

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

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

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

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

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

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

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

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

        :type  filter: :class:`BaseImages.FilterSpec` or ``None``
        :param filter: The specification of matching base-images.
            If None, the behavior is equivalent to a
            :class:`BaseImages.FilterSpec` with all attributes None, which
            means all base-images match the filter.
        :rtype: :class:`list` of :class:`BaseImages.Summary`
        :return: List of base-images in the depot. These will be sorted by the
            version of the base-image.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If there is unknown internal error. The accompanying error message
            will give more details about the failure.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            If the service is not available.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the caller is not authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``VcIntegrity.lifecycleSettings.Read``.
        """
        return self._invoke('list', {
            'filter': filter,
        })
Beispiel #13
0
class ServiceStatus(VapiInterface):
    """
    The ``ServiceStatus`` class provides methods to get the Attestation Service
    health status. This class was added in vSphere API 7.0.0.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.service_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, _ServiceStatusStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update({'get_task': 'get$task'})

    class Health(Enum):
        """
        The ``ServiceStatus.Health`` class defines the possible service 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
        """
        No status available. This class attribute was added in vSphere API 7.0.0.

        """
        OK = None
        """
        Service is functioning normally. This class attribute was added in vSphere
        API 7.0.0.

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

        """
        ERROR = None
        """
        Service is not functioning. 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.service_status.health',
            Health))

    class Info(VapiStruct):
        """
        The ``ServiceStatus.Info`` class contains information that describes the
        status of the 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,
            health=None,
            details=None,
        ):
            """
            :type  health: :class:`ServiceStatus.Health`
            :param health: The service health status. 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 of the service. 
                
                When the service ``ServiceStatus.Health`` is not
                :attr:`ServiceStatus.Health.OK` or
                :attr:`ServiceStatus.Health.NONE`, this member will provide an
                actionable description of the issues present.. This attribute was
                added in vSphere API 7.0.0.
            """
            self.health = health
            self.details = details
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.service_status.info',
            {
                'health':
                type.ReferenceType(__name__, 'ServiceStatus.Health'),
                'details':
                type.ListType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
            }, Info, False, None))

    def get_task(
        self,
        cluster,
    ):
        """
        Return the Attestation service health in the given cluster. This method
        was added in vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: Identifier of the cluster.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            For any other 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('get$task', {
            'cluster': cluster,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ReferenceType(__name__, 'ServiceStatus.Info'))
        return task_instance
Beispiel #14
0
    def __init__(self, config):
        # properties for delete operation
        delete_input_type = type.StructType(
            'operation-input', {
                'service_id': type.StringType(),
                'service_entry_id': type.StringType(),
            })
        delete_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        delete_input_value_validator_list = []
        delete_output_validator_list = []
        delete_rest_metadata = OperationRestMetadata(
            http_method='DELETE',
            url_template=
            '/policy/api/v1/infra/services/{service-id}/service-entries/{service-entry-id}',
            path_variables={
                'service_id': 'service-id',
                'service_entry_id': 'service-entry-id',
            },
            query_parameters={})

        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'service_id': type.StringType(),
                'service_entry_id': type.StringType(),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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 = [HasFieldsOfValidator()]
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/policy/api/v1/infra/services/{service-id}/service-entries/{service-entry-id}',
            path_variables={
                'service_id': 'service-id',
                'service_entry_id': 'service-entry-id',
            },
            query_parameters={})

        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'service_id': type.StringType(),
                'cursor': type.OptionalType(type.StringType()),
                'included_fields': type.OptionalType(type.StringType()),
                'page_size': type.OptionalType(type.IntegerType()),
                'sort_ascending': type.OptionalType(type.BooleanType()),
                'sort_by': type.OptionalType(type.StringType()),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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 = [HasFieldsOfValidator()]
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/policy/api/v1/infra/services/{service-id}/service-entries',
            path_variables={
                'service_id': 'service-id',
            },
            query_parameters={
                'cursor': 'cursor',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            })

        # properties for patch operation
        patch_input_type = type.StructType(
            'operation-input', {
                'service_id':
                type.StringType(),
                'service_entry_id':
                type.StringType(),
                'service_entry':
                type.DynamicStructType(
                    'vmware.vapi.dynamic_struct', {}, VapiStruct, [
                        type.ReferenceType(
                            'com.vmware.nsx_policy.model_client',
                            'ServiceEntry')
                    ]),
            })
        patch_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        patch_input_value_validator_list = [HasFieldsOfValidator()]
        patch_output_validator_list = []
        patch_rest_metadata = OperationRestMetadata(
            http_method='PATCH',
            url_template=
            '/policy/api/v1/infra/services/{service-id}/service-entries/{service-entry-id}',
            request_body_parameter='service_entry',
            path_variables={
                'service_id': 'service-id',
                'service_entry_id': 'service-entry-id',
            },
            query_parameters={})

        # properties for update operation
        update_input_type = type.StructType(
            'operation-input', {
                'service_id':
                type.StringType(),
                'service_entry_id':
                type.StringType(),
                'service_entry':
                type.DynamicStructType(
                    'vmware.vapi.dynamic_struct', {}, VapiStruct, [
                        type.ReferenceType(
                            'com.vmware.nsx_policy.model_client',
                            'ServiceEntry')
                    ]),
            })
        update_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        update_input_value_validator_list = [HasFieldsOfValidator()]
        update_output_validator_list = [HasFieldsOfValidator()]
        update_rest_metadata = OperationRestMetadata(
            http_method='PUT',
            url_template=
            '/policy/api/v1/infra/services/{service-id}/service-entries/{service-entry-id}',
            request_body_parameter='service_entry',
            path_variables={
                'service_id': 'service-id',
                'service_entry_id': 'service-entry-id',
            },
            query_parameters={})

        operations = {
            'delete': {
                'input_type': delete_input_type,
                'output_type': type.VoidType(),
                'errors': delete_error_dict,
                'input_value_validator_list':
                delete_input_value_validator_list,
                'output_validator_list': delete_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.DynamicStructType(
                    'vmware.vapi.dynamic_struct', {}, VapiStruct, [
                        type.ReferenceType(
                            'com.vmware.nsx_policy.model_client',
                            'ServiceEntry')
                    ]),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'ServiceEntryListResult'),
                'errors':
                list_error_dict,
                'input_value_validator_list':
                list_input_value_validator_list,
                'output_validator_list':
                list_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'patch': {
                'input_type': patch_input_type,
                'output_type': type.VoidType(),
                'errors': patch_error_dict,
                'input_value_validator_list': patch_input_value_validator_list,
                'output_validator_list': patch_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'update': {
                'input_type':
                update_input_type,
                'output_type':
                type.DynamicStructType(
                    'vmware.vapi.dynamic_struct', {}, VapiStruct, [
                        type.ReferenceType(
                            'com.vmware.nsx_policy.model_client',
                            'ServiceEntry')
                    ]),
                'errors':
                update_error_dict,
                'input_value_validator_list':
                update_input_value_validator_list,
                'output_validator_list':
                update_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'delete': delete_rest_metadata,
            'get': get_rest_metadata,
            'list': list_rest_metadata,
            'patch': patch_rest_metadata,
            'update': update_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.nsx_policy.infra.services.service_entries',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
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

    """
    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,
        })
Beispiel #16
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'enforcement_point_id': type.StringType(),
                'domain_id': type.StringType(),
                'discovery_session_id': type.StringType(),
                'view': type.OptionalType(type.StringType()),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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=
            '/policy/api/v1/infra/realized-state/enforcement-points/{enforcement-point-id}/ops/domains/{domain-id}/discovery-sessions/{discovery-session-id}',
            path_variables={
                'enforcement_point_id': 'enforcement-point-id',
                'domain_id': 'domain-id',
                'discovery_session_id': 'discovery-session-id',
            },
            query_parameters={
                'view': 'view',
            })

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'RealizedDiscoverySession'),
                '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 = {
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name=
            'com.vmware.nsx_policy.infra.realized_state.enforcement_points.ops.domains.discovery_sessions',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'tier0_id': type.StringType(),
            'locale_services_id': type.StringType(),
            'cursor': type.OptionalType(type.StringType()),
            'edge_path': type.OptionalType(type.StringType()),
            'included_fields': type.OptionalType(type.StringType()),
            'page_size': type.OptionalType(type.IntegerType()),
            'sort_ascending': type.OptionalType(type.BooleanType()),
            'sort_by': type.OptionalType(type.StringType()),
        })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            '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='/policy/api/v1/infra/tier-0s/{tier-0-id}/locale-services/{locale-services-id}/multicast/routes',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_services_id': 'locale-services-id',
            },
            query_parameters={
                'cursor': 'cursor',
                'edge_path': 'edge_path',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            },
            content_type='application/json'
        )

        operations = {
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'PolicyMulticastRoutes'),
                '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 = {
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.nsx_policy.infra.tier_0s.locale_services.multicast.routes',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=False)
Beispiel #18
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType('operation-input', {})
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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='/api/v1/capacity/threshold',
            path_variables={},
            query_parameters={},
            content_type='application/json')

        # properties for update operation
        update_input_type = type.StructType(
            'operation-input', {
                'capacity_threshold_list':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'CapacityThresholdList'),
            })
        update_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        update_input_value_validator_list = []
        update_output_validator_list = []
        update_rest_metadata = OperationRestMetadata(
            http_method='PUT',
            url_template='/api/v1/capacity/threshold',
            request_body_parameter='capacity_threshold_list',
            path_variables={},
            query_parameters={},
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'CapacityThresholdList'),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'update': {
                'input_type':
                update_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'CapacityThresholdList'),
                'errors':
                update_error_dict,
                'input_value_validator_list':
                update_input_value_validator_list,
                'output_validator_list':
                update_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'get': get_rest_metadata,
            'update': update_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.nsx.capacity.threshold',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
    def __init__(self, config):
        # properties for delete operation
        delete_input_type = type.StructType(
            'operation-input', {
                'domain_id': type.StringType(),
                'gateway_policy_id': type.StringType(),
                'rule_id': type.StringType(),
            })
        delete_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        delete_input_value_validator_list = []
        delete_output_validator_list = []
        delete_rest_metadata = OperationRestMetadata(
            http_method='DELETE',
            url_template=
            '/policy/api/v1/global-infra/domains/{domain-id}/gateway-policies/{gateway-policy-id}/rules/{rule-id}',
            path_variables={
                'domain_id': 'domain-id',
                'gateway_policy_id': 'gateway-policy-id',
                'rule_id': 'rule-id',
            },
            query_parameters={},
            content_type='application/json')

        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'domain_id': type.StringType(),
                'gateway_policy_id': type.StringType(),
                'rule_id': type.StringType(),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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 = [HasFieldsOfValidator()]
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/policy/api/v1/global-infra/domains/{domain-id}/gateway-policies/{gateway-policy-id}/rules/{rule-id}',
            path_variables={
                'domain_id': 'domain-id',
                'gateway_policy_id': 'gateway-policy-id',
                'rule_id': 'rule-id',
            },
            query_parameters={},
            content_type='application/json')

        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'domain_id':
                type.StringType(),
                'gateway_policy_id':
                type.StringType(),
                'cursor':
                type.OptionalType(type.StringType()),
                'include_mark_for_delete_objects':
                type.OptionalType(type.BooleanType()),
                'included_fields':
                type.OptionalType(type.StringType()),
                'page_size':
                type.OptionalType(type.IntegerType()),
                'sort_ascending':
                type.OptionalType(type.BooleanType()),
                'sort_by':
                type.OptionalType(type.StringType()),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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 = [HasFieldsOfValidator()]
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/policy/api/v1/global-infra/domains/{domain-id}/gateway-policies/{gateway-policy-id}/rules',
            path_variables={
                'domain_id': 'domain-id',
                'gateway_policy_id': 'gateway-policy-id',
            },
            query_parameters={
                'cursor': 'cursor',
                'include_mark_for_delete_objects':
                'include_mark_for_delete_objects',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            },
            content_type='application/json')

        # properties for patch operation
        patch_input_type = type.StructType(
            'operation-input', {
                'domain_id':
                type.StringType(),
                'gateway_policy_id':
                type.StringType(),
                'rule_id':
                type.StringType(),
                'rule':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'Rule'),
            })
        patch_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        patch_input_value_validator_list = [HasFieldsOfValidator()]
        patch_output_validator_list = []
        patch_rest_metadata = OperationRestMetadata(
            http_method='PATCH',
            url_template=
            '/policy/api/v1/global-infra/domains/{domain-id}/gateway-policies/{gateway-policy-id}/rules/{rule-id}',
            request_body_parameter='rule',
            path_variables={
                'domain_id': 'domain-id',
                'gateway_policy_id': 'gateway-policy-id',
                'rule_id': 'rule-id',
            },
            query_parameters={},
            content_type='application/json')

        # properties for revise operation
        revise_input_type = type.StructType(
            'operation-input', {
                'domain_id':
                type.StringType(),
                'gateway_policy_id':
                type.StringType(),
                'rule_id':
                type.StringType(),
                'rule':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'Rule'),
                'anchor_path':
                type.OptionalType(type.StringType()),
                'operation':
                type.OptionalType(type.StringType()),
            })
        revise_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        revise_input_value_validator_list = [HasFieldsOfValidator()]
        revise_output_validator_list = [HasFieldsOfValidator()]
        revise_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template=
            '/policy/api/v1/global-infra/domains/{domain-id}/gateway-policies/{gateway-policy-id}/rules/{rule-id}?action=revise',
            request_body_parameter='rule',
            path_variables={
                'domain_id': 'domain-id',
                'gateway_policy_id': 'gateway-policy-id',
                'rule_id': 'rule-id',
            },
            query_parameters={
                'anchor_path': 'anchor_path',
                'operation': 'operation',
            },
            content_type='application/json')

        # properties for update operation
        update_input_type = type.StructType(
            'operation-input', {
                'domain_id':
                type.StringType(),
                'gateway_policy_id':
                type.StringType(),
                'rule_id':
                type.StringType(),
                'rule':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'Rule'),
            })
        update_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        update_input_value_validator_list = [HasFieldsOfValidator()]
        update_output_validator_list = [HasFieldsOfValidator()]
        update_rest_metadata = OperationRestMetadata(
            http_method='PUT',
            url_template=
            '/policy/api/v1/global-infra/domains/{domain-id}/gateway-policies/{gateway-policy-id}/rules/{rule-id}',
            request_body_parameter='rule',
            path_variables={
                'domain_id': 'domain-id',
                'gateway_policy_id': 'gateway-policy-id',
                'rule_id': 'rule-id',
            },
            query_parameters={},
            content_type='application/json')

        operations = {
            'delete': {
                'input_type': delete_input_type,
                'output_type': type.VoidType(),
                'errors': delete_error_dict,
                'input_value_validator_list':
                delete_input_value_validator_list,
                'output_validator_list': delete_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'Rule'),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'RuleListResult'),
                'errors':
                list_error_dict,
                'input_value_validator_list':
                list_input_value_validator_list,
                'output_validator_list':
                list_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'patch': {
                'input_type': patch_input_type,
                'output_type': type.VoidType(),
                'errors': patch_error_dict,
                'input_value_validator_list': patch_input_value_validator_list,
                'output_validator_list': patch_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'revise': {
                'input_type':
                revise_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'Rule'),
                'errors':
                revise_error_dict,
                'input_value_validator_list':
                revise_input_value_validator_list,
                'output_validator_list':
                revise_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'update': {
                'input_type':
                update_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'Rule'),
                'errors':
                update_error_dict,
                'input_value_validator_list':
                update_input_value_validator_list,
                'output_validator_list':
                update_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'delete': delete_rest_metadata,
            'get': get_rest_metadata,
            'list': list_rest_metadata,
            'patch': patch_rest_metadata,
            'revise': revise_rest_metadata,
            'update': update_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name=
            'com.vmware.nsx_policy.global_infra.domains.gateway_policies.rules',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Beispiel #20
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'category': type.OptionalType(type.StringType()),
                'cursor': type.OptionalType(type.StringType()),
                'force': type.OptionalType(type.BooleanType()),
                'included_fields': type.OptionalType(type.StringType()),
                'page_size': type.OptionalType(type.IntegerType()),
                'sort_ascending': type.OptionalType(type.BooleanType()),
                'sort_by': type.OptionalType(type.StringType()),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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='/api/v1/capacity/usage',
            path_variables={},
            query_parameters={
                'category': 'category',
                'cursor': 'cursor',
                'force': 'force',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            },
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'CapacityUsageResponse'),
                '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 = {
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(self,
                                  iface_name='com.vmware.nsx.capacity.usage',
                                  config=config,
                                  operations=operations,
                                  rest_metadata=rest_metadata,
                                  is_vapi_rest=False)
Beispiel #21
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'cc_ext_id': type.StringType(),
        })
        list_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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=
            '/api/v1/fabric/compute-collections/{cc-ext-id}/member-status',
            path_variables={
                'cc_ext_id': 'cc-ext-id',
            },
            query_parameters={},
            content_type='application/json')

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'HostNodeStatusListResult'),
                '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.nsx.fabric.compute_collections.member_status',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Beispiel #22
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'filter': type.ReferenceType(__name__, 'VM.FilterSpec'),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            '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.unsupported':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unsupported'),
            '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/compliance/vm',
            path_variables={},
            query_parameters={})

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.MapType(type.IdType(),
                             type.ReferenceType(__name__, 'VM.Info')),
                '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.vcenter.storage.policies.compliance.VM',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Beispiel #23
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'enforcement_point_name': type.StringType(),
            'mac_set_name': type.StringType(),
        })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            '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='/policy/api/v1/infra/realized-state/enforcement-points/{enforcement-point-name}/mac-sets/mac-sets-nsxt/{mac-set-name}',
            path_variables={
                'enforcement_point_name': 'enforcement-point-name',
                'mac_set_name': 'mac-set-name',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'enforcement_point_name': type.StringType(),
            'cursor': type.OptionalType(type.StringType()),
            'included_fields': type.OptionalType(type.StringType()),
            'page_size': type.OptionalType(type.IntegerType()),
            'sort_ascending': type.OptionalType(type.BooleanType()),
            'sort_by': type.OptionalType(type.StringType()),
        })
        list_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            '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='/policy/api/v1/infra/realized-state/enforcement-points/{enforcement-point-name}/mac-sets/mac-sets-nsxt',
            path_variables={
                'enforcement_point_name': 'enforcement-point-name',
            },
            query_parameters={
                'cursor': 'cursor',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            },
            content_type='application/json'
        )

        operations = {
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'GenericPolicyRealizedResource'),
                'errors': get_error_dict,
                'input_value_validator_list': get_input_value_validator_list,
                'output_validator_list': get_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'list': {
                'input_type': list_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'GenericPolicyRealizedResourceListResult'),
                '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 = {
            'get': get_rest_metadata,
            'list': list_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.nsx_policy.infra.realized_state.enforcement_points.mac_sets.mac_sets_nsxt',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=False)
Beispiel #24
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.
    """

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

    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,
        })
Beispiel #25
0
class Associations(VapiInterface):
    """
    The ``Associations`` class provides methods to list tag associations. This
    class was added in vSphere API 7.0.0.0.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.tagging.associations'
    """
    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, _AssociationsStub)
        self._VAPI_OPERATION_IDS = {}

    class LastIterationStatus(Enum):
        """
        The last status for the iterator. A field of this type is returned as part
        of the result and indicates to the caller of the API whether it can
        continue to make requests for more data. 
        
        The last status only reports on the state of the iteration at the time data
        was last returned. As a result, it not does guarantee if the next call will
        succeed in getting more data or not. 
        
        Failures to retrieve results will be returned as Error responses. These
        last statuses are only returned when the iterator is operating as
        expected.. 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>`.
        """
        READY = None
        """
        Iterator has more data pending and is ready to provide it. The caller can
        request the next page of data at any time. 
        
        The number of results returned may be less than the usual size. In other
        words, the iterator may not fill the page. The iterator has returned at
        least 1 result.. This class attribute was added in vSphere API 7.0.0.0.

        """
        END_OF_DATA = None
        """
        Iterator has finished iterating through its inventory. There are currently
        no more entities to return and the caller can terminate iteration. If the
        iterator returned some data, the marker may be set to allow the iterator to
        continue from where it left off when additional data does become available.
        This value is used to indicate that all available data has been returned by
        the iterator. 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:`LastIterationStatus` instance.
            """
            Enum.__init__(string)

    LastIterationStatus._set_values([
        LastIterationStatus('READY'),
        LastIterationStatus('END_OF_DATA'),
    ])
    LastIterationStatus._set_binding_type(
        type.EnumType(
            'com.vmware.vcenter.tagging.associations.last_iteration_status',
            LastIterationStatus))

    class IterationSpec(VapiStruct):
        """
        The ``Associations.IterationSpec`` class contains attributes used to break
        results into pages when listing tags associated to objects see
        :func:`Associations.list`). 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,
            marker=None,
        ):
            """
            :type  marker: :class:`str` or ``None``
            :param marker: Marker is an opaque token that allows the caller to request the
                next page of tag associations. 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:
                ``com.vmware.vcenter.tagging.associations.Marker``. 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.tagging.associations.Marker``.
                If None or empty, first page of tag associations will be returned.
            """
            self.marker = marker
            VapiStruct.__init__(self)

    IterationSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.tagging.associations.iteration_spec', {
                'marker': type.OptionalType(type.IdType()),
            }, IterationSpec, False, None))

    class Summary(VapiStruct):
        """
        The ``Associations.Summary`` describes a tag association. 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,
            tag=None,
            object=None,
        ):
            """
            :type  tag: :class:`str`
            :param tag: The identifier of a tag. 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:
                ``com.vmware.cis.tagging.Tag``. 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.tagging.Tag``.
            :type  object: :class:`com.vmware.vapi.std_client.DynamicID`
            :param object: The identifier of an associated object. This attribute was added in
                vSphere API 7.0.0.0.
            """
            self.tag = tag
            self.object = object
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.tagging.associations.summary', {
                'tag':
                type.IdType(resource_types='com.vmware.cis.tagging.Tag'),
                'object':
                type.ReferenceType('com.vmware.vapi.std_client', 'DynamicID'),
            }, Summary, False, None))

    class ListResult(VapiStruct):
        """
        The ``Associations.ListResult`` class contains the list of tag associations
        in a page, as well as related metadata fields. 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,
            associations=None,
            marker=None,
            status=None,
        ):
            """
            :type  associations: :class:`list` of :class:`Associations.Summary`
            :param associations: List of tag associations. This attribute was added in vSphere API
                7.0.0.0.
            :type  marker: :class:`str` or ``None``
            :param marker: Marker is an opaque data structure that allows the caller to
                request the next page of tag associations. 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:
                ``com.vmware.vcenter.tagging.associations.Marker``. 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.tagging.associations.Marker``.
                If None or empty, there are no more tag associations to request.
            :type  status: :class:`Associations.LastIterationStatus`
            :param status: The last status for the iterator that indicates whether any more
                results can be expected if the caller continues to make requests
                for more data using the iterator. This attribute was added in
                vSphere API 7.0.0.0.
            """
            self.associations = associations
            self.marker = marker
            self.status = status
            VapiStruct.__init__(self)

    ListResult._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.tagging.associations.list_result', {
                'associations':
                type.ListType(
                    type.ReferenceType(__name__, 'Associations.Summary')),
                'marker':
                type.OptionalType(type.IdType()),
                'status':
                type.ReferenceType(__name__,
                                   'Associations.LastIterationStatus'),
            }, ListResult, False, None))

    def list(
        self,
        iterate=None,
    ):
        """
        Returns tag associations that match the specified iteration spec. This
        method was added in vSphere API 7.0.0.0.

        :type  iterate: :class:`Associations.IterationSpec` or ``None``
        :param iterate: The specification of a page to be retrieved.
            If None, the first page will be retrieved.
        :rtype: :class:`Associations.ListResult`
        :return: A page of the tag associations matching the iteration spec.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if :attr:`Associations.IterationSpec.marker` is not a marker
            returned from an earlier invocation of this {\\\\@term operation).
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user doesn't have the required privileges.
        """
        return self._invoke('list', {
            'iterate': iterate,
        })
Beispiel #26
0
    def __init__(self, config):
        # properties for create operation
        create_input_type = type.StructType(
            'operation-input', {
                'org': type.StringType(),
                'sddc': type.StringType(),
                'edge_id': type.StringType(),
                'enable': type.BooleanType(),
            })
        create_error_dict = {
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        create_input_value_validator_list = []
        create_output_validator_list = []
        create_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template=
            '/vmc/api/orgs/{org}/sddcs/{sddc}/networks/4.0/edges/{edgeId}/dns/config',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
                'edge_id': 'edgeId',
            },
            query_parameters={
                'enable': 'enable',
            },
            content_type='application/json')

        # properties for delete operation
        delete_input_type = type.StructType(
            'operation-input', {
                'org': type.StringType(),
                'sddc': type.StringType(),
                'edge_id': type.StringType(),
            })
        delete_error_dict = {
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        delete_input_value_validator_list = []
        delete_output_validator_list = []
        delete_rest_metadata = OperationRestMetadata(
            http_method='DELETE',
            url_template=
            '/vmc/api/orgs/{org}/sddcs/{sddc}/networks/4.0/edges/{edgeId}/dns/config',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
                'edge_id': 'edgeId',
            },
            query_parameters={},
            content_type='application/json')

        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'org': type.StringType(),
                'sddc': type.StringType(),
                'edge_id': type.StringType(),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            '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=
            '/vmc/api/orgs/{org}/sddcs/{sddc}/networks/4.0/edges/{edgeId}/dns/config',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
                'edge_id': 'edgeId',
            },
            query_parameters={},
            content_type='application/json')

        # properties for update operation
        update_input_type = type.StructType(
            'operation-input', {
                'org':
                type.StringType(),
                'sddc':
                type.StringType(),
                'edge_id':
                type.StringType(),
                'dns_config':
                type.ReferenceType('com.vmware.vmc.model_client', 'DnsConfig'),
            })
        update_error_dict = {
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        update_input_value_validator_list = []
        update_output_validator_list = []
        update_rest_metadata = OperationRestMetadata(
            http_method='PUT',
            url_template=
            '/vmc/api/orgs/{org}/sddcs/{sddc}/networks/4.0/edges/{edgeId}/dns/config',
            request_body_parameter='dns_config',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
                'edge_id': 'edgeId',
            },
            query_parameters={},
            content_type='application/json')

        operations = {
            'create': {
                'input_type': create_input_type,
                'output_type': type.VoidType(),
                'errors': create_error_dict,
                'input_value_validator_list':
                create_input_value_validator_list,
                'output_validator_list': create_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'delete': {
                'input_type': delete_input_type,
                'output_type': type.VoidType(),
                'errors': delete_error_dict,
                'input_value_validator_list':
                delete_input_value_validator_list,
                'output_validator_list': delete_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.vmc.model_client', 'DnsConfig'),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'update': {
                'input_type': update_input_type,
                'output_type': type.VoidType(),
                'errors': update_error_dict,
                'input_value_validator_list':
                update_input_value_validator_list,
                'output_validator_list': update_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'create': create_rest_metadata,
            'delete': delete_rest_metadata,
            'get': get_rest_metadata,
            'update': update_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vmc.orgs.sddcs.networks.edges.dns.config',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Beispiel #27
0
class Forwarding(VapiInterface):
    """
    The ``Forwarding`` class provides methods to manage forwarding of log
    messages to remote logging servers. This class was added in vSphere API
    6.7.
    """

    _VAPI_SERVICE_ID = 'com.vmware.appliance.logging.forwarding'
    """
    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, _ForwardingStub)

    class Protocol(Enum):
        """
        The ``Forwarding.Protocol`` class defines transport protocols for outbound
        log messages. 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>`.
        """
        TLS = None
        """
        Log messages will be forwarded to the remote host by using the TLS
        protocol. This class attribute was added in vSphere API 6.7.

        """
        UDP = None
        """
        Log messages will be forwarded to the remote host using the UDP protocol.
        This class attribute was added in vSphere API 6.7.

        """
        TCP = None
        """
        Log messages will be forwarded to the remote host using the TCP protocol.
        This class attribute was added in vSphere API 6.7.

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

    Protocol._set_values([
        Protocol('TLS'),
        Protocol('UDP'),
        Protocol('TCP'),
    ])
    Protocol._set_binding_type(
        type.EnumType('com.vmware.appliance.logging.forwarding.protocol',
                      Protocol))

    class Config(VapiStruct):
        """
        The ``Forwarding.Config`` class defines the configuration for log message
        forwarding to remote logging servers. 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,
            hostname=None,
            port=None,
            protocol=None,
        ):
            """
            :type  hostname: :class:`str`
            :param hostname: FQDN or IP address of the logging server to which messages are
                forwarded. This attribute was added in vSphere API 6.7.
            :type  port: :class:`long`
            :param port: The port on which the remote logging server is listening for
                forwarded log messages. This attribute was added in vSphere API
                6.7.
            :type  protocol: :class:`Forwarding.Protocol`
            :param protocol: Transport protocol used to forward log messages. This attribute was
                added in vSphere API 6.7.
            """
            self.hostname = hostname
            self.port = port
            self.protocol = protocol
            VapiStruct.__init__(self)

    Config._set_binding_type(
        type.StructType(
            'com.vmware.appliance.logging.forwarding.config', {
                'hostname': type.StringType(),
                'port': type.IntegerType(),
                'protocol': type.ReferenceType(__name__,
                                               'Forwarding.Protocol'),
            }, Config, False, None))

    class ConnectionStatus(VapiStruct):
        """


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

        _validator_list = [
            UnionValidator('state', {
                'DOWN': [('message', False)],
                'UP': [],
                'UNKNOWN': [],
            }),
        ]

        def __init__(
            self,
            hostname=None,
            state=None,
            message=None,
        ):
            """
            :type  hostname: :class:`str`
            :param hostname: FQDN or IP address of the configured remote logging servers. This
                attribute was added in vSphere API 6.7.
            :type  state: :class:`Forwarding.ConnectionStatus.State`
            :param state: State of the configured remote logging server. This attribute was
                added in vSphere API 6.7.
            :type  message: :class:`com.vmware.vapi.std_client.LocalizableMessage` or ``None``
            :param message: Message associated with the state of the configured remote logging
                server. This attribute was added in vSphere API 6.7.
                If None, there is no message to be shown.
            """
            self.hostname = hostname
            self.state = state
            self.message = message
            VapiStruct.__init__(self)

        class State(Enum):
            """
            The ``Forwarding.ConnectionStatus.State`` class defines the state values
            that a remote logging server can be in. 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>`.
            """
            UP = None
            """
            The remote logging server is reachable. This class attribute was added in
            vSphere API 6.7.

            """
            DOWN = None
            """
            The remote logging server is not reachable. This class attribute was added
            in vSphere API 6.7.

            """
            UNKNOWN = None
            """
            The status of remote logging server is unknown. 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:`State` instance.
                """
                Enum.__init__(string)

        State._set_values([
            State('UP'),
            State('DOWN'),
            State('UNKNOWN'),
        ])
        State._set_binding_type(
            type.EnumType(
                'com.vmware.appliance.logging.forwarding.connection_status.state',
                State))

    ConnectionStatus._set_binding_type(
        type.StructType(
            'com.vmware.appliance.logging.forwarding.connection_status', {
                'hostname':
                type.StringType(),
                'state':
                type.ReferenceType(__name__,
                                   'Forwarding.ConnectionStatus.State'),
                'message':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
            }, ConnectionStatus, False, None))

    def test(
        self,
        send_test_message=None,
    ):
        """
        Validates the current log forwarding configuration by checking the
        liveness of the remote machine and optionally sending a test diagnostic
        log message from the appliance to all configured logging servers to
        allow manual end-to-end validation. The message that is sent is: "This
        is a diagnostic log test message from vCenter Server.". This method was
        added in vSphere API 6.7.

        :type  send_test_message: :class:`bool` or ``None``
        :param send_test_message: Flag specifying whether a default test message should be sent to
            the configured logging servers.
            If None, no test message will be sent to the configured remote
            logging servers.
        :rtype: :class:`list` of :class:`Forwarding.ConnectionStatus`
        :return: Information about the status of the connection to each of the
            remote logging servers.
        """
        return self._invoke('test', {
            'send_test_message': send_test_message,
        })

    def set(
        self,
        cfg_list,
    ):
        """
        Sets the configuration for forwarding log messages to remote log
        servers. This method was added in vSphere API 6.7.

        :type  cfg_list: :class:`list` of :class:`Forwarding.Config`
        :param cfg_list: The cfgList is a list of Config structure that contains the log
            message forwarding rules in terms of the host, port, protocol of
            the log message.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if an invalid configuration is provided.
        :raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource` 
            if the number of configurations exceeds the maximum number of
            supported configurations.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is any internal error during the execution of the
            operation.
        """
        return self._invoke('set', {
            'cfg_list': cfg_list,
        })

    def get(self):
        """
        Returns the configuration for forwarding log messages to remote logging
        servers. This method was added in vSphere API 6.7.


        :rtype: :class:`list` of :class:`Forwarding.Config`
        :return: Information about the configuration for forwarding log messages to
            remote logging servers.
        """
        return self._invoke('get', None)
    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)
Beispiel #29
0
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.
    """

    _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.

        .. 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.
            :type  certificate: :class:`str` or ``None``
            :param certificate: Server certificate. This attribute was added in vSphere API 7.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.
            :type  trusted: :class:`bool`
            :param trusted: whether server certificate is already trusted . This attribute was
                added in vSphere API 7.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.

        .. 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.
                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.
                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.

        :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
Beispiel #30
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'vm': type.IdType(resource_types='VirtualMachine'),
            })
        get_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.resource_inaccessible':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ResourceInaccessible'),
            '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'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vcenter/vm/{vm}/hardware/boot/device',
            path_variables={
                'vm': 'vm',
            },
            query_parameters={})

        # properties for set operation
        set_input_type = type.StructType(
            'operation-input', {
                'vm':
                type.IdType(resource_types='VirtualMachine'),
                'devices':
                type.ListType(type.ReferenceType(__name__, 'Device.Entry')),
            })
        set_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.invalid_argument':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidArgument'),
            'com.vmware.vapi.std.errors.resource_busy':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ResourceBusy'),
            'com.vmware.vapi.std.errors.resource_inaccessible':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ResourceInaccessible'),
            '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'),
        }
        set_input_value_validator_list = []
        set_output_validator_list = []
        set_rest_metadata = OperationRestMetadata(
            http_method='PUT',
            url_template='/vcenter/vm/{vm}/hardware/boot/device',
            path_variables={
                'vm': 'vm',
            },
            query_parameters={})

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ListType(type.ReferenceType(__name__, 'Device.Entry')),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_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,
            },
        }
        rest_metadata = {
            'get': get_rest_metadata,
            'set': set_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vcenter.vm.hardware.boot.device',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)