com.vmware package

Submodules

com.vmware.nsx_vmc_app_client module

class com.vmware.nsx_vmc_app_client.StubFactory(stub_config)

Bases: vmware.vapi.bindings.stub.StubFactoryBase

Initialize StubFactoryBase

Parameters

stub_config (vmware.vapi.bindings.stub.StubConfiguration) – Stub config instance

com.vmware.nsx_vmc_app_client_for_vmc module

Convenience methods to get API clients for NSX APIs in VMC

class com.vmware.nsx_vmc_app_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_vmc_app_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_vmc_app_client_for_vmc.create_nsx_vmc_app_client_for_vmc(refresh_token, org_id, sddc_id, session=None)

Helper method to create an instance of the VMC NSX VMC app 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