Bindings common module that contains common code for skeletons and stubs
Bases: object
Helper class that resolves a fully qualified canonical type name to a type descriptor. The type name can be a structure name or an error name.
Initialize NameToTypeResolver
Parameters: | type_map (dict of str and VapiStruct) – Type map that contains the canonical names and the references to the binding classes for these types. |
---|
Create and raise a CoreException from a list of messages
Parameters: | msg_list (vmware.vapi.message.Message) – List of messages |
---|---|
Raise : | CoreException if msg list is not empty |
Type converter to/from vAPI runtime data model to Python native data model
Bases: vmware.vapi.bindings.type.BindingTypeVisitor
Visitor to convert from Python native value to vAPI DataValue
Initialize PythonToVapiVisitor
Parameters: | value (object) – Native python value |
---|
Returns the vAPI DataValue converted from the Python native value
Return type: | vmware.vapi.data.value.DataValue |
---|---|
Returns: | vAPI DataValue |
Visit any error value
Parameters: | typ (vmware.vapi.bindings.type.AnyErrorType) – Binding type of the value |
---|
Visit a datetime value
Parameters: | typ (vmware.vapi.bindings.type.DateTimeType) – Binding type of the value |
---|
Visit any struct value
Parameters: | typ (vmware.vapi.bindings.type.DynamicStructType) – Binding type of the value |
---|
Visit a enum type python value
Parameters: | typ (vmware.vapi.bindings.type.EnumType) – Binding type of the value |
---|
Visit an error value
Parameters: | typ (vmware.vapi.bindings.type.ErrorType) – Binding type of the value |
---|
Visit a list value
Parameters: | typ (vmware.vapi.bindings.type.ListType) – Binding type of the value |
---|
Visit a python dict
Parameters: | typ (vmware.vapi.bindings.type.MapType) – Binding type of the value |
---|
Visit an opaque value. Don’t do any conversion.
Parameters: | typ (vmware.vapi.bindings.type.OpaqueType) – Binding type of the value |
---|
Visit an optional value
Parameters: | typ (vmware.vapi.bindings.type.OptionalType) – Binding type of the value |
---|
Visit a primitive type python value
Parameters: | typ (vmware.vapi.bindings.type.BindingType) – Binding type of the value |
---|
Visit a reference type
Parameters: | typ (vmware.vapi.bindings.type.ReferenceType) – Binding type of the value |
---|
Visit a python set
Parameters: | typ (vmware.vapi.bindings.type.SetType) – Binding type of the value |
---|
Visit a struct value
Parameters: | typ (vmware.vapi.bindings.type.StructType) – Binding type of the value |
---|
Visit an URI value
Parameters: | typ (vmware.vapi.bindings.type.UriType) – Binding type of the value |
---|
Visit a void value (i.e. None)
Parameters: | typ (vmware.vapi.bindings.type.VoidType) – Binding type of the value |
---|
Bases: object
Converter class that converts values from vAPI data model to Python native data model
Converts vAPI DataValue to Python native value
Parameters: |
|
---|---|
Return type: | object |
Returns: | Python native value |
Converts Python native value to vAPI DataValue
Parameters: |
|
---|---|
Return type: | |
Returns: | vAPI DataValue |
Bases: vmware.vapi.bindings.type.BindingTypeVisitor
Visitor to convert from vAPI DataValue to Python native value
Initialize VapiToPythonVisitor
Parameters: |
|
---|
Returns the Python native value converted from the vAPI DataValue
Return type: | object |
---|---|
Returns: | Native python value |
Visit ErrorValue to convert it into the base VapiError
Parameters: | typ (vmware.vapi.bindings.type.AnyErrorType) – Binding type of the value |
---|
Visit a datetime value
Parameters: | typ (vmware.vapi.bindings.type.DateTimeType) – Binding type of the value |
---|
Visit StructValue to convert it into the base VapiStruct
Parameters: | typ (vmware.vapi.bindings.type.DynamicStructType) – Binding type of the value |
---|
Visit an Enum value
Parameters: | typ (vmware.vapi.bindings.type.EnumType) – Binding type of the value |
---|
Visit ErrorValue
Parameters: | typ (vmware.vapi.bindings.type.ErrorType) – Binding type of the value |
---|
Visit a ListValue
Parameters: | typ (vmware.vapi.bindings.type.ListType) – Binding type of the value |
---|
Visit a List Value. This ListValue must represent a map. Each element of the ListValue is a StructValue with two fields, namely ‘key’ and ‘value’. The ‘key’ field represents the key of the map and the ‘value’ field represents the value of the map. Also, since this represents a map, there should not be duplicate keys.
Parameters: | typ (vmware.vapi.bindings.type.MapType) – Binding type of the value |
---|
Since there is no OpaqueValue, don’t do any conversion
Parameters: | typ (vmware.vapi.bindings.type.OpaqueType) – Binding type of the value |
---|
Visit OptionalValue
Parameters: | typ (vmware.vapi.bindings.type.OptionalType) – Binding type of the value |
---|
Visit one of the primitive DataValues
Parameters: | typ (vmware.vapi.bindings.type.BindingType) – Binding type of the value |
---|
Visit a reference type
Parameters: | typ (vmware.vapi.bindings.type.ReferenceType) – Binding type of the value |
---|
Visit a List Value. This ListValue must represent a set i.e. there must not be any duplicate elements
Parameters: | typ (vmware.vapi.bindings.type.SetType) – Binding type of the value |
---|
Visit StringValue
Parameters: | typ (vmware.vapi.bindings.type.StringType) – Binding type of the value |
---|
Visit StructValue
Parameters: | typ (vmware.vapi.bindings.type.StructType) – Binding type of the value |
---|
Visit an URI value
Parameters: | typ (vmware.vapi.bindings.type.UriType) – Binding type of the value |
---|
Since there is no VoidValue, just return None
Parameters: | typ (vmware.vapi.bindings.type.VoidType) – Binding type of the value |
---|
Utility library for converting to/from datetime objects in Python Bindings
Bases: object
Helper class to convert to/from Python datetime strings to datetime objects.
Datetime is represented as vmware.vapi.data.value.StringValue in the vAPI Runtime. Datetime is a primitive string that follows a subset of ISO 8601. DateTime string represents a complete date plus hours, minutes, seconds and a decimal fraction of a second:
YYYY-MM-DDThh:mm:ss.sssZ (e.g. 1878-03-03T19:20:30.000Z) where:
- YYYY = four-digit year (years BC are not supported;
- 0001 = 1 AD is the first valid year, 0000 = 1 BC is not allowed)
MM = two-digit month (01=January, ..., 12=December) DD = two-digit day of month (01 through 31) “T” = separator; appears literally in the string hh = two digits of hour (00 through 23; 24 NOT allowed;
am/pm NOT allowed)mm = two digits of minute (00 through 59) ss = two digits of second (00 through 59) sss = exactly three digits representing milliseconds “Z” = UTC time zone designator; appears literally in the string
Convert from Python native datetime object to the datetime format in vAPI Runtime i.e. YYYY-MM-DDThh:mm:ss.sssZ.
datetime objects returned by datetime.now() or datetime.utcnow() does not contain any timezone information. The caller to this method should only pass datetime objects that have time in UTC timezone.
datetime objects have microsecond precision but the vAPI datetime string format has millisecond precision. The method will truncate the microsecond to millisecond and won’t do any rounding of the value.
Parameters: | datetime_obj (datetime.datetime) – Datetime object with UTC time |
---|---|
Return type: | str |
Returns: | String representation of the input datetime object |
Bindings data classes
Bases: unicode
Representation of IDL Enum in python language bindings
Returns the corresponding BindingType for the VapiStruct class
Return type: | vmware.vapi.data.value.BindingType or None |
---|---|
Returns: | BindingType for this VapiStruct |
Returns the list of all the possible enum values
Return type: | list of vmware.vapi.bindings.enum.Enum |
---|---|
Returns: | List of all possible enum values |
Error classes and factory
Bases: vmware.vapi.bindings.error.VapiError
VapiError which represents a VMODL2 error that was reported but couldn’t be resolved
Initialize VapiError
Parameters: |
|
---|
Bases: vmware.vapi.bindings.struct.VapiStruct, exceptions.Exception
Representation of VMODL Error in python language bindings
Initialize VapiError
Parameters: |
|
---|
Returns the corresponding ErrorValue for the VapiError class
Return type: | vmware.vapi.data.value.ErrorValue |
---|---|
Returns: | ErrorValue for this VapiError |
Message Factory import for the bindings to use
Skeleton helper classes
Bases: vmware.vapi.core.ApiInterface
Skeleton class for ApiInterface. This class implements the ApiInterface interface.
Initialize the ApiInterface skeleton class
Parameters: |
|
---|
Check if the StructValues inside the input DataValue has any unknown fields
Parameters: |
|
---|---|
Return type: | |
Returns: | ErrorValue describing the unknown fields or None if no unknown fields were found |
Invokes the specified method using the execution context and the input provided
Parameters: |
|
---|---|
Return type: | |
Returns: | Result of the method invocation |
Returns true if the value is OptionalValue and it is set
Parameters: | value (vmware.vapi.data.value.DataValue) – value to be checked |
---|---|
Return type: | bool |
Returns: | True if the value is OptionalValue and is set, False otherwise |
Bases: logging.Filter
This is a filter that injects request context into the log
Initialize a filter.
Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no name is specified, allow every event.
Bases: object
vAPI Interface class is used by the python server side bindings. This encapsulates the vmware.vapi.bindings.skeleton.ApiInterfaceSkeleton class.
Initialize the VapiInterface class
Parameters: |
|
---|
Returns the ApiInterfaceSkeleton instance. Local Provider uses this method to discover the ApiInterface so that it can route method calls for the methods implemented by this interface.
Return type: | vmware.vapi.bindings.skeleton.ApiInterfaceSkeleton |
---|---|
Returns: | Api Interface skeleton class for this interface |
Returns the execution context of a method invocation
Return type: | vmware.vapi.core.ExecutionContext |
---|---|
Returns: | Execution context of a method invocation |
Bindings data classes
Bases: object
Helper class to pretty print Python native values (with special support for VapiStruct objects).
Initialize PrettyPrinter
Parameters: |
|
---|
Print a Python native value
Parameters: |
|
---|
Bases: object
Representation of IDL Structure in python language bindings
Initialize VapiStruct
Parameters: |
|
---|
Convert the underlying StructValue to an instance of the provided class if possible. Conversion will be possible if the StructValue contains all the fields expected by the provided class and the type of the value in each fields matches the type of the field expected by the provided class.
Parameters: | cls (vmware.vapi.data.value.StructValue) – The type to convert to |
---|---|
Return type: | :class:’vmware.vapi.bindings.struct.VapiStruct’ |
Returns: | The converted value |
Returns the corresponding BindingType for the VapiStruct class
Return type: | vmware.vapi.bindings.type.BindingType |
---|---|
Returns: | BindingType for this VapiStruct |
Returns the struct field value
Parameters: | attr (str) – Field name as defined in IDL |
---|---|
Return type: | object |
Returns: | Field value |
Returns the corresponding StructValue for the VapiStruct class
Return type: | vmware.vapi.data.value.StructValue |
---|---|
Returns: | StructValue for this VapiStruct |
Convert the object into a python dictionary. Even the nested types are converted to dictionaries.
Return type: | dict |
---|---|
Returns: | Dictionary representation of this object |
Convert the object into a json string.
Return type: | str |
---|---|
Returns: | JSON string representation of this object |
Validate if the current VapiStruct instance satisfies all the constraints of this VapiStruct type.
Validate if the given struct value satisfies all the constraints of this VapiStruct.
Parameters: |
|
---|
Stub helper classes
Bases: vmware.vapi.core.ApiInterface
Stub class for Api Interface
Initialize the ApiMethod skeleton object
Parameters: |
|
---|
Returns interface definition
Return type: | InterfaceDefinition |
---|---|
Returns: | Interface definition |
Returns interface identifier
Return type: | InterfaceIdentifier |
---|---|
Returns: | Interface identifier |
Invokes the specified method using the execution context and the input provided
Parameters: |
|
---|---|
Return type: | |
Returns: | Result of the method invocation |
Invokes the method corresponding to the given method name with the kwargs.
In this method, python native values are converted to vAPI runtime values, operation is invoked and the result are converted back to python native values
Parameters: |
|
---|---|
Return type: | object |
Returns: | Method result |
Bases: object
Configuration data for vAPI stub classes
Variables: | connector – Connection to be used to talk to the remote ApiProvider |
---|
Initialize the stub configuration
Parameters: |
|
---|
Return type: | vmware.vapi.protocol.client.connector.Connector |
---|---|
Returns: | Connection to be used to talk to the remote ApiProvider |
Type resolver that can resolve canonical names to its binding types
Return type: | vmware.vapi.bindings.common.NameToTypeResolver |
---|---|
Returns: | Type resolver |
Bases: object
Factory for client-side vAPI stubs
Initialize the stub factory
Parameters: | config (StubConfiguration) – Configuration data for vAPI stubs |
---|
Create a stub corresponding to the specified service name
Parameters: | service_name (str) – Name of the service |
---|---|
Return type: | VapiInterface |
Returns: | The stub correspoding to the specified service name |
Bases: object
vAPI Interface class is used by the python client side bindings. This encapsulates the ApiInterfaceStub instance
Initialize VapiInterface object
Parameters: |
|
---|
Representation of an IDL type for the use of the Python language bindings.
Bases: vmware.vapi.bindings.type.BindingType
Representation of Exception type in Python Binding
Initialize AnyErrorType
Bases: object
Representation of an IDL type for the use of the Python language bindings
Parameters: | definition (vmware.vapi.data.definition.DataDefinition) – Data definition corresponding to this binding type |
---|
Applies a visitor to this BindingType
Parameters: | visitor (BindingTypeVisitor) – visitor operating on the BindingType |
---|
Bases: vmware.vapi.lib.visitor.VapiVisitor
Base no-op implementation of a BindingType visitor
Initialize BindingTypeVisitor
Visit an error value
Parameters: | typ (AnyErrorType) – Binding type of the value |
---|
Visit a boolean value
Parameters: | typ (BooleanType) – Binding type of the value |
---|
Visit a datetime value
Parameters: | typ (DateTimeType) – Binding type of the value |
---|
Visit a double value
Parameters: | typ (DoubleType) – Binding type of the value |
---|
Visit a struct value
Parameters: | typ (DynamicStructType) – Binding type of the value |
---|
Visit an error type
Parameters: | typ (ErrorType) – Binding type of the value |
---|
Visit an integer value
Parameters: | typ (IntegerType) – Binding type of the value |
---|
Visit an opaque value.
Parameters: | typ (OpaqueType) – Binding type of the value |
---|
Visit an optional value
Parameters: | typ (OptionalType) – Binding type of the value |
---|
Visit a reference type
Parameters: | typ (ReferenceType) – Binding type of the value |
---|
Visit a secret value
Parameters: | typ (SecretType) – Binding type of the value |
---|
Visit a string value
Parameters: | typ (StringType) – Binding type of the value |
---|
Visit a struct value
Parameters: | typ (StructType) – Binding type of the value |
---|
Bases: vmware.vapi.bindings.type.BindingType
Representation of binary IDL Type in Python Binding
Bases: vmware.vapi.bindings.type.BindingType
Representation of boolean IDL Type in Python Binding
Bases: vmware.vapi.bindings.type.BindingTypeVisitor
Builds DataDefinition by visiting a BindingType
Initialize DataDefinitionBuilder
Parameters: |
|
---|
Returns the data definition
Return type: | vmware.vapi.data.definition.DataDefinition |
---|---|
Returns: | Data definition |
Visit an error value
Parameters: | typ (AnyErrorType) – Binding type of the value |
---|
Visit a boolean value
Parameters: | typ (BooleanType) – Binding type of the value |
---|
Visit a datetime value
Parameters: | typ (DateTimeType) – Binding type of the value |
---|
Visit a double value
Parameters: | typ (DoubleType) – Binding type of the value |
---|
Visit a struct value
Parameters: | typ (DynamicStructType) – Binding type of the value |
---|
Visit an error type
Parameters: | typ (ErrorType) – Binding type of the value |
---|
Visit an integer value
Parameters: | typ (IntegerType) – Binding type of the value |
---|
Visit an opaque value.
Parameters: | typ (OpaqueType) – Binding type of the value |
---|
Visit an optional value
Parameters: | typ (OptionalType) – Binding type of the value |
---|
Visit a reference type
Parameters: | typ (ReferenceType) – Binding type of the value |
---|
Visit a secret value
Parameters: | typ (SecretType) – Binding type of the value |
---|
Visit a string value
Parameters: | typ (StringType) – Binding type of the value |
---|
Visit a struct value
Parameters: | typ (StructType) – Binding type of the value |
---|
Bases: vmware.vapi.bindings.type.BindingType
Representation of datetime IDL Type in Python Binding
Bases: vmware.vapi.bindings.type.BindingType
Representation of float IDL Type in Python Binding
Bases: vmware.vapi.bindings.type.StructType
Representation of StructValue IDL annotation in Python Binding
Variables: | has_fields_of_type – List of reference types whose fields need to be present in the StructValue for this DynamicStruct type |
---|
Initialize DynamicStructType
Parameters: |
|
---|
Returns the has_fields_of_type
:rtype ReferenceType :return List of reference types whose fields need to be present in the
StructValue for this DynamicStruct type
Bases: vmware.vapi.bindings.type.BindingType
Representation of enum IDL Type in Python Binding
Variables: |
|
---|
Bases: vmware.vapi.bindings.type.StructType
Representation of Error IDL type in Python Binding
Variables: |
|
---|
Bases: vmware.vapi.bindings.type.BindingType
Representation of ID IDL type in Python Binding
Variables: |
|
---|
Bases: vmware.vapi.bindings.type.BindingType
Representation of integer IDL Type in Python Binding
Bases: vmware.vapi.bindings.type.BindingType
Representation of List IDL type in Python Binding
Variables: | element_type – element type |
---|
Return the element type of this ListType
Return type: | BindingType |
---|---|
Returns: | element type |
Bases: vmware.vapi.bindings.type.BindingType
Representation of Map IDL type in Python Binding
Variables: |
|
---|
Return the key type of this MapType
Return type: | BindingType |
---|---|
Returns: | key type |
Return the value type of this MapType
Return type: | BindingType |
---|---|
Returns: | value type |
Bases: vmware.vapi.bindings.type.BindingType
Representation of Opaque IDL annotation in Python Binding
Bases: vmware.vapi.bindings.type.BindingType
Representation of optional IDL annotation in Python Binding
Variables: | element_type – element type |
---|
Return the element type of this ListType
Return type: | BindingType |
---|---|
Returns: | element type |
Bases: vmware.vapi.bindings.type.BindingType
Reference type to resolve references lazily.
Variables: | resolved_type – Resolved reference type |
---|
Initialize ReferenceType
Parameters: |
|
---|
Returns the resolved struct type or enum type
Return type: | StructType or EnumType |
---|---|
Returns: | Resolved struct type or enum type |
Bases: vmware.vapi.bindings.type.BindingType
Representation of @secret IDL annotation in Python Binding. @secret annotation can only be applied to strings.
Bases: vmware.vapi.bindings.type.BindingType
Representation of Set IDL type in Python Binding
Variables: | element_type – element type |
---|
Return the element type of this SetType
Return type: | BindingType |
---|---|
Returns: | element type |
Bases: vmware.vapi.bindings.type.BindingType
Representation of string IDL Type in Python Binding
Bases: vmware.vapi.bindings.type.BindingType
Representation of Structure IDL type in Python Binding
Variables: |
|
---|
Returns the reference to the Python native class corresponding to this structure
Return type: | vmware.vapi.bindings.struct.VapiStruct |
---|---|
Returns: | Reference to the python native class |
Returns the BindingType of the argument
Parameters: | field_name (str) – Field name |
---|---|
Return type: | BindingType |
Returns: | BindingType of the field specified |
Returns the list of field names present in this StructType
Return type: | list of str |
---|---|
Returns: | List of field names |
Check if the Struct is marked as model
Return type: | bool |
---|---|
Returns: | True if the Struct is marked as model, False otherwise |
Bases: object
Converts a BindingType object to DataDefinition object
Converts a BindingType object to DataDefinition object
Parameters: | binding_type (BindingType) – Binding type |
---|---|
Return type: | vmware.vapi.data.definition.DataDefinition |
Returns: | DataDefinition |
Bases: vmware.vapi.bindings.type.BindingType
Representation of URI IDL Type in Python Binding
Bases: vmware.vapi.bindings.type.BindingType
Representation of void IDL type in Python Binding
Utility library for validating IRI that conform to RFC 3987
Bases: object
Helper class for validation of IRI’s
Validate the given IRI string
Parameters: | iri (str) – IRI string to be validated |
---|