def __init__(self, config):
        # properties for set operation
        set_input_type = type.StructType(
            'operation-input', {
                'spec': type.ReferenceType(__name__, 'Tls.Spec'),
            })
        set_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            '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'),
        }
        set_input_value_validator_list = []
        set_output_validator_list = []
        set_rest_metadata = OperationRestMetadata(
            http_method='PUT',
            url_template='/vcenter/certificate-management/vcenter/tls',
            path_variables={},
            query_parameters={})

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

        # properties for renew operation
        renew_input_type = type.StructType(
            'operation-input', {
                'duration': type.OptionalType(type.IntegerType()),
            })
        renew_error_dict = {
            'com.vmware.vapi.std.errors.unsupported':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unsupported'),
            'com.vmware.vapi.std.errors.invalid_argument':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidArgument'),
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        renew_input_value_validator_list = []
        renew_output_validator_list = []
        renew_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/vcenter/certificate-management/vcenter/tls',
            path_variables={},
            query_parameters={})

        operations = {
            '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.ReferenceType(__name__, 'Tls.Info'),
                'errors': get_error_dict,
                'input_value_validator_list': get_input_value_validator_list,
                'output_validator_list': get_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'renew': {
                'input_type': renew_input_type,
                'output_type': type.VoidType(),
                'errors': renew_error_dict,
                'input_value_validator_list': renew_input_value_validator_list,
                'output_validator_list': renew_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'set': set_rest_metadata,
            'get': get_rest_metadata,
            'renew': renew_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vcenter.certificate_management.vcenter.tls',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Example #2
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'lport_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/logical-ports/{lport-id}/status',
            path_variables={
                'lport_id': 'lport-id',
            },
            query_parameters={
                'source': 'source',
            },
            content_type='application/json')

        # properties for getall operation
        getall_input_type = type.StructType(
            'operation-input', {
                'attachment_id': type.OptionalType(type.StringType()),
                'attachment_type': type.OptionalType(type.StringType()),
                'bridge_cluster_id': type.OptionalType(type.StringType()),
                'container_ports_only': type.OptionalType(type.BooleanType()),
                'cursor': type.OptionalType(type.StringType()),
                'diagnostic': type.OptionalType(type.BooleanType()),
                'included_fields': type.OptionalType(type.StringType()),
                'logical_switch_id': type.OptionalType(type.StringType()),
                'page_size': type.OptionalType(type.IntegerType()),
                'parent_vif_id': type.OptionalType(type.StringType()),
                'sort_ascending': type.OptionalType(type.BooleanType()),
                'sort_by': type.OptionalType(type.StringType()),
                'source': type.OptionalType(type.StringType()),
                'switching_profile_id': type.OptionalType(type.StringType()),
                'transport_node_id': type.OptionalType(type.StringType()),
                'transport_zone_id': type.OptionalType(type.StringType()),
            })
        getall_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'),
        }
        getall_input_value_validator_list = []
        getall_output_validator_list = []
        getall_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/api/v1/logical-ports/status',
            path_variables={},
            query_parameters={
                'attachment_id': 'attachment_id',
                'attachment_type': 'attachment_type',
                'bridge_cluster_id': 'bridge_cluster_id',
                'container_ports_only': 'container_ports_only',
                'cursor': 'cursor',
                'diagnostic': 'diagnostic',
                'included_fields': 'included_fields',
                'logical_switch_id': 'logical_switch_id',
                'page_size': 'page_size',
                'parent_vif_id': 'parent_vif_id',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
                'source': 'source',
                'switching_profile_id': 'switching_profile_id',
                'transport_node_id': 'transport_node_id',
                'transport_zone_id': 'transport_zone_id',
            },
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'LogicalPortOperationalStatus'),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'getall': {
                'input_type':
                getall_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'LogicalPortStatusSummary'),
                'errors':
                getall_error_dict,
                'input_value_validator_list':
                getall_input_value_validator_list,
                'output_validator_list':
                getall_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'get': get_rest_metadata,
            'getall': getall_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.nsx.logical_ports.status',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #3
0
class Inbound(VapiInterface):
    """
    The ``Inbound`` class provides methods to manage inbound firewall rules.
    This class was added in vSphere API 6.7.1.
    """

    _VAPI_SERVICE_ID = 'com.vmware.appliance.networking.firewall.inbound'
    """
    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, _InboundStub)
        self._VAPI_OPERATION_IDS = {}

    class Policy(Enum):
        """
        ``Inbound.Policy`` class Defines firewall rule policies. This enumeration
        was added in vSphere API 6.7.1.

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

        """
        ACCEPT = None
        """
        Allow packet with corresponding address. This class attribute was added in
        vSphere API 6.7.1.

        """
        REJECT = None
        """
        Drop packet with corresponding address sending destination is not
        reachable. This class attribute was added in vSphere API 6.7.1.

        """
        RETURN = None
        """
        Apply default or port-specific rules to packet with corresponding address.
        This class attribute was added in vSphere API 6.7.1.

        """

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

    Policy._set_values([
        Policy('IGNORE'),
        Policy('ACCEPT'),
        Policy('REJECT'),
        Policy('RETURN'),
    ])
    Policy._set_binding_type(type.EnumType(
        'com.vmware.appliance.networking.firewall.inbound.policy',
        Policy))


    class Rule(VapiStruct):
        """
        ``Inbound.Rule`` class Structure that defines a single address-based
        firewall rule. This class was added in vSphere API 6.7.1.

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




        def __init__(self,
                     address=None,
                     prefix=None,
                     policy=None,
                     interface_name=None,
                    ):
            """
            :type  address: :class:`str`
            :param address: IPv4 or IPv6 address. This attribute was added in vSphere API
                6.7.1.
            :type  prefix: :class:`long`
            :param prefix: CIDR prefix used to mask address. For example, an IPv4 prefix of 24
                ignores the low-order 8 bits of address. This attribute was added
                in vSphere API 6.7.1.
            :type  policy: :class:`Inbound.Policy`
            :param policy: The allow or deny policy of this rule. This attribute was added in
                vSphere API 6.7.1.
            :type  interface_name: :class:`str` or ``None``
            :param interface_name: The interface to which this rule applies. An empty string indicates
                that the rule applies to all interfaces. This attribute was added
                in vSphere API 6.7.1.
            """
            self.address = address
            self.prefix = prefix
            self.policy = policy
            self.interface_name = interface_name
            VapiStruct.__init__(self)


    Rule._set_binding_type(type.StructType(
        'com.vmware.appliance.networking.firewall.inbound.rule', {
            'address': type.StringType(),
            'prefix': type.IntegerType(),
            'policy': type.ReferenceType(__name__, 'Inbound.Policy'),
            'interface_name': type.OptionalType(type.StringType()),
        },
        Rule,
        False,
        None))



    def set(self,
            rules,
            ):
        """
        Set the ordered list of firewall rules to allow or deny traffic from
        one or more incoming IP addresses. This overwrites the existing
        firewall rules and creates a new rule list. Within the list of traffic
        rules, rules are processed in order of appearance, from top to bottom.
        For example, the list of rules can be as follows: 
        
        +------------+--------+----------------+--------+
        | Address    | Prefix | Interface Name | Policy |
        +============+========+================+========+
        | 10.112.0.1 | 0      | \*             | REJECT |
        +------------+--------+----------------+--------+
        | 10.112.0.1 | 0      | nic0           | ACCEPT |
        +------------+--------+----------------+--------+
        In the above example, the first rule drops all packets originating from
        10.112.0.1 and
        the second rule accepts all packets originating from 10.112.0.1 only on
        nic0. In effect, the second rule is always ignored which is not
        desired, hence the order has to be swapped. When a connection matches a
        firewall rule, further processing for the connection stops, and the
        appliance ignores any additional firewall rules you have set. This
        method was added in vSphere API 6.7.1.

        :type  rules: :class:`list` of :class:`Inbound.Rule`
        :param rules: List of address-based firewall rules.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('set',
                            {
                            'rules': rules,
                            })

    def get(self):
        """
        Get the ordered list of firewall rules. Within the list of traffic
        rules, rules are processed in order of appearance, from top to bottom.
        When a connection matches a firewall rule, further processing for the
        connection stops, and the appliance ignores any additional firewall
        rules you have set. This method was added in vSphere API 6.7.1.


        :rtype: :class:`list` of :class:`Inbound.Rule`
        :return: List of address-based firewall rules.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('get', None)
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                '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()),
            })
        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/cluster/restore/backuptimestamps',
            path_variables={},
            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.model_client',
                                   'ClusterBackupInfoListResult'),
                '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.cluster.restore.backuptimestamps',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #5
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/users',
            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',
            })

        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.users',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
