Esempio n. 1
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)
        self._VAPI_OPERATION_IDS = {}

    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)
Esempio n. 2
0
class Details(VapiInterface):
    """
    The ``Details`` class provides methods to get the details about backup
    jobs. This class was added in vSphere API 6.7.
    """

    _VAPI_SERVICE_ID = 'com.vmware.appliance.recovery.backup.job.details'
    """
    Identifier of the service in canonical form.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _DetailsStub)
        self._VAPI_OPERATION_IDS = {}

    class Type(Enum):
        """
        The ``Details.Type`` class defines the type of backup job. This enumeration
        was added in vSphere API 6.7.

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

        """
        MANUAL = None
        """
        Job type is Manual. This class attribute was added in vSphere API 6.7.

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

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

    class Info(VapiStruct):
        """
        The ``Details.Info`` class contains information about a backup job. This
        class was added in vSphere API 6.7.

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

        _validator_list = [
            UnionValidator(
                'status', {
                    'SUCCEEDED': [('duration', True), ('size', True),
                                  ('progress', True), ('start_time', True),
                                  ('end_time', True)],
                    'FAILED': [('duration', True), ('size', True),
                               ('progress', True), ('error', False),
                               ('start_time', True), ('end_time', True)],
                    'RUNNING': [('duration', True), ('size', True),
                                ('progress', True), ('start_time', True)],
                    'BLOCKED': [('start_time', True)],
                    'PENDING': [],
                }),
        ]

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

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

    class FilterSpec(VapiStruct):
        """
        The ``Details.FilterSpec`` class contains attributes used to filter the
        results when listing backup jobs details (see :func:`Details.list`). This
        class was added in vSphere API 6.7.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            jobs=None,
        ):
            """
            :type  jobs: :class:`set` of :class:`str` or ``None``
            :param jobs: Identifiers of backup jobs that can match the filter. This
                attribute was added in vSphere API 6.7.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.appliance.recovery.backup.job``. When methods return a
                value of this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.appliance.recovery.backup.job``.
                If None the filter will match all the backup jobs.
            """
            self.jobs = jobs
            VapiStruct.__init__(self)

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

    class BuildInfo(VapiStruct):
        """
        The ``Details.BuildInfo`` class contains information about the build of the
        appliance. This class was added in vSphere API 6.7.2.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            version_name=None,
            version=None,
            build_number=None,
        ):
            """
            :type  version_name: :class:`str`
            :param version_name: Appliance product type, for example 6.8.2 GA. This attribute was
                added in vSphere API 6.7.2.
            :type  version: :class:`str`
            :param version: Appliance version, for example 6.8.2.10000. This attribute was
                added in vSphere API 6.7.2.
            :type  build_number: :class:`str`
            :param build_number: Build Number of the appliance. This attribute was added in vSphere
                API 6.7.2.
            """
            self.version_name = version_name
            self.version = version
            self.build_number = build_number
            VapiStruct.__init__(self)

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

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

        :type  filter: :class:`Details.FilterSpec` or ``None``
        :param filter: Specification of matching backup jobs for which information should
            be returned.
            If None, the behavior is equivalent to :class:`Details.FilterSpec`
            with all attributes None which means all the backup jobs match the
            filter.
        :rtype: :class:`dict` of :class:`str` and :class:`Details.Info`
        :return: Map of backup job identifier to Info Structure.
            The key in the return value :class:`dict` will be an identifier for
            the resource type: ``com.vmware.appliance.recovery.backup.job``.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any error occurs during the execution of the operation.
        """
        return self._invoke('list', {
            'filter': filter,
        })
Esempio n. 3
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'filter': 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',
            path_variables={},
            query_parameters={
                'filter': 'filter',
            },
            content_type='application/json')

        # properties for patch operation
        patch_input_type = type.StructType(
            'operation-input', {
                'infra':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'Infra'),
            })
        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',
            request_body_parameter='infra',
            path_variables={},
            query_parameters={},
            content_type='application/json')

        # properties for update operation
        update_input_type = type.StructType(
            'operation-input', {
                'infra':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'Infra'),
            })
        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',
            request_body_parameter='infra',
            path_variables={},
            query_parameters={},
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'Infra'),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_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.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'Infra'),
                '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,
            'patch': patch_rest_metadata,
            'update': update_rest_metadata,
        }
        ApiInterfaceStub.__init__(self,
                                  iface_name='com.vmware.nsx_policy.infra',
                                  config=config,
                                  operations=operations,
                                  rest_metadata=rest_metadata,
                                  is_vapi_rest=False)
