class Session(VapiInterface): """ The ``Session`` class allows API clients to manage session tokens including creating, deleting and obtaining information about sessions. * The :func:`Session.create` method creates session token in exchange for another authentication token. * The :func:`Session.delete` method invalidates a session token. * The :func:`Session.get` retrieves information about a session token. The call to the :func:`Session.create` method is part of the overall authentication process for API clients. For example, the sequence of steps for establishing a session with SAML token is: * Connect to lookup service. * Discover the secure token service (STS) endpoint URL. * Connect to the secure token service to obtain a SAML token. * Authenticate to the lookup service using the obtained SAML token. * Discover the API endpoint URL from lookup service. * Call the :func:`Session.create` method. The :func:`Session.create` call must include the SAML token. See the programming guide and samples for additional information about establishing API sessions. **Execution Context and Security Context** To use session based authentication a client should supply the session token obtained through the :func:`Session.create` method. The client should add the session token in the security context when using SDK classes. Clients using the REST API should supply the session token using the ``vmware-api-session-id`` HTTP header field. **Session Lifetime** A session begins with call to the :func:`Session.create` method to exchange a SAML token for a API session token. A session ends under the following circumstances: * Call to the :func:`Session.delete` method. * The session expires. Session expiration may be caused by one of the following situations: * Client inactivity - For a particular session identified by client requests that specify the associated session ID, the lapsed time since the last request exceeds the maximum interval between requests. * Unconditional or absolute session expiration time: At the beginning of the session, the session logic uses the SAML token and the system configuration to calculate absolute expiration time. When a session ends, the authentication logic will reject any subsequent client requests that specify that session. Any operations in progress will continue to completion. **Error Handling** The :class:`Session` returns the following exceptions: * :class:`com.vmware.vapi.std.errors_client.Unauthenticated` exception for any exceptions related to the request. * :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` exception for all exceptions caused by internal service failure. """ _VAPI_SERVICE_ID = 'com.vmware.cis.session' """ 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, _SessionStub) self._VAPI_OPERATION_IDS = {} class Info(VapiStruct): """ Represents data associated with an API session. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, user=None, created_time=None, last_accessed_time=None, ): """ :type user: :class:`str` :param user: Fully qualified name of the end user that created the session, for example Administrator\\\\@vsphere.local. A typical use case for this information is in Graphical User Interfaces (GUI) or logging systems to visualize the identity of the current user. :type created_time: :class:`datetime.datetime` :param created_time: Time when the session was created. :type last_accessed_time: :class:`datetime.datetime` :param last_accessed_time: Last time this session was used by passing the session token for invoking an API. """ self.user = user self.created_time = created_time self.last_accessed_time = last_accessed_time VapiStruct.__init__(self) Info._set_binding_type( type.StructType( 'com.vmware.cis.session.info', { 'user': type.StringType(), 'created_time': type.DateTimeType(), 'last_accessed_time': type.DateTimeType(), }, Info, False, None)) def create(self): """ Creates a session with the API. This is the equivalent of login. This method exchanges user credentials supplied in the security context for a session token that is to be used for authenticating subsequent calls. To authenticate subsequent calls clients are expected to include the session token. For REST API calls the HTTP ``vmware-api-session-id`` header field should be used for this. :rtype: :class:`str` :return: Newly created session token to be used for authenticating further requests. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the session creation fails due to request specific issues. Due to the security nature of the API the details of the error are not disclosed. Please check the following preconditions if using a SAML token to authenticate: * the supplied token is delegate-able. * the time of client and server system are synchronized. * the token supplied is valid. * if bearer tokens are used check that system configuration allows the API endpoint to accept such tokens. :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` if session creation fails due to server specific issues, for example connection to a back end component is failing. Due to the security nature of this API further details will not be disclosed in the exception. Please refer to component health information, administrative logs and product specific documentation for possible causes. """ return self._invoke('create', None) def delete(self): """ Terminates the validity of a session token. This is the equivalent of log out. A session token is expected as part of the request. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the session id is missing from the request or the corresponding session object cannot be found. :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` if session deletion fails due to server specific issues, for example connection to a back end component is failing. Due to the security nature of this API further details will not be disclosed in the exception. Please refer to component health information, administrative logs and product specific documentation for possible causes. """ return self._invoke('delete', None) def get(self): """ Returns information about the current session. This method expects a valid session token to be supplied. A side effect of invoking this method may be a change to the session's last accessed time to the current time if this is supported by the session implementation. Invoking any other method in the API will also update the session's last accessed time. This API is meant to serve the needs of various front end projects that may want to display the name of the user. Examples of this include various web based user interfaces and logging facilities. :rtype: :class:`Session.Info` :return: Information about the session. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the session id is missing from the request or the corresponding session object cannot be found. :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` if session retrieval fails due to server specific issues e.g. connection to back end component is failing. Due to the security nature of this API further details will not be disclosed in the error. Please refer to component health information, administrative logs and product specific documentation for possible causes. """ return self._invoke('get', None)
def __init__(self, config): # properties for list operation list_input_type = type.StructType( 'operation-input', { 'component_type': type.OptionalType(type.StringType()), 'cursor': type.OptionalType(type.StringType()), 'group_id': type.OptionalType(type.StringType()), 'has_errors': type.OptionalType(type.BooleanType()), 'included_fields': type.OptionalType(type.StringType()), 'metadata': type.OptionalType(type.StringType()), 'page_size': type.OptionalType(type.IntegerType()), 'selection_status': 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='/api/v1/migration/migration-units/aggregate-info', path_variables={}, query_parameters={ 'component_type': 'component_type', 'cursor': 'cursor', 'group_id': 'group_id', 'has_errors': 'has_errors', 'included_fields': 'included_fields', 'metadata': 'metadata', 'page_size': 'page_size', 'selection_status': 'selection_status', 'sort_ascending': 'sort_ascending', 'sort_by': 'sort_by', }, content_type='application/json') operations = { 'list': { 'input_type': list_input_type, 'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'MigrationUnitAggregateInfoListResult'), '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.migration.migration_units.aggregate_info', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
class Reports(VapiInterface): """ The ``Report`` class provides an method to download the report generated by the interop and precheck operations. To download a report, you must use the ``get`` method. A ``Report.Location`` class represents the location of the file which has ``Report.Token`` class which represents the token ID (\\\\@name String) and the expiration time of the token ``Report.Token.expiry`` DateTime. ``Report.Location`` class also has the URI for the file which needs to be downloaded. """ _VAPI_SERVICE_ID = 'com.vmware.vcenter.lcm.reports' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _ReportsStub) self._VAPI_OPERATION_IDS = {} class Token(VapiStruct): """ The ``Reports.Token`` class contains information about the token required in the HTTP GET request to generate the report. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, token=None, expiry=None, ): """ :type token: :class:`str` :param token: A one-time, short-lived token required in the HTTP header of the request to the url. This token needs to be passed in as a header with the name "session-id". :type expiry: :class:`datetime.datetime` :param expiry: Expiry time of the token """ self.token = token self.expiry = expiry VapiStruct.__init__(self) Token._set_binding_type( type.StructType('com.vmware.vcenter.lcm.reports.token', { 'token': type.StringType(), 'expiry': type.DateTimeType(), }, Token, False, None)) class Location(VapiStruct): """ The ``Reports.Location`` class contains the URI location to download the report from, as well as a token required (as a header on the HTTP request) to get the bundle. The validity of the token is 5 minutes as best attempt. After the token expires, any attempt to call the URI with said token will fail. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, uri=None, download_file_token=None, ): """ :type uri: :class:`str` :param uri: Report Download URI. :type download_file_token: :class:`Reports.Token` :param download_file_token: Information about the token required in the HTTP GET request to retrieve the report """ self.uri = uri self.download_file_token = download_file_token VapiStruct.__init__(self) Location._set_binding_type( type.StructType( 'com.vmware.vcenter.lcm.reports.location', { 'uri': type.URIType(), 'download_file_token': type.ReferenceType(__name__, 'Reports.Token'), }, Location, False, None)) def get( self, report, ): """ Returns the location :class:`Reports.Location` information for downloading the report for the specified file name. Retrieving a report involves two steps: * Step 1: Invoke the :func:`Reports.get` method to provision a token and a URI. * Step 2: Make an HTTP GET request by using the URI and the token returned in step 1 to retrieve the report. The HTTP GET request will: * Return 401 (Not Authorized) if the download URI is recognized, but the token is invalid, 404 if the URL is not recognized otherwise return 200 (OK) * Provide the CSV contents as the output of the request. The API accepts the file name as input, reads the contents of that CSV file, and returns this text as the result of the API. :type report: :class:`str` :param report: The parameter must be an identifier for the resource type: ``com.vmware.vcenter.lcm.report``. :rtype: :class:`Reports.Location` :return: :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` If there is no file associated with ``report`` in the system. :raise: :class:`com.vmware.vapi.std.errors_client.Error` If there is some unknown internal error. The accompanying error message will give more details about the failure. """ return self._invoke('get', { 'report': report, })
def __init__(self, config): # properties for add operation add_input_type = type.StructType( 'operation-input', { 'org': type.StringType(), 'sddc': type.StringType(), 'edge_id': type.StringType(), 'nat_rules': type.ReferenceType('com.vmware.vmc.model_client', 'NatRules'), }) add_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'), } add_input_value_validator_list = [] add_output_validator_list = [] add_rest_metadata = OperationRestMetadata( http_method='POST', url_template= '/vmc/api/orgs/{org}/sddcs/{sddc}/networks/4.0/edges/{edgeId}/nat/config/rules', request_body_parameter='nat_rules', path_variables={ 'org': 'org', 'sddc': 'sddc', 'edge_id': 'edgeId', }, query_parameters={}, content_type='application/json') # properties for delete operation delete_input_type = type.StructType( 'operation-input', { 'org': type.StringType(), 'sddc': type.StringType(), 'edge_id': type.StringType(), 'rule_id': type.IntegerType(), }) delete_error_dict = { 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } delete_input_value_validator_list = [] delete_output_validator_list = [] delete_rest_metadata = OperationRestMetadata( http_method='DELETE', url_template= '/vmc/api/orgs/{org}/sddcs/{sddc}/networks/4.0/edges/{edgeId}/nat/config/rules/{ruleId}', path_variables={ 'org': 'org', 'sddc': 'sddc', 'edge_id': 'edgeId', 'rule_id': 'ruleId', }, query_parameters={}, content_type='application/json') # properties for update operation update_input_type = type.StructType( 'operation-input', { 'org': type.StringType(), 'sddc': type.StringType(), 'edge_id': type.StringType(), 'rule_id': type.IntegerType(), 'nsxnatrule': type.ReferenceType('com.vmware.vmc.model_client', 'Nsxnatrule'), }) update_error_dict = { 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } update_input_value_validator_list = [] update_output_validator_list = [] update_rest_metadata = OperationRestMetadata( http_method='PUT', url_template= '/vmc/api/orgs/{org}/sddcs/{sddc}/networks/4.0/edges/{edgeId}/nat/config/rules/{ruleId}', request_body_parameter='nsxnatrule', path_variables={ 'org': 'org', 'sddc': 'sddc', 'edge_id': 'edgeId', 'rule_id': 'ruleId', }, query_parameters={}, content_type='application/json') operations = { 'add': { 'input_type': add_input_type, 'output_type': type.VoidType(), 'errors': add_error_dict, 'input_value_validator_list': add_input_value_validator_list, 'output_validator_list': add_output_validator_list, 'task_type': TaskType.NONE, }, '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, }, 'update': { 'input_type': update_input_type, 'output_type': type.VoidType(), 'errors': update_error_dict, 'input_value_validator_list': update_input_value_validator_list, 'output_validator_list': update_output_validator_list, 'task_type': TaskType.NONE, }, } rest_metadata = { 'add': add_rest_metadata, 'delete': delete_rest_metadata, 'update': update_rest_metadata, } ApiInterfaceStub.__init__( self, iface_name= 'com.vmware.vmc.orgs.sddcs.networks.edges.nat.config.rules', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
def __init__(self, config): # properties for get operation get_input_type = type.StructType( 'operation-input', { 'cursor': type.OptionalType(type.StringType()), 'diagnostic': 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()), 'source': type.OptionalType(type.StringType()), 'switching_profile_id': type.OptionalType(type.StringType()), 'transport_type': type.OptionalType(type.StringType()), 'transport_zone_id': type.OptionalType(type.StringType()), 'uplink_teaming_policy_name': type.OptionalType( type.StringType()), 'vlan': type.OptionalType(type.IntegerType()), 'vni': type.OptionalType(type.IntegerType()), }) 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-switches/status', path_variables={}, query_parameters={ 'cursor': 'cursor', 'diagnostic': 'diagnostic', 'included_fields': 'included_fields', 'page_size': 'page_size', 'sort_ascending': 'sort_ascending', 'sort_by': 'sort_by', 'source': 'source', 'switching_profile_id': 'switching_profile_id', 'transport_type': 'transport_type', 'transport_zone_id': 'transport_zone_id', 'uplink_teaming_policy_name': 'uplink_teaming_policy_name', 'vlan': 'vlan', 'vni': 'vni', }, content_type='application/json') operations = { 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'LogicalSwitchStatusSummary'), '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.logical_switches.status', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
class Nodes(VapiInterface): """ The ``Nodes`` interface provides methods to retrieve vCenter and Platform Services Controller nodes information in the topology. This class was added in vSphere API 6.7.2. """ _VAPI_SERVICE_ID = 'com.vmware.vcenter.topology.nodes' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _NodesStub) self._VAPI_OPERATION_IDS = {} class ApplianceType(Enum): """ The ``Nodes.ApplianceType`` class defines values for valid appliance types for the vCenter and Platform Services Controller node. See :class:`Nodes.Info`. This enumeration was added in vSphere API 6.7.2. .. note:: This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See :ref:`enumerated type description page <enumeration_description>`. """ VCSA_EMBEDDED = None """ vCenter Server Appliance with an embedded Platform Services Controller. This class attribute was added in vSphere API 6.7.2. """ VCSA_EXTERNAL = None """ vCenter Server Appliance with an external Platform Services Controller. This class attribute was added in vSphere API 6.7.2. """ PSC_EXTERNAL = None """ An external Platform Services Controller. This class attribute was added in vSphere API 6.7.2. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`ApplianceType` instance. """ Enum.__init__(string) ApplianceType._set_values([ ApplianceType('VCSA_EMBEDDED'), ApplianceType('VCSA_EXTERNAL'), ApplianceType('PSC_EXTERNAL'), ]) ApplianceType._set_binding_type( type.EnumType('com.vmware.vcenter.topology.nodes.appliance_type', ApplianceType)) class Info(VapiStruct): """ The ``Nodes.Info`` class contains vCenter or Platform Services Controller node details. This class was added in vSphere API 6.7.2. .. tip:: The arguments are used to initialize data attributes with the same names. """ _validator_list = [ UnionValidator( 'type', { 'VCSA_EMBEDDED': [('replication_partners', True)], 'PSC_EXTERNAL': [('replication_partners', True)], 'VCSA_EXTERNAL': [('client_affinity', True)], }), ] def __init__( self, domain=None, type=None, replication_partners=None, client_affinity=None, ): """ :type domain: :class:`str` :param domain: Domain name of the node. This attribute was added in vSphere API 6.7.2. :type type: :class:`Nodes.ApplianceType` :param type: Appliance type of the node. This attribute was added in vSphere API 6.7.2. :type replication_partners: :class:`list` of :class:`str` :param replication_partners: List of replication partners' node identifiers. Identifiers can be either IP address or DNS resolvable name of the partner node. This attribute was added in vSphere API 6.7.2. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: ``com.vmware.vcenter.VCenter.name``. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: ``com.vmware.vcenter.VCenter.name``. This attribute is optional and it is only relevant when the value of ``type`` is one of :attr:`Nodes.ApplianceType.VCSA_EMBEDDED` or :attr:`Nodes.ApplianceType.PSC_EXTERNAL`. :type client_affinity: :class:`str` :param client_affinity: Identifier of the affinitized Platform Services Controller node. Identifier can be either IP address or DNS resolvable name of the affinitized node. This attribute was added in vSphere API 6.7.2. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``com.vmware.vcenter.VCenter.name``. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ``com.vmware.vcenter.VCenter.name``. This attribute is optional and it is only relevant when the value of ``type`` is :attr:`Nodes.ApplianceType.VCSA_EXTERNAL`. """ self.domain = domain self.type = type self.replication_partners = replication_partners self.client_affinity = client_affinity VapiStruct.__init__(self) Info._set_binding_type( type.StructType( 'com.vmware.vcenter.topology.nodes.info', { 'domain': type.StringType(), 'type': type.ReferenceType(__name__, 'Nodes.ApplianceType'), 'replication_partners': type.OptionalType(type.ListType(type.IdType())), 'client_affinity': type.OptionalType(type.IdType()), }, Info, False, None)) class Summary(VapiStruct): """ The ``Nodes.Summary`` class contains commonly used information of vCenter or Platform Services Controller node. This class was added in vSphere API 6.7.2. .. tip:: The arguments are used to initialize data attributes with the same names. """ _validator_list = [ UnionValidator( 'type', { 'VCSA_EMBEDDED': [('replication_partners', True)], 'PSC_EXTERNAL': [('replication_partners', True)], 'VCSA_EXTERNAL': [('client_affinity', True)], }), ] def __init__( self, node=None, type=None, replication_partners=None, client_affinity=None, ): """ :type node: :class:`str` :param node: Identifier for the vCenter or Platform Services Controller node. Identifier can be either IP address or DNS resolvable name of the node. This attribute was added in vSphere API 6.7.2. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``com.vmware.vcenter.VCenter.name``. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ``com.vmware.vcenter.VCenter.name``. :type type: :class:`Nodes.ApplianceType` :param type: Appliance type of the node. This attribute was added in vSphere API 6.7.2. :type replication_partners: :class:`list` of :class:`str` :param replication_partners: List of replication partners' node identifiers. Identifiers can be either IP address or DNS resolvable name of the partner node. This attribute was added in vSphere API 6.7.2. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: ``com.vmware.vcenter.VCenter.name``. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: ``com.vmware.vcenter.VCenter.name``. This attribute is optional and it is only relevant when the value of ``type`` is one of :attr:`Nodes.ApplianceType.VCSA_EMBEDDED` or :attr:`Nodes.ApplianceType.PSC_EXTERNAL`. :type client_affinity: :class:`str` :param client_affinity: Identifier of the affinitized Platform Services Controller node. Identifier can be either IP address or DNS resolvable name of the affinitized node. This attribute was added in vSphere API 6.7.2. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``com.vmware.vcenter.VCenter.name``. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ``com.vmware.vcenter.VCenter.name``. This attribute is optional and it is only relevant when the value of ``type`` is :attr:`Nodes.ApplianceType.VCSA_EXTERNAL`. """ self.node = node self.type = type self.replication_partners = replication_partners self.client_affinity = client_affinity VapiStruct.__init__(self) Summary._set_binding_type( type.StructType( 'com.vmware.vcenter.topology.nodes.summary', { 'node': type.IdType(resource_types='com.vmware.vcenter.VCenter.name'), 'type': type.ReferenceType(__name__, 'Nodes.ApplianceType'), 'replication_partners': type.OptionalType(type.ListType(type.IdType())), 'client_affinity': type.OptionalType(type.IdType()), }, Summary, False, None)) class FilterSpec(VapiStruct): """ The ``Nodes.FilterSpec`` class contains attribute used to filter the results when listing vCenter and Platform Services Controller nodes (see :func:`Nodes.list`). This class was added in vSphere API 6.7.2. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, types=None, ): """ :type types: :class:`set` of :class:`Nodes.ApplianceType` or ``None`` :param types: Types of the appliance that a vCenter and Platform Services Controller node must be to match the filter (see :class:`Nodes.ApplianceType`. This attribute was added in vSphere API 6.7.2. If None or empty, node of any ApplianceType match the filter. """ self.types = types VapiStruct.__init__(self) FilterSpec._set_binding_type( type.StructType( 'com.vmware.vcenter.topology.nodes.filter_spec', { 'types': type.OptionalType( type.SetType( type.ReferenceType(__name__, 'Nodes.ApplianceType'))), }, FilterSpec, False, None)) def list( self, filter=None, ): """ Returns information about all vCenter and Platform Services Controller nodes matching the :class:`Nodes.FilterSpec`. This method was added in vSphere API 6.7.2. :type filter: :class:`Nodes.FilterSpec` or ``None`` :param filter: Specification of matching vCenter and Platform Services Controller nodes for which information should be returned. If None, the behavior is equivalent to a :class:`Nodes.FilterSpec` with all attributes None which means all nodes match the filter. :rtype: :class:`list` of :class:`Nodes.Summary` :return: commonly used information for all vCenter and Platform Services Controller nodes matching the :class:`Nodes.FilterSpec`. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user doesn't have the required privileges. :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` if the :attr:`Nodes.FilterSpec.types` attribute contains a value that is not supported. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if you do not have all of the privileges described as follows: * Method execution requires ``System.Read``. """ return self._invoke('list', { 'filter': filter, }) def get( self, node, ): """ Retrieve details for a given identifier of the vCenter or Platform Services Controller node. This method was added in vSphere API 6.7.2. :type node: :class:`str` :param node: Identifier of the vCenter or Platform Services Controller node. Identifier can be either IP address or DNS resolvable name of the node. The parameter must be an identifier for the resource type: ``com.vmware.vcenter.VCenter.name``. :rtype: :class:`Nodes.Info` :return: vCenter or Platform Services Controller node details with replication partners and client affinity information as applicable. See :class:`Nodes.Info`. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user doesn't have the required privileges. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` if a node doesn't exist for given node identifier. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if you do not have all of the privileges described as follows: * Method execution requires ``System.Read``. """ return self._invoke('get', { 'node': node, })
def __init__(self, config): # properties for delete operation delete_input_type = type.StructType( 'operation-input', { 'domain_id': type.StringType(), 'security_policy_id': type.StringType(), 'rule_id': type.StringType(), }) delete_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } delete_input_value_validator_list = [] delete_output_validator_list = [] delete_rest_metadata = OperationRestMetadata( http_method='DELETE', url_template= '/policy/api/v1/global-infra/domains/{domain-id}/security-policies/{security-policy-id}/rules/{rule-id}', path_variables={ 'domain_id': 'domain-id', 'security_policy_id': 'security-policy-id', 'rule_id': 'rule-id', }, query_parameters={}, content_type='application/json') # properties for get operation get_input_type = type.StructType( 'operation-input', { 'domain_id': type.StringType(), 'security_policy_id': type.StringType(), 'rule_id': type.StringType(), }) get_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } get_input_value_validator_list = [] get_output_validator_list = [HasFieldsOfValidator()] get_rest_metadata = OperationRestMetadata( http_method='GET', url_template= '/policy/api/v1/global-infra/domains/{domain-id}/security-policies/{security-policy-id}/rules/{rule-id}', path_variables={ 'domain_id': 'domain-id', 'security_policy_id': 'security-policy-id', 'rule_id': 'rule-id', }, query_parameters={}, content_type='application/json') # properties for list operation list_input_type = type.StructType( 'operation-input', { 'domain_id': type.StringType(), 'security_policy_id': type.StringType(), 'cursor': type.OptionalType(type.StringType()), 'include_mark_for_delete_objects': type.OptionalType(type.BooleanType()), 'included_fields': type.OptionalType(type.StringType()), 'page_size': type.OptionalType(type.IntegerType()), 'sort_ascending': type.OptionalType(type.BooleanType()), 'sort_by': type.OptionalType(type.StringType()), }) list_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } list_input_value_validator_list = [] list_output_validator_list = [HasFieldsOfValidator()] list_rest_metadata = OperationRestMetadata( http_method='GET', url_template= '/policy/api/v1/global-infra/domains/{domain-id}/security-policies/{security-policy-id}/rules', path_variables={ 'domain_id': 'domain-id', 'security_policy_id': 'security-policy-id', }, query_parameters={ 'cursor': 'cursor', 'include_mark_for_delete_objects': 'include_mark_for_delete_objects', 'included_fields': 'included_fields', 'page_size': 'page_size', 'sort_ascending': 'sort_ascending', 'sort_by': 'sort_by', }, content_type='application/json') # properties for patch operation patch_input_type = type.StructType( 'operation-input', { 'domain_id': type.StringType(), 'security_policy_id': type.StringType(), 'rule_id': type.StringType(), 'rule': type.ReferenceType('com.vmware.nsx_policy.model_client', 'Rule'), }) patch_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } patch_input_value_validator_list = [HasFieldsOfValidator()] patch_output_validator_list = [] patch_rest_metadata = OperationRestMetadata( http_method='PATCH', url_template= '/policy/api/v1/global-infra/domains/{domain-id}/security-policies/{security-policy-id}/rules/{rule-id}', request_body_parameter='rule', path_variables={ 'domain_id': 'domain-id', 'security_policy_id': 'security-policy-id', 'rule_id': 'rule-id', }, query_parameters={}, content_type='application/json') # properties for revise operation revise_input_type = type.StructType( 'operation-input', { 'domain_id': type.StringType(), 'security_policy_id': type.StringType(), 'rule_id': type.StringType(), 'rule': type.ReferenceType('com.vmware.nsx_policy.model_client', 'Rule'), 'anchor_path': type.OptionalType(type.StringType()), 'operation': type.OptionalType(type.StringType()), }) revise_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } revise_input_value_validator_list = [HasFieldsOfValidator()] revise_output_validator_list = [HasFieldsOfValidator()] revise_rest_metadata = OperationRestMetadata( http_method='POST', url_template= '/policy/api/v1/global-infra/domains/{domain-id}/security-policies/{security-policy-id}/rules/{rule-id}?action=revise', request_body_parameter='rule', path_variables={ 'domain_id': 'domain-id', 'security_policy_id': 'security-policy-id', 'rule_id': 'rule-id', }, query_parameters={ 'anchor_path': 'anchor_path', 'operation': 'operation', }, content_type='application/json') # properties for update operation update_input_type = type.StructType( 'operation-input', { 'domain_id': type.StringType(), 'security_policy_id': type.StringType(), 'rule_id': type.StringType(), 'rule': type.ReferenceType('com.vmware.nsx_policy.model_client', 'Rule'), }) update_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } update_input_value_validator_list = [HasFieldsOfValidator()] update_output_validator_list = [HasFieldsOfValidator()] update_rest_metadata = OperationRestMetadata( http_method='PUT', url_template= '/policy/api/v1/global-infra/domains/{domain-id}/security-policies/{security-policy-id}/rules/{rule-id}', request_body_parameter='rule', path_variables={ 'domain_id': 'domain-id', 'security_policy_id': 'security-policy-id', 'rule_id': 'rule-id', }, query_parameters={}, content_type='application/json') operations = { 'delete': { 'input_type': delete_input_type, 'output_type': type.VoidType(), 'errors': delete_error_dict, 'input_value_validator_list': delete_input_value_validator_list, 'output_validator_list': delete_output_validator_list, 'task_type': TaskType.NONE, }, 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'Rule'), 'errors': get_error_dict, 'input_value_validator_list': get_input_value_validator_list, 'output_validator_list': get_output_validator_list, 'task_type': TaskType.NONE, }, 'list': { 'input_type': list_input_type, 'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'RuleListResult'), 'errors': list_error_dict, 'input_value_validator_list': list_input_value_validator_list, 'output_validator_list': list_output_validator_list, 'task_type': TaskType.NONE, }, 'patch': { 'input_type': patch_input_type, 'output_type': type.VoidType(), 'errors': patch_error_dict, 'input_value_validator_list': patch_input_value_validator_list, 'output_validator_list': patch_output_validator_list, 'task_type': TaskType.NONE, }, 'revise': { 'input_type': revise_input_type, 'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'Rule'), 'errors': revise_error_dict, 'input_value_validator_list': revise_input_value_validator_list, 'output_validator_list': revise_output_validator_list, 'task_type': TaskType.NONE, }, 'update': { 'input_type': update_input_type, 'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'Rule'), 'errors': update_error_dict, 'input_value_validator_list': update_input_value_validator_list, 'output_validator_list': update_output_validator_list, 'task_type': TaskType.NONE, }, } rest_metadata = { 'delete': delete_rest_metadata, 'get': get_rest_metadata, 'list': list_rest_metadata, 'patch': patch_rest_metadata, 'revise': revise_rest_metadata, 'update': update_rest_metadata, } ApiInterfaceStub.__init__( self, iface_name= 'com.vmware.nsx_policy.global_infra.domains.security_policies.rules', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
class Clusters(VapiInterface): """ The ``Clusters`` class provides methods to upgrade the vSphere clusters. """ _VAPI_SERVICE_ID = 'com.vmware.vcenter.namespace_management.software.clusters' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _ClustersStub) self._VAPI_OPERATION_IDS = {} class State(Enum): """ The ``Clusters.State`` class describes the state of the upgrade. .. note:: This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See :ref:`enumerated type description page <enumeration_description>`. """ PENDING = None """ Upgrade is in progress. """ READY = None """ Cluster is ready when there is no upgrade or upgrade is completed. """ ERROR = None """ Upgrade failed and need user intervention. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`State` instance. """ Enum.__init__(string) State._set_values([ State('PENDING'), State('READY'), State('ERROR'), ]) State._set_binding_type(type.EnumType( 'com.vmware.vcenter.namespace_management.software.clusters.state', State)) class Result(VapiStruct): """ The ``Clusters.Result`` class contains the result of batch upgrade method. .. tip:: The arguments are used to initialize data attributes with the same names. """ _validator_list = [ UnionValidator( 'res', { 'REJECTED' : [('exception', True)], 'STARTED' : [], } ), ] def __init__(self, res=None, exception=None, ): """ :type res: :class:`Clusters.Result.Res` :param res: The result of batch upgrade method. :type exception: :class:`Exception` :param exception: Exception when cluster pre-check failed during upgrade invocation. This attribute is optional and it is only relevant when the value of ``res`` is :attr:`Clusters.Result.Res.REJECTED`. """ self.res = res self.exception = exception VapiStruct.__init__(self) class Res(Enum): """ The ``Clusters.Result.Res`` class represents the upgrade invocation result for each cluster. .. note:: This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See :ref:`enumerated type description page <enumeration_description>`. """ STARTED = None """ Upgrade is started. """ REJECTED = None """ Upgrade is rejected. This implies pre-check failed when invoking upgrade of the cluster. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`Res` instance. """ Enum.__init__(string) Res._set_values([ Res('STARTED'), Res('REJECTED'), ]) Res._set_binding_type(type.EnumType( 'com.vmware.vcenter.namespace_management.software.clusters.result.res', Res)) Result._set_binding_type(type.StructType( 'com.vmware.vcenter.namespace_management.software.clusters.result', { 'res': type.ReferenceType(__name__, 'Clusters.Result.Res'), 'exception': type.OptionalType(type.AnyErrorType()), }, Result, False, None)) class UpgradeSpec(VapiStruct): """ The ``Clusters.UpgradeSpec`` class contains the specification required to upgrade a cluster. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__(self, desired_version=None, ignore_precheck_warnings=None, ): """ :type desired_version: :class:`str` :param desired_version: Version number the cluster is going to be upgraded to. :type ignore_precheck_warnings: :class:`bool` or ``None`` :param ignore_precheck_warnings: If true, the upgrade workflow will ignore any pre-check warnings and proceed with the upgrade. If None, the upgrade workflow will not ignore pre-check warnings and fail the upgrade. It is equivalent to setting the value to false. The workflow adopts a conservative approach of failing the upgrade if None to solely let the user decide whether to force the upgrade despite the warnings. """ self.desired_version = desired_version self.ignore_precheck_warnings = ignore_precheck_warnings VapiStruct.__init__(self) UpgradeSpec._set_binding_type(type.StructType( 'com.vmware.vcenter.namespace_management.software.clusters.upgrade_spec', { 'desired_version': type.StringType(), 'ignore_precheck_warnings': type.OptionalType(type.BooleanType()), }, UpgradeSpec, False, None)) class Summary(VapiStruct): """ The ``Clusters.Summary`` class contains basic information about the cluster upgrade related information. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__(self, cluster=None, cluster_name=None, current_version=None, available_versions=None, last_upgraded_date=None, desired_version=None, state=None, ): """ :type cluster: :class:`str` :param cluster: Identifier for the cluster. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``ClusterComputeResource``. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ``ClusterComputeResource``. :type cluster_name: :class:`str` :param cluster_name: Name of the cluster. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``ClusterComputeResource.name``. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ``ClusterComputeResource.name``. :type current_version: :class:`str` :param current_version: Current version of the cluster. :type available_versions: :class:`list` of :class:`str` :param available_versions: Set of versions available for upgrade. :type last_upgraded_date: :class:`datetime.datetime` or ``None`` :param last_upgraded_date: Date of last successful upgrade. If None, the cluster has not yet been upgraded. :type desired_version: :class:`str` or ``None`` :param desired_version: Desired version the cluster will be upgraded to. If None, the cluster upgrade is not in progress. :type state: :class:`Clusters.State` :param state: Current state of the upgrade. """ self.cluster = cluster self.cluster_name = cluster_name self.current_version = current_version self.available_versions = available_versions self.last_upgraded_date = last_upgraded_date self.desired_version = desired_version self.state = state VapiStruct.__init__(self) Summary._set_binding_type(type.StructType( 'com.vmware.vcenter.namespace_management.software.clusters.summary', { 'cluster': type.IdType(resource_types='ClusterComputeResource'), 'cluster_name': type.IdType(resource_types='ClusterComputeResource.name'), 'current_version': type.StringType(), 'available_versions': type.ListType(type.StringType()), 'last_upgraded_date': type.OptionalType(type.DateTimeType()), 'desired_version': type.OptionalType(type.StringType()), 'state': type.ReferenceType(__name__, 'Clusters.State'), }, Summary, False, None)) class Info(VapiStruct): """ The ``Clusters.Info`` class contains detailed information about the cluster upgrade status and related information. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__(self, current_version=None, available_versions=None, last_upgraded_date=None, messages=None, state=None, upgrade_status=None, ): """ :type current_version: :class:`str` :param current_version: Current version of the cluster. :type available_versions: :class:`list` of :class:`str` :param available_versions: Set of available versions can be upgraded to. :type last_upgraded_date: :class:`datetime.datetime` or ``None`` :param last_upgraded_date: Date of last successful upgrade. If None, the cluster has not yet been upgraded. :type messages: :class:`list` of :class:`Clusters.Message` :param messages: Current set of messages associated with the cluster version. :type state: :class:`Clusters.State` :param state: Current state of the upgrade. :type upgrade_status: :class:`Clusters.UpgradeStatus` or ``None`` :param upgrade_status: Information about upgrade in progress. If None, the cluster upgrade is not in progress. """ self.current_version = current_version self.available_versions = available_versions self.last_upgraded_date = last_upgraded_date self.messages = messages self.state = state self.upgrade_status = upgrade_status VapiStruct.__init__(self) Info._set_binding_type(type.StructType( 'com.vmware.vcenter.namespace_management.software.clusters.info', { 'current_version': type.StringType(), 'available_versions': type.ListType(type.StringType()), 'last_upgraded_date': type.OptionalType(type.DateTimeType()), 'messages': type.ListType(type.ReferenceType(__name__, 'Clusters.Message')), 'state': type.ReferenceType(__name__, 'Clusters.State'), 'upgrade_status': type.OptionalType(type.ReferenceType(__name__, 'Clusters.UpgradeStatus')), }, Info, False, None)) class UpgradeStatus(VapiStruct): """ The ``Clusters.UpgradeStatus`` class contains detailed information about the cluster when upgraded is in progress. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__(self, desired_version=None, messages=None, progress=None, ): """ :type desired_version: :class:`str` or ``None`` :param desired_version: Desired version the cluster will be upgraded to. If None, the cluster upgrade is not in progress. :type messages: :class:`list` of :class:`Clusters.Message` :param messages: Current set of messages associated with the upgrade state. :type progress: :class:`Clusters.UpgradeProgress` or ``None`` :param progress: Information about upgrade progess. If None, the cluster upgrade is not in progress. """ self.desired_version = desired_version self.messages = messages self.progress = progress VapiStruct.__init__(self) UpgradeStatus._set_binding_type(type.StructType( 'com.vmware.vcenter.namespace_management.software.clusters.upgrade_status', { 'desired_version': type.OptionalType(type.StringType()), 'messages': type.ListType(type.ReferenceType(__name__, 'Clusters.Message')), 'progress': type.OptionalType(type.ReferenceType(__name__, 'Clusters.UpgradeProgress')), }, UpgradeStatus, False, None)) class UpgradeProgress(VapiStruct): """ The ``Clusters.UpgradeProgress`` class contains detailed information about the cluster upgrade progess. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__(self, total=None, completed=None, message=None, ): """ :type total: :class:`long` :param total: Total amount of the work for the operation. The work here represents the number of master nodes in the cluster need to be upgraded. :type completed: :class:`long` :param completed: The amount of work completed for the operation. The value can only be incremented. The number or master nodes which upgrade completed. :type message: :class:`com.vmware.vapi.std_client.LocalizableMessage` :param message: Message about the work progress. """ self.total = total self.completed = completed self.message = message VapiStruct.__init__(self) UpgradeProgress._set_binding_type(type.StructType( 'com.vmware.vcenter.namespace_management.software.clusters.upgrade_progress', { 'total': type.IntegerType(), 'completed': type.IntegerType(), 'message': type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage'), }, UpgradeProgress, False, None)) class Message(VapiStruct): """ The ``Clusters.Message`` class contains the information about the object configuration. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__(self, severity=None, details=None, ): """ :type severity: :class:`Clusters.Message.Severity` :param severity: Type of the message. :type details: :class:`com.vmware.vapi.std_client.LocalizableMessage` :param details: Details about the message. """ self.severity = severity self.details = details VapiStruct.__init__(self) class Severity(Enum): """ The ``Clusters.Message.Severity`` class represents the severity of the message. .. note:: This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See :ref:`enumerated type description page <enumeration_description>`. """ INFO = None """ Informational message. This may be accompanied by vCenter event. """ WARNING = None """ Warning message. This may be accompanied by vCenter event. """ ERROR = None """ Error message. This is accompanied by vCenter event and/or alarm. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`Severity` instance. """ Enum.__init__(string) Severity._set_values([ Severity('INFO'), Severity('WARNING'), Severity('ERROR'), ]) Severity._set_binding_type(type.EnumType( 'com.vmware.vcenter.namespace_management.software.clusters.message.severity', Severity)) Message._set_binding_type(type.StructType( 'com.vmware.vcenter.namespace_management.software.clusters.message', { 'severity': type.ReferenceType(__name__, 'Clusters.Message.Severity'), 'details': type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage'), }, Message, False, None)) def upgrade(self, cluster, spec, ): """ Upgrade the cluster to a specific version. This operation upgrades the components on control plane VMs and worker plane hosts based on the selected version. Before upgrading, this operation performs pre-checks and sets the evaluation response in Info.UpgradeStatus.messages with various Message.Severity levels. Depending on the severity, the upgrade may or may not proceed beyond prechecks. Here is a list of severities and corresponding behavior: - ERROR: Upgrade does not proceed beyond precheck operation - WARNING: Upgrade proceeds beyond precheck operation only if UpgradeSpec.ignorePrecheckWarnings is set to true - INFO: Upgrade proceeds beyond precheck operation uninterrupted :type cluster: :class:`str` :param cluster: Identifier for the cluster which will be upgraded. The parameter must be an identifier for the resource type: ``ClusterComputeResource``. :type spec: :class:`Clusters.UpgradeSpec` :param spec: Specification for upgrading the cluster. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if the system reports an error while responding to the request. :raise: :class:`com.vmware.vapi.std.errors_client.Unsupported` if pre-check failed of the cluster. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` if cluster could not be located. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user does not have Namespaces.Manage privilege. """ return self._invoke('upgrade', { 'cluster': cluster, 'spec': spec, }) def upgrade_multiple(self, specs, ): """ Upgrade a set of clusters to its corresponding specific version. :type specs: :class:`dict` of :class:`str` and :class:`Clusters.UpgradeSpec` :param specs: Specifications for upgrading selected clusters. The key in the parameter :class:`dict` must be an identifier for the resource type: ``ClusterComputeResource``. :rtype: :class:`dict` of :class:`str` and :class:`Clusters.Result` :return: Pre-check result when invoking upgrade for each cluster. The key in the return value :class:`dict` will be an identifier for the resource type: ``ClusterComputeResource``. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if the system reports an error while responding to the request. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user does not have Namespaces.Manage privilege on all specified clusters. """ return self._invoke('upgrade_multiple', { 'specs': specs, }) def get(self, cluster, ): """ Returns upgrade related information of a specific cluster. :type cluster: :class:`str` :param cluster: Identifier for the cluster which will be upgraded. The parameter must be an identifier for the resource type: ``ClusterComputeResource``. :rtype: :class:`Clusters.Info` :return: Information about the upgrade of the specified WCP enabled cluster. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` if cluster could not be located. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if the system reports an error while responding to the request. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user does not have System.Read privilege. :raise: :class:`com.vmware.vapi.std.errors_client.Unsupported` if the cluster is not WCP enabled. """ return self._invoke('get', { 'cluster': cluster, }) def list(self): """ Returns upgrade related information about all WCP enabled clusters. :rtype: :class:`list` of :class:`Clusters.Summary` :return: List of upgrade summary of all WCP enabled clusters. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if the system reports an error while responding to the request. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user does not have System.Read privilege. """ return self._invoke('list', None)
def __init__(self, config): # properties for get operation get_input_type = type.StructType( 'operation-input', { 'logical_router_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', path_variables={ 'logical_router_id': 'logical-router-id', }, query_parameters={}, content_type='application/json') # properties for update operation update_input_type = type.StructType( 'operation-input', { 'logical_router_id': type.StringType(), 'routing_config': type.ReferenceType('com.vmware.nsx.model_client', 'RoutingConfig'), }) 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', request_body_parameter='routing_config', path_variables={ 'logical_router_id': 'logical-router-id', }, query_parameters={}, content_type='application/json') operations = { 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'RoutingConfig'), 'errors': get_error_dict, 'input_value_validator_list': get_input_value_validator_list, 'output_validator_list': get_output_validator_list, 'task_type': TaskType.NONE, }, 'update': { 'input_type': update_input_type, 'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'RoutingConfig'), 'errors': update_error_dict, 'input_value_validator_list': update_input_value_validator_list, 'output_validator_list': update_output_validator_list, 'task_type': TaskType.NONE, }, } rest_metadata = { 'get': get_rest_metadata, 'update': update_rest_metadata, } ApiInterfaceStub.__init__( self, iface_name='com.vmware.nsx.logical_routers.routing', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
:param id: The identifier for a resource whose type is specified by :attr:`DynamicID.type`. When clients pass a value of this class as a parameter, the attribute ``type`` must contain the actual resource type. When methods return a value of this class as a return value, the attribute ``type`` will contain the actual resource type. """ self.type = type self.id = id VapiStruct.__init__(self) DynamicID._set_binding_type( type.StructType( 'com.vmware.vapi.std.dynamic_ID', { 'type': type.StringType(), 'id': type.IdType(resource_types=[], resource_type_field_name="type"), }, DynamicID, False, None)) class LocalizableMessage(VapiStruct): """ The ``LocalizableMessage`` class represents localizable string and message template. Classes include one or more localizable message templates in the exceptions they report so that clients can display diagnostic messages in the native language of the user. Classes can include localizable strings in the data returned from methods to allow clients to display localized status information in the native language of the user. .. tip::
:param propagate: True if permission can be propagated to child entities. :type role_id: :class:`long` :param role_id: Role associated with the permission. """ self.principal = principal self.group = group self.propagate = propagate self.role_id = role_id VapiStruct.__init__(self) Permission._set_binding_type( type.StructType( 'com.vmware.appliance.vcenter.settings.v1.config.components.inventory.permission', { 'principal': type.StringType(), 'group': type.BooleanType(), 'propagate': type.BooleanType(), 'role_id': type.IntegerType(), }, Permission, False, None)) class Settings(VapiStruct): """ The ``Settings`` class defines vCenter Server settings as key-value pairs. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__(
:param id: The identifier for a resource whose type is specified by :attr:`DynamicID.type`. When clients pass a value of this class as a parameter, the attribute ``type`` must contain the actual resource type. When methods return a value of this class as a return value, the attribute ``type`` will contain the actual resource type. """ self.type = type self.id = id VapiStruct.__init__(self) DynamicID._set_binding_type( type.StructType( 'com.vmware.vapi.std.dynamic_ID', { 'type': type.StringType(), 'id': type.IdType(resource_types=[], resource_type_field_name="type"), }, DynamicID, False, None)) class LocalizableMessage(VapiStruct): """ The ``LocalizableMessage`` class represents a localizable string or message template. Classes include one or more localizable message templates in the exceptions they report so that clients can display diagnostic messages in the native language of the user. Classes can include localizable strings in the data returned from methods to allow clients to display localized status information in the native language of the user. .. tip::
:type display_version: :class:`str` :param display_version: Human readable version of the component. :type vendor: :class:`str` :param vendor: Vendor of the component. """ self.version = version self.display_name = display_name self.display_version = display_version self.vendor = vendor VapiStruct.__init__(self) ComponentInfo._set_binding_type( type.StructType( 'com.vmware.esx.hosts.component_info', { 'version': type.StringType(), 'display_name': type.StringType(), 'display_version': type.StringType(), 'vendor': type.StringType(), }, ComponentInfo, False, None)) class SolutionInfo(VapiStruct): """ The ``SolutionInfo`` class contains attributes that describe solution registered in the software specification. .. tip:: The arguments are used to initialize data attributes with the same names. """
def __init__(self, config): # properties for list operation list_input_type = type.StructType( 'operation-input', { 'flood_protection_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/flood-protection-profiles/{flood-protection-profile-id}/bindings', path_variables={ 'flood_protection_profile_id': 'flood-protection-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', 'FloodProtectionProfileBindingListResult'), '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.flood_protection_profiles.bindings', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
def __init__(self, config): # properties for create operation create_input_type = type.StructType( 'operation-input', { 'view_id': type.StringType(), 'widget_configuration': type.DynamicStructType( 'vmware.vapi.dynamic_struct', {}, VapiStruct, [ type.ReferenceType( 'com.vmware.nsx_policy.model_client', 'WidgetConfiguration') ]), }) create_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } create_input_value_validator_list = [HasFieldsOfValidator()] create_output_validator_list = [HasFieldsOfValidator()] create_rest_metadata = OperationRestMetadata( http_method='POST', url_template= '/policy/api/v1/ui-views/{view-id}/widgetconfigurations', request_body_parameter='widget_configuration', path_variables={ 'view_id': 'view-id', }, query_parameters={}, content_type='application/json') # properties for delete operation delete_input_type = type.StructType( 'operation-input', { 'view_id': type.StringType(), 'widgetconfiguration_id': type.StringType(), }) delete_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } delete_input_value_validator_list = [] delete_output_validator_list = [] delete_rest_metadata = OperationRestMetadata( http_method='DELETE', url_template= '/policy/api/v1/ui-views/{view-id}/widgetconfigurations/{widgetconfiguration-id}', path_variables={ 'view_id': 'view-id', 'widgetconfiguration_id': 'widgetconfiguration-id', }, query_parameters={}, content_type='application/json') # properties for get operation get_input_type = type.StructType( 'operation-input', { 'view_id': type.StringType(), 'container': type.OptionalType(type.StringType()), 'widget_ids': type.OptionalType(type.StringType()), }) get_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } get_input_value_validator_list = [] get_output_validator_list = [HasFieldsOfValidator()] get_rest_metadata = OperationRestMetadata( http_method='GET', url_template= '/policy/api/v1/ui-views/{view-id}/widgetconfigurations', path_variables={ 'view_id': 'view-id', }, query_parameters={ 'container': 'container', 'widget_ids': 'widget_ids', }, content_type='application/json') # properties for get_0 operation get_0_input_type = type.StructType( 'operation-input', { 'view_id': type.StringType(), 'widgetconfiguration_id': type.StringType(), }) get_0_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } get_0_input_value_validator_list = [] get_0_output_validator_list = [HasFieldsOfValidator()] get_0_rest_metadata = OperationRestMetadata( http_method='GET', url_template= '/policy/api/v1/ui-views/{view-id}/widgetconfigurations/{widgetconfiguration-id}', path_variables={ 'view_id': 'view-id', 'widgetconfiguration_id': 'widgetconfiguration-id', }, query_parameters={}, content_type='application/json') # properties for update operation update_input_type = type.StructType( 'operation-input', { 'view_id': type.StringType(), 'widgetconfiguration_id': type.StringType(), 'widget_configuration': type.DynamicStructType( 'vmware.vapi.dynamic_struct', {}, VapiStruct, [ type.ReferenceType( 'com.vmware.nsx_policy.model_client', 'WidgetConfiguration') ]), }) update_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } update_input_value_validator_list = [HasFieldsOfValidator()] update_output_validator_list = [HasFieldsOfValidator()] update_rest_metadata = OperationRestMetadata( http_method='PUT', url_template= '/policy/api/v1/ui-views/{view-id}/widgetconfigurations/{widgetconfiguration-id}', request_body_parameter='widget_configuration', path_variables={ 'view_id': 'view-id', 'widgetconfiguration_id': 'widgetconfiguration-id', }, query_parameters={}, content_type='application/json') operations = { 'create': { 'input_type': create_input_type, 'output_type': type.DynamicStructType( 'vmware.vapi.dynamic_struct', {}, VapiStruct, [ type.ReferenceType( 'com.vmware.nsx_policy.model_client', 'WidgetConfiguration') ]), 'errors': create_error_dict, 'input_value_validator_list': create_input_value_validator_list, 'output_validator_list': create_output_validator_list, 'task_type': TaskType.NONE, }, 'delete': { 'input_type': delete_input_type, 'output_type': type.VoidType(), 'errors': delete_error_dict, 'input_value_validator_list': delete_input_value_validator_list, 'output_validator_list': delete_output_validator_list, 'task_type': TaskType.NONE, }, 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'WidgetConfigurationList'), 'errors': get_error_dict, 'input_value_validator_list': get_input_value_validator_list, 'output_validator_list': get_output_validator_list, 'task_type': TaskType.NONE, }, 'get_0': { 'input_type': get_0_input_type, 'output_type': type.DynamicStructType( 'vmware.vapi.dynamic_struct', {}, VapiStruct, [ type.ReferenceType( 'com.vmware.nsx_policy.model_client', 'WidgetConfiguration') ]), 'errors': get_0_error_dict, 'input_value_validator_list': get_0_input_value_validator_list, 'output_validator_list': get_0_output_validator_list, 'task_type': TaskType.NONE, }, 'update': { 'input_type': update_input_type, 'output_type': type.DynamicStructType( 'vmware.vapi.dynamic_struct', {}, VapiStruct, [ type.ReferenceType( 'com.vmware.nsx_policy.model_client', 'WidgetConfiguration') ]), 'errors': update_error_dict, 'input_value_validator_list': update_input_value_validator_list, 'output_validator_list': update_output_validator_list, 'task_type': TaskType.NONE, }, } rest_metadata = { 'create': create_rest_metadata, 'delete': delete_rest_metadata, 'get': get_rest_metadata, 'get_0': get_0_rest_metadata, 'update': update_rest_metadata, } ApiInterfaceStub.__init__( self, iface_name='com.vmware.nsx_policy.ui_views.widgetconfigurations', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
def __init__(self, config): # properties for list operation list_input_type = type.StructType( 'operation-input', { 'tier1_id': type.StringType(), 'cursor': type.OptionalType(type.StringType()), 'enforcement_point_path': type.OptionalType(type.StringType()), 'include_mark_for_delete_objects': type.OptionalType(type.BooleanType()), 'included_fields': type.OptionalType(type.StringType()), 'page_size': type.OptionalType(type.IntegerType()), 'sort_ascending': type.OptionalType(type.BooleanType()), 'sort_by': type.OptionalType(type.StringType()), }) list_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } list_input_value_validator_list = [] list_output_validator_list = [] list_rest_metadata = OperationRestMetadata( http_method='GET', url_template= '/policy/api/v1/global-infra/tier-1s/{tier-1-id}/nat/statistics', path_variables={ 'tier1_id': 'tier-1-id', }, query_parameters={ 'cursor': 'cursor', 'enforcement_point_path': 'enforcement_point_path', 'include_mark_for_delete_objects': 'include_mark_for_delete_objects', 'included_fields': 'included_fields', 'page_size': 'page_size', 'sort_ascending': 'sort_ascending', 'sort_by': 'sort_by', }, content_type='application/json') operations = { 'list': { 'input_type': list_input_type, 'output_type': type.ReferenceType( 'com.vmware.nsx_policy.model_client', 'PolicyNatRuleStatisticsPerLogicalRouterListResult'), 'errors': list_error_dict, 'input_value_validator_list': list_input_value_validator_list, 'output_validator_list': list_output_validator_list, 'task_type': TaskType.NONE, }, } rest_metadata = { 'list': list_rest_metadata, } ApiInterfaceStub.__init__( self, iface_name= 'com.vmware.nsx_policy.global_infra.tier_1s.nat.statistics', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
def __init__(self, config): # properties for create operation create_input_type = type.StructType('operation-input', { 'mac_set_id': type.StringType(), 'm_AC_address_element': type.ReferenceType('com.vmware.nsx.model_client', 'MACAddressElement'), }) 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/mac-sets/{mac-set-id}/members', request_body_parameter='m_AC_address_element', path_variables={ 'mac_set_id': 'mac-set-id', }, query_parameters={ }, content_type='application/json' ) # properties for delete operation delete_input_type = type.StructType('operation-input', { 'mac_set_id': type.StringType(), 'mac_address': 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/mac-sets/{mac-set-id}/members/{mac-address}', path_variables={ 'mac_set_id': 'mac-set-id', 'mac_address': 'mac-address', }, query_parameters={ }, content_type='application/json' ) # properties for list operation list_input_type = type.StructType('operation-input', { 'mac_set_id': type.StringType(), }) list_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } list_input_value_validator_list = [ ] list_output_validator_list = [ ] list_rest_metadata = OperationRestMetadata( http_method='GET', url_template='/api/v1/mac-sets/{mac-set-id}/members', path_variables={ 'mac_set_id': 'mac-set-id', }, query_parameters={ }, content_type='application/json' ) operations = { 'create': { 'input_type': create_input_type, 'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'MACAddressElement'), '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, }, 'list': { 'input_type': list_input_type, 'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'MACAddressElementListResult'), '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 = { 'create': create_rest_metadata, 'delete': delete_rest_metadata, 'list': list_rest_metadata, } ApiInterfaceStub.__init__( self, iface_name='com.vmware.nsx.mac_sets.members', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
class Kms(VapiInterface): """ The ``Kms`` class contains information necessary to connect to the hosts running Key Provider Service. This class was added in vSphere API 7.0.0.0. """ _VAPI_SERVICE_ID = 'com.vmware.vcenter.trusted_infrastructure.trust_authority_hosts.kms' """ Identifier of the service in canonical form. """ def __init__(self, config): """ :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub. """ VapiInterface.__init__(self, config, _KmsStub) self._VAPI_OPERATION_IDS = {} class SummaryType(Enum): """ The connection information could include the certificates or be a shorter summary. This enumeration was added in vSphere API 7.0.0.0. .. note:: This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See :ref:`enumerated type description page <enumeration_description>`. """ FULL = None """ The full connection information, including certificates. This class attribute was added in vSphere API 7.0.0.0. """ NORMAL = None """ A summary containing only the hostname, port, and the group which determines the Attestation Services this Key Provider Service can communicate with. This class attribute was added in vSphere API 7.0.0.0. """ BRIEF = None """ A brief summary, containing only the hostname for the Key Provider Service. This class attribute was added in vSphere API 7.0.0.0. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`SummaryType` instance. """ Enum.__init__(string) SummaryType._set_values([ SummaryType('FULL'), SummaryType('NORMAL'), SummaryType('BRIEF'), ]) SummaryType._set_binding_type( type.EnumType( 'com.vmware.vcenter.trusted_infrastructure.trust_authority_hosts.kms.summary_type', SummaryType)) class Summary(VapiStruct): """ The ``Kms.Summary`` class contains all the stored information about a Key Provider Service. This class was added in vSphere API 7.0.0.0. .. tip:: The arguments are used to initialize data attributes with the same names. """ _validator_list = [ UnionValidator( 'summary_type', { 'BRIEF': [('host', True), ('address', True)], 'NORMAL': [('host', True), ('address', True), ('group', True), ('cluster', True)], 'FULL': [('host', True), ('address', True), ('group', True), ('cluster', True), ('trusted_CA', True)], }), ] _canonical_to_pep_names = { 'trusted_CA': 'trusted_ca', } def __init__( self, summary_type=None, host=None, address=None, group=None, cluster=None, trusted_ca=None, ): """ :type summary_type: :class:`Kms.SummaryType` :param summary_type: Defines the verbosity of the summary. This attribute was added in vSphere API 7.0.0.0. :type host: :class:`str` :param host: The trusted ESX on which the service runs. This attribute was added in vSphere API 7.0.0.0. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``HostSystem``. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ``HostSystem``. This attribute is optional and it is only relevant when the value of ``summaryType`` is one of :attr:`Kms.SummaryType.BRIEF`, :attr:`Kms.SummaryType.NORMAL`, or :attr:`Kms.SummaryType.FULL`. :type address: :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress` :param address: The service's address. This attribute was added in vSphere API 7.0.0.0. This attribute is optional and it is only relevant when the value of ``summaryType`` is one of :attr:`Kms.SummaryType.BRIEF`, :attr:`Kms.SummaryType.NORMAL`, or :attr:`Kms.SummaryType.FULL`. :type group: :class:`str` :param group: The group ID determines which Attestation Service instances this Key Provider Service can communicate with. This attribute was added in vSphere API 7.0.0.0. This attribute is optional and it is only relevant when the value of ``summaryType`` is one of :attr:`Kms.SummaryType.NORMAL` or :attr:`Kms.SummaryType.FULL`. :type cluster: :class:`str` :param cluster: The opaque string identifier of the cluster in which the Key Provider Service is part of. This attribute was added in vSphere API 7.0.0.0. This attribute is optional and it is only relevant when the value of ``summaryType`` is one of :attr:`Kms.SummaryType.NORMAL` or :attr:`Kms.SummaryType.FULL`. :type trusted_ca: :class:`com.vmware.vcenter.trusted_infrastructure_client.X509CertChain` :param trusted_ca: The service's TLS certificate chain. This attribute was added in vSphere API 7.0.0.0. This attribute is optional and it is only relevant when the value of ``summaryType`` is :attr:`Kms.SummaryType.FULL`. """ self.summary_type = summary_type self.host = host self.address = address self.group = group self.cluster = cluster self.trusted_ca = trusted_ca VapiStruct.__init__(self) Summary._set_binding_type( type.StructType( 'com.vmware.vcenter.trusted_infrastructure.trust_authority_hosts.kms.summary', { 'summary_type': type.ReferenceType(__name__, 'Kms.SummaryType'), 'host': type.OptionalType(type.IdType()), 'address': type.OptionalType( type.ReferenceType( 'com.vmware.vcenter.trusted_infrastructure_client', 'NetworkAddress')), 'group': type.OptionalType(type.StringType()), 'cluster': type.OptionalType(type.StringType()), 'trusted_CA': type.OptionalType( type.ReferenceType( 'com.vmware.vcenter.trusted_infrastructure_client', 'X509CertChain')), }, Summary, False, None)) class Info(VapiStruct): """ The ``Kms.Info`` class contains all the stored information about a Key Provider Service. This class was added in vSphere API 7.0.0.0. .. tip:: The arguments are used to initialize data attributes with the same names. """ _canonical_to_pep_names = { 'trusted_CA': 'trusted_ca', } def __init__( self, host=None, address=None, group=None, cluster=None, trusted_ca=None, ): """ :type host: :class:`str` :param host: The trusted ESX on which the service runs. This attribute was added in vSphere API 7.0.0.0. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: ``HostSystem``. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: ``HostSystem``. :type address: :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress` :param address: The service's address. This attribute was added in vSphere API 7.0.0.0. :type group: :class:`str` :param group: The group ID determines which Attestation Service instances this Key Provider Service can communicate with. This attribute was added in vSphere API 7.0.0.0. :type cluster: :class:`str` :param cluster: The opaque string identifier of the cluster in which the Key Provider Service is part of. This attribute was added in vSphere API 7.0.0.0. :type trusted_ca: :class:`com.vmware.vcenter.trusted_infrastructure_client.X509CertChain` :param trusted_ca: The service's TLS certificate chain. This attribute was added in vSphere API 7.0.0.0. """ self.host = host self.address = address self.group = group self.cluster = cluster self.trusted_ca = trusted_ca VapiStruct.__init__(self) Info._set_binding_type( type.StructType( 'com.vmware.vcenter.trusted_infrastructure.trust_authority_hosts.kms.info', { 'host': type.IdType(resource_types='HostSystem'), 'address': type.ReferenceType( 'com.vmware.vcenter.trusted_infrastructure_client', 'NetworkAddress'), 'group': type.StringType(), 'cluster': type.StringType(), 'trusted_CA': type.ReferenceType( 'com.vmware.vcenter.trusted_infrastructure_client', 'X509CertChain'), }, Info, False, None)) class FilterSpec(VapiStruct): """ The ``Kms.FilterSpec`` class contains the data necessary for identifying a Key Provider Service. This class was added in vSphere API 7.0.0.0. .. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, hosts=None, clusters=None, address=None, groups=None, ): """ :type hosts: :class:`set` of :class:`str` or ``None`` :param hosts: A set of host IDs by which to filter the services. This attribute was added in vSphere API 7.0.0.0. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: ``HostSystem``. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: ``HostSystem``. If None, the services will not be filtered by the hosts on which they run. :type clusters: :class:`set` of :class:`str` or ``None`` :param clusters: A set of cluster IDs by which to filter the services. This attribute was added in vSphere API 7.0.0.0. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: ``ClusterComputeResource``. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: ``ClusterComputeResource``. If None, the services will not be filtered by the clusters on which they run. :type address: :class:`list` of :class:`com.vmware.vcenter.trusted_infrastructure_client.NetworkAddress` or ``None`` :param address: The service's address. This attribute was added in vSphere API 7.0.0.0. If None, the services will not be filtered by address. :type groups: :class:`set` of :class:`str` or ``None`` :param groups: The group determines reports issued by which Attestation Service instances this Key Provider Service can accept. This attribute was added in vSphere API 7.0.0.0. If None, the services will not be filtered by groupId. """ self.hosts = hosts self.clusters = clusters self.address = address self.groups = groups VapiStruct.__init__(self) FilterSpec._set_binding_type( type.StructType( 'com.vmware.vcenter.trusted_infrastructure.trust_authority_hosts.kms.filter_spec', { 'hosts': type.OptionalType(type.SetType(type.IdType())), 'clusters': type.OptionalType(type.SetType(type.IdType())), 'address': type.OptionalType( type.ListType( type.ReferenceType( 'com.vmware.vcenter.trusted_infrastructure_client', 'NetworkAddress'))), 'groups': type.OptionalType(type.SetType(type.StringType())), }, FilterSpec, False, None)) def get( self, host, ): """ Returns the connection info about the Key Provider Service running on the specified host. This method was added in vSphere API 7.0.0.0. :type host: :class:`str` :param host: \\\\@{link com.vmware.vcenter.Host} id. The parameter must be an identifier for the resource type: ``HostSystem``. :rtype: :class:`Kms.Info` :return: The :class:`Kms.Info` instance which contains the information necessary to connect to the Key Provider Service. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if service's TLS certificate chain is not valid. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` if ``host`` doesn't match to any Host. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible` if connection to ``host`` failed. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if you do not have all of the privileges described as follows: * Method execution requires ``TrustedAdmin.ReadTrustedHosts``. * The resource ``HostSystem`` referenced by the parameter ``host`` requires ``System.View``. """ return self._invoke('get', { 'host': host, }) def list( self, spec=None, projection=None, ): """ Returns a list of the hosts running a Key Provider Service matching the specified :class:`Kms.FilterSpec`. This method was added in vSphere API 7.0.0.0. :type spec: :class:`Kms.FilterSpec` or ``None`` :param spec: Return details about Key Provider Services matching the filter. If {\\\\@term.unset} return all registered Key Provider Services. :type projection: :class:`Kms.SummaryType` or ``None`` :param projection: The type of the returned summary - brief, normal, or full. If {\\\\@term.unset} a normal projection will be used. :rtype: :class:`list` of :class:`Kms.Summary` :return: List of :class:`Kms.Summary` of Key Provider Services. :raise: :class:`com.vmware.vapi.std.errors_client.Error` if there is a generic error. :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` if the response data will exceed the message limit. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if you do not have all of the privileges described as follows: * Method execution requires ``TrustedAdmin.ReadTrustedHosts``. * The resource ``HostSystem`` referenced by the attribute :attr:`Kms.FilterSpec.hosts` requires ``System.View``. * The resource ``ClusterComputeResource`` referenced by the attribute :attr:`Kms.FilterSpec.clusters` requires ``System.View``. """ return self._invoke('list', { 'spec': spec, 'projection': projection, })
.. tip:: The arguments are used to initialize data attributes with the same names. """ def __init__( self, cert_chain=None, ): """ :type cert_chain: :class:`list` of :class:`str` :param cert_chain: Certificate chain in base64 format. This attribute was added in vSphere API 6.7.2. """ self.cert_chain = cert_chain VapiStruct.__init__(self) X509CertChain._set_binding_type( type.StructType( 'com.vmware.vcenter.certificate_management.x509_cert_chain', { 'cert_chain': type.ListType(type.StringType()), }, X509CertChain, False, None)) class StubFactory(StubFactoryBase): _attrs = { 'vcenter': 'com.vmware.vcenter.certificate_management.vcenter_client.StubFactory', }
def __init__(self, config): # properties for create operation create_input_type = type.StructType('operation-input', { 'org': type.StringType(), 'sddc_id': type.StringType(), 'addon_type': type.StringType(), 'credentials': type.ReferenceType('com.vmware.vmc.model_client', 'NewCredentials'), }) create_error_dict = { 'com.vmware.vapi.std.errors.concurrent_change': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ConcurrentChange'), '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'), } create_input_value_validator_list = [ ] create_output_validator_list = [ ] create_rest_metadata = OperationRestMetadata( http_method='POST', url_template='/vmc/api/orgs/{org}/sddcs/{sddcId}/addons/{addonType}/credentials', request_body_parameter='credentials', path_variables={ 'org': 'org', 'sddc_id': 'sddcId', 'addon_type': 'addonType', }, query_parameters={ }, content_type='application/json' ) # properties for get operation get_input_type = type.StructType('operation-input', { 'org': type.StringType(), 'sddc_id': type.StringType(), 'addon_type': type.StringType(), 'name': type.StringType(), }) get_error_dict = { 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), } get_input_value_validator_list = [ ] get_output_validator_list = [ ] get_rest_metadata = OperationRestMetadata( http_method='GET', url_template='/vmc/api/orgs/{org}/sddcs/{sddcId}/addons/{addonType}/credentials/{name}', path_variables={ 'org': 'org', 'sddc_id': 'sddcId', 'addon_type': 'addonType', 'name': 'name', }, query_parameters={ }, content_type='application/json' ) # properties for list operation list_input_type = type.StructType('operation-input', { 'org': type.StringType(), 'sddc_id': type.StringType(), 'addon_type': type.StringType(), }) list_error_dict = { 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), } list_input_value_validator_list = [ ] list_output_validator_list = [ ] list_rest_metadata = OperationRestMetadata( http_method='GET', url_template='/vmc/api/orgs/{org}/sddcs/{sddcId}/addons/{addonType}/credentials', path_variables={ 'org': 'org', 'sddc_id': 'sddcId', 'addon_type': 'addonType', }, query_parameters={ }, content_type='application/json' ) # properties for update operation update_input_type = type.StructType('operation-input', { 'org': type.StringType(), 'sddc_id': type.StringType(), 'addon_type': type.StringType(), 'name': type.StringType(), 'credentials': type.ReferenceType('com.vmware.vmc.model_client', 'UpdateCredentials'), }) update_error_dict = { 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), } update_input_value_validator_list = [ ] update_output_validator_list = [ ] update_rest_metadata = OperationRestMetadata( http_method='PUT', url_template='/vmc/api/orgs/{org}/sddcs/{sddcId}/addons/{addonType}/credentials/{name}', request_body_parameter='credentials', path_variables={ 'org': 'org', 'sddc_id': 'sddcId', 'addon_type': 'addonType', 'name': 'name', }, query_parameters={ }, content_type='application/json' ) operations = { 'create': { 'input_type': create_input_type, 'output_type': type.ReferenceType('com.vmware.vmc.model_client', 'NewCredentials'), 'errors': create_error_dict, 'input_value_validator_list': create_input_value_validator_list, 'output_validator_list': create_output_validator_list, 'task_type': TaskType.NONE, }, 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType('com.vmware.vmc.model_client', 'NewCredentials'), '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.ListType(type.ReferenceType('com.vmware.vmc.model_client', 'NewCredentials')), '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.vmc.model_client', 'NewCredentials'), '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, 'get': get_rest_metadata, 'list': list_rest_metadata, 'update': update_rest_metadata, } ApiInterfaceStub.__init__( self, iface_name='com.vmware.vmc.orgs.sddcs.addons.credentials', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
def __init__(self, config): # properties for list operation list_input_type = type.StructType( 'operation-input', { 'domain_id': type.StringType(), 'security_policy_id': type.StringType(), 'enforcement_point_path': type.OptionalType(type.StringType()), }) list_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } list_input_value_validator_list = [] list_output_validator_list = [] list_rest_metadata = OperationRestMetadata( http_method='GET', url_template= '/policy/api/v1/global-infra/domains/{domain-id}/security-policies/{security-policy-id}/statistics', path_variables={ 'domain_id': 'domain-id', 'security_policy_id': 'security-policy-id', }, query_parameters={ 'enforcement_point_path': 'enforcement_point_path', }, content_type='application/json') operations = { 'list': { 'input_type': list_input_type, 'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'SecurityPolicyStatisticsListResult'), 'errors': list_error_dict, 'input_value_validator_list': list_input_value_validator_list, 'output_validator_list': list_output_validator_list, 'task_type': TaskType.NONE, }, } rest_metadata = { 'list': list_rest_metadata, } ApiInterfaceStub.__init__( self, iface_name= 'com.vmware.nsx_policy.global_infra.domains.security_policies.statistics', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
def __init__(self, config): # properties for get operation get_input_type = type.StructType( 'operation-input', { 'enforcement_point_name': type.StringType(), 'firewall_section_id': type.StringType(), }) get_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } get_input_value_validator_list = [] get_output_validator_list = [] get_rest_metadata = OperationRestMetadata( http_method='GET', url_template= '/policy/api/v1/infra/realized-state/enforcement-points/{enforcement-point-name}/firewalls/firewall-sections/{firewall-section-id}', path_variables={ 'enforcement_point_name': 'enforcement-point-name', 'firewall_section_id': 'firewall-section-id', }, query_parameters={}, content_type='application/json') # properties for list operation list_input_type = type.StructType( 'operation-input', { 'enforcement_point_name': type.StringType(), 'cursor': type.OptionalType(type.StringType()), 'included_fields': type.OptionalType(type.StringType()), 'page_size': type.OptionalType(type.IntegerType()), 'sort_ascending': type.OptionalType(type.BooleanType()), 'sort_by': type.OptionalType(type.StringType()), }) list_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } list_input_value_validator_list = [] list_output_validator_list = [] list_rest_metadata = OperationRestMetadata( http_method='GET', url_template= '/policy/api/v1/infra/realized-state/enforcement-points/{enforcement-point-name}/firewalls/firewall-sections', path_variables={ 'enforcement_point_name': 'enforcement-point-name', }, query_parameters={ 'cursor': 'cursor', 'included_fields': 'included_fields', 'page_size': 'page_size', 'sort_ascending': 'sort_ascending', 'sort_by': 'sort_by', }, content_type='application/json') operations = { 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'RealizedFirewallSection'), 'errors': get_error_dict, 'input_value_validator_list': get_input_value_validator_list, 'output_validator_list': get_output_validator_list, 'task_type': TaskType.NONE, }, 'list': { 'input_type': list_input_type, 'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'RealizedFirewallSectionListResult'), 'errors': list_error_dict, 'input_value_validator_list': list_input_value_validator_list, 'output_validator_list': list_output_validator_list, 'task_type': TaskType.NONE, }, } rest_metadata = { 'get': get_rest_metadata, 'list': list_rest_metadata, } ApiInterfaceStub.__init__( self, iface_name= 'com.vmware.nsx_policy.infra.realized_state.enforcement_points.firewalls.firewall_sections', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
def __init__(self, config): # properties for get operation get_input_type = type.StructType( 'operation-input', { 'lswitch_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-switches/{lswitch-id}/statistics', path_variables={ 'lswitch_id': 'lswitch-id', }, query_parameters={ 'source': 'source', }, content_type='application/json') operations = { 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'LogicalSwitchStatistics'), '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.logical_switches.statistics', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
def __init__(self, config): # properties for list operation list_input_type = type.StructType( 'operation-input', { 'domain_id': type.StringType(), 'group_id': type.StringType(), 'enforcement_point_path': type.StringType(), 'cursor': type.OptionalType(type.StringType()), 'included_fields': type.OptionalType(type.StringType()), 'page_size': type.OptionalType(type.IntegerType()), 'sort_ascending': type.OptionalType(type.BooleanType()), 'sort_by': type.OptionalType(type.StringType()), }) list_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } list_input_value_validator_list = [] list_output_validator_list = [] list_rest_metadata = OperationRestMetadata( http_method='GET', url_template= '/policy/api/v1/infra/domains/{domain-id}/groups/{group-id}/members/ip-addresses', path_variables={ 'domain_id': 'domain-id', 'group_id': 'group-id', }, query_parameters={ 'enforcement_point_path': 'enforcement_point_path', 'cursor': 'cursor', 'included_fields': 'included_fields', 'page_size': 'page_size', 'sort_ascending': 'sort_ascending', 'sort_by': 'sort_by', }, content_type='application/json') operations = { 'list': { 'input_type': list_input_type, 'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'PolicyGroupIPMembersListResult'), '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.members.ip_addresses', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
def __init__(self, config): # properties for list operation list_input_type = type.StructType( 'operation-input', { 'lswitch_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-switches/{lswitch-id}/vtep-table', path_variables={ 'lswitch_id': 'lswitch-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', 'VtepListResult'), '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_switches.vtep_table', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
:mod:`com.vmware.vapi.metadata.metamodel_client` module. It could expose metamodel information of one or more components. This attribute is optional and it is only relevant when the value of ``type`` is :attr:`SourceType.REMOTE`. """ self.description = description self.type = type self.filepath = filepath self.address = address VapiStruct.__init__(self) SourceCreateSpec._set_binding_type( type.StructType( 'com.vmware.vapi.metadata.source_create_spec', { 'description': type.StringType(), 'type': type.ReferenceType(sys.modules[__name__], 'SourceType'), 'filepath': type.OptionalType(type.StringType()), 'address': type.OptionalType(type.URIType()), }, SourceCreateSpec, False, None)) class SourceInfo(VapiStruct): """ Metadata source info .. tip:: The arguments are used to initialize data attributes with the same names. """
:type resolution: :class:`com.vmware.vapi.std_client.LocalizableMessage` or ``None`` :param resolution: The resolution message, if any. Only :class:`set` for warnings and errors. """ self.id = id self.time = time self.message = message self.resolution = resolution VapiStruct.__init__(self) Notification._set_binding_type( type.StructType( 'com.vmware.vcenter.lcm.notification', { 'id': type.StringType(), 'time': type.OptionalType(type.DateTimeType()), 'message': type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage'), 'resolution': type.OptionalType( type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage')), }, Notification, False, None)) class Notifications(VapiStruct): """ The ``Notifications`` class contains info/warning/error messages that can
def __init__(self, config): # properties for get operation get_input_type = type.StructType( 'operation-input', { 'tier1_id': type.StringType(), 'locale_service_id': type.StringType(), 'service_id': type.StringType(), 'session_id': type.StringType(), 'enforcement_point_path': type.OptionalType(type.StringType()), 'source': type.OptionalType(type.StringType()), }) get_error_dict = { 'com.vmware.vapi.std.errors.service_unavailable': type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'), 'com.vmware.vapi.std.errors.invalid_request': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'), 'com.vmware.vapi.std.errors.internal_server_error': type.ReferenceType('com.vmware.vapi.std.errors_client', 'InternalServerError'), 'com.vmware.vapi.std.errors.unauthorized': type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'), 'com.vmware.vapi.std.errors.not_found': type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'), } get_input_value_validator_list = [] get_output_validator_list = [HasFieldsOfValidator()] get_rest_metadata = OperationRestMetadata( http_method='GET', url_template= '/policy/api/v1/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/ipsec-vpn-services/{service-id}/sessions/{session-id}/statistics', path_variables={ 'tier1_id': 'tier-1-id', 'locale_service_id': 'locale-service-id', 'service_id': 'service-id', 'session_id': 'session-id', }, query_parameters={ 'enforcement_point_path': 'enforcement_point_path', 'source': 'source', }, content_type='application/json') operations = { 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType('com.vmware.nsx_policy.model_client', 'AggregateIPSecVpnSessionStatistics'), 'errors': get_error_dict, 'input_value_validator_list': get_input_value_validator_list, 'output_validator_list': get_output_validator_list, 'task_type': TaskType.NONE, }, } rest_metadata = { 'get': get_rest_metadata, } ApiInterfaceStub.__init__( self, iface_name= 'com.vmware.nsx_policy.infra.tier_1s.locale_services.ipsec_vpn_services.sessions.statistics', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
def __init__(self, config): # properties for create operation create_input_type = type.StructType( 'operation-input', { 'n_DRA_profile': type.ReferenceType('com.vmware.nsx.model_client', 'NDRAProfile'), }) 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/ipv6/nd-ra-profiles', request_body_parameter='n_DRA_profile', path_variables={}, query_parameters={}, content_type='application/json') # properties for delete operation delete_input_type = type.StructType( 'operation-input', { 'nd_ra_profile_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/ipv6/nd-ra-profiles/{nd-ra-profile-id}', path_variables={ 'nd_ra_profile_id': 'nd-ra-profile-id', }, query_parameters={}, content_type='application/json') # properties for get operation get_input_type = type.StructType('operation-input', { 'nd_ra_profile_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/ipv6/nd-ra-profiles/{nd-ra-profile-id}', path_variables={ 'nd_ra_profile_id': 'nd-ra-profile-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 = [] list_rest_metadata = OperationRestMetadata( http_method='GET', url_template='/api/v1/ipv6/nd-ra-profiles', 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', { 'nd_ra_profile_id': type.StringType(), 'n_DRA_profile': type.ReferenceType('com.vmware.nsx.model_client', 'NDRAProfile'), }) 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/ipv6/nd-ra-profiles/{nd-ra-profile-id}', request_body_parameter='n_DRA_profile', path_variables={ 'nd_ra_profile_id': 'nd-ra-profile-id', }, query_parameters={}, content_type='application/json') operations = { 'create': { 'input_type': create_input_type, 'output_type': type.ReferenceType('com.vmware.nsx.model_client', 'NDRAProfile'), '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', 'NDRAProfile'), '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', 'NDRAProfileListResult'), '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', 'NDRAProfile'), '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.ipv6.nd_ra_profiles', config=config, operations=operations, rest_metadata=rest_metadata, is_vapi_rest=False)
class Tasks(VapiInterface): """ The ``Tasks`` class provides methods for managing the task related to a long running operation. This class was added in vSphere API 6.7.1. """ RESOURCE_TYPE = "com.vmware.cis.task" """ Resource type for task. This class attribute was added in vSphere API 6.7.1. """ _VAPI_SERVICE_ID = 'com.vmware.cis.tasks' """ 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, _TasksStub) self._VAPI_OPERATION_IDS = {} class GetSpec(VapiStruct): """ The ``Tasks.GetSpec`` class describes what data should be included when retrieving information about a task. 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, return_all=None, exclude_result=None, ): """ :type return_all: :class:`bool` or ``None`` :param return_all: If true, all data, including operation-specific data, will be returned, otherwise only the data described in :class:`com.vmware.cis.task_client.Info` will be returned. This attribute was added in vSphere API 6.7.1. If None, only the data described in :class:`com.vmware.cis.task_client.Info` will be returned. :type exclude_result: :class:`bool` or ``None`` :param exclude_result: If true, the result will not be included in the task information, otherwise it will be included. This attribute was added in vSphere API 6.7.1. If None, the result of the operation will be included in the task information. """ self.return_all = return_all self.exclude_result = exclude_result VapiStruct.__init__(self) GetSpec._set_binding_type( type.StructType( 'com.vmware.cis.tasks.get_spec', { 'return_all': type.OptionalType(type.BooleanType()), 'exclude_result': type.OptionalType(type.BooleanType()), }, GetSpec, False, None)) class FilterSpec(VapiStruct): """ The ``Tasks.FilterSpec`` class contains attributes used to filter the results when listing tasks (see :func:`Tasks.list`). If multiple attributes are specified, only tasks matching all of the attributes match the filter. Currently at least one of :attr:`Tasks.FilterSpec.tasks` or :attr:`Tasks.FilterSpec.services` must be specified and not empty.. 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, tasks=None, services=None, operations=None, status=None, targets=None, users=None, ): """ :type tasks: :class:`set` of :class:`str` or ``None`` :param tasks: Identifiers of tasks that can match the filter. This attribute was added in vSphere API 6.7.1. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: ``com.vmware.cis.task``. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: ``com.vmware.cis.task``. This attribute may be None if ``services`` is specified. Currently all tasks must be from the same provider. If None or empty, tasks with any identifier will match the filter. :type services: :class:`set` of :class:`str` or ``None`` :param services: Identifiers of services. Tasks created by operations in these services match the filter (see :attr:`com.vmware.cis.task_client.CommonInfo.service`). This attribute was added in vSphere API 6.7.1. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: ``com.vmware.vapi.service``. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: ``com.vmware.vapi.service``. This attribute may be None if ``tasks`` is specified. Currently all services must be from the same provider. If this attribute is None or empty, tasks for any service will match the filter. :type operations: :class:`set` of :class:`str` or ``None`` :param operations: Identifiers of operations. Tasks created by these operations match the filter (see :attr:`com.vmware.cis.task_client.CommonInfo.operation`). Note that an operation identifier by itself is not globally unique. To filter on an operation, the identifier of the service interface containing the operation should also be specified in ``services``.. This attribute was added in vSphere API 7.0.0.0. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: ``com.vmware.vapi.operation``. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: ``com.vmware.vapi.operation``. If None or empty, tasks associated with any operation will match the filter. :type status: :class:`set` of :class:`com.vmware.cis.task_client.Status` or ``None`` :param status: Status that a task must have to match the filter (see :attr:`com.vmware.cis.task_client.CommonInfo.status`). This attribute was added in vSphere API 6.7.1. If None or empty, tasks with any status match the filter. :type targets: :class:`list` of :class:`com.vmware.vapi.std_client.DynamicID` or ``None`` :param targets: Identifiers of the targets the operation for the associated task created or was performed on (see :attr:`com.vmware.cis.task_client.CommonInfo.target`). This attribute was added in vSphere API 6.7.1. If None or empty, tasks associated with operations on any target match the filter. :type users: :class:`set` of :class:`str` or ``None`` :param users: Users who must have initiated the operation for the associated task to match the filter (see :attr:`com.vmware.cis.task_client.CommonInfo.user`). This attribute was added in vSphere API 6.7.1. If None or empty, tasks associated with operations initiated by any user match the filter. """ self.tasks = tasks self.services = services self.operations = operations self.status = status self.targets = targets self.users = users VapiStruct.__init__(self) FilterSpec._set_binding_type( type.StructType( 'com.vmware.cis.tasks.filter_spec', { 'tasks': type.OptionalType(type.SetType(type.IdType())), 'services': type.OptionalType(type.SetType(type.IdType())), 'operations': type.OptionalType(type.SetType(type.IdType())), 'status': type.OptionalType( type.SetType( type.ReferenceType('com.vmware.cis.task_client', 'Status'))), 'targets': type.OptionalType( type.ListType( type.ReferenceType('com.vmware.vapi.std_client', 'DynamicID'))), 'users': type.OptionalType(type.SetType(type.StringType())), }, FilterSpec, False, None)) def get( self, task, spec=None, ): """ Returns information about a task. This method was added in vSphere API 6.7.1. :type task: :class:`str` :param task: Task identifier. The parameter must be an identifier for the resource type: ``com.vmware.cis.task``. :type spec: :class:`Tasks.GetSpec` or ``None`` :param spec: Specification on what to get for a task. If None, the behavior is equivalent to a :class:`Tasks.GetSpec` with all attributes None which means only the data described in :class:`com.vmware.cis.task_client.Info` will be returned and the result of the operation will be return. :rtype: :class:`com.vmware.cis.task_client.Info` :return: Information about the specified task. :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 task is not found. :raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible` if the task's state cannot be accessed. :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` if the system is unable to communicate with a service to complete the request. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user doesn't have the required privileges. """ return self._invoke('get', { 'task': task, 'spec': spec, }) def list( self, filter_spec=None, result_spec=None, ): """ Returns information about at most 1000 visible (subject to permission checks) tasks matching the :class:`Tasks.FilterSpec`. All tasks must be in the same provider. This method was added in vSphere API 6.7.1. :type filter_spec: :class:`Tasks.FilterSpec` or ``None`` :param filter_spec: Specification of matching tasks. This is currently required. In the future, if it is None, the behavior is equivalent to a :class:`Tasks.FilterSpec` with all attributes None which means all tasks match the filter. :type result_spec: :class:`Tasks.GetSpec` or ``None`` :param result_spec: Specification of what to return for a task. If None, the behavior is equivalent to a :class:`Tasks.GetSpec` with all attributes None which means only the data describe in :class:`com.vmware.cis.task_client.Info` will be returned and the result of the operation will be return. :rtype: :class:`dict` of :class:`str` and :class:`com.vmware.cis.task_client.Info` :return: Map of task identifier to information about the task. The key in the return value :class:`dict` will be an identifier for the resource type: ``com.vmware.cis.task``. :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` if any of the specified parameters are invalid. :raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible` if a task's state cannot be accessed or over 1000 tasks matching the :class:`Tasks.FilterSpec`. :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` if the system is unable to communicate with a service to complete the request. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user doesn't have the required privileges. """ return self._invoke('list', { 'filter_spec': filter_spec, 'result_spec': result_spec, }) def cancel( self, task, ): """ Cancel a running operation associated with the task. This is the best effort attempt. Operation may not be cancelled anymore once it reaches certain stage. This method was added in vSphere API 6.7.1. :type task: :class:`str` :param task: Task identifier. The parameter must be an identifier for the resource type: ``com.vmware.cis.task``. :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.NotAllowedInCurrentState` if the task is already canceled or completed. :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` if the task is not found. :raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible` if the task's state cannot be accessed. :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` if the system is unable to communicate with a service to complete the request. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` if the user can not be authenticated. :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` if the user doesn't have the required privileges. :raise: :class:`com.vmware.vapi.std.errors_client.Unsupported` if the task is not cancelable. """ return self._invoke('cancel', { 'task': task, })