class Apply(VapiInterface):
    """
    The ``Apply`` class provides methods to configure the policies that will
    impact how the software and configuration specification documents are
    applied to an ESXi cluster.
    """

    _VAPI_SERVICE_ID = 'com.vmware.esx.settings.clusters.policies.apply'
    """
    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, _ApplyStub)
        self._VAPI_OPERATION_IDS = {}

    class FailureAction(VapiStruct):
        """
        The ``Apply.FailureAction`` class contains attributes that describe the
        actions to be taken when entering maintenance mode fails on a single host
        within the cluster.

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

        _validator_list = [
            UnionValidator(
                'action', {
                    'RETRY': [('retry_delay', True), ('retry_count', True)],
                    'FAIL': [],
                }),
        ]

        def __init__(
            self,
            action=None,
            retry_delay=None,
            retry_count=None,
        ):
            """
            :type  action: :class:`Apply.FailureAction.Action`
            :param action: What action (FAIL, RETRY) is to be taken if entering maintenance
                mode fails on a single host within the cluster.
            :type  retry_delay: :class:`long`
            :param retry_delay: Time to wait to retry the failed operation in seconds.
                This attribute is optional and it is only relevant when the value
                of ``action`` is :attr:`Apply.FailureAction.Action.RETRY`.
            :type  retry_count: :class:`long`
            :param retry_count: Number of times to retry the failed operation.
                This attribute is optional and it is only relevant when the value
                of ``action`` is :attr:`Apply.FailureAction.Action.RETRY`.
            """
            self.action = action
            self.retry_delay = retry_delay
            self.retry_count = retry_count
            VapiStruct.__init__(self)

        class Action(Enum):
            """
            The ``Apply.FailureAction.Action`` class defines the actions to be taken
            when entering maintenance mode fails on a single host within the cluster.

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

            """
            RETRY = None
            """
            Retry the task :attr:`Apply.FailureAction.retry_count` number of times on
            the failed host after :attr:`Apply.FailureAction.retry_delay`.

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

        Action._set_values([
            Action('FAIL'),
            Action('RETRY'),
        ])
        Action._set_binding_type(
            type.EnumType(
                'com.vmware.esx.settings.clusters.policies.apply.failure_action.action',
                Action))

    FailureAction._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.clusters.policies.apply.failure_action', {
                'action':
                type.ReferenceType(__name__, 'Apply.FailureAction.Action'),
                'retry_delay':
                type.OptionalType(type.IntegerType()),
                'retry_count':
                type.OptionalType(type.IntegerType()),
            }, FailureAction, False, None))

    class ConfiguredPolicySpec(VapiStruct):
        """
        The ``Apply.ConfiguredPolicySpec`` class contains attributes that describe
        the policies configured to be used when the software and configuration
        specification documents are applied to an ESXi cluster.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            failure_action=None,
            pre_remediation_power_action=None,
            enable_quick_boot=None,
            disable_dpm=None,
            disable_hac=None,
            evacuate_offline_vms=None,
            enforce_hcl_validation=None,
        ):
            """
            :type  failure_action: :class:`Apply.FailureAction` or ``None``
            :param failure_action: What action is to be taken if entering maintenance mode fails on a
                given host of the cluster.
                If None, configured value would be unset.
            :type  pre_remediation_power_action: :class:`Apply.ConfiguredPolicySpec.PreRemediationPowerAction` or ``None``
            :param pre_remediation_power_action: Specifies what should be done to the power state of the VM before
                entering maintenance mode.
                If None, configured value would be unset.
            :type  enable_quick_boot: :class:`bool` or ``None``
            :param enable_quick_boot: Enable Quick Boot during remediation in the cluster.
                If None, configured value would be unset.
            :type  disable_dpm: :class:`bool` or ``None``
            :param disable_dpm: Disable DPM on the cluster.
                If None, configured value would be unset.
            :type  disable_hac: :class:`bool` or ``None``
            :param disable_hac: Disable HA Admission control on the cluster.
                If None, configured value would be unset.
            :type  evacuate_offline_vms: :class:`bool` or ``None``
            :param evacuate_offline_vms: Evacuate powered off/suspended VMs when attempting maintenance
                mode.
                If None, configured value would be unset.
            :type  enforce_hcl_validation: :class:`bool` or ``None``
            :param enforce_hcl_validation: Enforce Hcl validation, when applicable, to prevent remediation if
                hardware compatibility issues are found. This attribute was added
                in vSphere API 7.0.1.0.
                If None, hardware compatibility issues will not prevent
                remediation.
            """
            self.failure_action = failure_action
            self.pre_remediation_power_action = pre_remediation_power_action
            self.enable_quick_boot = enable_quick_boot
            self.disable_dpm = disable_dpm
            self.disable_hac = disable_hac
            self.evacuate_offline_vms = evacuate_offline_vms
            self.enforce_hcl_validation = enforce_hcl_validation
            VapiStruct.__init__(self)

        class PreRemediationPowerAction(Enum):
            """
            The ``Apply.ConfiguredPolicySpec.PreRemediationPowerAction`` class defines
            the possible actions to be taken, before entering maintenance mode.

            .. 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>`.
            """
            POWER_OFF_VMS = None
            """
            Power off VMs before entering maintenance mode.

            """
            SUSPEND_VMS = None
            """
            Suspend VMs before entering maintenance mode

            """
            DO_NOT_CHANGE_VMS_POWER_STATE = None
            """
            Do not change the VM power state

            """
            SUSPEND_VMS_TO_MEMORY = None
            """
            Suspend VMs to Memory before entering maintenance mode. This class
            attribute was added in vSphere API 7.0.2.0.

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

        PreRemediationPowerAction._set_values([
            PreRemediationPowerAction('POWER_OFF_VMS'),
            PreRemediationPowerAction('SUSPEND_VMS'),
            PreRemediationPowerAction('DO_NOT_CHANGE_VMS_POWER_STATE'),
            PreRemediationPowerAction('SUSPEND_VMS_TO_MEMORY'),
        ])
        PreRemediationPowerAction._set_binding_type(
            type.EnumType(
                'com.vmware.esx.settings.clusters.policies.apply.configured_policy_spec.pre_remediation_power_action',
                PreRemediationPowerAction))

    ConfiguredPolicySpec._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.clusters.policies.apply.configured_policy_spec',
            {
                'failure_action':
                type.OptionalType(
                    type.ReferenceType(__name__, 'Apply.FailureAction')),
                'pre_remediation_power_action':
                type.OptionalType(
                    type.ReferenceType(
                        __name__,
                        'Apply.ConfiguredPolicySpec.PreRemediationPowerAction')
                ),
                'enable_quick_boot':
                type.OptionalType(type.BooleanType()),
                'disable_dpm':
                type.OptionalType(type.BooleanType()),
                'disable_hac':
                type.OptionalType(type.BooleanType()),
                'evacuate_offline_vms':
                type.OptionalType(type.BooleanType()),
                'enforce_hcl_validation':
                type.OptionalType(type.BooleanType()),
            }, ConfiguredPolicySpec, False, None))

    def get(
        self,
        cluster,
    ):
        """
        Returns the configured policy that has been set for the cluster.

        :type  cluster: :class:`str`
        :param cluster: The cluster identifier.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :rtype: :class:`Apply.ConfiguredPolicySpec`
        :return: The configured policies that impact the apply method
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If there is an unknown internal error. The accompanying error
            message will give more details about the failure.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If there is no cluster associated with ``cluster`` in the system.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            If the service is not available.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the caller is not authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``VcIntegrity.lifecycleSettings.Read``.
            * The resource ``ClusterComputeResource`` referenced by the
              parameter ``cluster`` requires
              ``VcIntegrity.lifecycleSettings.Read``.
        """
        return self._invoke('get', {
            'cluster': cluster,
        })

    def set(
        self,
        cluster,
        spec,
    ):
        """
        This API will set the configured policy specification for the cluster.

        :type  cluster: :class:`str`
        :param cluster: The cluster identifier.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`Apply.ConfiguredPolicySpec`
        :param spec: The policy that needs to be configured.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If there is an unknown internal error. The accompanying error
            message will give more details about the failure.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If there is no cluster associated with ``cluster`` in the system.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            If invalid value is provided.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            If the service is not available.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            If the caller is not authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires
              ``VcIntegrity.lifecycleSettings.Write``.
            * The resource ``ClusterComputeResource`` referenced by the
              parameter ``cluster`` requires
              ``VcIntegrity.lifecycleSettings.Write``.
        """
        return self._invoke('set', {
            'cluster': cluster,
            'spec': spec,
        })
Example #7
0
    def __init__(self, config):
        # properties for create operation
        create_input_type = type.StructType('operation-input', {
            'section_id': type.StringType(),
            'service_insertion_rule': type.ReferenceType('com.vmware.nsx.model_client', 'ServiceInsertionRule'),
            'id': type.OptionalType(type.StringType()),
            'operation': type.OptionalType(type.StringType()),
        })
        create_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        create_input_value_validator_list = [
            HasFieldsOfValidator()
        ]
        create_output_validator_list = [
            HasFieldsOfValidator()
        ]
        create_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/api/v1/serviceinsertion/sections/{section-id}/rules',
            request_body_parameter='service_insertion_rule',
            path_variables={
                'section_id': 'section-id',
            },
            query_parameters={
                'id': 'id',
                'operation': 'operation',
            },
            content_type='application/json'
        )

        # properties for createmultiple operation
        createmultiple_input_type = type.StructType('operation-input', {
            'section_id': type.StringType(),
            'service_insertion_rule_list': type.ReferenceType('com.vmware.nsx.model_client', 'ServiceInsertionRuleList'),
            'id': type.OptionalType(type.StringType()),
            'operation': type.OptionalType(type.StringType()),
        })
        createmultiple_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'),

        }
        createmultiple_input_value_validator_list = [
            HasFieldsOfValidator()
        ]
        createmultiple_output_validator_list = [
            HasFieldsOfValidator()
        ]
        createmultiple_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/api/v1/serviceinsertion/sections/{section-id}/rules?action=create_multiple',
            request_body_parameter='service_insertion_rule_list',
            path_variables={
                'section_id': 'section-id',
            },
            query_parameters={
                'id': 'id',
                'operation': 'operation',
            },
            content_type='application/json'
        )

        # properties for delete operation
        delete_input_type = type.StructType('operation-input', {
            'section_id': type.StringType(),
            'rule_id': type.StringType(),
        })
        delete_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        delete_input_value_validator_list = [
        ]
        delete_output_validator_list = [
        ]
        delete_rest_metadata = OperationRestMetadata(
            http_method='DELETE',
            url_template='/api/v1/serviceinsertion/sections/{section-id}/rules/{rule-id}',
            path_variables={
                'section_id': 'section-id',
                'rule_id': 'rule-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'section_id': type.StringType(),
            'rule_id': type.StringType(),
        })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        get_input_value_validator_list = [
        ]
        get_output_validator_list = [
            HasFieldsOfValidator()
        ]
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/api/v1/serviceinsertion/sections/{section-id}/rules/{rule-id}',
            path_variables={
                'section_id': 'section-id',
                'rule_id': 'rule-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'section_id': type.StringType(),
            'applied_tos': type.OptionalType(type.StringType()),
            'cursor': type.OptionalType(type.StringType()),
            'destinations': type.OptionalType(type.StringType()),
            'filter_type': type.OptionalType(type.StringType()),
            'included_fields': type.OptionalType(type.StringType()),
            'page_size': type.OptionalType(type.IntegerType()),
            'services': type.OptionalType(type.StringType()),
            'sort_ascending': type.OptionalType(type.BooleanType()),
            'sort_by': type.OptionalType(type.StringType()),
            'sources': 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='/api/v1/serviceinsertion/sections/{section-id}/rules',
            path_variables={
                'section_id': 'section-id',
            },
            query_parameters={
                'applied_tos': 'applied_tos',
                'cursor': 'cursor',
                'destinations': 'destinations',
                'filter_type': 'filter_type',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'services': 'services',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
                'sources': 'sources',
            },
            content_type='application/json'
        )

        # properties for revise operation
        revise_input_type = type.StructType('operation-input', {
            'section_id': type.StringType(),
            'rule_id': type.StringType(),
            'service_insertion_rule': type.ReferenceType('com.vmware.nsx.model_client', 'ServiceInsertionRule'),
            'id': type.OptionalType(type.StringType()),
            'operation': type.OptionalType(type.StringType()),
        })
        revise_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        revise_input_value_validator_list = [
            HasFieldsOfValidator()
        ]
        revise_output_validator_list = [
            HasFieldsOfValidator()
        ]
        revise_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/api/v1/serviceinsertion/sections/{section-id}/rules/{rule-id}?action=revise',
            request_body_parameter='service_insertion_rule',
            path_variables={
                'section_id': 'section-id',
                'rule_id': 'rule-id',
            },
            query_parameters={
                'id': 'id',
                'operation': 'operation',
            },
            content_type='application/json'
        )

        # properties for update operation
        update_input_type = type.StructType('operation-input', {
            'section_id': type.StringType(),
            'rule_id': type.StringType(),
            'service_insertion_rule': type.ReferenceType('com.vmware.nsx.model_client', 'ServiceInsertionRule'),
        })
        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/serviceinsertion/sections/{section-id}/rules/{rule-id}',
            request_body_parameter='service_insertion_rule',
            path_variables={
                'section_id': 'section-id',
                'rule_id': 'rule-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        operations = {
            'create': {
                'input_type': create_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'ServiceInsertionRule'),
                'errors': create_error_dict,
                'input_value_validator_list': create_input_value_validator_list,
                'output_validator_list': create_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'createmultiple': {
                'input_type': createmultiple_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'ServiceInsertionRuleList'),
                'errors': createmultiple_error_dict,
                'input_value_validator_list': createmultiple_input_value_validator_list,
                'output_validator_list': createmultiple_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', 'ServiceInsertionRule'),
                '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', 'ServiceInsertionRuleListResult'),
                'errors': list_error_dict,
                'input_value_validator_list': list_input_value_validator_list,
                'output_validator_list': list_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'revise': {
                'input_type': revise_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'ServiceInsertionRule'),
                'errors': revise_error_dict,
                'input_value_validator_list': revise_input_value_validator_list,
                'output_validator_list': revise_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'update': {
                'input_type': update_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'ServiceInsertionRule'),
                '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,
            'createmultiple': createmultiple_rest_metadata,
            'delete': delete_rest_metadata,
            'get': get_rest_metadata,
            'list': list_rest_metadata,
            'revise': revise_rest_metadata,
            'update': update_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.nsx.serviceinsertion.sections.rules',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #8
0
    def __init__(self, config):
        # properties for create operation
        create_input_type = type.StructType(
            'operation-input', {
                'directory_domain':
                type.DynamicStructType(
                    'vmware.vapi.dynamic_struct', {}, VapiStruct, [
                        type.ReferenceType('com.vmware.nsx.model_client',
                                           'DirectoryDomain')
                    ]),
            })
        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/directory/domains',
            request_body_parameter='directory_domain',
            path_variables={},
            query_parameters={},
            content_type='application/json')

        # properties for create_0 operation
        create_0_input_type = type.StructType(
            'operation-input', {
                'domain_id': type.StringType(),
                'action': type.StringType(),
                'delay': type.OptionalType(type.IntegerType()),
            })
        create_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'),
        }
        create_0_input_value_validator_list = []
        create_0_output_validator_list = []
        create_0_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/api/v1/directory/domains/{domain-id}',
            path_variables={
                'domain_id': 'domain-id',
            },
            query_parameters={
                'action': 'action',
                'delay': 'delay',
            },
            content_type='application/json')

        # properties for delete operation
        delete_input_type = type.StructType(
            'operation-input', {
                'domain_id': type.StringType(),
                'force': type.OptionalType(type.BooleanType()),
            })
        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/directory/domains/{domain-id}',
            path_variables={
                'domain_id': 'domain-id',
            },
            query_parameters={
                'force': 'force',
            },
            content_type='application/json')

        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'domain_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='/api/v1/directory/domains/{domain-id}',
            path_variables={
                'domain_id': 'domain-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()),
                '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='/api/v1/directory/domains',
            path_variables={},
            query_parameters={
                'cursor': 'cursor',
                'included_fields': 'included_fields',
                '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', {
                'domain_id':
                type.StringType(),
                'directory_domain':
                type.DynamicStructType(
                    'vmware.vapi.dynamic_struct', {}, VapiStruct, [
                        type.ReferenceType('com.vmware.nsx.model_client',
                                           'DirectoryDomain')
                    ]),
            })
        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/directory/domains/{domain-id}',
            request_body_parameter='directory_domain',
            path_variables={
                'domain_id': 'domain-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',
                                           'DirectoryDomain')
                    ]),
                'errors':
                create_error_dict,
                'input_value_validator_list':
                create_input_value_validator_list,
                'output_validator_list':
                create_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'create_0': {
                'input_type': create_0_input_type,
                'output_type': type.VoidType(),
                'errors': create_0_error_dict,
                'input_value_validator_list':
                create_0_input_value_validator_list,
                'output_validator_list': create_0_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.DynamicStructType(
                    'vmware.vapi.dynamic_struct', {}, VapiStruct, [
                        type.ReferenceType('com.vmware.nsx.model_client',
                                           'DirectoryDomain')
                    ]),
                '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',
                                   'DirectoryDomainListResults'),
                '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.DynamicStructType(
                    'vmware.vapi.dynamic_struct', {}, VapiStruct, [
                        type.ReferenceType('com.vmware.nsx.model_client',
                                           'DirectoryDomain')
                    ]),
                '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,
            'create_0': create_0_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.directory.domains',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #9
0
class Ipv6(VapiInterface):
    """
    The ``Ipv6`` class provides methods to perform IPv6 network configuration
    for interfaces. This class was added in vSphere API 6.7
    """


    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _Ipv6Stub)

    class Origin(Enum):
        """
        The ``Ipv6.Origin`` class defines IPv6 address origin values. 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>`.
        """
        DHCP = None
        """
        The IPv6 address is assigned by a DHCP server. See RFC 4293. This class
        attribute was added in vSphere API 6.7

        """
        RANDOM = None
        """
        The IPv6 address is assigned randomly by the system. See RFC 4293. This
        class attribute was added in vSphere API 6.7

        """
        MANUAL = None
        """
        The IPv6 address was manually configured to a specified address, for
        example, by user configuration. See RFC 4293. This class attribute was
        added in vSphere API 6.7

        """
        LINKLAYER = None
        """
        The IPv6 address is assigned by IPv6 Stateless Address Auto-configuration
        (SLAAC). See RFC 4293. This class attribute was added in vSphere API 6.7

        """
        OTHER = None
        """
        The IPv6 address is assigned by a mechanism other than manual, DHCP, SLAAC,
        or random. See RFC 4293. 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:`Origin` instance.
            """
            Enum.__init__(string)

    Origin._set_values([
        Origin('DHCP'),
        Origin('RANDOM'),
        Origin('MANUAL'),
        Origin('LINKLAYER'),
        Origin('OTHER'),
    ])
    Origin._set_binding_type(type.EnumType(
        'com.vmware.appliance.networking.interfaces.ipv6.origin',
        Origin))


    class Status(Enum):
        """
        The ``Ipv6.Status`` class defines IPv6 address status values. See RFC 4293.
        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>`.
        """
        TENTATIVE = None
        """
        The IPv6 address is in the process of being verified as unique. An address
        in this state cannot be used for general communication. It can be used to
        determine the uniqueness of the address. This class attribute was added in
        vSphere API 6.7

        """
        UNKNOWN = None
        """
        The status of this address cannot be determined. This class attribute was
        added in vSphere API 6.7

        """
        INACCESSIBLE = None
        """
        The IPv6 address is inaccessible because the interface to which this
        address is assigned is not operational. This class attribute was added in
        vSphere API 6.7

        """
        INVALID = None
        """
        The IPv6 address is not a valid address. It should not appear as the
        destination or source address of a packet. This class attribute was added
        in vSphere API 6.7

        """
        DUPLICATE = None
        """
        The IPv6 address is not unique on the link and cannot be used. This class
        attribute was added in vSphere API 6.7

        """
        PREFERRED = None
        """
        This is a valid IPv6 address that can appear as the destination or source
        address of a packet. This class attribute was added in vSphere API 6.7

        """
        DEPRECATED = None
        """
        The is a valid but deprecated IPv6 address. This address cannot be used as
        a source address in new communications, although packets addressed to such
        an address are processed as expected. This class attribute was added in
        vSphere API 6.7

        """
        OPTIMISTIC = None
        """
        The IPv6 address is available for use, subject to restrictions, while its
        uniqueness on a link is being verified. 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('TENTATIVE'),
        Status('UNKNOWN'),
        Status('INACCESSIBLE'),
        Status('INVALID'),
        Status('DUPLICATE'),
        Status('PREFERRED'),
        Status('DEPRECATED'),
        Status('OPTIMISTIC'),
    ])
    Status._set_binding_type(type.EnumType(
        'com.vmware.appliance.networking.interfaces.ipv6.status',
        Status))


    class Address(VapiStruct):
        """
        The ``Ipv6.Address`` class provides the structure used to name an IPv6
        address. 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,
                     address=None,
                     prefix=None,
                    ):
            """
            :type  address: :class:`str`
            :param address: The IPv6 address, for example, fc00:10:20:83:20c:29ff:fe94:bb5a.
                This attribute was added in vSphere API 6.7
            :type  prefix: :class:`long`
            :param prefix: The IPv6 CIDR prefix, for example, 64. This attribute was added in
                vSphere API 6.7
            """
            self.address = address
            self.prefix = prefix
            VapiStruct.__init__(self)

    Address._set_binding_type(type.StructType(
        'com.vmware.appliance.networking.interfaces.ipv6.address', {
            'address': type.StringType(),
            'prefix': type.IntegerType(),
        },
        Address,
        False,
        None))


    class AddressInfo(VapiStruct):
        """
        The ``Ipv6.AddressInfo`` class provides the structure that you can use to
        get information about an IPv6 address along with its origin and status.
        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,
                     origin=None,
                     status=None,
                     address=None,
                     prefix=None,
                    ):
            """
            :type  origin: :class:`Ipv6.Origin`
            :param origin: The Origin of the IPv6 address. For more information, see RFC 4293.
                This attribute was added in vSphere API 6.7
            :type  status: :class:`Ipv6.Status`
            :param status: The Status of the IPv6 address. For more information, see RFC 4293.
                This attribute was added in vSphere API 6.7
            :type  address: :class:`str`
            :param address: The IPv6 address, for example, fc00:10:20:83:20c:29ff:fe94:bb5a.
                This attribute was added in vSphere API 6.7
            :type  prefix: :class:`long`
            :param prefix: The IPv6 CIDR prefix, for example, 64. This attribute was added in
                vSphere API 6.7
            """
            self.origin = origin
            self.status = status
            self.address = address
            self.prefix = prefix
            VapiStruct.__init__(self)

    AddressInfo._set_binding_type(type.StructType(
        'com.vmware.appliance.networking.interfaces.ipv6.address_info', {
            'origin': type.ReferenceType(__name__, 'Ipv6.Origin'),
            'status': type.ReferenceType(__name__, 'Ipv6.Status'),
            'address': type.StringType(),
            'prefix': type.IntegerType(),
        },
        AddressInfo,
        False,
        None))


    class Config(VapiStruct):
        """
        The ``Ipv6.Config`` class provides the structure that you can use to
        configure IPv6 on a particular interface. Addresses can be assigned by
        DHCP, SLAAC or STATIC, as IPv6 permits multiple addresses per interface.
        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,
                     dhcp=None,
                     autoconf=None,
                     addresses=None,
                     default_gateway=None,
                    ):
            """
            :type  dhcp: :class:`bool`
            :param dhcp: An address will be assigned by a DHCP server. This attribute was
                added in vSphere API 6.7
            :type  autoconf: :class:`bool`
            :param autoconf: An address will be assigned by Stateless Address Autoconfiguration
                (SLAAC). This attribute was added in vSphere API 6.7
            :type  addresses: :class:`list` of :class:`Ipv6.Address`
            :param addresses: The list of addresses to be statically assigned. This attribute was
                added in vSphere API 6.7
            :type  default_gateway: :class:`str`
            :param default_gateway: The default gateway for static IP address assignment. This
                configures the global IPv6 default gateway on the appliance with
                the specified gateway address and interface. This gateway replaces
                the existing default gateway configured on the appliance. However,
                if the gateway address is link-local, then it is added for that
                interface. This does not support configuration of multiple global
                default gateways through different interfaces. This attribute was
                added in vSphere API 6.7
            """
            self.dhcp = dhcp
            self.autoconf = autoconf
            self.addresses = addresses
            self.default_gateway = default_gateway
            VapiStruct.__init__(self)

    Config._set_binding_type(type.StructType(
        'com.vmware.appliance.networking.interfaces.ipv6.config', {
            'dhcp': type.BooleanType(),
            'autoconf': type.BooleanType(),
            'addresses': type.ListType(type.ReferenceType(__name__, 'Ipv6.Address')),
            'default_gateway': type.StringType(),
        },
        Config,
        False,
        None))


    class Info(VapiStruct):
        """
        The ``Ipv6.Info`` class provides the structure that defines an existing
        IPv6 configuration on a particular interface. This structure is read only.
        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,
                     dhcp=None,
                     autoconf=None,
                     addresses=None,
                     default_gateway=None,
                     configurable=None,
                    ):
            """
            :type  dhcp: :class:`bool`
            :param dhcp: DHCP is on. This attribute was added in vSphere API 6.7
            :type  autoconf: :class:`bool`
            :param autoconf: Stateless Address Autoconfiguration (SLAAC) is on. This attribute
                was added in vSphere API 6.7
            :type  addresses: :class:`list` of :class:`Ipv6.AddressInfo`
            :param addresses: List of addresses with their origins and statuses. This attribute
                was added in vSphere API 6.7
            :type  default_gateway: :class:`str`
            :param default_gateway: The default gateway for static IP address assignment. This
                configures the global IPv6 default gateway on the appliance with
                the specified gateway address and interface. This gateway replaces
                the existing default gateway configured on the appliance. However,
                if the gateway address is link-local, then it is added for that
                interface. This does not support configuration of multiple global
                default gateways through different interfaces. This attribute was
                added in vSphere API 6.7
            :type  configurable: :class:`bool`
            :param configurable: Is NIC configurable or not. This attribute was added in vSphere API
                6.7
            """
            self.dhcp = dhcp
            self.autoconf = autoconf
            self.addresses = addresses
            self.default_gateway = default_gateway
            self.configurable = configurable
            VapiStruct.__init__(self)

    Info._set_binding_type(type.StructType(
        'com.vmware.appliance.networking.interfaces.ipv6.info', {
            'dhcp': type.BooleanType(),
            'autoconf': type.BooleanType(),
            'addresses': type.ListType(type.ReferenceType(__name__, 'Ipv6.AddressInfo')),
            'default_gateway': type.StringType(),
            'configurable': type.BooleanType(),
        },
        Info,
        False,
        None))



    def set(self,
            interface_name,
            config,
            ):
        """
        Set IPv6 network configuration for specific interface. This method was
        added in vSphere API 6.7

        :type  interface_name: :class:`str`
        :param interface_name: Network interface to update, for example, "nic0".
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.networking.interfaces``.
        :type  config: :class:`Ipv6.Config`
        :param config: The IPv6 configuration.
        :raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy` 
            The specified NIC is busy.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            The specified NIC is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error.
        """
        return self._invoke('set',
                            {
                            'interface_name': interface_name,
                            'config': config,
                            })

    def get(self,
            interface_name,
            ):
        """
        Get IPv6 network configuration for specific interface. This method was
        added in vSphere API 6.7

        :type  interface_name: :class:`str`
        :param interface_name: Network interface to query, for example, "nic0".
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.networking.interfaces``.
        :rtype: :class:`Ipv6.Info`
        :return: IPv6 configuration.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the specified NIC is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error.
        """
        return self._invoke('get',
                            {
                            'interface_name': interface_name,
                            })