Esempio n. 4
0
class Source(VapiInterface):
    """
    The ``Source`` class provides methods to manage the sources of privilege
    metadata information. 
    
    The interface definition language infrastructure provides tools to generate
    various kinds of metadata in JSON format from the interface definition
    files and additional properties files. One of the generated files contains
    privilege information. The generated file can be registered as a source of
    metadata. 
    
    The privilege file contains all the data present in the interface
    definition files. Each privilege file contains data about one component
    element. When a privilege file is added as a source, each source
    contributes only one component element's metadata. 
    
    Privilege metadata can also be discovered from a remote server that
    supports the privilege metadata classes (see
    :mod:`com.vmware.vapi.metadata.privilege_client`). Since multiple
    components can be registered with a single metadata server, when a remote
    server is registered as a source, that source can contribute more than one
    component.
    """
    RESOURCE_TYPE = "com.vmware.vapi.metadata.privilege.source"
    """
    Resource type for metadata source.

    """
    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, _SourceStub)

    class Info(VapiStruct):
        """
        The ``Source.Info`` class contains the metadata source information.

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

        _validator_list = [
            UnionValidator('type', {
                'FILE': [('filepath', True)],
                'REMOTE': [('address', True)],
            }),
        ]

        def __init__(
            self,
            description=None,
            type=None,
            filepath=None,
            address=None,
        ):
            """
            :type  description: :class:`str`
            :param description: English language human readable description of the source.
            :type  type: :class:`com.vmware.vapi.metadata_client.SourceType`
            :param type: Type of the metadata source.
            :type  filepath: :class:`str`
            :param filepath: Absolute file path of the privilege metadata file that has the
                privilege information about one component element. The ``filePath``
                is the path to the file in the server's filesystem.
                This attribute is optional and it is only relevant when the value
                of ``type`` is null.
            :type  address: :class:`str`
            :param address: Connection information for the remote server. This must be in the
                format http(s)://IP:port/namespace. 
                
                The remote server must support the classes in the
                :mod:`com.vmware.vapi.metadata.privilege_client` module. It must
                expose privilege information of one or more components.
                This attribute is optional and it is only relevant when the value
                of ``type`` is null.
            """
            self.description = description
            self.type = type
            self.filepath = filepath
            self.address = address
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vapi.metadata.privilege.source.info', {
                'description':
                type.StringType(),
                'type':
                type.ReferenceType(com.vmware.vapi.metadata_client,
                                   'SourceType'),
                'filepath':
                type.OptionalType(type.StringType()),
                'address':
                type.OptionalType(type.URIType()),
            }, Info, False, None))

    class CreateSpec(VapiStruct):
        """
        The ``Source.CreateSpec`` class contains the registration information of a
        privilege source.

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

        _validator_list = [
            UnionValidator('type', {
                'FILE': [('filepath', True)],
                'REMOTE': [('address', True)],
            }),
        ]

        def __init__(
            self,
            description=None,
            type=None,
            filepath=None,
            address=None,
        ):
            """
            :type  description: :class:`str`
            :param description: English language human readable description of the source.
            :type  type: :class:`com.vmware.vapi.metadata_client.SourceType`
            :param type: Type of the metadata source.
            :type  filepath: :class:`str`
            :param filepath: Absolute file path of the metamodel metadata file that has the
                metamodel information about one component element.
                This attribute is optional and it is only relevant when the value
                of ``type`` is
                :attr:`com.vmware.vapi.metadata_client.SourceType.FILE`.
            :type  address: :class:`str`
            :param address: Connection information of the remote server. This should be of the
                format http(s)://IP:port/namespace. 
                
                The remote server should contain the classes in
                :mod:`com.vmware.vapi.metadata.metamodel_client` module. It could
                expose metamodel information of one or more components.
                This attribute is optional and it is only relevant when the value
                of ``type`` is
                :attr:`com.vmware.vapi.metadata_client.SourceType.REMOTE`.
            """
            self.description = description
            self.type = type
            self.filepath = filepath
            self.address = address
            VapiStruct.__init__(self)

    CreateSpec._set_binding_type(
        type.StructType(
            'com.vmware.vapi.metadata.privilege.source.create_spec', {
                'description':
                type.StringType(),
                'type':
                type.ReferenceType(com.vmware.vapi.metadata_client,
                                   'SourceType'),
                'filepath':
                type.OptionalType(type.StringType()),
                'address':
                type.OptionalType(type.URIType()),
            }, CreateSpec, False, None))

    def create(
        self,
        source_id,
        spec,
    ):
        """
        Creates a new metadata source. Once the server validates the
        registration information of the metadata source, the privilege metadata
        is retrieved from the source. This populates elements in all the
        classes defined in :mod:`com.vmware.vapi.metadata.privilege_client`
        module.

        :type  source_id: :class:`str`
        :param source_id: metadata source identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vapi.metadata.privilege.source``.
        :type  spec: :class:`Source.CreateSpec`
        :param spec: create specification.
        :raise: :class:`com.vmware.vapi.std.errors_client.AlreadyExists` 
            if the metadata source identifier is already registered with the
            infrastructure.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the type of the source specified in null is invalid.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the file specified in null is not a valid JSON file or if the
            format of the privilege metadata in the JSON file is invalid.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the URI specified in null is unreachable or if there is a
            transport protocol or message protocol mismatch between the client
            and the server or if the remote server do not have classes present
            in :mod:`com.vmware.vapi.metadata.privilege_client` module.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the file specified in null does not exist.
        """
        return self._invoke('create', {
            'source_id': source_id,
            'spec': spec,
        })

    def delete(
        self,
        source_id,
    ):
        """
        Deletes an existing privilege metadata source from the infrastructure.

        :type  source_id: :class:`str`
        :param source_id: Identifier of the metadata source.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vapi.metadata.privilege.source``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the metadata source associated with ``source_id`` is not found.
        """
        return self._invoke('delete', {
            'source_id': source_id,
        })

    def get(
        self,
        source_id,
    ):
        """
        Retrieves information about the metadata source corresponding to
        ``source_id``.

        :type  source_id: :class:`str`
        :param source_id: Identifier of the metadata source.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vapi.metadata.privilege.source``.
        :rtype: :class:`Source.Info`
        :return: The :class:`Source.Info` instance that corresponds to ``source_id``
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the metadata source associated with ``source_id`` is not found.
        """
        return self._invoke('get', {
            'source_id': source_id,
        })

    def list(self):
        """
        Returns the identifiers of the metadata sources currently registered
        with the infrastructure.


        :rtype: :class:`list` of :class:`str`
        :return: The list of identifiers for metadata sources currently registered.
            The return value will contain identifiers for the resource type:
            ``com.vmware.vapi.metadata.privilege.source``.
        """
        return self._invoke('list', None)

    def reload(
        self,
        source_id=None,
    ):
        """
        Reloads the privilege metadata from all the metadata sources or of a
        particular metadata source if ``source_id`` is specified.

        :type  source_id: :class:`str` or ``None``
        :param source_id: Identifier of the metadata source.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vapi.metadata.privilege.source``.
            If unspecified, all the metadata sources are reloaded.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the metadata source associated with ``source_id`` is not found.
        """
        return self._invoke('reload', {
            'source_id': source_id,
        })

    def fingerprint(
        self,
        source_id=None,
    ):
        """
        Returns the aggregate fingerprint of metadata from all the metadata
        sources or from a particular metadata source if ``source_id`` is
        specified.

        :type  source_id: :class:`str` or ``None``
        :param source_id: Identifier of the metadata source.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vapi.metadata.privilege.source``.
            If unspecified, the fingerprint of all the metadata sources is
            returned.
        :rtype: :class:`str`
        :return: Aggregate fingerprint of all the metadata sources or of a
            particular metadata source.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the metadata source associated with ``source_id`` is not found.
        """
        return self._invoke('fingerprint', {
            'source_id': source_id,
        })
