vmware.vapi.security.client package

Submodules

vmware.vapi.security.client.security_context_filter module

SecurityContext API Provider filter

class vmware.vapi.security.client.security_context_filter.LegacySecurityContextFilter(next_provider=None, security_context=None)

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

SecurityContextFilter in API Provider chain adds the security context to the execution context passed in.

Initialize SecurityContextFilter

Parameters
get_max_retries()

Get the max number of retries

Return type

int

Returns

Number of retries

get_security_context(on_error)

Retrieve the stored security context.

Parameters

on_error (bool) – Whether this method is called after getting an error

Return type

vmware.vapi.core.SecurityContext or None

Returns

Security context or None

set_security_context(security_context)

Set security context

Parameters

security_context (vmware.vapi.core.SecurityContext) – Security context

should_retry(error_value)

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

Parameters

error_value (vmware.vapi.data.value.ErrorValue) – Method error

Return type

bool

Returns

Returns True if request should be retried based on the error value provided else False

class vmware.vapi.security.client.security_context_filter.SecurityContextFilter(next_provider=None)

Bases: vmware.vapi.provider.filter.ApiProviderFilter

SecurityContextFilter in API Provider chain adds the security context to the execution context passed in.

Initialize SecurityContextFilter

Parameters

next_provider (vmware.vapi.core.ApiProvider) – API Provider to invoke the requests

abstract get_max_retries()

Get the max number of retries

Return type

int

Returns

Number of retries

abstract get_security_context(on_error)

Retrieve security context. If this method is called after an error occured and the request needs to be retried, then a new security context may be created depending on the scheme.

Parameters

on_error (bool) – Whether this method is called after getting an error

Return type

vmware.vapi.core.SecurityContext

Returns

Security context

invoke(service_id, operation_id, input_value, ctx)

Invoke an API request

Parameters
  • service_id (str) – Service identifier

  • operation_id (str) – Operation identifier

  • input_value (vmware.vapi.data.value.StructValue) – Method input parameters

  • ctx (vmware.vapi.core.ExecutionContext) – Execution context for this method

Return type

vmware.vapi.core.MethodResult

Returns

Result of the method invocation

abstract should_retry(error_value)

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

Parameters

error_value (vmware.vapi.data.value.ErrorValue) – Method error

Return type

bool

Returns

Returns True if request should be retried based on the error value provided else False