Example #10
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()),
                '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/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',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            })

        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.infra.domains.groups.statistics.virtual_machines',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
    def __init__(self, config):
        # properties for delete operation
        delete_input_type = type.StructType(
            'operation-input', {
                'tier0_id': type.StringType(),
                'locale_service_id': type.StringType(),
                'neighbor_id': type.StringType(),
                'override': type.OptionalType(type.BooleanType()),
            })
        delete_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        delete_input_value_validator_list = []
        delete_output_validator_list = []
        delete_rest_metadata = OperationRestMetadata(
            http_method='DELETE',
            url_template=
            '/policy/api/v1/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-service-id',
                'neighbor_id': 'neighbor-id',
            },
            query_parameters={
                'override': 'override',
            },
            content_type='application/json')

        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'tier0_id': type.StringType(),
                'locale_service_id': type.StringType(),
                'neighbor_id': type.StringType(),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = [HasFieldsOfValidator()]
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/policy/api/v1/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-service-id',
                'neighbor_id': 'neighbor-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(),
                'cursor':
                type.OptionalType(type.StringType()),
                'include_mark_for_delete_objects':
                type.OptionalType(type.BooleanType()),
                'included_fields':
                type.OptionalType(type.StringType()),
                'page_size':
                type.OptionalType(type.IntegerType()),
                'sort_ascending':
                type.OptionalType(type.BooleanType()),
                'sort_by':
                type.OptionalType(type.StringType()),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = [HasFieldsOfValidator()]
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/policy/api/v1/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-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(),
                'neighbor_id':
                type.StringType(),
                'bgp_neighbor_config':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'BgpNeighborConfig'),
                'override':
                type.OptionalType(type.BooleanType()),
            })
        patch_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        patch_input_value_validator_list = [HasFieldsOfValidator()]
        patch_output_validator_list = []
        patch_rest_metadata = OperationRestMetadata(
            http_method='PATCH',
            url_template=
            '/policy/api/v1/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}',
            request_body_parameter='bgp_neighbor_config',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-service-id',
                'neighbor_id': 'neighbor-id',
            },
            query_parameters={
                'override': 'override',
            },
            content_type='application/json')

        # properties for update operation
        update_input_type = type.StructType(
            'operation-input', {
                'tier0_id':
                type.StringType(),
                'locale_service_id':
                type.StringType(),
                'neighbor_id':
                type.StringType(),
                'bgp_neighbor_config':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'BgpNeighborConfig'),
                'override':
                type.OptionalType(type.BooleanType()),
            })
        update_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        update_input_value_validator_list = [HasFieldsOfValidator()]
        update_output_validator_list = [HasFieldsOfValidator()]
        update_rest_metadata = OperationRestMetadata(
            http_method='PUT',
            url_template=
            '/policy/api/v1/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}',
            request_body_parameter='bgp_neighbor_config',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-service-id',
                'neighbor_id': 'neighbor-id',
            },
            query_parameters={
                'override': 'override',
            },
            content_type='application/json')

        operations = {
            'delete': {
                'input_type': delete_input_type,
                'output_type': type.VoidType(),
                'errors': delete_error_dict,
                'input_value_validator_list':
                delete_input_value_validator_list,
                'output_validator_list': delete_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'BgpNeighborConfig'),
                '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',
                                   'BgpNeighborConfigListResult'),
                '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',
                                   'BgpNeighborConfig'),
                'errors':
                update_error_dict,
                'input_value_validator_list':
                update_input_value_validator_list,
                'output_validator_list':
                update_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'delete': delete_rest_metadata,
            'get': get_rest_metadata,
            'list': list_rest_metadata,
            'patch': patch_rest_metadata,
            'update': update_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name=
            'com.vmware.nsx_policy.global_infra.tier_0s.locale_services.bgp.neighbors',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #12