Esempio n. 5
0
class Service(VapiInterface):
    """
    The ``Service`` class provides methods to manage a single/set of services
    that are managed by vMon.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _ServiceStub)

    class StartupType(Enum):
        """
        The ``Service.StartupType`` class defines valid Startup Type for services
        managed by vMon.

        .. 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>`.
        """
        MANUAL = None
        """
        Service Startup type is Manual, thus issuing an explicit start on the
        service will start it.

        """
        AUTOMATIC = None
        """
        Service Startup type is Automatic, thus during starting all services or
        issuing explicit start on the service will start it.

        """
        DISABLED = None
        """
        Service Startup type is Disabled, thus it will not start unless the startup
        type changes to manual or automatic.

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

    StartupType._set_values([
        StartupType('MANUAL'),
        StartupType('AUTOMATIC'),
        StartupType('DISABLED'),
    ])
    StartupType._set_binding_type(
        type.EnumType('com.vmware.appliance.vmon.service.startup_type',
                      StartupType))

    class State(Enum):
        """
        The ``Service.State`` class defines valid Run State for services.

        .. 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>`.
        """
        STARTING = None
        """
        Service Run State is Starting, it is still not functional

        """
        STOPPING = None
        """
        Service Run State is Stopping, it is not functional

        """
        STARTED = None
        """
        Service Run State is Started, it is fully functional

        """
        STOPPED = None
        """
        Service Run State is Stopped

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

    State._set_values([
        State('STARTING'),
        State('STOPPING'),
        State('STARTED'),
        State('STOPPED'),
    ])
    State._set_binding_type(
        type.EnumType('com.vmware.appliance.vmon.service.state', State))

    class Health(Enum):
        """
        The ``Service.Health`` class defines the possible values for health of a
        service.

        .. 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>`.
        """
        DEGRADED = None
        """
        Service is in degraded state, it is not functional.

        """
        HEALTHY = None
        """
        Service is in a healthy state and is fully functional.

        """
        HEALTHY_WITH_WARNINGS = None
        """
        Service is healthy with warnings.

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

    Health._set_values([
        Health('DEGRADED'),
        Health('HEALTHY'),
        Health('HEALTHY_WITH_WARNINGS'),
    ])
    Health._set_binding_type(
        type.EnumType('com.vmware.appliance.vmon.service.health', Health))

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

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

        _validator_list = [
            UnionValidator(
                'state', {
                    'STARTED': [('health', True), ('health_messages', True)],
                    'STARTING': [],
                    'STOPPING': [],
                    'STOPPED': [],
                }),
        ]

        def __init__(
            self,
            name_key=None,
            description_key=None,
            startup_type=None,
            state=None,
            health=None,
            health_messages=None,
        ):
            """
            :type  name_key: :class:`str`
            :param name_key: Service name key. Can be used to lookup resource bundle
            :type  description_key: :class:`str`
            :param description_key: Service description key. Can be used to lookup resource bundle
            :type  startup_type: :class:`Service.StartupType`
            :param startup_type: Startup Type.
            :type  state: :class:`Service.State`
            :param state: Running State.
            :type  health: :class:`Service.Health`
            :param health: Health of service.
                This attribute is optional and it is only relevant when the value
                of ``state`` is :attr:`Service.State.STARTED`.
            :type  health_messages: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param health_messages: Localizable messages associated with the health of the service
                This attribute is optional and it is only relevant when the value
                of ``state`` is :attr:`Service.State.STARTED`.
            """
            self.name_key = name_key
            self.description_key = description_key
            self.startup_type = startup_type
            self.state = state
            self.health = health
            self.health_messages = health_messages
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.appliance.vmon.service.info', {
                'name_key':
                type.StringType(),
                'description_key':
                type.StringType(),
                'startup_type':
                type.ReferenceType(sys.modules[__name__],
                                   'Service.StartupType'),
                'state':
                type.ReferenceType(sys.modules[__name__], 'Service.State'),
                'health':
                type.OptionalType(
                    type.ReferenceType(sys.modules[__name__],
                                       'Service.Health')),
                'health_messages':
                type.OptionalType(
                    type.ListType(
                        type.ReferenceType(com.vmware.vapi.std_client,
                                           'LocalizableMessage'))),
            }, Info, False, None))

    class UpdateSpec(VapiStruct):
        """
        The ``Service.UpdateSpec`` class describes the changes to be made to the
        configuration of the service.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            startup_type=None,
        ):
            """
            :type  startup_type: :class:`Service.StartupType` or ``None``
            :param startup_type: Startup Type
                If unspecified, leaves value unchanged.
            """
            self.startup_type = startup_type
            VapiStruct.__init__(self)

    UpdateSpec._set_binding_type(
        type.StructType(
            'com.vmware.appliance.vmon.service.update_spec', {
                'startup_type':
                type.OptionalType(
                    type.ReferenceType(sys.modules[__name__],
                                       'Service.StartupType')),
            }, UpdateSpec, False, None))

    def start(
        self,
        service,
    ):
        """
        Starts a service

        :type  service: :class:`str`
        :param service: identifier of the service to start
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.vmon.Service``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the service associated with ``service`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the operation is denied in the current state of the service. If
            a stop or restart operation is in progress, the start operation
            will not be allowed.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if start operation is issued on a service which has startup type
            :attr:`Service.StartupType.DISABLED`.
        :raise: :class:`com.vmware.vapi.std.errors_client.TimedOut` 
            if any timeout occurs during the execution of the start operation.
            Timeout occurs when the service takes longer than StartTimeout to
            start.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any other error occurs during the execution of the operation.
        """
        return self._invoke('start', {
            'service': service,
        })

    def stop(
        self,
        service,
    ):
        """
        Stops a service

        :type  service: :class:`str`
        :param service: identifier of the service to stop
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.vmon.Service``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the service associated with ``service`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any other error occurs during the execution of the operation.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the operation is denied in the current state of the service. If
            a stop operation is in progress, issuing another stop operation
            will lead to this error.
        """
        return self._invoke('stop', {
            'service': service,
        })

    def restart(
        self,
        service,
    ):
        """
        Restarts a service

        :type  service: :class:`str`
        :param service: identifier of the service to restart
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.vmon.Service``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the service associated with ``service`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.TimedOut` 
            if any timeout occurs during the execution of the restart
            operation.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the operation is denied in the current state of the service. If
            a stop or start operation is in progress, issuing a restart
            operation will lead to this error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if a restart operation is issued on a service which has startup
            type :attr:`Service.StartupType.DISABLED`
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any other error occurs during the execution of the operation.
        """
        return self._invoke('restart', {
            'service': service,
        })

    def get(
        self,
        service,
    ):
        """
        Returns the state of a service.

        :type  service: :class:`str`
        :param service: identifier of the service whose state is being queried.
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.vmon.Service``.
        :rtype: :class:`Service.Info`
        :return: Service Info structure.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the service associated with ``service`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any other error occurs during the execution of the operation.
        """
        return self._invoke('get', {
            'service': service,
        })

    def update(
        self,
        service,
        spec,
    ):
        """
        Updates the properties of a service.

        :type  service: :class:`str`
        :param service: identifier of the service whose properties are being updated.
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.vmon.Service``.
        :type  spec: :class:`Service.UpdateSpec`
        :param spec: Service Update specification.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the service associated with ``service`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any other error occurs during the execution of the operation.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the operation is denied in the current state of the service. If
            a start, stop or restart operation is in progress, update operation
            will fail with this error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if a request to set the :attr:`Service.UpdateSpec.startup_type`
            attribute of ``spec`` to :attr:`Service.StartupType.DISABLED` comes
            in for a service that is not in :attr:`Service.State.STOPPED`
            state.
        """
        return self._invoke('update', {
            'service': service,
            'spec': spec,
        })

    def list_details(self):
        """
        Lists details of services managed by vMon.


        :rtype: :class:`dict` of :class:`str` and :class:`Service.Info`
        :return: Map of service identifiers to service Info structures.
            The key in the return value :class:`dict` will be an identifier for
            the resource type: ``com.vmware.appliance.vmon.Service``.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any error occurs during the execution of the operation.
        """
        return self._invoke('list_details', None)
Esempio n. 6
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'org': type.StringType(),
                'sddc': type.StringType(),
                'version_source': type.OptionalType(type.StringType()),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
            '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/draas/api/orgs/{org}/sddcs/{sddc}/site-recovery/versions',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
            },
            query_parameters={
                'version_source': 'version_source',
            },
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.vmc.draas.model_client',
                                   'SiteRecoveryVersions'),
                '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.draas.site_recovery_versions',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Esempio n. 7
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'domain_id': type.StringType(),
                'security_policy_id': type.StringType(),
                'rule_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/infra/domains/{domain-id}/security-policies/{security-policy-id}/rules/{rule-id}/statistics',
            path_variables={
                'domain_id': 'domain-id',
                'security_policy_id': 'security-policy-id',
                'rule_id': 'rule-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',
                                   'RuleStatisticsListResult'),
                '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.infra.domains.security_policies.rules.statistics',
            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', {
                'org': type.StringType(),
                'sddc': type.StringType(),
                'edge_id': type.StringType(),
                'interval': type.OptionalType(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}/statistics/dashboard/ipsec',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
                'edge_id': 'edgeId',
            },
            query_parameters={
                'interval': 'interval',
            },
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.vmc.model_client',
                                   'DashboardStatistics'),
                '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.statistics.dashboard.ipsec',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
        SchemeType('SESSIONLESS'),
        SchemeType('SESSION_AWARE'),
    ])
    SchemeType._set_binding_type(
        type.EnumType(
            'com.vmware.vapi.metadata.authentication.authentication_info.scheme_type',
            SchemeType))


AuthenticationInfo._set_binding_type(
    type.StructType(
        'com.vmware.vapi.metadata.authentication.authentication_info', {
            'scheme_type':
            type.ReferenceType(__name__, 'AuthenticationInfo.SchemeType'),
            'session_manager':
            type.OptionalType(type.StringType()),
            'scheme':
            type.StringType(),
        }, AuthenticationInfo, False, None))


