com.vmware package

Subpackages

Submodules

com.vmware.nsx_policy_client module

class com.vmware.nsx_policy_client.Batch(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

Parameters:config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.
create(batch_request, atomic=None)

Enables you to make multiple API requests using a single request. The batch API takes in an array of logical HTTP requests represented as JSON arrays. Each request has a method (GET, PUT, POST, or DELETE), a relative_url (the portion of the URL after https://<nsx-mgr>/api/), optional headers array (corresponding to HTTP headers) and an optional body (for POST and PUT requests). The batch API returns an array of logical HTTP responses represented as JSON arrays. Each response has a status code, an optional headers array and an optional body (which is a JSON-encoded string).

Parameters:
Return type:

com.vmware.nsx_policy.model_client.BatchResponse

Returns:

com.vmware.nsx_policy.model.BatchResponse

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable

Raise:

com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed

Raise:

com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error

Raise:

com.vmware.vapi.std.errors_client.Unauthorized Forbidden

Raise:

com.vmware.vapi.std.errors_client.NotFound Not Found

class com.vmware.nsx_policy_client.Cluster(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

Parameters:config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.
backuptoremote()

Request one-time backup. The backup will be uploaded using the same server configuration as for automatic backup.

Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
get()

Returns information about the NSX cluster configuration. An NSX cluster has two functions or purposes, commonly referred to as "roles." These two roles are control and management. Each NSX installation has a single cluster. Separate NSX clusters do not share data. In other words, a given data-plane node is attached to only one cluster, not to multiple clusters.

Return type:com.vmware.nsx_policy.model_client.ClusterConfig
Returns:com.vmware.nsx_policy.model.ClusterConfig
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
summarizeinventorytoremote()

Request one-time inventory summary. The backup will be uploaded using the same server configuration as for an automatic backup.

Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
class com.vmware.nsx_policy_client.ErrorResolver(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

Parameters:config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.
get(error_id)

Returns some metadata about the given error_id. This includes information of whether there is a resolver present for the given error_id and its associated user input data

Parameters:error_id (str) – (required)
Return type:com.vmware.nsx_policy.model_client.ErrorResolverInfo
Returns:com.vmware.nsx_policy.model.ErrorResolverInfo
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
list()

Returns a list of metadata for all the error resolvers registered.

Return type:com.vmware.nsx_policy.model_client.ErrorResolverInfoList
Returns:com.vmware.nsx_policy.model.ErrorResolverInfoList
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
resolveerror(error_resolver_metadata_list)

Invokes the corresponding error resolver for the given error(s) present in the payload

Parameters:error_resolver_metadata_list (com.vmware.nsx_policy.model_client.ErrorResolverMetadataList) – (required)
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
class com.vmware.nsx_policy_client.Infra(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

Parameters:config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.
get(filter=None)

Read infra. Returns only the infra related properties. Inner object are not populated.

Parameters:filter (str or None) – Filter string as java regex (optional)
Return type:com.vmware.nsx_policy.model_client.Infra
Returns:com.vmware.nsx_policy.model.Infra
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
patch(infra)

Update the infra including all the nested entities

Parameters:infra (com.vmware.nsx_policy.model_client.Infra) – (required)
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
update(infra)

Update the infra including all the nested entities

Parameters:infra (com.vmware.nsx_policy.model_client.Infra) – (required)
Return type:com.vmware.nsx_policy.model_client.Infra
Returns:com.vmware.nsx_policy.model.Infra
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
class com.vmware.nsx_policy_client.Licenses(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

Parameters:config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.
create(license)

This will add a license key to the system. The API supports adding only one license key for each license edition type - Standard, Advanced or Enterprise. If a new license key is tried to add for an edition for which the license key already exists, then this API will return an error.

Parameters:license (com.vmware.nsx_policy.model_client.License) – (required)
Return type:com.vmware.nsx_policy.model_client.License
Returns:com.vmware.nsx_policy.model.License
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
delete(license_key)

Deprecated. Use POST /licenses?action=delete API instead.

Parameters:license_key (str) – (required)
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
delete_0(license)

This will delete the license key identified in the request body by "license_key" and its properties from the system. Attempting to delete the last license key will result in an error.

Parameters:license (com.vmware.nsx_policy.model_client.License) – (required)
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
get()

Deprecated. Use the GET /licenses API instead.

Return type:com.vmware.nsx_policy.model_client.License
Returns:com.vmware.nsx_policy.model.License
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
getlicensebykey(license_key)

Deprecated. Use GET /licenses API instead.

Parameters:license_key (str) – (required)
Return type:com.vmware.nsx_policy.model_client.License
Returns:com.vmware.nsx_policy.model.License
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
list()

Returns all licenses.

Return type:com.vmware.nsx_policy.model_client.LicensesListResult
Returns:com.vmware.nsx_policy.model.LicensesListResult
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
update(license)

Deprecated. Use the POST /licenses API instead

Parameters:license (com.vmware.nsx_policy.model_client.License) – (required)
Return type:com.vmware.nsx_policy.model_client.License
Returns:com.vmware.nsx_policy.model.License
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
class com.vmware.nsx_policy_client.StubFactory(stub_config)

Bases: vmware.vapi.bindings.stub.StubFactoryBase

Initialize StubFactoryBase

Parameters:stub_config (vmware.vapi.bindings.stub.StubConfiguration) – Stub config instance
class com.vmware.nsx_policy_client.Tasks(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

Parameters:config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.
get(task_id)

Get information about the specified task

Parameters:task_id (str) – ID of task to read (required)
Return type:com.vmware.nsx_policy.model_client.TaskProperties
Returns:com.vmware.nsx_policy.model.TaskProperties
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
list(cursor=None, included_fields=None, page_size=None, request_uri=None, sort_ascending=None, sort_by=None, status=None, user=None)

Get information about all tasks

Parameters:
  • cursor (str or None) – Opaque cursor to be used for getting next page of records (supplied by current result page) (optional)
  • included_fields (str or None) – Comma separated list of fields that should be included in query result (optional)
  • page_size (long or None) – Maximum number of results to return in this page (server may return fewer) (optional, default to 1000)
  • request_uri (str or None) – Request URI(s) to include in query result (optional)
  • sort_ascending (bool or None) – (optional)
  • sort_by (str or None) – Field by which records are sorted (optional)
  • status (str or None) – Status(es) to include in query result (optional)
  • user (str or None) – Names of users to include in query result (optional)
Return type:

com.vmware.nsx_policy.model_client.TaskListResult

Returns:

com.vmware.nsx_policy.model.TaskListResult

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable

Raise:

com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed

Raise:

com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error

Raise:

com.vmware.vapi.std.errors_client.Unauthorized Forbidden

Raise:

com.vmware.vapi.std.errors_client.NotFound Not Found

class com.vmware.nsx_policy_client.Templates(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

Parameters:config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.
delete(template_id)

Delete a template.

Parameters:template_id (str) – Template identifier (required)
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
deploy(template_id, policy_template_parameters)

Read a template, populate the placeholders’ fields with the parameters’ values, and deploy the template body by creating or updating all the nested policy objects inside the AbstractSpace object.

Parameters:
Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable

Raise:

com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed

Raise:

com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error

Raise:

com.vmware.vapi.std.errors_client.Unauthorized Forbidden

Raise:

com.vmware.vapi.std.errors_client.NotFound Not Found

get(template_id)

Read a template and returns the template properties for a given template identifier.

Parameters:template_id (str) – Template identifier (required)
Return type:com.vmware.nsx_policy.model_client.PolicyTemplate
Returns:com.vmware.nsx_policy.model.PolicyTemplate
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found
list(cursor=None, included_fields=None, page_size=None, sort_ascending=None, sort_by=None)

List Policy Templates

Parameters:
  • cursor (str or None) – Opaque cursor to be used for getting next page of records (supplied by current result page) (optional)
  • included_fields (str or None) – Comma separated list of fields that should be included in query result (optional)
  • page_size (long or None) – Maximum number of results to return in this page (server may return fewer) (optional, default to 1000)
  • sort_ascending (bool or None) – (optional)
  • sort_by (str or None) – Field by which records are sorted (optional)
Return type:

com.vmware.nsx_policy.model_client.PolicyTemplateListResult

Returns:

com.vmware.nsx_policy.model.PolicyTemplateListResult

Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable

Raise:

com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed

Raise:

com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error

Raise:

com.vmware.vapi.std.errors_client.Unauthorized Forbidden

Raise:

com.vmware.vapi.std.errors_client.NotFound Not Found

patch(template_id, policy_template)

Create a new template if the specified template id does not correspond to an existing template. Update the template if otherwise.

Parameters:
Raise:

com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable

Raise:

com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed

Raise:

com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error

Raise:

com.vmware.vapi.std.errors_client.Unauthorized Forbidden

Raise:

com.vmware.vapi.std.errors_client.NotFound Not Found

class com.vmware.nsx_policy_client.TrustManagement(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

Parameters:config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.
get()

Returns information about the supported algorithms and key sizes.

Return type:com.vmware.nsx_policy.model_client.TrustManagementData
Returns:com.vmware.nsx_policy.model.TrustManagementData
Raise:com.vmware.vapi.std.errors_client.ServiceUnavailable Service Unavailable
Raise:com.vmware.vapi.std.errors_client.InvalidRequest Bad Request, Precondition Failed
Raise:com.vmware.vapi.std.errors_client.InternalServerError Internal Server Error
Raise:com.vmware.vapi.std.errors_client.Unauthorized Forbidden
Raise:com.vmware.vapi.std.errors_client.NotFound Not Found

com.vmware.nsx_policy_client_for_vmc module

Convenience methods to get API clients for NSX APIs in VMC

class com.vmware.nsx_policy_client_for_vmc.CSPSecurityContextFilter(session, refresh_token, refresh_url)

Bases: vmware.vapi.security.client.security_context_filter.SecurityContextFilter

CSP Security Context filter in API Provider chain adds the security context based on a refresh token to the execution context passed in.

Initialize SecurityContextFilter

Parameters:
  • session (requests.Session) – Requests Session object to use for making HTTP calls
  • refresh_token (str) – Refresh token to use for obtaining an access token
  • refresh_url (str) – URL that allows exchanging a refresh token for an access token
get_max_retries()

Get the max number of retries

Return type:int
Returns:Number of retries
get_security_context(on_error)

Retrieve security context. If this method is called after an error occured, then a new access token is obtained using the refresh token and a new security context is created.

Parameters:on_error (bool) – Whether this method is called after getting an error
Return type:vmware.vapi.core.SecurityContext
Returns:Security context
should_retry(error_value)

Returns whether the request should be retried or not based on the error specified.

Parameters:error_value (vmware.vapi.data.value.ErrorValue) – Method error
Return type:bool
Returns:Returns True if request should be retried in case the error is either Unauthenticated or Unauthorized else False
class com.vmware.nsx_policy_client_for_vmc.VmcNsxClient(stub_factory_class, session, refresh_token, vmc_url, csp_url, org_id, sddc_id)

Bases: vmware.vapi.bindings.stub.ApiClient

Client class that providess access to stubs for all the services in the VMC NSX API

Initialize VmcClient by creating a stub factory instance using a CSP Security context filter added to the filter chain of the connector

Parameters:
  • stub_factory_class (type) – Which stub factory class to use
  • session (requests.Session) – Requests HTTP session instance
  • refresh_token (str) – Refresh token obtained from CSP
  • vmc_url (str) – URL of the VMC service
  • csp_url (str) – URL of the CSP service
  • org_id (str) – ID of the VMC organization
  • sddc_id (str) – ID of the VMC Software-Defined Data Center (SDDC)
com.vmware.nsx_policy_client_for_vmc.create_nsx_policy_client_for_vmc(refresh_token, org_id, sddc_id, session=None)

Helper method to create an instance of the VMC NSX Policy API client

Parameters:
  • refresh_token (str) – Refresh token obtained from CSP
  • org_id (str) – ID of the VMC organization
  • sddc_id (str) – ID of the VMC Software-Defined Data Center (SDDC)
  • session (requests.Session or None) – Requests HTTP session instance. If not specified, then one is automatically created and used
Return type:

vmware.vapi.vmc.client.VmcNsxClient

Returns:

VMC NSX Client instance