0
class Providers(VapiInterface):
    """
    The ``Providers`` class provides methods to create a sync session, get
    information on Sync. Usage beyond VMware Cloud on AWS is not supported.
    **Warning:** This class is available as Technology Preview. These are early
    access APIs provided to test, automate and provide feedback on the feature.
    Since this can change based on feedback, VMware does not guarantee
    backwards compatibility and recommends against using them in production
    environments. Some Technology Preview APIs might only be applicable to
    specific environments.
    """
    RESOURCE_TYPE = "com.vmware.vcenter.hvc.links.sync.Providers"
    """
    Resource type for Sync Providers. **Warning:** This class attribute is
    available as Technology Preview. These are early access APIs provided to test,
    automate and provide feedback on the feature. Since this can change based on
    feedback, VMware does not guarantee backwards compatibility and recommends
    against using them in production environments. Some Technology Preview APIs
    might only be applicable to specific environments.

    """

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

    class Status(Enum):
        """
        The ``Providers.Status`` class defines valid sync status. **Warning:** This
        enumeration is available as Technology Preview. These are early access APIs
        provided to test, automate and provide feedback on the feature. Since this
        can change based on feedback, VMware does not guarantee backwards
        compatibility and recommends against using them in production environments.
        Some Technology Preview APIs might only be applicable to specific
        environments.

        .. note::
            This class represents an enumerated type in the interface language
            definition. The class contains class attributes which represent the
            values in the current version of the enumerated type. Newer versions of
            the enumerated type may contain new values. To use new values of the
            enumerated type in communication with a server that supports the newer
            version of the API, you instantiate this class. See :ref:`enumerated
            type description page <enumeration_description>`.
        """
        SUCCEEDED = None
        """
        If Sync was successful. **Warning:** This class attribute is available as
        Technology Preview. These are early access APIs provided to test, automate
        and provide feedback on the feature. Since this can change based on
        feedback, VMware does not guarantee backwards compatibility and recommends
        against using them in production environments. Some Technology Preview APIs
        might only be applicable to specific environments.

        """
        FAILED = None
        """
        If Sync failed. **Warning:** This class attribute is available as
        Technology Preview. These are early access APIs provided to test, automate
        and provide feedback on the feature. Since this can change based on
        feedback, VMware does not guarantee backwards compatibility and recommends
        against using them in production environments. Some Technology Preview APIs
        might only be applicable to specific environments.

        """
        NO_SYNC_FOUND = None
        """
        If Sync has not been triggered. **Warning:** This class attribute is
        available as Technology Preview. These are early access APIs provided to
        test, automate and provide feedback on the feature. Since this can change
        based on feedback, VMware does not guarantee backwards compatibility and
        recommends against using them in production environments. Some Technology
        Preview APIs might only be applicable to specific environments.

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

    Status._set_values([
        Status('SUCCEEDED'),
        Status('FAILED'),
        Status('NO_SYNC_FOUND'),
    ])
    Status._set_binding_type(
        type.EnumType('com.vmware.vcenter.hvc.links.sync.providers.status',
                      Status))

    class Info(VapiStruct):
        """
        The ``Providers.Info`` class contains information about sync for a
        provider. **Warning:** This class is available as Technology Preview. These
        are early access APIs provided to test, automate and provide feedback on
        the feature. Since this can change based on feedback, VMware does not
        guarantee backwards compatibility and recommends against using them in
        production environments. Some Technology Preview APIs might only be
        applicable to specific environments.

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

        _validator_list = [
            UnionValidator(
                'status', {
                    'FAILED': [('status_message', True)],
                    'SUCCEEDED': [],
                    'NO_SYNC_FOUND': [],
                }),
        ]

        def __init__(
            self,
            last_sync_time=None,
            status=None,
            polling_interval_in_seconds=None,
            current_session_info=None,
            status_message=None,
        ):
            """
            :type  last_sync_time: :class:`datetime.datetime` or ``None``
            :param last_sync_time: Last sync time for the provider. This indicates the last time that
                either a background sync or a force sync was started for the
                provider. **Warning:** This attribute is available as Technology
                Preview. These are early access APIs provided to test, automate and
                provide feedback on the feature. Since this can change based on
                feedback, VMware does not guarantee backwards compatibility and
                recommends against using them in production environments. Some
                Technology Preview APIs might only be applicable to specific
                environments.
                If None no sync was found for the provider.
            :type  status: :class:`Providers.Status`
            :param status: Last Sync status for the provider. **Warning:** This attribute is
                available as Technology Preview. These are early access APIs
                provided to test, automate and provide feedback on the feature.
                Since this can change based on feedback, VMware does not guarantee
                backwards compatibility and recommends against using them in
                production environments. Some Technology Preview APIs might only be
                applicable to specific environments.
            :type  polling_interval_in_seconds: :class:`long`
            :param polling_interval_in_seconds: Sync Polling interval between local and remote replicas for the
                provider. **Warning:** This attribute is available as Technology
                Preview. These are early access APIs provided to test, automate and
                provide feedback on the feature. Since this can change based on
                feedback, VMware does not guarantee backwards compatibility and
                recommends against using them in production environments. Some
                Technology Preview APIs might only be applicable to specific
                environments.
            :type  current_session_info: :class:`Providers.SessionInfo` or ``None``
            :param current_session_info: Returns information on the forced sync for the provider.
                **Warning:** This attribute is available as Technology Preview.
                These are early access APIs provided to test, automate and provide
                feedback on the feature. Since this can change based on feedback,
                VMware does not guarantee backwards compatibility and recommends
                against using them in production environments. Some Technology
                Preview APIs might only be applicable to specific environments.
                If None there is no outstanding sync session created for this
                provider
            :type  status_message: :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param status_message: Localizable messages associated with sync status. **Warning:** This
                attribute is available as Technology Preview. These are early
                access APIs provided to test, automate and provide feedback on the
                feature. Since this can change based on feedback, VMware does not
                guarantee backwards compatibility and recommends against using them
                in production environments. Some Technology Preview APIs might only
                be applicable to specific environments.
                This attribute is optional and it is only relevant when the value
                of ``status`` is :attr:`Providers.Status.FAILED`.
            """
            self.last_sync_time = last_sync_time
            self.status = status
            self.polling_interval_in_seconds = polling_interval_in_seconds
            self.current_session_info = current_session_info
            self.status_message = status_message
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.hvc.links.sync.providers.info', {
                'last_sync_time':
                type.OptionalType(type.DateTimeType()),
                'status':
                type.ReferenceType(__name__, 'Providers.Status'),
                'polling_interval_in_seconds':
                type.IntegerType(),
                'current_session_info':
                type.OptionalType(
                    type.ReferenceType(__name__, 'Providers.SessionInfo')),
                'status_message':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
            }, Info, False, None))

    class SessionInfo(VapiStruct):
        """
        The ``Providers.SessionInfo`` class contains sync session information.
        **Warning:** This class is available as Technology Preview. These are early
        access APIs provided to test, automate and provide feedback on the feature.
        Since this can change based on feedback, VMware does not guarantee
        backwards compatibility and recommends against using them in production
        environments. Some Technology Preview APIs might only be applicable to
        specific environments.

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

        _validator_list = [
            UnionValidator(
                'stage', {
                    'FAILED': [('completion_time', True), ('exception', True)],
                    'COMPLETED': [('completion_time', True)],
                    'CHANGE_DETECTION': [],
                    'CHANGE_ENUMERATION': [],
                    'CHANGE_APPLICATION': [],
                    'WAITING': [],
                }),
        ]

        def __init__(
            self,
            stage=None,
            completed_work=None,
            total_work=None,
            completion_time=None,
            start_time=None,
            exception=None,
        ):
            """
            :type  stage: :class:`Providers.SessionInfo.Stage`
            :param stage: Sync stage for the session. **Warning:** This attribute is
                available as Technology Preview. These are early access APIs
                provided to test, automate and provide feedback on the feature.
                Since this can change based on feedback, VMware does not guarantee
                backwards compatibility and recommends against using them in
                production environments. Some Technology Preview APIs might only be
                applicable to specific environments.
            :type  completed_work: :class:`long`
            :param completed_work: Completed work for the session. **Warning:** This attribute is
                available as Technology Preview. These are early access APIs
                provided to test, automate and provide feedback on the feature.
                Since this can change based on feedback, VMware does not guarantee
                backwards compatibility and recommends against using them in
                production environments. Some Technology Preview APIs might only be
                applicable to specific environments.
            :type  total_work: :class:`long`
            :param total_work: Total work for the session. **Warning:** This attribute is
                available as Technology Preview. These are early access APIs
                provided to test, automate and provide feedback on the feature.
                Since this can change based on feedback, VMware does not guarantee
                backwards compatibility and recommends against using them in
                production environments. Some Technology Preview APIs might only be
                applicable to specific environments.
            :type  completion_time: :class:`datetime.datetime`
            :param completion_time: Time at which forced sync session was completed. **Warning:** This
                attribute is available as Technology Preview. These are early
                access APIs provided to test, automate and provide feedback on the
                feature. Since this can change based on feedback, VMware does not
                guarantee backwards compatibility and recommends against using them
                in production environments. Some Technology Preview APIs might only
                be applicable to specific environments.
                If None there is an ongoing sync that has not completed
            :type  start_time: :class:`datetime.datetime`
            :param start_time: Time at which force sync was initiated. **Warning:** This attribute
                is available as Technology Preview. These are early access APIs
                provided to test, automate and provide feedback on the feature.
                Since this can change based on feedback, VMware does not guarantee
                backwards compatibility and recommends against using them in
                production environments. Some Technology Preview APIs might only be
                applicable to specific environments.
            :type  exception: :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param exception: Exception message if there is a sync failure on forced sync.
                **Warning:** This attribute is available as Technology Preview.
                These are early access APIs provided to test, automate and provide
                feedback on the feature. Since this can change based on feedback,
                VMware does not guarantee backwards compatibility and recommends
                against using them in production environments. Some Technology
                Preview APIs might only be applicable to specific environments.
                This attribute is optional and it is only relevant when the value
                of ``stage`` is :attr:`Providers.SessionInfo.Stage.FAILED`.
            """
            self.stage = stage
            self.completed_work = completed_work
            self.total_work = total_work
            self.completion_time = completion_time
            self.start_time = start_time
            self.exception = exception
            VapiStruct.__init__(self)

        class Stage(Enum):
            """
            The ``Providers.SessionInfo.Stage`` class defines the different stages of
            Sync. **Warning:** This enumeration is available as Technology Preview.
            These are early access APIs provided to test, automate and provide feedback
            on the feature. Since this can change based on feedback, VMware does not
            guarantee backwards compatibility and recommends against using them in
            production environments. Some Technology Preview APIs might only be
            applicable to specific environments.

            .. note::
                This class represents an enumerated type in the interface language
                definition. The class contains class attributes which represent the
                values in the current version of the enumerated type. Newer versions of
                the enumerated type may contain new values. To use new values of the
                enumerated type in communication with a server that supports the newer
                version of the API, you instantiate this class. See :ref:`enumerated
                type description page <enumeration_description>`.
            """
            CHANGE_DETECTION = None
            """
            Changes are being detected on the source replica. **Warning:** This class
            attribute is available as Technology Preview. These are early access APIs
            provided to test, automate and provide feedback on the feature. Since this
            can change based on feedback, VMware does not guarantee backwards
            compatibility and recommends against using them in production environments.
            Some Technology Preview APIs might only be applicable to specific
            environments.

            """
            CHANGE_ENUMERATION = None
            """
            Changes from the source replica are being enumerated. **Warning:** This
            class attribute is available as Technology Preview. These are early access
            APIs provided to test, automate and provide feedback on the feature. Since
            this can change based on feedback, VMware does not guarantee backwards
            compatibility and recommends against using them in production environments.
            Some Technology Preview APIs might only be applicable to specific
            environments.

            """
            CHANGE_APPLICATION = None
            """
            Changes are being applied to the destination replica. **Warning:** This
            class attribute is available as Technology Preview. These are early access
            APIs provided to test, automate and provide feedback on the feature. Since
            this can change based on feedback, VMware does not guarantee backwards
            compatibility and recommends against using them in production environments.
            Some Technology Preview APIs might only be applicable to specific
            environments.

            """
            COMPLETED = None
            """
            Sync has completed. **Warning:** This class attribute is available as
            Technology Preview. These are early access APIs provided to test, automate
            and provide feedback on the feature. Since this can change based on
            feedback, VMware does not guarantee backwards compatibility and recommends
            against using them in production environments. Some Technology Preview APIs
            might only be applicable to specific environments.

            """
            FAILED = None
            """
            Sync failed. **Warning:** This class attribute is available as Technology
            Preview. These are early access APIs provided to test, automate and provide
            feedback on the feature. Since this can change based on feedback, VMware
            does not guarantee backwards compatibility and recommends against using
            them in production environments. Some Technology Preview APIs might only be
            applicable to specific environments.

            """
            WAITING = None
            """
            Session is waiting for progress to be set. **Warning:** This class
            attribute is available as Technology Preview. These are early access APIs
            provided to test, automate and provide feedback on the feature. Since this
            can change based on feedback, VMware does not guarantee backwards
            compatibility and recommends against using them in production environments.
            Some Technology Preview APIs might only be applicable to specific
            environments.

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

        Stage._set_values([
            Stage('CHANGE_DETECTION'),
            Stage('CHANGE_ENUMERATION'),
            Stage('CHANGE_APPLICATION'),
            Stage('COMPLETED'),
            Stage('FAILED'),
            Stage('WAITING'),
        ])
        Stage._set_binding_type(
            type.EnumType(
                'com.vmware.vcenter.hvc.links.sync.providers.session_info.stage',
                Stage))

    SessionInfo._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.hvc.links.sync.providers.session_info', {
                'stage':
                type.ReferenceType(__name__, 'Providers.SessionInfo.Stage'),
                'completed_work':
                type.IntegerType(),
                'total_work':
                type.IntegerType(),
                'completion_time':
                type.OptionalType(type.DateTimeType()),
                'start_time':
                type.DateTimeType(),
                'exception':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
            }, SessionInfo, False, None))

    class Summary(VapiStruct):
        """
        The ``Providers.Summary`` class contains information about a provider.
        **Warning:** This class is available as Technology Preview. These are early
        access APIs provided to test, automate and provide feedback on the feature.
        Since this can change based on feedback, VMware does not guarantee
        backwards compatibility and recommends against using them in production
        environments. Some Technology Preview APIs might only be applicable to
        specific environments.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            provider=None,
        ):
            """
            :type  provider: :class:`str`
            :param provider: Sync provider id. **Warning:** This attribute is available as
                Technology Preview. These are early access APIs provided to test,
                automate and provide feedback on the feature. Since this can change
                based on feedback, VMware does not guarantee backwards
                compatibility and recommends against using them in production
                environments. Some Technology Preview APIs might only be applicable
                to specific environments.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.hvc.links.sync.Providers``. When methods
                return a value of this class as a return value, the attribute will
                be an identifier for the resource type:
                ``com.vmware.vcenter.hvc.links.sync.Providers``.
            """
            self.provider = provider
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.hvc.links.sync.providers.summary', {
                'provider':
                type.IdType(
                    resource_types='com.vmware.vcenter.hvc.links.sync.Providers'
                ),
            }, Summary, False, None))

    class Credentials(VapiStruct):
        """
        The ``Providers.Credentials`` class specifies user credentials to make a
        successful connection to remote endpoint. **Warning:** This class is
        available as Technology Preview. These are early access APIs provided to
        test, automate and provide feedback on the feature. Since this can change
        based on feedback, VMware does not guarantee backwards compatibility and
        recommends against using them in production environments. Some Technology
        Preview APIs might only be applicable to specific environments.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            user_name=None,
            password=None,
        ):
            """
            :type  user_name: :class:`str`
            :param user_name: Name of the user to authenticate. **Warning:** This attribute is
                available as Technology Preview. These are early access APIs
                provided to test, automate and provide feedback on the feature.
                Since this can change based on feedback, VMware does not guarantee
                backwards compatibility and recommends against using them in
                production environments. Some Technology Preview APIs might only be
                applicable to specific environments.
            :type  password: :class:`str`
            :param password: Password for the user. **Warning:** This attribute is available as
                Technology Preview. These are early access APIs provided to test,
                automate and provide feedback on the feature. Since this can change
                based on feedback, VMware does not guarantee backwards
                compatibility and recommends against using them in production
                environments. Some Technology Preview APIs might only be applicable
                to specific environments.
            """
            self.user_name = user_name
            self.password = password
            VapiStruct.__init__(self)

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

    def list(
        self,
        link,
    ):
        """
        Enumerates the sync providers. Usage beyond VMware Cloud on AWS is not
        supported. **Warning:** This method is available as Technology Preview.
        These are early access APIs provided to test, automate and provide
        feedback on the feature. Since this can change based on feedback,
        VMware does not guarantee backwards compatibility and recommends
        against using them in production environments. Some Technology Preview
        APIs might only be applicable to specific environments.

        :type  link: :class:`str`
        :param link: Unique identifier of the link
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.hvc.Links``.
        :rtype: :class:`list` of :class:`Providers.Summary`
        :return: The :class:`list` of sync provider information.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If list fails.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            If the user is not authorized to perform this operation.
        """
        return self._invoke('list', {
            'link': link,
        })

    def get(
        self,
        link,
        provider,
    ):
        """
        Gets Sync information for a sync provider. Usage beyond VMware Cloud on
        AWS is not supported. **Warning:** This method is available as
        Technology Preview. These are early access APIs provided to test,
        automate and provide feedback on the feature. Since this can change
        based on feedback, VMware does not guarantee backwards compatibility
        and recommends against using them in production environments. Some
        Technology Preview APIs might only be applicable to specific
        environments.

        :type  link: :class:`str`
        :param link: Unique identifier of the link
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.hvc.Links``.
        :type  provider: :class:`str`
        :param provider: Unique identifier of the sync provider.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.hvc.sync.Providers``.
        :rtype: :class:`Providers.Info`
        :return: The Info of sync information for the provider.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if the system reports an error while responding to the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the sync provider associated with ``provider`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user is not authorized to perform this operation.
        """
        return self._invoke('get', {
            'link': link,
            'provider': provider,
        })

    def start(
        self,
        link,
        provider,
    ):
        """
        Initiates synchronization between the local and remote replicas for the
        sync provider. Usage beyond VMware Cloud on AWS is not supported.
        **Warning:** This method is available as Technology Preview. These are
        early access APIs provided to test, automate and provide feedback on
        the feature. Since this can change based on feedback, VMware does not
        guarantee backwards compatibility and recommends against using them in
        production environments. Some Technology Preview APIs might only be
        applicable to specific environments.

        :type  link: :class:`str`
        :param link: Unique identifier of the link
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.hvc.Links``.
        :type  provider: :class:`str`
        :param provider: Unique identifier representing the sync provider
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.hvc.sync.Providers``.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if the system reports an error while responding to the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the link associated with ``link`` does not exist if the provider
            associated with ``provider`` is not registered for sync
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user is not authorized to perform this operation.
        :raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy` 
            if a sync is already running.
        """
        return self._invoke('start', {
            'link': link,
            'provider': provider,
        })