class ComponentData(VapiStruct):
    """
    The ``ComponentData`` class contains the authentication information of the
    component along with its fingerprint.

    .. tip::
        The arguments are used to initialize data attributes with the same
        names.
    """
    def __init__(
Esempio n. 10
0
class User(VapiInterface):
    """
    ``User`` class provides methods Perform operations on local user account.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _UserStub)

    class UserAccountStatus(Enum):
        """
        ``User.UserAccountStatus`` class Defines status of user accounts

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

        """
        enabled = None
        """
        The user account is enabled.

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

    UserAccountStatus._set_values([
        UserAccountStatus('disabled'),
        UserAccountStatus('enabled'),
    ])
    UserAccountStatus._set_binding_type(
        type.EnumType(
            'com.vmware.appliance.techpreview.localaccounts.user.user_account_status',
            UserAccountStatus))

    class UserPasswordStatus(Enum):
        """
        ``User.UserPasswordStatus`` class Defines state of user password

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

        """
        expired = None
        """
        The password has expired.

        """
        valid = None
        """
        The password is still valid.

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

    UserPasswordStatus._set_values([
        UserPasswordStatus('notset'),
        UserPasswordStatus('expired'),
        UserPasswordStatus('valid'),
    ])
    UserPasswordStatus._set_binding_type(
        type.EnumType(
            'com.vmware.appliance.techpreview.localaccounts.user.user_password_status',
            UserPasswordStatus))

    class UserRole(Enum):
        """
        ``User.UserRole`` class Defines user roles for appliance

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

        """
        operator = None
        """
        Able to read the appliance configuration.

        """
        superAdmin = None
        """
        Able to configure the appliance, manage local accounts and use the BASH
        shell

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

    UserRole._set_values([
        UserRole('admin'),
        UserRole('operator'),
        UserRole('superAdmin'),
    ])
    UserRole._set_binding_type(
        type.EnumType(
            'com.vmware.appliance.techpreview.localaccounts.user.user_role',
            UserRole))

    class UserConfigGet(VapiStruct):
        """
        ``User.UserConfigGet`` class Structure defines a user configuration for
        user.get API.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            username=None,
            role=None,
            fullname=None,
            status=None,
            passwordstatus=None,
            email=None,
        ):
            """
            :type  username: :class:`str`
            :param username: User login name
            :type  role: :class:`User.UserRole`
            :param role: User roles
            :type  fullname: :class:`str`
            :param fullname: User full name
            :type  status: :class:`User.UserAccountStatus`
            :param status: Shows whether the user account is enabled or disabled.
            :type  passwordstatus: :class:`User.UserPasswordStatus`
            :param passwordstatus: Shows whether the user account is still valid or expired.
            :type  email: :class:`str`
            :param email: Email address of the local account.
            """
            self.username = username
            self.role = role
            self.fullname = fullname
            self.status = status
            self.passwordstatus = passwordstatus
            self.email = email
            VapiStruct.__init__(self)

    UserConfigGet._set_binding_type(
        type.StructType(
            'com.vmware.appliance.techpreview.localaccounts.user.user_config_get',
            {
                'username':
                type.StringType(),
                'role':
                type.ReferenceType(sys.modules[__name__], 'User.UserRole'),
                'fullname':
                type.StringType(),
                'status':
                type.ReferenceType(sys.modules[__name__],
                                   'User.UserAccountStatus'),
                'passwordstatus':
                type.ReferenceType(sys.modules[__name__],
                                   'User.UserPasswordStatus'),
                'email':
                type.StringType(),
            }, UserConfigGet, False, None))

    class UserConfig(VapiStruct):
        """
        ``User.UserConfig`` class Structure that defines a new user configuration
        for CLI.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            username=None,
            role=None,
            fullname=None,
            status=None,
            email=None,
        ):
            """
            :type  username: :class:`str`
            :param username: User login name
            :type  role: :class:`User.UserRole`
            :param role: User roles
            :type  fullname: :class:`str`
            :param fullname: User full name
            :type  status: :class:`User.UserAccountStatus`
            :param status: Enabled status of the local account
            :type  email: :class:`str`
            :param email: email of the local account
            """
            self.username = username
            self.role = role
            self.fullname = fullname
            self.status = status
            self.email = email
            VapiStruct.__init__(self)

    UserConfig._set_binding_type(
        type.StructType(
            'com.vmware.appliance.techpreview.localaccounts.user.user_config',
            {
                'username':
                type.StringType(),
                'role':
                type.ReferenceType(sys.modules[__name__], 'User.UserRole'),
                'fullname':
                type.StringType(),
                'status':
                type.ReferenceType(sys.modules[__name__],
                                   'User.UserAccountStatus'),
                'email':
                type.StringType(),
            }, UserConfig, False, None))

    class NewUserConfig(VapiStruct):
        """
        ``User.NewUserConfig`` class Structure that defines a new user
        configuration.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            username=None,
            role=None,
            password=None,
            fullname=None,
            email=None,
        ):
            """
            :type  username: :class:`str`
            :param username: User login name
            :type  role: :class:`User.UserRole` or ``None``
            :param role: User roles. The default role is operator.
                role Default role is operator
            :type  password: :class:`str`
            :param password: User login password In Interactive mode, provide --password as part
                of the command, and enter the value on the prompt. When accessed
                remotely, provide --password value as part the command.
            :type  fullname: :class:`str` or ``None``
            :param fullname: User full name
                fullname Optional full name for a person
            :type  email: :class:`str` or ``None``
            :param email: Email address of the local account.
                email Optional email
            """
            self.username = username
            self.role = role
            self.password = password
            self.fullname = fullname
            self.email = email
            VapiStruct.__init__(self)

    NewUserConfig._set_binding_type(
        type.StructType(
            'com.vmware.appliance.techpreview.localaccounts.user.new_user_config',
            {
                'username':
                type.StringType(),
                'role':
                type.OptionalType(
                    type.ReferenceType(sys.modules[__name__],
                                       'User.UserRole')),
                'password':
                type.SecretType(),
                'fullname':
                type.OptionalType(type.StringType()),
                'email':
                type.OptionalType(type.StringType()),
            }, NewUserConfig, False, None))

    def delete(
        self,
        username,
    ):
        """
        Delete a local user account.

        :type  username: :class:`str`
        :param username: User login name.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('delete', {
            'username': username,
        })

    def add(
        self,
        config,
    ):
        """
        Create a new local user account.

        :type  config: :class:`User.NewUserConfig`
        :param config: User configuration.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('add', {
            'config': config,
        })

    def set(
        self,
        config,
    ):
        """
        Update local user account properties role, full name, enabled status
        and password

        :type  config: :class:`User.UserConfig`
        :param config: User configuration.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('set', {
            'config': config,
        })

    def list(self):
        """
        List of local accounts


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

    def get(
        self,
        username,
    ):
        """
        Get the local user account information.

        :type  username: :class:`str`
        :param username: User login name.
        :rtype: :class:`User.UserConfigGet`
        :return: local user account information
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('get', {
            'username': username,
        })