class Policy(VapiInterface):
    """
    The ``Policy`` class provides methods to manage local user accounts. This
    class was added in vSphere API 6.7.
    """

    _VAPI_SERVICE_ID = 'com.vmware.appliance.local_accounts.policy'
    """
    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, _PolicyStub)
        self._VAPI_OPERATION_IDS = {}

    class Info(VapiStruct):
        """
        The ``Policy.Info`` class defines the global password policy. This class
        was added in vSphere API 6.7.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            max_days=None,
            min_days=None,
            warn_days=None,
        ):
            """
            :type  max_days: :class:`long` or ``None``
            :param max_days: Maximum number of days a password may be used. If the password is
                older than this, a password change will be forced. This attribute
                was added in vSphere API 6.7.
                If None then the restriction will be ignored.
            :type  min_days: :class:`long` or ``None``
            :param min_days: Minimum number of days allowed between password changes. Any
                password changes attempted sooner than this will be rejected. This
                attribute was added in vSphere API 6.7.
                If None then the restriction will be ignored.
            :type  warn_days: :class:`long` or ``None``
            :param warn_days: Number of days warning given before a password expires. A zero
                means warning is given only upon the day of expiration. This
                attribute was added in vSphere API 6.7.
                If None then no warning will be provided.
            """
            self.max_days = max_days
            self.min_days = min_days
            self.warn_days = warn_days
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.appliance.local_accounts.policy.info', {
                'max_days': type.OptionalType(type.IntegerType()),
                'min_days': type.OptionalType(type.IntegerType()),
                'warn_days': type.OptionalType(type.IntegerType()),
            }, Info, False, None))

    def get(self):
        """
        Get the global password policy. This method was added in vSphere API
        6.7.


        :rtype: :class:`Policy.Info`
        :return: Global password policy
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('get', None)

    def set(
        self,
        policy,
    ):
        """
        Set the global password policy. This method was added in vSphere API
        6.7.

        :type  policy: :class:`Policy.Info`
        :param policy: Global password policy
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if passed policy values are < -1 or > 99999
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('set', {
            'policy': policy,
        })
Example #14
0
class TokenExchange(VapiInterface):
    """
    The ``TokenExchange`` interface provides possibility to exchange between
    different tokens types. Implementation of "OAuth 2.0 Token Exchange"
    standard (https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-12).
    """
    TOKEN_EXCHANGE_GRANT = "urn:ietf:params:oauth:grant-type:token-exchange"
    """
    Class attribute indicates that token exchange grant type.

    """
    ACCESS_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:access_token"
    """
    Class attribute indicates OAuth 2.0 access token type.

    """
    REFRESH_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:refresh_token"
    """
    Class attribute indicates OAuth 2.0 refresh token type.

    """
    ID_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:id_token"
    """
    Class attribute indicates OIDC ID token type.

    """
    SAML1_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:saml1"
    """
    Class attribute indicates base64-encoded SAML 1.1 token type.

    """
    SAML2_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:saml2"
    """
    Class attribute indicates base64-encoded SAML 2.0 token type.

    """
    BEARER_TOKEN_METHOD_TYPE = "Bearer"
    """
    Class attribute indicates that the security token is a bearer token.

    """
    N_A_TOKEN_METHOD_TYPE = "N_A"
    """
    Class attribute indicates :attr:`TokenExchange.Info.token_type` identifier is
    not applicable in that context.

    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.tokenservice.token_exchange'
    """
    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, _TokenExchangeStub)
        self._VAPI_OPERATION_IDS = {}

    class ExchangeSpec(VapiStruct):
        """
        The ``TokenExchange.ExchangeSpec`` class contains arguments required for
        token exchange.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            grant_type=None,
            resource=None,
            audience=None,
            scope=None,
            requested_token_type=None,
            subject_token=None,
            subject_token_type=None,
            actor_token=None,
            actor_token_type=None,
        ):
            """
            :type  grant_type: :class:`str`
            :param grant_type: The value of :attr:`TokenExchange.TOKEN_EXCHANGE_GRANT` indicates
                that a token exchange is being performed.
            :type  resource: :class:`str` or ``None``
            :param resource: Indicates the location of the target service or resource where the
                client intends to use the requested security token.
                if can be inferred from other arguments or not needed for specific
                case of exchange.
            :type  audience: :class:`str` or ``None``
            :param audience: The logical name of the target service where the client intends to
                use the requested security token. This serves a purpose similar to
                the :attr:`TokenExchange.ExchangeSpec.resource` parameter, but with
                the client providing a logical name rather than a location.
                if can be inferred from other arguments or not needed for specific
                case of exchange.
            :type  scope: :class:`str` or ``None``
            :param scope: A list of space-delimited, case-sensitive strings, that allow the
                client to specify the desired scope of the requested security token
                in the context of the service or resource where the token will be
                used.
                if can be inferred from other arguments or not needed for specific
                case of exchange.
            :type  requested_token_type: :class:`str` or ``None``
            :param requested_token_type: An identifier for the type of the requested security token. If the
                requested type is unspecified, the issued token type is at the
                discretion of the server and may be dictated by knowledge of the
                requirements of the service or resource indicated by the
                :attr:`TokenExchange.ExchangeSpec.resource` or
                :attr:`TokenExchange.ExchangeSpec.audience` parameter.
                if can be inferred from other arguments or not needed for specific
                case of exchange.
            :type  subject_token: :class:`str`
            :param subject_token: A security token that represents the identity of the party on
                behalf of whom exchange is being made. Typically, the subject of
                this token will be the subject of the security token issued. Token
                is base64-encoded.
            :type  subject_token_type: :class:`str`
            :param subject_token_type: An identifier, that indicates the type of the security token in the
                :attr:`TokenExchange.ExchangeSpec.subject_token` parameter.
            :type  actor_token: :class:`str` or ``None``
            :param actor_token: A security token that represents the identity of the acting party.
                Typically, this will be the party that is authorized to use the
                requested security token and act on behalf of the subject.
                if not needed for specific case of exchange.
            :type  actor_token_type: :class:`str` or ``None``
            :param actor_token_type: An identifier, that indicates the type of the security token in the
                :attr:`TokenExchange.ExchangeSpec.actor_token` parameter.
                if :attr:`TokenExchange.ExchangeSpec.actor_token` parameter is not
                present.
            """
            self.grant_type = grant_type
            self.resource = resource
            self.audience = audience
            self.scope = scope
            self.requested_token_type = requested_token_type
            self.subject_token = subject_token
            self.subject_token_type = subject_token_type
            self.actor_token = actor_token
            self.actor_token_type = actor_token_type
            VapiStruct.__init__(self)

    ExchangeSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.tokenservice.token_exchange.exchange_spec', {
                'grant_type': type.StringType(),
                'resource': type.OptionalType(type.StringType()),
                'audience': type.OptionalType(type.StringType()),
                'scope': type.OptionalType(type.StringType()),
                'requested_token_type': type.OptionalType(type.StringType()),
                'subject_token': type.StringType(),
                'subject_token_type': type.StringType(),
                'actor_token': type.OptionalType(type.StringType()),
                'actor_token_type': type.OptionalType(type.StringType()),
            }, ExchangeSpec, False, None))

    class Info(VapiStruct):
        """
        The ``TokenExchange.Info`` class contains data that represents successful
        token exchange response.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            access_token=None,
            issued_token_type=None,
            token_type=None,
            expires_in=None,
            scope=None,
            refresh_token=None,
        ):
            """
            :type  access_token: :class:`str`
            :param access_token: The security token issued by the server in response to the token
                exchange request. Token is base64-encoded.
            :type  issued_token_type: :class:`str`
            :param issued_token_type: An identifier, that indicates the type of the security token in the
                :attr:`TokenExchange.Info.access_token` parameter.
            :type  token_type: :class:`str`
            :param token_type: A case-insensitive value specifying the method of using the access
                token issued.
            :type  expires_in: :class:`long` or ``None``
            :param expires_in: The validity lifetime, in seconds, of the token issued by the
                server.
                if not applicable for issued token.
            :type  scope: :class:`str` or ``None``
            :param scope: Scope of the issued security token.
                if the scope of the issued security token is identical to the scope
                requested by the client.
            :type  refresh_token: :class:`str` or ``None``
            :param refresh_token: A refresh token can be issued in cases where the client of the
                token exchange needs the ability to access a resource even when the
                original credential is no longer valid.
                if not needed for specific case of exchange.
            """
            self.access_token = access_token
            self.issued_token_type = issued_token_type
            self.token_type = token_type
            self.expires_in = expires_in
            self.scope = scope
            self.refresh_token = refresh_token
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.tokenservice.token_exchange.info', {
                'access_token': type.StringType(),
                'issued_token_type': type.StringType(),
                'token_type': type.StringType(),
                'expires_in': type.OptionalType(type.IntegerType()),
                'scope': type.OptionalType(type.StringType()),
                'refresh_token': type.OptionalType(type.StringType()),
            }, Info, False, None))

    def exchange(
        self,
        spec,
    ):
        """
        Exchanges incoming token based on the spec and current client
        authorization data.

        :type  spec: :class:`TokenExchange.ExchangeSpec`
        :param spec: ``TokenExchange.ExchangeSpec`` class contains arguments that define
            exchange process.
        :rtype: :class:`TokenExchange.Info`
        :return: :class:`TokenExchange.Info` class that contains new token.
        :raise: :class:`InvalidGrant` 
            provided authorization grant (e.g., authorization code, resource
            owner credentials) or refresh token is invalid, expired, revoked,
            does not match the redirection URI used in the authorization
            request, or was issued to another client.
        :raise: :class:`InvalidScope` 
            If the server is unwilling or unable to issue a token for all the
            target services indicated by the
            :attr:`TokenExchange.ExchangeSpec.resource` or
            :attr:`TokenExchange.ExchangeSpec.audience` parameters.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
             if authorization is not given to a caller.
        """
        return self._invoke('exchange', {
            'spec': spec,
        })
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'enforcement_point_name': type.StringType(),
            'ip_set_name': type.StringType(),
        })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        get_input_value_validator_list = [
        ]
        get_output_validator_list = [
        ]
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/policy/api/v1/global-infra/realized-state/enforcement-points/{enforcement-point-name}/ip-sets/ip-sets-nsxt/{ip-set-name}',
            path_variables={
                'enforcement_point_name': 'enforcement-point-name',
                'ip_set_name': 'ip-set-name',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'enforcement_point_name': type.StringType(),
            'cursor': type.OptionalType(type.StringType()),
            'included_fields': type.OptionalType(type.StringType()),
            'page_size': type.OptionalType(type.IntegerType()),
            'sort_ascending': type.OptionalType(type.BooleanType()),
            'sort_by': type.OptionalType(type.StringType()),
        })
        list_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        list_input_value_validator_list = [
        ]
        list_output_validator_list = [
        ]
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/policy/api/v1/global-infra/realized-state/enforcement-points/{enforcement-point-name}/ip-sets/ip-sets-nsxt',
            path_variables={
                'enforcement_point_name': 'enforcement-point-name',
            },
            query_parameters={
                'cursor': 'cursor',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            },
            content_type='application/json'
        )

        operations = {
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'GenericPolicyRealizedResource'),
                'errors': get_error_dict,
                'input_value_validator_list': get_input_value_validator_list,
                'output_validator_list': get_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'list': {
                'input_type': list_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'GenericPolicyRealizedResourceListResult'),
                'errors': list_error_dict,
                'input_value_validator_list': list_input_value_validator_list,
                'output_validator_list': list_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'get': get_rest_metadata,
            'list': list_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.nsx_policy.global_infra.realized_state.enforcement_points.ip_sets.ip_sets_nsxt',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #16