Esempio n. 11
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'tier0_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/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/statistics',
            path_variables={
                'tier0_id': 'tier-0-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 = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'AggregateL2VPNSessionStatistics'),
                '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.global_infra.tier_0s.locale_services.l2vpn_services.sessions.statistics',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Esempio n. 12
0
        self.user = user
        self.groups = groups
        VapiStruct.__init__(self)


InvocationRequest._set_binding_type(
    type.StructType(
        'com.vmware.vapi.std.interposition.invocation_request', {
            'service_id':
            type.StringType(),
            'operation_id':
            type.StringType(),
            'operation_input':
            type.OpaqueType(),
            'user':
            type.OptionalType(type.ReferenceType(__name__,
                                                 'SecurityPrincipal')),
            'groups':
            type.ListType(type.ReferenceType(__name__, 'SecurityPrincipal')),
        }, InvocationRequest, False, None))


class InvocationResult(VapiStruct):
    """
    Information about the result from an interposed operation invocation. All
    POST interposers will receive an instance of this structure.

    .. tip::
        The arguments are used to initialize data attributes with the same
        names.
    """
Esempio n. 13
0
    def __init__(self, config):
        # properties for create operation
        create_input_type = type.StructType('operation-input', {
            'l2_vpn_session': type.ReferenceType('com.vmware.nsx.model_client', 'L2VpnSession'),
        })
        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='/api/v1/vpn/l2vpn/sessions',
            request_body_parameter='l2_vpn_session',
            path_variables={
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for delete operation
        delete_input_type = type.StructType('operation-input', {
            'l2vpn_session_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='/api/v1/vpn/l2vpn/sessions/{l2vpn-session-id}',
            path_variables={
                'l2vpn_session_id': 'l2vpn-session-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'l2vpn_session_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 = [
        ]
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/api/v1/vpn/l2vpn/sessions/{l2vpn-session-id}',
            path_variables={
                'l2vpn_session_id': 'l2vpn-session-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'cursor': type.OptionalType(type.StringType()),
            'included_fields': type.OptionalType(type.StringType()),
            'l2vpn_service_id': 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='/api/v1/vpn/l2vpn/sessions',
            path_variables={
            },
            query_parameters={
                'cursor': 'cursor',
                'included_fields': 'included_fields',
                'l2vpn_service_id': 'l2vpn_service_id',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            },
            content_type='application/json'
        )

        # properties for update operation
        update_input_type = type.StructType('operation-input', {
            'l2vpn_session_id': type.StringType(),
            'l2_vpn_session': type.ReferenceType('com.vmware.nsx.model_client', 'L2VpnSession'),
        })
        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/vpn/l2vpn/sessions/{l2vpn-session-id}',
            request_body_parameter='l2_vpn_session',
            path_variables={
                'l2vpn_session_id': 'l2vpn-session-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        operations = {
            'create': {
                'input_type': create_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'L2VpnSession'),
                '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.nsx.model_client', 'L2VpnSession'),
                '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', 'L2VpnSessionListResult'),
                'errors': list_error_dict,
                'input_value_validator_list': list_input_value_validator_list,
                'output_validator_list': list_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'update': {
                'input_type': update_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'L2VpnSession'),
                '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,
            'list': list_rest_metadata,
            'update': update_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.nsx.vpn.l2vpn.sessions',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=False)
Esempio n. 14
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'enforcement_point_name': type.StringType(),
                'firewall_section_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 = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/policy/api/v1/infra/realized-state/enforcement-points/{enforcement-point-name}/firewalls/firewall-sections/{firewall-section-id}',
            path_variables={
                'enforcement_point_name': 'enforcement-point-name',
                'firewall_section_id': 'firewall-section-id',
            },
            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}/firewalls/firewall-sections',
            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',
                                   'RealizedFirewallSection'),
                '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',
                                   'RealizedFirewallSectionListResult'),
                '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.firewalls.firewall_sections',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Esempio n. 15
0
    def __init__(self, config):
        # properties for createwithpeercode operation
        createwithpeercode_input_type = type.StructType('operation-input', {
            'tier0_id': type.StringType(),
            'locale_service_id': type.StringType(),
            'service_id': type.StringType(),
            'session_id': type.StringType(),
            'l2_VPN_session_data': type.ReferenceType('com.vmware.nsx_policy.model_client', 'L2VPNSessionData'),
        })
        createwithpeercode_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'),

        }
        createwithpeercode_input_value_validator_list = [
        ]
        createwithpeercode_output_validator_list = [
        ]
        createwithpeercode_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/policy/api/v1/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}?action=create_with_peer_code',
            request_body_parameter='l2_VPN_session_data',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-service-id',
                'service_id': 'service-id',
                'session_id': 'session-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for delete operation
        delete_input_type = type.StructType('operation-input', {
            'tier0_id': type.StringType(),
            'locale_service_id': type.StringType(),
            'service_id': type.StringType(),
            'session_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/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-service-id',
                'service_id': 'service-id',
                'session_id': 'session-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'tier0_id': type.StringType(),
            'locale_service_id': type.StringType(),
            'service_id': type.StringType(),
            'session_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/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-service-id',
                'service_id': 'service-id',
                'session_id': 'session-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'tier0_id': type.StringType(),
            'locale_service_id': type.StringType(),
            'service_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/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-service-id',
                'service_id': 'service-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', {
            'tier0_id': type.StringType(),
            'locale_service_id': type.StringType(),
            'service_id': type.StringType(),
            'session_id': type.StringType(),
            'l2_VPN_session': type.ReferenceType('com.vmware.nsx_policy.model_client', 'L2VPNSession'),
        })
        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/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}',
            request_body_parameter='l2_VPN_session',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-service-id',
                'service_id': 'service-id',
                'session_id': 'session-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for update operation
        update_input_type = type.StructType('operation-input', {
            'tier0_id': type.StringType(),
            'locale_service_id': type.StringType(),
            'service_id': type.StringType(),
            'session_id': type.StringType(),
            'l2_VPN_session': type.ReferenceType('com.vmware.nsx_policy.model_client', 'L2VPNSession'),
        })
        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/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}',
            request_body_parameter='l2_VPN_session',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-service-id',
                'service_id': 'service-id',
                'session_id': 'session-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        operations = {
            'createwithpeercode': {
                'input_type': createwithpeercode_input_type,
                'output_type': type.VoidType(),
                'errors': createwithpeercode_error_dict,
                'input_value_validator_list': createwithpeercode_input_value_validator_list,
                'output_validator_list': createwithpeercode_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.nsx_policy.model_client', 'L2VPNSession'),
                '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', 'L2VPNSessionListResult'),
                '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.ReferenceType('com.vmware.nsx_policy.model_client', 'L2VPNSession'),
                '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 = {
            'createwithpeercode': createwithpeercode_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.tier_0s.locale_services.l2vpn_services.sessions',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=False)