0
class Ipv4(VapiInterface):
    """
    The ``Ipv4`` class provides methods to perform IPv4 network configuration
    for interfaces. This class was added in vSphere API 6.7
    """


    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _Ipv4Stub)

    class Mode(Enum):
        """
        The ``Ipv4.Mode`` class defines different IPv4 address assignment modes.
        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>`.
        """
        DHCP = None
        """
        The IPv4 address is automatically assigned by a DHCP server. This class
        attribute was added in vSphere API 6.7

        """
        STATIC = None
        """
        The IPv4 address is static. This class attribute was added in vSphere API
        6.7

        """
        UNCONFIGURED = None
        """
        The IPv4 protocol is not configured. 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:`Mode` instance.
            """
            Enum.__init__(string)

    Mode._set_values([
        Mode('DHCP'),
        Mode('STATIC'),
        Mode('UNCONFIGURED'),
    ])
    Mode._set_binding_type(type.EnumType(
        'com.vmware.appliance.networking.interfaces.ipv4.mode',
        Mode))


    class Config(VapiStruct):
        """
        The ``Ipv4.Config`` class provides defines the IPv4 configuration of a
        network interface. 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(
                'mode',
                {
                    'STATIC' : [('address', True), ('prefix', True)],
                    'DHCP' : [],
                    'UNCONFIGURED' : [],
                }
            ),
        ]



        def __init__(self,
                     mode=None,
                     address=None,
                     prefix=None,
                     default_gateway=None,
                    ):
            """
            :type  mode: :class:`Ipv4.Mode`
            :param mode: The Address assignment mode. This attribute was added in vSphere
                API 6.7
            :type  address: :class:`str`
            :param address: The IPv4 address, for example, "10.20.80.191". This attribute was
                added in vSphere API 6.7
                This attribute is optional and it is only relevant when the value
                of ``mode`` is :attr:`Ipv4.Mode.STATIC`.
            :type  prefix: :class:`long`
            :param prefix: The IPv4 CIDR prefix, for example, 24. See
                http://www.oav.net/mirrors/cidr.html for netmask-to-prefix
                conversion. This attribute was added in vSphere API 6.7
                This attribute is optional and it is only relevant when the value
                of ``mode`` is :attr:`Ipv4.Mode.STATIC`.
            :type  default_gateway: :class:`str` or ``None``
            :param default_gateway: The IPv4 address of the default gateway. This configures the global
                default gateway on the appliance with the specified gateway address
                and interface. This gateway replaces the existing default gateway
                configured on the appliance. However, if the gateway address is
                link-local, then it is added for that interface. This does not
                support configuration of multiple global default gateways through
                different interfaces. This attribute was added in vSphere API 6.7
                If None, the defaultGateway was never set.
            """
            self.mode = mode
            self.address = address
            self.prefix = prefix
            self.default_gateway = default_gateway
            VapiStruct.__init__(self)

    Config._set_binding_type(type.StructType(
        'com.vmware.appliance.networking.interfaces.ipv4.config', {
            'mode': type.ReferenceType(__name__, 'Ipv4.Mode'),
            'address': type.OptionalType(type.StringType()),
            'prefix': type.OptionalType(type.IntegerType()),
            'default_gateway': type.OptionalType(type.StringType()),
        },
        Config,
        False,
        None))


    class Info(VapiStruct):
        """
        The ``Ipv4.Info`` class defines current IPv4 configuration state of a
        network interface. 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(
                'mode',
                {
                    'STATIC' : [('address', True), ('prefix', True), ('default_gateway', True)],
                    'DHCP' : [('address', True), ('prefix', True), ('default_gateway', True)],
                    'UNCONFIGURED' : [],
                }
            ),
        ]



        def __init__(self,
                     configurable=None,
                     mode=None,
                     address=None,
                     prefix=None,
                     default_gateway=None,
                    ):
            """
            :type  configurable: :class:`bool`
            :param configurable: The specified network interface is configurable or not. This
                attribute was added in vSphere API 6.7
            :type  mode: :class:`Ipv4.Mode`
            :param mode: The Address assignment mode. This attribute was added in vSphere
                API 6.7
            :type  address: :class:`str`
            :param address: The IPv4 address, for example, "10.20.80.191". This attribute was
                added in vSphere API 6.7
                This attribute is optional and it is only relevant when the value
                of ``mode`` is one of :attr:`Ipv4.Mode.STATIC` or
                :attr:`Ipv4.Mode.DHCP`.
            :type  prefix: :class:`long`
            :param prefix: The IPv4 CIDR prefix, for example, 24. See
                http://www.oav.net/mirrors/cidr.html for netmask-to-prefix
                conversion. This attribute was added in vSphere API 6.7
                This attribute is optional and it is only relevant when the value
                of ``mode`` is one of :attr:`Ipv4.Mode.STATIC` or
                :attr:`Ipv4.Mode.DHCP`.
            :type  default_gateway: :class:`str`
            :param default_gateway: The IPv4 address of the default gateway. This configures the global
                default gateway on the appliance with the specified gateway address
                and interface. This gateway replaces the existing default gateway
                configured on the appliance. However, if the gateway address is
                link-local, then it is added for that interface. This does not
                support configuration of multiple global default gateways through
                different interfaces. This attribute was added in vSphere API 6.7
                This attribute is optional and it is only relevant when the value
                of ``mode`` is one of :attr:`Ipv4.Mode.STATIC` or
                :attr:`Ipv4.Mode.DHCP`.
            """
            self.configurable = configurable
            self.mode = mode
            self.address = address
            self.prefix = prefix
            self.default_gateway = default_gateway
            VapiStruct.__init__(self)

    Info._set_binding_type(type.StructType(
        'com.vmware.appliance.networking.interfaces.ipv4.info', {
            'configurable': type.BooleanType(),
            'mode': type.ReferenceType(__name__, 'Ipv4.Mode'),
            'address': type.OptionalType(type.StringType()),
            'prefix': type.OptionalType(type.IntegerType()),
            'default_gateway': type.OptionalType(type.StringType()),
        },
        Info,
        False,
        None))



    def set(self,
            interface_name,
            config,
            ):
        """
        Set IPv4 network configuration for specific network interface. This
        method was added in vSphere API 6.7

        :type  interface_name: :class:`str`
        :param interface_name: Network interface to update, for example, "nic0".
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.networking.interfaces``.
        :type  config: :class:`Ipv4.Config`
        :param config: The IPv4 Network configuration to set.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the specified NIC is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the IP is used as PNID
        :raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy` 
            if the specified NIC is busy.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error.
        """
        return self._invoke('set',
                            {
                            'interface_name': interface_name,
                            'config': config,
                            })

    def get(self,
            interface_name,
            ):
        """
        Get IPv4 network configuration for specific NIC. This method was added
        in vSphere API 6.7

        :type  interface_name: :class:`str`
        :param interface_name: The Network interface to query, for example, "nic0".
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.networking.interfaces``.
        :rtype: :class:`Ipv4.Info`
        :return: The IPv4 configuration for the queried NIC.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the specified NIC is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error.
        """
        return self._invoke('get',
                            {
                            'interface_name': interface_name,
                            })
        self.hostname = hostname
        self.username = username
        self.password = password
        self.https_port = https_port
        self.ssl_verify = ssl_verify
        self.ssl_thumbprint = ssl_thumbprint
        VapiStruct.__init__(self)


Connection._set_binding_type(
    type.StructType(
        'com.vmware.vcenter.lcm.common.connection', {
            'hostname': type.StringType(),
            'username': type.StringType(),
            'password': type.SecretType(),
            'https_port': type.OptionalType(type.IntegerType()),
            'ssl_verify': type.OptionalType(type.BooleanType()),
            'ssl_thumbprint': type.OptionalType(type.StringType()),
        }, Connection, False, None))


class EsxPlacementConfig(VapiStruct):
    """
    The ``EsxPlacementConfig`` class contains configuration of ESX placement of
    the target appliance.

    .. tip::
        The arguments are used to initialize data attributes with the same
        names.
    """
    def __init__(
            be incremented. This attribute was added in vSphere API 6.7.
        :type  message: :class:`com.vmware.vapi.std_client.LocalizableMessage`
        :param message: Message about the work progress. This attribute was added in
            vSphere API 6.7.
        """
        self.total = total
        self.completed = completed
        self.message = message
        VapiStruct.__init__(self)


Progress._set_binding_type(
    type.StructType(
        'com.vmware.cis.task.progress', {
            'total':
            type.IntegerType(),
            'completed':
            type.IntegerType(),
            'message':
            type.ReferenceType('com.vmware.vapi.std_client',
                               'LocalizableMessage'),
        }, Progress, False, None))


class CommonInfo(VapiStruct):
    """
    The ``CommonInfo`` class contains information common to all tasks. This
    class was added in vSphere API 6.7.

    .. tip::
        The arguments are used to initialize data attributes with the same
    def __init__(self, config):
        # properties for create operation
        create_input_type = type.StructType(
            'operation-input', {
                'logical_router_id':
                type.StringType(),
                'static_hop_bfd_peer':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'StaticHopBfdPeer'),
            })
        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/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers',
            request_body_parameter='static_hop_bfd_peer',
            path_variables={
                'logical_router_id': 'logical-router-id',
            },
            query_parameters={},
            content_type='application/json')

        # properties for delete operation
        delete_input_type = type.StructType(
            'operation-input', {
                'logical_router_id': type.StringType(),
                'bfd_peer_id': type.StringType(),
                'force': type.OptionalType(type.BooleanType()),
            })
        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/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}',
            path_variables={
                'logical_router_id': 'logical-router-id',
                'bfd_peer_id': 'bfd-peer-id',
            },
            query_parameters={
                'force': 'force',
            },
            content_type='application/json')

        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'logical_router_id': type.StringType(),
                'bfd_peer_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/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}',
            path_variables={
                'logical_router_id': 'logical-router-id',
                'bfd_peer_id': 'bfd-peer-id',
            },
            query_parameters={},
            content_type='application/json')

        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'logical_router_id': type.StringType(),
                'cursor': type.OptionalType(type.StringType()),
                'included_fields': type.OptionalType(type.StringType()),
                'page_size': type.OptionalType(type.IntegerType()),
                'sort_ascending': type.OptionalType(type.BooleanType()),
                'sort_by': type.OptionalType(type.StringType()),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/api/v1/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers',
            path_variables={
                'logical_router_id': 'logical-router-id',
            },
            query_parameters={
                'cursor': 'cursor',
                'included_fields': 'included_fields',
                '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', {
                'logical_router_id':
                type.StringType(),
                'bfd_peer_id':
                type.StringType(),
                'static_hop_bfd_peer':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'StaticHopBfdPeer'),
            })
        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/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}',
            request_body_parameter='static_hop_bfd_peer',
            path_variables={
                'logical_router_id': 'logical-router-id',
                'bfd_peer_id': 'bfd-peer-id',
            },
            query_parameters={},
            content_type='application/json')

        operations = {
            'create': {
                'input_type':
                create_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'StaticHopBfdPeer'),
                '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',
                                   'StaticHopBfdPeer'),
                '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',
                                   'StaticHopBfdPeerListResult'),
                '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',
                                   'StaticHopBfdPeer'),
                '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.logical_routers.routing.static_routes.bfd_peers',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #20
0
    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(),
                'start_time': type.OptionalType(type.IntegerType()),
                'end_time': type.OptionalType(type.IntegerType()),
            })
        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/interfaces',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
                'edge_id': 'edgeId',
            },
            query_parameters={
                'start_time': 'startTime',
                'end_time': 'endTime',
            },
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.vmc.model_client',
                                   'CbmStatistics'),
                '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.interfaces',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #21
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'server_id': type.StringType(),
                'binding_id': type.StringType(),
                'barrier_id': type.OptionalType(type.IntegerType()),
                'request_id': 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/dhcp/servers/{server-id}/static-bindings/{binding-id}/state',
            path_variables={
                'server_id': 'server-id',
                'binding_id': 'binding-id',
            },
            query_parameters={
                'barrier_id': 'barrier_id',
                'request_id': 'request_id',
            },
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'ConfigurationState'),
                '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.dhcp.servers.static_bindings.state',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
class Proxy(VapiInterface):
    """
    The ``Proxy`` class provides methods Proxy configuration. This class was
    added in vSphere API 6.7
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _ProxyStub)

    class Protocol(Enum):
        """
        ``Proxy.Protocol`` class defines the protocols for which proxying is
        supported. This enumeration was added in vSphere API 6.7

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

        """
        HTTPS = None
        """
        Proxy configuration for https. This class attribute was added in vSphere
        API 6.7

        """
        FTP = None
        """
        Proxy configuration for ftp. This class attribute was added in vSphere API
        6.7

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

    Protocol._set_values([
        Protocol('HTTP'),
        Protocol('HTTPS'),
        Protocol('FTP'),
    ])
    Protocol._set_binding_type(
        type.EnumType('com.vmware.appliance.networking.proxy.protocol',
                      Protocol))

    class ServerStatus(Enum):
        """
        ``Proxy.ServerStatus`` class defines the status of the server associated
        with the test run. This enumeration was added in vSphere API 6.7

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

        """
        SERVER_UNREACHABLE = None
        """
        Server is unreachable. This class attribute was added in vSphere API 6.7

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

    ServerStatus._set_values([
        ServerStatus('SERVER_REACHABLE'),
        ServerStatus('SERVER_UNREACHABLE'),
    ])
    ServerStatus._set_binding_type(
        type.EnumType('com.vmware.appliance.networking.proxy.server_status',
                      ServerStatus))

    class Config(VapiStruct):
        """
        The ``Proxy.Config`` class defines proxy configuration. This class was
        added in vSphere API 6.7

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            server=None,
            port=None,
            username=None,
            password=None,
            enabled=None,
        ):
            """
            :type  server: :class:`str`
            :param server: Hostname or IP address of the proxy server. This attribute was
                added in vSphere API 6.7
            :type  port: :class:`long`
            :param port: Port to connect to the proxy server. In a 'get' call, indicates the
                port connected to the proxy server. In a 'set' call, specifies the
                port to connect to the proxy server. A value of -1 indicates the
                default port. This attribute was added in vSphere API 6.7
            :type  username: :class:`str` or ``None``
            :param username: Username for proxy server. This attribute was added in vSphere API
                6.7
                Only :class:`set` if proxy requires username.
            :type  password: :class:`str` or ``None``
            :param password: Password for proxy server. This attribute was added in vSphere API
                6.7
                Only :class:`set` if proxy requires password.
            :type  enabled: :class:`bool`
            :param enabled: In the result of the ``#get`` and ``#list`` methods this attribute
                indicates whether proxying is enabled for a particular protocol. In
                the input to the ``test`` and ``set`` methods this attribute
                specifies whether proxying should be enabled for a particular
                protocol. This attribute was added in vSphere API 6.7
            """
            self.server = server
            self.port = port
            self.username = username
            self.password = password
            self.enabled = enabled
            VapiStruct.__init__(self)

    Config._set_binding_type(
        type.StructType(
            'com.vmware.appliance.networking.proxy.config', {
                'server': type.StringType(),
                'port': type.IntegerType(),
                'username': type.OptionalType(type.StringType()),
                'password': type.OptionalType(type.SecretType()),
                'enabled': type.BooleanType(),
            }, Config, False, None))

    class TestResult(VapiStruct):
        """
        The ``Proxy.TestResult`` class contains information about the test
        operation done on a proxy server. This class was added in vSphere API 6.7

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            status=None,
            message=None,
        ):
            """
            :type  status: :class:`Proxy.ServerStatus`
            :param status: Status of the proxy server indicating whether the proxy server is
                reachable. This attribute was added in vSphere API 6.7
            :type  message: :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param message: Message associated with status. This attribute was added in vSphere
                API 6.7
            """
            self.status = status
            self.message = message
            VapiStruct.__init__(self)

    TestResult._set_binding_type(
        type.StructType(
            'com.vmware.appliance.networking.proxy.test_result', {
                'status':
                type.ReferenceType(__name__, 'Proxy.ServerStatus'),
                'message':
                type.ReferenceType('com.vmware.vapi.std_client',
                                   'LocalizableMessage'),
            }, TestResult, False, None))

    def test(
        self,
        host,
        protocol,
        config,
    ):
        """
        Tests a proxy configuration by testing the connection to the proxy
        server and test host. This method was added in vSphere API 6.7

        :type  host: :class:`str`
        :param host: A hostname, IPv4 or Ipv6 address.
        :type  protocol: :class:`str`
        :param protocol: Protocol whose proxy is to be tested.
        :type  config: :class:`Proxy.Config`
        :param config: Proxy configuration to test.
        :rtype: :class:`Proxy.TestResult`
        :return: Status of proxy settings.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error.
        """
        return self._invoke('test', {
            'host': host,
            'protocol': protocol,
            'config': config,
        })

    def set(
        self,
        protocol,
        config,
    ):
        """
        Configures which proxy server to use for the specified protocol. This
        operation sets environment variables for using proxy. In order for this
        configuration to take effect a logout / service restart is required.
        This method was added in vSphere API 6.7

        :type  protocol: :class:`str`
        :param protocol: The protocol for which proxy should be set.
        :type  config: :class:`Proxy.Config`
        :param config: Proxy configuration for the specific protocol.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error.
        """
        return self._invoke('set', {
            'protocol': protocol,
            'config': config,
        })

    def delete(
        self,
        protocol,
    ):
        """
        Deletes a proxy configuration for a specific protocol. This method was
        added in vSphere API 6.7

        :type  protocol: :class:`str`
        :param protocol: ID whose proxy is to be deleted.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error.
        """
        return self._invoke('delete', {
            'protocol': protocol,
        })

    def list(self):
        """
        Gets proxy configuration for all configured protocols. This method was
        added in vSphere API 6.7


        :rtype: :class:`dict` of :class:`Proxy.Protocol` and :class:`Proxy.Config`
        :return: Proxy configuration for all configured protocols.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error.
        """
        return self._invoke('list', None)

    def get(
        self,
        protocol,
    ):
        """
        Gets the proxy configuration for a specific protocol. This method was
        added in vSphere API 6.7

        :type  protocol: :class:`str`
        :param protocol: The protocol whose proxy configuration is requested.
        :rtype: :class:`Proxy.Config`
        :return: Proxy configuration for a specific protocol.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error.
        """
        return self._invoke('get', {
            'protocol': protocol,
        })
Example #23
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(),
                'interface_id': type.StringType(),
                'cursor': type.OptionalType(type.StringType()),
                'enforcement_point_path': type.OptionalType(type.StringType()),
                'included_fields': type.OptionalType(type.StringType()),
                'page_size': type.OptionalType(type.IntegerType()),
                'sort_ascending': type.OptionalType(type.BooleanType()),
                'sort_by': type.OptionalType(type.StringType()),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/policy/api/v1/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/statistics/summary',
            path_variables={
                'tier0_id': 'tier-0-id',
                'locale_service_id': 'locale-service-id',
                'interface_id': 'interface-id',
            },
            query_parameters={
                'cursor': 'cursor',
                'enforcement_point_path': 'enforcement_point_path',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            },
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx_policy.model_client',
                                   'PolicyInterfaceStatisticsSummary'),
                '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.interfaces.statistics.summary',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #24
0
class Archive(VapiInterface):
    """
    The ``Archive`` class provides methods to get the backup information. This
    class was added in vSphere API 6.7.
    """

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

    class Info(VapiStruct):
        """
        The ``Archive.Info`` class represents backup archive information. This
        class was added in vSphere API 6.7.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            timestamp=None,
            location=None,
            parts=None,
            version=None,
            system_name=None,
            comment=None,
        ):
            """
            :type  timestamp: :class:`datetime.datetime`
            :param timestamp: Time when this backup was completed. This attribute was added in
                vSphere API 6.7.
            :type  location: :class:`str`
            :param location: Backup location URL. This attribute was added in vSphere API 6.7.
            :type  parts: :class:`list` of :class:`str`
            :param parts: List of parts included in the backup. This attribute was added in
                vSphere API 6.7.
            :type  version: :class:`str`
            :param version: The version of the appliance represented by the backup. This
                attribute was added in vSphere API 6.7.
            :type  system_name: :class:`str`
            :param system_name: The system name identifier of the appliance represented by the
                backup. This attribute was added in vSphere API 6.7.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.appliance.recovery.backup.system_name``. When methods
                return a value of this class as a return value, the attribute will
                be an identifier for the resource type:
                ``com.vmware.appliance.recovery.backup.system_name``.
            :type  comment: :class:`str`
            :param comment: Custom comment added by the user for this backup. This attribute
                was added in vSphere API 6.7.
            """
            self.timestamp = timestamp
            self.location = location
            self.parts = parts
            self.version = version
            self.system_name = system_name
            self.comment = comment
            VapiStruct.__init__(self)

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

    class Summary(VapiStruct):
        """
        The ``Archive.Summary`` class contains commonly used information about a
        backup archive. This class was added in vSphere API 6.7.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            archive=None,
            timestamp=None,
            version=None,
            comment=None,
        ):
            """
            :type  archive: :class:`str`
            :param archive: Backup archive identifier. This attribute was added in vSphere API
                6.7.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.appliance.recovery.backup.system_name.archive``. When
                methods return a value of this class as a return value, the
                attribute will be an identifier for the resource type:
                ``com.vmware.appliance.recovery.backup.system_name.archive``.
            :type  timestamp: :class:`datetime.datetime`
            :param timestamp: Time when this backup was started. This attribute was added in
                vSphere API 6.7.
            :type  version: :class:`str`
            :param version: The version of the appliance represented by the backup archive.
                This attribute was added in vSphere API 6.7.
            :type  comment: :class:`str`
            :param comment: Custom comment added by the user for this backup. This attribute
                was added in vSphere API 6.7.
            """
            self.archive = archive
            self.timestamp = timestamp
            self.version = version
            self.comment = comment
            VapiStruct.__init__(self)

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

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

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            start_timestamp=None,
            end_timestamp=None,
            comment_substring=None,
            max_results=None,
        ):
            """
            :type  start_timestamp: :class:`datetime.datetime` or ``None``
            :param start_timestamp: Backup must have been taken on or after this time to match the
                filter. This attribute was added in vSphere API 6.7.
                If None the filter will match oldest backups.
            :type  end_timestamp: :class:`datetime.datetime` or ``None``
            :param end_timestamp: Backup must have been taken on or before this time to match the
                filter. This attribute was added in vSphere API 6.7.
                If None the filter will match most recent backups.
            :type  comment_substring: :class:`str` or ``None``
            :param comment_substring: Backup comment must contain this :class:`str` to match the filter.
                This attribute was added in vSphere API 6.7.
                If None the filter will match backups with any comment.
            :type  max_results: :class:`long` or ``None``
            :param max_results: Limit result to a max count of most recent backups. This attribute
                was added in vSphere API 6.7.
                If None it defaults to 128.
            """
            self.start_timestamp = start_timestamp
            self.end_timestamp = end_timestamp
            self.comment_substring = comment_substring
            self.max_results = max_results
            VapiStruct.__init__(self)

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

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

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

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

        :type  loc_spec: :class:`com.vmware.appliance.recovery.backup_client.LocationSpec`
        :param loc_spec: LocationSpec Structure.
        :type  system_name: :class:`str`
        :param system_name: System name identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.recovery.backup.system_name``.
        :type  filter_spec: :class:`Archive.FilterSpec`
        :param filter_spec: Specification of matching backups for which information should be
            returned.
        :rtype: :class:`list` of :class:`Archive.Summary`
        :return: Commonly used information about the backup archives.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if combination of ``loc_spec`` and system name does not refer to an
            existing location on the backup server.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any error occurs during the execution of the operation.
        """
        return self._invoke(
            'list', {
                'loc_spec': loc_spec,
                'system_name': system_name,
                'filter_spec': filter_spec,
            })