Esempio n. 16
0
    def __init__(self, config):
        # properties for create operation
        create_input_type = type.StructType('operation-input', {
            'view_id': type.StringType(),
            'widget_configuration': type.DynamicStructType('vmware.vapi.dynamic_struct', {}, VapiStruct, [type.ReferenceType('com.vmware.nsx.model_client', 'WidgetConfiguration')]),
        })
        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 = [
            HasFieldsOfValidator()
        ]
        create_output_validator_list = [
            HasFieldsOfValidator()
        ]
        create_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/api/v1/ui-views/{view-id}/widgetconfigurations',
            request_body_parameter='widget_configuration',
            path_variables={
                'view_id': 'view-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for delete operation
        delete_input_type = type.StructType('operation-input', {
            'view_id': type.StringType(),
            'widgetconfiguration_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='/api/v1/ui-views/{view-id}/widgetconfigurations/{widgetconfiguration-id}',
            path_variables={
                'view_id': 'view-id',
                'widgetconfiguration_id': 'widgetconfiguration-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'view_id': type.StringType(),
            'container': type.OptionalType(type.StringType()),
            'widget_ids': 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='/api/v1/ui-views/{view-id}/widgetconfigurations',
            path_variables={
                'view_id': 'view-id',
            },
            query_parameters={
                'container': 'container',
                'widget_ids': 'widget_ids',
            },
            content_type='application/json'
        )

        # properties for get_0 operation
        get_0_input_type = type.StructType('operation-input', {
            'view_id': type.StringType(),
            'widgetconfiguration_id': type.StringType(),
        })
        get_0_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_0_input_value_validator_list = [
        ]
        get_0_output_validator_list = [
            HasFieldsOfValidator()
        ]
        get_0_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/api/v1/ui-views/{view-id}/widgetconfigurations/{widgetconfiguration-id}',
            path_variables={
                'view_id': 'view-id',
                'widgetconfiguration_id': 'widgetconfiguration-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for update operation
        update_input_type = type.StructType('operation-input', {
            'view_id': type.StringType(),
            'widgetconfiguration_id': type.StringType(),
            'widget_configuration': type.DynamicStructType('vmware.vapi.dynamic_struct', {}, VapiStruct, [type.ReferenceType('com.vmware.nsx.model_client', 'WidgetConfiguration')]),
        })
        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='/api/v1/ui-views/{view-id}/widgetconfigurations/{widgetconfiguration-id}',
            request_body_parameter='widget_configuration',
            path_variables={
                'view_id': 'view-id',
                'widgetconfiguration_id': 'widgetconfiguration-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        operations = {
            'create': {
                'input_type': create_input_type,
                'output_type': type.DynamicStructType('vmware.vapi.dynamic_struct', {}, VapiStruct, [type.ReferenceType('com.vmware.nsx.model_client', 'WidgetConfiguration')]),
                '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.nsx.model_client', 'WidgetConfigurationList'),
                'errors': get_error_dict,
                'input_value_validator_list': get_input_value_validator_list,
                'output_validator_list': get_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get_0': {
                'input_type': get_0_input_type,
                'output_type': type.DynamicStructType('vmware.vapi.dynamic_struct', {}, VapiStruct, [type.ReferenceType('com.vmware.nsx.model_client', 'WidgetConfiguration')]),
                'errors': get_0_error_dict,
                'input_value_validator_list': get_0_input_value_validator_list,
                'output_validator_list': get_0_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.model_client', 'WidgetConfiguration')]),
                '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,
            'get_0': get_0_rest_metadata,
            'update': update_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.nsx.ui_views.widgetconfigurations',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=False)
Esempio n. 17
0
    def __init__(self, config):
        # properties for delete operation
        delete_input_type = type.StructType(
            'operation-input', {
                'org': type.StringType(),
                'sddc': type.StringType(),
                'srm_node': type.StringType(),
            })
        delete_error_dict = {
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
            '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/draas/api/orgs/{org}/sddcs/{sddc}/site-recovery/srm-nodes/{srmNode}',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
                'srm_node': 'srmNode',
            },
            query_parameters={},
            content_type='application/json')

        # properties for post operation
        post_input_type = type.StructType(
            'operation-input', {
                'org':
                type.StringType(),
                'sddc':
                type.StringType(),
                'provision_srm_config':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vmc.draas.model_client',
                                       'ProvisionSrmConfig')),
            })
        post_error_dict = {
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
            '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'),
        }
        post_input_value_validator_list = []
        post_output_validator_list = []
        post_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template=
            '/vmc/draas/api/orgs/{org}/sddcs/{sddc}/site-recovery/srm-nodes',
            request_body_parameter='provision_srm_config',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
            },
            query_parameters={},
            content_type='application/json')

        operations = {
            'delete': {
                'input_type':
                delete_input_type,
                'output_type':
                type.ReferenceType('com.vmware.vmc.draas.model_client',
                                   'Task'),
                'errors':
                delete_error_dict,
                'input_value_validator_list':
                delete_input_value_validator_list,
                'output_validator_list':
                delete_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'post': {
                'input_type':
                post_input_type,
                'output_type':
                type.ReferenceType('com.vmware.vmc.draas.model_client',
                                   'Task'),
                'errors':
                post_error_dict,
                'input_value_validator_list':
                post_input_value_validator_list,
                'output_validator_list':
                post_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'delete': delete_rest_metadata,
            'post': post_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vmc.draas.site_recovery_srm_nodes',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Esempio n. 18
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'template_id': type.StringType(),
                'compute_collection_id': type.OptionalType(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=
            '/api/v1/compute-collection-transport-node-templates/{template-id}/state',
            path_variables={
                'template_id': 'template-id',
            },
            query_parameters={
                'compute_collection_id': 'compute_collection_id',
                'cursor': 'cursor',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            },
            content_type='application/json')

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ReferenceType(
                    'com.vmware.nsx.model_client',
                    'ComputeCollectionTransportNodeTemplateStateList'),
                '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.compute_collection_transport_node_templates.state',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
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,
        })
    def __init__(self, config):
        # properties for create operation
        create_input_type = type.StructType(
            'operation-input', {
                'org':
                type.StringType(),
                'sddc':
                type.StringType(),
                'esx_config':
                type.ReferenceType('com.vmware.vmc.model_client', 'EsxConfig'),
                'action':
                type.OptionalType(type.StringType()),
            })
        create_error_dict = {
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
            '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}/esxs',
            request_body_parameter='esx_config',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
            },
            query_parameters={
                'action': 'action',
            },
            content_type='application/json')

        operations = {
            'create': {
                'input_type':
                create_input_type,
                'output_type':
                type.ReferenceType('com.vmware.vmc.model_client', 'Task'),
                'errors':
                create_error_dict,
                'input_value_validator_list':
                create_input_value_validator_list,
                'output_validator_list':
                create_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'create': create_rest_metadata,
        }
        ApiInterfaceStub.__init__(self,
                                  iface_name='com.vmware.vmc.orgs.sddcs.esxs',
                                  config=config,
                                  operations=operations,
                                  rest_metadata=rest_metadata,
                                  is_vapi_rest=False)
Esempio n. 21
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'version_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/infra/settings/firewall/security/intrusion-services/signature-versions/{version-id}/signatures',
            path_variables={
                'version_id': 'version-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')

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'IdsSignatureListResult'),
                '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.infra.settings.firewall.security.intrusion_services.signature_versions.signatures',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Esempio n. 22