Example #25
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'lport_id': type.StringType(),
                'cursor': type.OptionalType(type.StringType()),
                'included_fields': type.OptionalType(type.StringType()),
                'page_size': type.OptionalType(type.IntegerType()),
                'sort_ascending': type.OptionalType(type.BooleanType()),
                'sort_by': type.OptionalType(type.StringType()),
                'source': type.OptionalType(type.StringType()),
                'transport_node_id': 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/logical-ports/{lport-id}/mac-table',
            path_variables={
                'lport_id': 'lport-id',
            },
            query_parameters={
                'cursor': 'cursor',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
                'source': 'source',
                'transport_node_id': 'transport_node_id',
            },
            content_type='application/json')

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ReferenceType('com.vmware.nsx.model_client',
                                   'LogicalPortMacAddressListResult'),
                '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.logical_ports.mac_table',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #26
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'enforcement_point_name': type.StringType(),
            'cursor': type.OptionalType(type.StringType()),
            'dsl': type.OptionalType(type.StringType()),
            'included_fields': type.OptionalType(type.StringType()),
            'page_size': type.OptionalType(type.IntegerType()),
            'query': type.OptionalType(type.StringType()),
            '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}/virtual-machines',
            path_variables={
                'enforcement_point_name': 'enforcement-point-name',
            },
            query_parameters={
                'cursor': 'cursor',
                'dsl': 'dsl',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'query': 'query',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            },
            content_type='application/json'
        )

        # properties for updatetags operation
        updatetags_input_type = type.StructType('operation-input', {
            'enforcement_point_name': type.StringType(),
            'virtual_machine_tags_update': type.ReferenceType('com.vmware.nsx_policy.model_client', 'VirtualMachineTagsUpdate'),
        })
        updatetags_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'),

        }
        updatetags_input_value_validator_list = [
        ]
        updatetags_output_validator_list = [
        ]
        updatetags_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/policy/api/v1/infra/realized-state/enforcement-points/{enforcement-point-name}/virtual-machines?action=update_tags',
            request_body_parameter='virtual_machine_tags_update',
            path_variables={
                'enforcement_point_name': 'enforcement-point-name',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'SearchResponse'),
                'errors': list_error_dict,
                'input_value_validator_list': list_input_value_validator_list,
                'output_validator_list': list_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'updatetags': {
                'input_type': updatetags_input_type,
                'output_type': type.VoidType(),
                'errors': updatetags_error_dict,
                'input_value_validator_list': updatetags_input_value_validator_list,
                'output_validator_list': updatetags_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'list': list_rest_metadata,
            'updatetags': updatetags_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.nsx_policy.infra.realized_state.enforcement_points.virtual_machines',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #27
0
class Shell(VapiInterface):
    """
    ``Shell`` class provides methods Get/Set enabled state of BASH.
    """

    _VAPI_SERVICE_ID = 'com.vmware.appliance.access.shell'
    """
    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, _ShellStub)
        self._VAPI_OPERATION_IDS = {}

    class ShellConfig(VapiStruct):
        """
        ``Shell.ShellConfig`` class Structure that defines shell configuration.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            enabled=None,
            timeout=None,
        ):
            """
            :type  enabled: :class:`bool`
            :param enabled: Enabled can be set to true or false
            :type  timeout: :class:`long`
            :param timeout: The timeout (in seconds) specifies how long you enable the Shell
                access. The maximum timeout is 86400 seconds(1 day).
            """
            self.enabled = enabled
            self.timeout = timeout
            VapiStruct.__init__(self)

    ShellConfig._set_binding_type(
        type.StructType('com.vmware.appliance.access.shell.shell_config', {
            'enabled': type.BooleanType(),
            'timeout': type.IntegerType(),
        }, ShellConfig, False, None))

    def set(
        self,
        config,
    ):
        """
        Set enabled state of BASH, that is, access to BASH from within the
        controlled CLI.

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

    def get(self):
        """
        Get enabled state of BASH, that is, access to BASH from within the
        controlled CLI.


        :rtype: :class:`Shell.ShellConfig`
        :return: Current shell configuration.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            Generic error
        """
        return self._invoke('get', None)
Example #28
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'session_timer_profile_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/session-timer-profiles/{session-timer-profile-id}/bindings',
            path_variables={
                'session_timer_profile_id': 'session-timer-profile-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',
                                   'SessionTimerProfileBindingListResult'),
                '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.session_timer_profiles.bindings',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #29
0
    def __init__(self, config):
        # properties for delete operation
        delete_input_type = type.StructType('operation-input', {
            'domain_id': type.StringType(),
            'communication_map_id': type.StringType(),
            'communication_entry_id': type.StringType(),
        })
        delete_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        delete_input_value_validator_list = [
        ]
        delete_output_validator_list = [
        ]
        delete_rest_metadata = OperationRestMetadata(
            http_method='DELETE',
            url_template='/policy/api/v1/global-infra/domains/{domain-id}/communication-maps/{communication-map-id}/communication-entries/{communication-entry-id}',
            path_variables={
                'domain_id': 'domain-id',
                'communication_map_id': 'communication-map-id',
                'communication_entry_id': 'communication-entry-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'domain_id': type.StringType(),
            'communication_map_id': type.StringType(),
            'communication_entry_id': type.StringType(),
        })
        get_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        get_input_value_validator_list = [
        ]
        get_output_validator_list = [
            HasFieldsOfValidator()
        ]
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/policy/api/v1/global-infra/domains/{domain-id}/communication-maps/{communication-map-id}/communication-entries/{communication-entry-id}',
            path_variables={
                'domain_id': 'domain-id',
                'communication_map_id': 'communication-map-id',
                'communication_entry_id': 'communication-entry-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'domain_id': type.StringType(),
            'communication_map_id': type.StringType(),
            'cursor': type.OptionalType(type.StringType()),
            'include_mark_for_delete_objects': type.OptionalType(type.BooleanType()),
            'included_fields': type.OptionalType(type.StringType()),
            'page_size': type.OptionalType(type.IntegerType()),
            'sort_ascending': type.OptionalType(type.BooleanType()),
            'sort_by': type.OptionalType(type.StringType()),
        })
        list_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        list_input_value_validator_list = [
        ]
        list_output_validator_list = [
            HasFieldsOfValidator()
        ]
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/policy/api/v1/global-infra/domains/{domain-id}/communication-maps/{communication-map-id}/communication-entries',
            path_variables={
                'domain_id': 'domain-id',
                'communication_map_id': 'communication-map-id',
            },
            query_parameters={
                'cursor': 'cursor',
                'include_mark_for_delete_objects': 'include_mark_for_delete_objects',
                'included_fields': 'included_fields',
                'page_size': 'page_size',
                'sort_ascending': 'sort_ascending',
                'sort_by': 'sort_by',
            },
            content_type='application/json'
        )

        # properties for patch operation
        patch_input_type = type.StructType('operation-input', {
            'domain_id': type.StringType(),
            'communication_map_id': type.StringType(),
            'communication_entry_id': type.StringType(),
            'communication_entry': type.ReferenceType('com.vmware.nsx_policy.model_client', 'CommunicationEntry'),
        })
        patch_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        patch_input_value_validator_list = [
            HasFieldsOfValidator()
        ]
        patch_output_validator_list = [
        ]
        patch_rest_metadata = OperationRestMetadata(
            http_method='PATCH',
            url_template='/policy/api/v1/global-infra/domains/{domain-id}/communication-maps/{communication-map-id}/communication-entries/{communication-entry-id}',
            request_body_parameter='communication_entry',
            path_variables={
                'domain_id': 'domain-id',
                'communication_map_id': 'communication-map-id',
                'communication_entry_id': 'communication-entry-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        # properties for revise operation
        revise_input_type = type.StructType('operation-input', {
            'domain_id': type.StringType(),
            'communication_map_id': type.StringType(),
            'communication_entry_id': type.StringType(),
            'communication_entry': type.ReferenceType('com.vmware.nsx_policy.model_client', 'CommunicationEntry'),
            'anchor_path': type.OptionalType(type.StringType()),
            'operation': type.OptionalType(type.StringType()),
        })
        revise_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        revise_input_value_validator_list = [
            HasFieldsOfValidator()
        ]
        revise_output_validator_list = [
            HasFieldsOfValidator()
        ]
        revise_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/policy/api/v1/global-infra/domains/{domain-id}/communication-maps/{communication-map-id}/communication-entries/{communication-entry-id}?action=revise',
            request_body_parameter='communication_entry',
            path_variables={
                'domain_id': 'domain-id',
                'communication_map_id': 'communication-map-id',
                'communication_entry_id': 'communication-entry-id',
            },
            query_parameters={
                'anchor_path': 'anchor_path',
                'operation': 'operation',
            },
            content_type='application/json'
        )

        # properties for update operation
        update_input_type = type.StructType('operation-input', {
            'domain_id': type.StringType(),
            'communication_map_id': type.StringType(),
            'communication_entry_id': type.StringType(),
            'communication_entry': type.ReferenceType('com.vmware.nsx_policy.model_client', 'CommunicationEntry'),
        })
        update_error_dict = {
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.internal_server_error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        update_input_value_validator_list = [
            HasFieldsOfValidator()
        ]
        update_output_validator_list = [
            HasFieldsOfValidator()
        ]
        update_rest_metadata = OperationRestMetadata(
            http_method='PUT',
            url_template='/policy/api/v1/global-infra/domains/{domain-id}/communication-maps/{communication-map-id}/communication-entries/{communication-entry-id}',
            request_body_parameter='communication_entry',
            path_variables={
                'domain_id': 'domain-id',
                'communication_map_id': 'communication-map-id',
                'communication_entry_id': 'communication-entry-id',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        operations = {
            'delete': {
                'input_type': delete_input_type,
                'output_type': type.VoidType(),
                'errors': delete_error_dict,
                'input_value_validator_list': delete_input_value_validator_list,
                'output_validator_list': delete_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'CommunicationEntry'),
                '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', 'CommunicationEntryListResult'),
                'errors': list_error_dict,
                'input_value_validator_list': list_input_value_validator_list,
                'output_validator_list': list_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'patch': {
                'input_type': patch_input_type,
                'output_type': type.VoidType(),
                'errors': patch_error_dict,
                'input_value_validator_list': patch_input_value_validator_list,
                'output_validator_list': patch_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'revise': {
                'input_type': revise_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'CommunicationEntry'),
                'errors': revise_error_dict,
                'input_value_validator_list': revise_input_value_validator_list,
                'output_validator_list': revise_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'update': {
                'input_type': update_input_type,
                'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'CommunicationEntry'),
                'errors': update_error_dict,
                'input_value_validator_list': update_input_value_validator_list,
                'output_validator_list': update_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'delete': delete_rest_metadata,
            'get': get_rest_metadata,
            'list': list_rest_metadata,
            'patch': patch_rest_metadata,
            'revise': revise_rest_metadata,
            'update': update_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.nsx_policy.global_infra.domains.communication_maps.communication_entries',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=False)
class TlsCsr(VapiInterface):
    """
    The ``TlsCsr`` interface provides methods to generate certificate signing
    request. This class was added in vSphere API 6.7.2.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.certificate_management.vcenter.tls_csr'
    """
    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, _TlsCsrStub)

    class Info(VapiStruct):
        """
        The ``TlsCsr.Info`` class contains information for a Certificate signing
        request. 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,
            csr=None,
        ):
            """
            :type  csr: :class:`str`
            :param csr: Certificate Signing Request in PEM format. This attribute was added
                in vSphere API 6.7.2.
            """
            self.csr = csr
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.certificate_management.vcenter.tls_csr.info', {
                'csr': type.StringType(),
            }, Info, False, None))

    class Spec(VapiStruct):
        """
        The ``TlsCsr.Spec`` class contains information to generate a Private Key
        and CSR. This class was added in vSphere API 6.7.2.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            key_size=None,
            common_name=None,
            organization=None,
            organization_unit=None,
            locality=None,
            state_or_province=None,
            country=None,
            email_address=None,
            subject_alt_name=None,
        ):
            """
            :type  key_size: :class:`long` or ``None``
            :param key_size: This attribute was added in vSphere API 6.7.2.
                keySize will take 2048 bits if not modified.
            :type  common_name: :class:`str` or ``None``
            :param common_name: This attribute was added in vSphere API 6.7.2.
                commonName will take PNID if not modified.
            :type  organization: :class:`str`
            :param organization: Organization field in certificate subject. This attribute was added
                in vSphere API 6.7.2.
            :type  organization_unit: :class:`str`
            :param organization_unit: Organization unit field in certificate subject. This attribute was
                added in vSphere API 6.7.2.
            :type  locality: :class:`str`
            :param locality: Locality field in certificate subject. This attribute was added in
                vSphere API 6.7.2.
            :type  state_or_province: :class:`str`
            :param state_or_province: State field in certificate subject. This attribute was added in
                vSphere API 6.7.2.
            :type  country: :class:`str`
            :param country: Country field in certificate subject. This attribute was added in
                vSphere API 6.7.2.
            :type  email_address: :class:`str`
            :param email_address: Email field in Certificate extensions. This attribute was added in
                vSphere API 6.7.2.
            :type  subject_alt_name: :class:`list` of :class:`str` or ``None``
            :param subject_alt_name: This attribute was added in vSphere API 6.7.2.
                subjectAltName is list of Dns Names and Ip addresses
            """
            self.key_size = key_size
            self.common_name = common_name
            self.organization = organization
            self.organization_unit = organization_unit
            self.locality = locality
            self.state_or_province = state_or_province
            self.country = country
            self.email_address = email_address
            self.subject_alt_name = subject_alt_name
            VapiStruct.__init__(self)

    Spec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.certificate_management.vcenter.tls_csr.spec', {
                'key_size':
                type.OptionalType(type.IntegerType()),
                'common_name':
                type.OptionalType(type.StringType()),
                'organization':
                type.StringType(),
                'organization_unit':
                type.StringType(),
                'locality':
                type.StringType(),
                'state_or_province':
                type.StringType(),
                'country':
                type.StringType(),
                'email_address':
                type.StringType(),
                'subject_alt_name':
                type.OptionalType(type.ListType(type.StringType())),
            }, Spec, False, None))

    def create(
        self,
        spec,
    ):
        """
        Generates a CSR with the given Spec. This method was added in vSphere
        API 6.7.2.

        :type  spec: :class:`TlsCsr.Spec`
        :param spec: The information needed to create a CSR.
        :rtype: :class:`TlsCsr.Info`
        :return: A Certificate Signing Request.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If CSR could not be created for given spec for a generic error.
        """
        return self._invoke('create', {
            'spec': spec,
        })