0
class Job(VapiInterface):
    """
    The ``Job`` class provides methods to create and get the status of
    reconciliation job. This class was added in vSphere API 6.7.
    """

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

    class Status(Enum):
        """
        The ``Job.Status`` class defines the status values that can be reported for
        an operation. This enumeration was added in vSphere API 6.7.

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

        """
        RUNNING = None
        """
        The operation is in progress. This class attribute was added in vSphere API
        6.7.

        """
        SUCCEEDED = None
        """
        The operation completed successfully. This class attribute was added in
        vSphere API 6.7.

        """
        FAILED = None
        """
        The operation failed. This class attribute was added in vSphere API 6.7.

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

    Status._set_values([
        Status('NONE'),
        Status('RUNNING'),
        Status('SUCCEEDED'),
        Status('FAILED'),
    ])
    Status._set_binding_type(
        type.EnumType(
            'com.vmware.appliance.recovery.reconciliation.job.status', Status))

    class CreateSpec(VapiStruct):
        """
        The ``Job.CreateSpec`` class has the fields to request the start of
        reconciliation job. This class was added in vSphere API 6.7.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            sso_admin_user_name=None,
            sso_admin_user_password=None,
            ignore_warnings=None,
        ):
            """
            :type  sso_admin_user_name: :class:`str` or ``None``
            :param sso_admin_user_name: Administrators username for SSO. This attribute was added in
                vSphere API 6.7.
                If None SSO authentication will not be used. If the vCenter Server
                is a management node or an embedded node, authentication is
                required.
            :type  sso_admin_user_password: :class:`str` or ``None``
            :param sso_admin_user_password: Password for SSO admin user. This attribute was added in vSphere
                API 6.7.
                If None SSO authentication will not be used. If the vCenter Server
                is a management node or an embedded node, authentication is
                required.
            :type  ignore_warnings: :class:`bool` or ``None``
            :param ignore_warnings: Flag indicating whether warnings should be ignored during
                reconciliation. This attribute was added in vSphere API 6.7.
                If None, validation warnings will fail the reconciliation
                operation.
            """
            self.sso_admin_user_name = sso_admin_user_name
            self.sso_admin_user_password = sso_admin_user_password
            self.ignore_warnings = ignore_warnings
            VapiStruct.__init__(self)

    CreateSpec._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.reconciliation.job.create_spec', {
                'sso_admin_user_name': type.OptionalType(type.StringType()),
                'sso_admin_user_password': type.OptionalType(
                    type.SecretType()),
                'ignore_warnings': type.OptionalType(type.BooleanType()),
            }, CreateSpec, False, None))

    class Info(VapiStruct):
        """
        The ``Job.Info`` class represents the reconciliation job information. It
        contains information related to current Status, any associated messages and
        progress as percentage. This class was added in vSphere API 6.7.

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

        _validator_list = [
            UnionValidator(
                'status', {
                    'FAILED': [('error', False), ('start_time', True),
                               ('end_time', True)],
                    'RUNNING': [('start_time', True)],
                    'SUCCEEDED': [('start_time', True), ('end_time', True)],
                    'NONE': [],
                }),
        ]

        def __init__(
            self,
            description=None,
            service=None,
            operation=None,
            parent=None,
            target=None,
            status=None,
            cancelable=None,
            error=None,
            start_time=None,
            end_time=None,
            messages=None,
            progress=None,
        ):
            """
            :type  description: :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param description: Description of the operation associated with the task. This
                attribute was added in vSphere API 6.7.
            :type  service: :class:`str`
            :param service: Name of the service containing the operation. This attribute was
                added in vSphere API 6.7.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.appliance.recovery.reconciliation.job``. When methods
                return a value of this class as a return value, the attribute will
                be an identifier for the resource type:
                ``com.vmware.appliance.recovery.reconciliation.job``.
            :type  operation: :class:`str`
            :param operation: Name of the operation associated with the task. This attribute was
                added in vSphere API 6.7.
            :type  parent: :class:`str` or ``None``
            :param parent: Parent of the current task. This attribute was added in vSphere API
                6.7.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.appliance.recovery.reconciliation.job``. When methods
                return a value of this class as a return value, the attribute will
                be an identifier for the resource type:
                ``com.vmware.appliance.recovery.reconciliation.job``.
                This attribute will be None if the task has no parent.
            :type  target: :class:`com.vmware.vapi.std_client.DynamicID` or ``None``
            :param target: Identifier of the target resource the operation modifies. This
                attribute was added in vSphere API 6.7.
                This attribute will be None if the task has multiple targets or no
                target.
            :type  status: :class:`Job.Status`
            :param status: Status of the operation associated with the task. This attribute
                was added in vSphere API 6.7.
            :type  cancelable: :class:`bool` or ``None``
            :param cancelable: Flag to indicate whether or not the operation can be cancelled. The
                value may change as the operation progresses. This attribute was
                added in vSphere API 6.7.
                If None, the operation cannot be canceled.
            :type  error: :class:`Exception` or ``None``
            :param error: Description of the error if the operation status is "FAILED". This
                attribute was added in vSphere API 6.7.
                If None the description of why the operation failed will be
                included in the result of the operation (see null).
            :type  start_time: :class:`datetime.datetime`
            :param start_time: Time when the operation is started. This attribute was added in
                vSphere API 6.7.
                This attribute is optional and it is only relevant when the value
                of ``status`` is one of :attr:`Job.Status.RUNNING`,
                :attr:`Job.Status.SUCCEEDED`, or :attr:`Job.Status.FAILED`.
            :type  end_time: :class:`datetime.datetime`
            :param end_time: Time when the operation is completed. This attribute was added in
                vSphere API 6.7.
                This attribute is optional and it is only relevant when the value
                of ``status`` is one of :attr:`Job.Status.SUCCEEDED` or
                :attr:`Job.Status.FAILED`.
            :type  messages: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param messages: A list of localized messages. This attribute was added in vSphere
                API 6.7.
            :type  progress: :class:`long`
            :param progress: The progress of the job as a percentage. This attribute was added
                in vSphere API 6.7.
            """
            self.description = description
            self.service = service
            self.operation = operation
            self.parent = parent
            self.target = target
            self.status = status
            self.cancelable = cancelable
            self.error = error
            self.start_time = start_time
            self.end_time = end_time
            self.messages = messages
            self.progress = progress
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.appliance.recovery.reconciliation.job.info', {
                'description':
                type.ReferenceType('com.vmware.vapi.std_client',
                                   'LocalizableMessage'),
                'service':
                type.IdType(
                    resource_types=
                    'com.vmware.appliance.recovery.reconciliation.job'),
                'operation':
                type.StringType(),
                'parent':
                type.OptionalType(type.IdType()),
                'target':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'DynamicID')),
                'status':
                type.ReferenceType(__name__, 'Job.Status'),
                'cancelable':
                type.OptionalType(type.BooleanType()),
                'error':
                type.OptionalType(type.AnyErrorType()),
                'start_time':
                type.OptionalType(type.DateTimeType()),
                'end_time':
                type.OptionalType(type.DateTimeType()),
                'messages':
                type.ListType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
                'progress':
                type.IntegerType(),
            }, Info, False, None))

    def create(
        self,
        spec,
    ):
        """
        Initiate reconciliation. This method was added in vSphere API 6.7.

        :type  spec: :class:`Job.CreateSpec`
        :param spec: CreateSpec Structure
        :rtype: :class:`Job.Info`
        :return: Info Structure
        :raise: :class:`com.vmware.vapi.std.errors_client.FeatureInUse` 
            A backup or restore is already in progress.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            Reconciliation is allowed only after restore has finished
            successfully.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any error occurs during the execution of the operation.
        """
        return self._invoke('create', {
            'spec': spec,
        })

    def get(self):
        """
        Get reconciliation job progress/result. This method was added in
        vSphere API 6.7.


        :rtype: :class:`Job.Info`
        :return: Info Structure
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if there is no running reconciliation job.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any error occurs during the execution of the operation.
        """
        return self._invoke('get', None)
Esempio n. 23
0
    def __init__(self, config):
        # properties for create operation
        create_input_type = type.StructType(
            'operation-input', {
                'source_id':
                type.IdType(
                    resource_types='com.vmware.vapi.metadata.privilege.source'
                ),
                'spec':
                type.ReferenceType(sys.modules[__name__], 'Source.CreateSpec'),
            })
        create_error_dict = {
            'com.vmware.vapi.std.errors.already_exists':
            type.ReferenceType(com.vmware.vapi.std.errors_client,
                               'AlreadyExists'),
            'com.vmware.vapi.std.errors.invalid_argument':
            type.ReferenceType(com.vmware.vapi.std.errors_client,
                               'InvalidArgument'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
        }
        create_input_validator_list = []
        create_output_validator_list = []

        # properties for delete operation
        delete_input_type = type.StructType(
            'operation-input', {
                'source_id':
                type.IdType(
                    resource_types='com.vmware.vapi.metadata.privilege.source'
                ),
            })
        delete_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
        }
        delete_input_validator_list = []
        delete_output_validator_list = []

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

        # properties for list operation
        list_input_type = type.StructType('operation-input', {})
        list_error_dict = {}
        list_input_validator_list = []
        list_output_validator_list = []

        # properties for reload operation
        reload_input_type = type.StructType(
            'operation-input', {
                'source_id': type.OptionalType(type.IdType()),
            })
        reload_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
        }
        reload_input_validator_list = []
        reload_output_validator_list = []

        # properties for fingerprint operation
        fingerprint_input_type = type.StructType(
            'operation-input', {
                'source_id': type.OptionalType(type.IdType()),
            })
        fingerprint_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
        }
        fingerprint_input_validator_list = []
        fingerprint_output_validator_list = []

        operations = {
            'create': {
                'input_type': create_input_type,
                'output_type': type.VoidType(),
                'errors': create_error_dict,
                'input_validator_list': create_input_validator_list,
                'output_validator_list': create_output_validator_list,
            },
            'delete': {
                'input_type': delete_input_type,
                'output_type': type.VoidType(),
                'errors': delete_error_dict,
                'input_validator_list': delete_input_validator_list,
                'output_validator_list': delete_output_validator_list,
            },
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType(sys.modules[__name__], 'Source.Info'),
                'errors':
                get_error_dict,
                'input_validator_list':
                get_input_validator_list,
                'output_validator_list':
                get_output_validator_list,
            },
            'list': {
                'input_type': list_input_type,
                'output_type': type.ListType(type.IdType()),
                'errors': list_error_dict,
                'input_validator_list': list_input_validator_list,
                'output_validator_list': list_output_validator_list,
            },
            'reload': {
                'input_type': reload_input_type,
                'output_type': type.VoidType(),
                'errors': reload_error_dict,
                'input_validator_list': reload_input_validator_list,
                'output_validator_list': reload_output_validator_list,
            },
            'fingerprint': {
                'input_type': fingerprint_input_type,
                'output_type': type.StringType(),
                'errors': fingerprint_error_dict,
                'input_validator_list': fingerprint_input_validator_list,
                'output_validator_list': fingerprint_output_validator_list,
            },
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vapi.metadata.privilege.source',
            config=config,
            operations=operations)
Esempio n. 24
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'domain_id':
                type.StringType(),
                'group_id':
                type.StringType(),
                'cursor':
                type.OptionalType(type.StringType()),
                'enforcement_point_path':
                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 = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/policy/api/v1/global-infra/domains/{domain-id}/groups/{group-id}/statistics/virtual-machines',
            path_variables={
                'domain_id': 'domain-id',
                'group_id': 'group-id',
            },
            query_parameters={
                'cursor': 'cursor',
                'enforcement_point_path': 'enforcement_point_path',
                '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')

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'RealizedVirtualMachineListResult'),
                '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.groups.statistics.virtual_machines',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Esempio n. 25
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'edge_cluster_id': 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 = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/api/v1/edge-clusters/{edge-cluster-id}/status',
            path_variables={
                'edge_cluster_id': 'edge-cluster-id',
            },
            query_parameters={
                'source': 'source',
            },
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'EdgeClusterStatus'),
                '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.edge_clusters.status',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Esempio n. 26
0
class BaseImages(VapiInterface):
    """
    The ``BaseImages`` class provides methods to manage trusted instances of
    ESX software on a cluster level. This class was added in vSphere API 7.0.0.
    """
    RESOURCE_TYPE = "com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage"
    """
    Resource type for ESX base image. This class attribute was added in vSphere API
    7.0.0.

    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.base_images'
    """
    Identifier of the service in canonical form.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _BaseImagesStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update(
            {'import_from_imgdb_task': 'import_from_imgdb$task'})
        self._VAPI_OPERATION_IDS.update({'list_task': 'list$task'})
        self._VAPI_OPERATION_IDS.update({'delete_task': 'delete$task'})
        self._VAPI_OPERATION_IDS.update({'get_task': 'get$task'})

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        """
        OK = None
        """
        Check passed

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

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

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

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

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

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

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

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

        """
        SFTP = None
        """
        Destination is SFTP server

        """
        NFS = None
        """
        Destination is NFS server. This class attribute was added in vSphere API
        6.7.2.

        """
        SMB = None
        """
        Destination is SMB server. This class attribute was added in vSphere API
        6.7.2.

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

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

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

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

        """
        INPROGRESS = None
        """
        In progress

        """
        NONE = None
        """
        Not started

        """
        SUCCEEDED = None
        """
        Completed successfully

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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


        :rtype: :class:`Job.RestoreJobStatus`
        :return: RestoreJobStatus Structure
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('get', None)
Esempio n. 28
0
    def __init__(self, config):
        # properties for import_from_imgdb operation
        import_from_imgdb_input_type = type.StructType(
            'operation-input', {
                'cluster':
                type.IdType(resource_types='ClusterComputeResource'),
                'imgdb': type.BlobType(),
            })
        import_from_imgdb_error_dict = {
            'com.vmware.vapi.std.errors.already_exists':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'AlreadyExists'),
            '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.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
        }
        import_from_imgdb_input_value_validator_list = []
        import_from_imgdb_output_validator_list = []
        import_from_imgdb_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template=
            '/vcenter/trusted-infrastructure/trust-authority-clusters/{cluster}/attestation/os/esx/base-images',
            request_body_parameter='imgdb',
            path_variables={
                'cluster': 'cluster',
            },
            query_parameters={},
            dispatch_parameters={
                'action': 'import-from-imgdb',
            },
            header_parameters={},
            dispatch_header_parameters={})

        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'cluster':
                type.IdType(resource_types='ClusterComputeResource'),
                'spec':
                type.OptionalType(
                    type.ReferenceType(__name__, 'BaseImages.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.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/vcenter/trusted-infrastructure/trust-authority-clusters/{cluster}/attestation/os/esx/base-images',
            path_variables={
                'cluster': 'cluster',
            },
            query_parameters={},
            dispatch_parameters={},
            header_parameters={},
            dispatch_header_parameters={})

        # properties for delete operation
        delete_input_type = type.StructType(
            'operation-input', {
                'cluster':
                type.IdType(resource_types='ClusterComputeResource'),
                'version':
                type.IdType(
                    resource_types=
                    'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage'
                ),
            })
        delete_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.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
        }
        delete_input_value_validator_list = []
        delete_output_validator_list = []
        delete_rest_metadata = OperationRestMetadata(
            http_method='DELETE',
            url_template=
            '/vcenter/trusted-infrastructure/trust-authority-clusters/{cluster}/attestation/os/esx/base-images/{version}',
            path_variables={
                'cluster': 'cluster',
                'version': 'version',
            },
            query_parameters={},
            dispatch_parameters={},
            header_parameters={},
            dispatch_header_parameters={})

        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'cluster':
                type.IdType(resource_types='ClusterComputeResource'),
                'version':
                type.IdType(
                    resource_types=
                    'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.BaseImage'
                ),
            })
        get_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.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/vcenter/trusted-infrastructure/trust-authority-clusters/{cluster}/attestation/os/esx/base-images/{version}',
            path_variables={
                'cluster': 'cluster',
                'version': 'version',
            },
            query_parameters={},
            dispatch_parameters={},
            header_parameters={},
            dispatch_header_parameters={})

        operations = {
            'import_from_imgdb$task': {
                'input_type': import_from_imgdb_input_type,
                'output_type':
                type.IdType(resource_types='com.vmware.cis.TASK'),
                'errors': import_from_imgdb_error_dict,
                'input_value_validator_list':
                import_from_imgdb_input_value_validator_list,
                'output_validator_list': [],
                'task_type': TaskType.TASK_ONLY,
            },
            'list$task': {
                'input_type': list_input_type,
                'output_type':
                type.IdType(resource_types='com.vmware.cis.TASK'),
                'errors': list_error_dict,
                'input_value_validator_list': list_input_value_validator_list,
                'output_validator_list': [],
                'task_type': TaskType.TASK_ONLY,
            },
            'delete$task': {
                'input_type': delete_input_type,
                'output_type':
                type.IdType(resource_types='com.vmware.cis.TASK'),
                'errors': delete_error_dict,
                'input_value_validator_list':
                delete_input_value_validator_list,
                'output_validator_list': [],
                'task_type': TaskType.TASK_ONLY,
            },
            'get$task': {
                'input_type': get_input_type,
                'output_type':
                type.IdType(resource_types='com.vmware.cis.TASK'),
                'errors': get_error_dict,
                'input_value_validator_list': get_input_value_validator_list,
                'output_validator_list': [],
                'task_type': TaskType.TASK_ONLY,
            },
        }
        rest_metadata = {
            'import_from_imgdb': import_from_imgdb_rest_metadata,
            'list': list_rest_metadata,
            'delete': delete_rest_metadata,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name=
            'com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.attestation.os.esx.base_images',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Esempio n. 29
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'search_string': 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/aaa/vidm/groups',
            path_variables={},
            query_parameters={
                'search_string': 'search_string',
                'cursor': 'cursor',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            },
            content_type='application/json')

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'VidmInfoListResult'),
                '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.aaa.vidm.groups',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Esempio n. 30
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)