DataDefinition classes
Bases: vmware.vapi.data.definition.SingletonDefinition
DataDefinition for ‘Exception’ type in IDL
Initialize AnyErrorDefinition
The validation for AnyErrorDefinition will succeed against any ErrorValue.
Parameters: | value (vmware.vapi.data.value.DataValue) – the data value to validate |
---|---|
Return type: | list of vmware.vapi.message.Message or None |
Returns: | a stack of messages indicating why the value is not an instance of this data-definition, or None if the value is an instance of this data-definition |
Bases: vmware.vapi.data.definition.SingletonDefinition
DataDefinition for binary values
Initialize BlobDefinition
Create a new BlobValue
Return type: | vmware.vapi.data.value.BlobValue |
---|---|
Returns: | Newly created BlobValue |
Bases: vmware.vapi.data.definition.SingletonDefinition
DataDefinition for bool values
Initialize BooleanDefinition
Create a new BooleanValue
Return type: | vmware.vapi.data.value.BooleanValue |
---|---|
Returns: | Newly created BooleanValue |
Bases: object
Base class for all types in the vAPI run-time type system
Variables: | type – String representation of the type |
---|
Initialize the data definition instance
Parameters: | data_type (str) – String representation of the type |
---|
Applies a visitor to this data-definition.
Parameters: | visitor (SimpleDefinitionVisitor) – the visitor operating on this data-definition |
---|
Fill the optional fields of StructValues. Also includes the StructValues present in other generic types: List and Optional.
Parameters: | value (vmware.vapi.data.value.DataValue) – DataValue |
---|
Validates that the specified vmware.vapi.data.value.DataValue is an instance of this data-definition
Parameters: | value (vmware.vapi.data.value.DataValue) – the data value to validate |
---|---|
Return type: | bool |
Returns: | true if the value is an instance of this data-definition, false, otherwise |
Validates that the specified vmware.vapi.data.value.DataValue is an instance of this data-definition
Parameters: | value (vmware.vapi.data.value.DataValue) – the data value to validate |
---|---|
Return type: | list of vmware.vapi.message.Message or None |
Returns: | a stack of messages indicating why the value is not an instance of this data-definition, or None if the value is an instance of this data-definition |
Bases: vmware.vapi.data.definition.SingletonDefinition
DataDefinition for floats
Initialize DoubleDefinition
Create a new DoubleValue
Return type: | vmware.vapi.data.value.DoubleValue |
---|---|
Returns: | Newly created DoubleValue |
Bases: vmware.vapi.data.definition.SingletonDefinition
DataDefinition for dynamic structs
Initialize DynamicStructDefinition
The validation for DynamicStructDefinition will succeed against any StructValue.
Parameters: | value (vmware.vapi.data.value.DataValue) – the data value to validate |
---|---|
Return type: | list of vmware.vapi.message.Message or None |
Returns: | a stack of messages indicating why the value is not an instance of this data-definition, or None if the value is an instance of this data-definition |
Bases: vmware.vapi.data.definition.StructDefinition
DataDefinition for errors
Initialize ErrorDefinition
Parameters: |
|
---|
Create a new ErrorValue
Return type: | vmware.vapi.data.value.ErrorValue |
---|---|
Returns: | Newly created ErrorValue |
Bases: vmware.vapi.data.definition.SingletonDefinition
DataDefinition for long values
Initialize IntegerDefinition
Create a new IntegerValue
Return type: | vmware.vapi.data.value.IntegerValue |
---|---|
Returns: | Newly created IntegerValue |
Bases: vmware.vapi.data.definition.DataDefinition
DataDefinition for lists
Initialize ListDefinition
Parameters: | element_type (DataDefinition) – DataDefinition of the elements inside ListDefinition |
---|
Fill the optional values inside StructValues
Parameters: | value (vmware.vapi.data.value.DataValue) – DataValue |
---|
Create a new ListValue
Parameters: | values (list of vmware.vapi.data.value.DataValue) – List of elements |
---|---|
Return type: | vmware.vapi.data.value.ListValue |
Returns: | Newly created ListValue |
Apart from the validation checks specified in the validate method of DataDefinition class, this method does some additional checks
Validation will fail if any element in the ListValue does not validate against the DataDefinition of the elementType of this ListDefinition
Parameters: | other (vmware.vapi.data.value.ListValue) – ListValue to be validated |
---|---|
Return type: | list of vmware.vapi.message.Message or None |
Returns: | a stack of messages indicating why the value is not an instance of this data-definition, or None if the value is an instance of this data-definition |
Bases: vmware.vapi.data.definition.SingletonDefinition
DataDefinition for opaque
Initialize OpaqueDefinition
The validation for OpaqueDefinition will succeed against any DataValue. Only validates that supplied value is not None
Parameters: | value (vmware.vapi.data.value.DataValue) – DataValue to be validated |
---|---|
Return type: | list of vmware.vapi.message.Message or None |
Returns: | a stack of messages indicating why the value is not an instance of this data-definition, or None if the value is an instance of this data-definition |
Bases: vmware.vapi.data.definition.DataDefinition
An OptionalDefinition instance defines an optional type with a specified element type
Variables: |
|
---|
Initialize OptionalDefinition
Parameters: | element_type (vmware.vapi.data.type.Type) – Type of the DataDefinition |
---|
Fill the optional values inside StructValues
Parameters: | value (vmware.vapi.data.value.OptionalValue) – DataValue |
---|
Create and return a new OptionalValue using this optional-definition.
Parameters: | value (vmware.vapi.data.value.DataValue) – The element value |
---|---|
Return type: | vmware.vapi.data.value.OptionalValue |
Returns: | A new optional value using the given data-definition |
Apart from the validation checks specified in the validate method of DataDefinition class, this method does some additional checks.
Since this is an OptionalValue, validation will succeed if the element value is None. If the element value is not None, validation will fail if element in the OptionalValue does not validate against the DataDefinition of the element_type of this OptionalDefinition.
Parameters: | other (vmware.vapi.data.value.OptionalValue) – OptionalValue to be validated |
---|---|
Return type: | list of vmware.vapi.message.Message |
Returns: | a stack of messages indicating why the value is not an instance of this data-definition, or None if the value is an instance of this data-definition |
Bases: object
Resolves all the StructRefDefinition objects
Initialize ReferenceResolver
Adds a new structure definition to the context
Parameters: | definition (StructDefinition) – StructDefinition |
---|
Adds a new structure refernce to the context
Parameters: | refernce (StructRefDefinition) – StructRefDefinition |
---|
Determines whether the context contains a definition for the specified structure
Return type: | StructDefinition |
---|---|
Returns: | Definition if the structure if it is already defined, None otherwise |
Bases: vmware.vapi.data.definition.SingletonDefinition
DataDefinition for Secrets. Only strings are allowed to be secrets.
Initialize SecretDefinition
Create a new SecretValue
Return type: | vmware.vapi.data.value.SecretValue |
---|---|
Returns: | Newly created SecretValue |
Bases: vmware.vapi.lib.visitor.VapiVisitor
Base no-op implementation of a definition visitor
Visit a BlobDefinition
Parameters: | defn (BlobDefinition) – Data definition |
---|
Visit a BooleanDefinition
Parameters: | defn (BooleanDefinition) – Data definition |
---|
Visit a DoubleDefinition
Parameters: | defn (DoubleDefinition) – Data definition |
---|
Visit an ErrorDefinition
Parameters: | defn (ErrorDefinition) – Data definition |
---|
Visit a IntegerDefinition
Parameters: | defn (IntegerDefinition) – Data definition |
---|
Visit a ListDefinition
Parameters: | defn (ListDefinition) – Data definition |
---|
Visit a OpaqueDefinition
Parameters: | defn (OpaqueDefinition) – Data definition |
---|
Visit a OptionalDefinition
Parameters: | defn (OptionalDefinition) – Data definition |
---|
Visit a SecretDefinition
Parameters: | defn (SecretDefinition) – Data definition |
---|
Visit a StringDefinition
Parameters: | defn (StringDefinition) – Data definition |
---|
Visit a StructDefinition
Parameters: | defn (StructDefinition) – Data definition |
---|
Visit a StructRefDefinition
Parameters: | defn (StructRefDefinition) – StructRefDefinition object |
---|
Visit a VoidDefinition
Parameters: | defn (VoidDefinition) – Data definition |
---|
Bases: vmware.vapi.data.definition.DataDefinition
Base class for all the primitive data definition classes. All the derived classes of this class will have only one instance.
Initialize SingletonDefinition
Parameters: | data_type (vmware.vapi.data.type.Type) – Type of the DataDefinition |
---|
Bases: vmware.vapi.data.definition.SingletonDefinition
DataDefinition for strings
Initialize StringDefinition
Create a new StringValue
Return type: | vmware.vapi.data.value.StringValue |
---|---|
Returns: | Newly created StringValue |
Bases: vmware.vapi.data.definition.DataDefinition
DataDefinition for structures
Initialize StructDefinition
Parameters: |
|
---|
Fill out all the unset optional fields in a structure based on the StructDefinition
Parameters: | value (vmware.vapi.data.value.StructValue) – Input Struct Value |
---|
Returns the field definition of the specified field
Return type: | DataDefinition |
---|---|
Returns: | field definition of the specified field |
Returns the list of field names in this struct definition. The ordering of fields is not preserved.
Return type: | list of str |
---|---|
Returns: | List of field names in this struct definition |
Create a new StructValue
Return type: | vmware.vapi.data.value.StructValue |
---|---|
Returns: | Newly created StructValue |
Apart from the validation checks specified in the validate method of DataDefinition class, this method does some additional checks
Validation will fail if - the name of the input StructValue does not match the name of this StructDefinition. - any of the fields (either required or optional) in this StructDefinition are not present in the input StructValue - the validation fails for any field value in the input StructValue with its corresponding definition in this StructDefinition
The method performs inclusive validation. i.e. If there are any extra fields in the input StructValue which are not present in the StructDefinition, validation will not fail.
Parameters: | other (vmware.vapi.data.value.StructValue) – StructValue to be validated |
---|---|
Return type: | list of vmware.vapi.message.Message of None |
Returns: | a stack of messages indicating why the value is not an instance of this data-definition, or None if the value is an instance of this data-definition |
Bases: vmware.vapi.data.definition.DataDefinition
Reference to a StructDefinition. If the reference is resolved, it is bound to a specific StructDefinition target. If the reference is unresolved, its target is None.
Variables: | name – Structure name |
---|
Initialize StructRefDefinition
Parameters: |
|
---|
Fill out all the unset optional fields in a structure based on the resolved StructDefinition for this StructRefDefinition.
Parameters: | value (vmware.vapi.data.value.StructValue) – Input StructValue |
---|
Returns the target structure definition of this reference.
Return type: | DataDefinition or None |
---|---|
Returns: | The target of this reference. The value will be None for unresolved reference |
Validate using the target if the reference is resolved
Parameters: | other (vmware.vapi.data.value.StructValue) – StructValue to be validated |
---|---|
Return type: | list of vmware.vapi.message.Message of None |
Returns: | a stack of messages indicating that the reference is not resolved or why the value is not an instance of this data-definition, or None if the value is an instance of this data-definition |
Bases: vmware.vapi.data.definition.SingletonDefinition
DataDefinition class for void
Initialize VoidDefinition
Create a new VoidValue
Return type: | vmware.vapi.data.value.VoidValue |
---|---|
Returns: | Newly created VoidValue |
data definition factory
Parameters: |
|
---|
List of Data types supported
Bases: object
Enum of all the data types used in vAPI Runtime
Data Validator classes
Bases: vmware.vapi.data.validator.Validator
HasFieldsOfValidator validator class that validates the data_value has reuired fields of the class specified
Validates a struct value for union consistency
:type data_value vmware.vapi.data.value.DataValue :param data_value The struct value that needs to be validated :type data_type vmware.vapi.binding.type.BindingType :param data_type The Struct binding type :rtype: list of vmware.vapi.message.Message or None :return List of error messages if validation fails or None
Bases: vmware.vapi.data.validator.Validator
Union Validator class that validates a struct value for union consistency
Initialize the union validator class
:type discriminant_name str :param discriminant_name Name of a structure field that represents a
union discriminant
:type case_map dict :param case_map Python dict with string value of the discriminant as
dictionary key and list of tuple of structure field associated with it and a boolean representing whether it is rqeuired as dictionary value
Validates a struct value for union consistency
:type data_value vmware.vapi.data.value.DataValue :param data_value The struct value that needs to be validated :type data_type vmware.vapi.binding.type.BindingType :param data_type The Struct binding type :rtype: list of vmware.vapi.message.Message or None :return List of error messages if validation fails or None
Bases: object
vAPI Data object validator class This is an abstract class.
This method validates a data value
:type data_value vmware.vapi.data.value.DataValue :param data_value The struct value that needs to be validated :type data_type vmware.vapi.binding.type.BindingType :param data_type The Struct binding type :rtype: list of vmware.vapi.message.Message or None :return List of error messages if validation fails or None
vAPI DataValues
Bases: vmware.vapi.data.value.PrimitiveDataValue, vmware.vapi.data.value.ComparableValueMixin
DataValue class for binary values
Variables: | value – Binary present in BlobValue |
---|
Initialize BooleanValue
Parameters: | value (bytes) – Binary value to be initialized |
---|
Bases: vmware.vapi.data.value.PrimitiveDataValue, vmware.vapi.data.value.ComparableValueMixin
DataValue class for bool values
Variables: | value – Bool present in BooleanValue |
---|
Initialize BooleanValue
Parameters: | value (bool) – Bool value to be initialized |
---|
Bases: object
Helper class to implement the rich comparator operations.
Bases: object
A piece of introspectable value in vAPI infrastructure
Variables: | type – Type of DataValue |
---|
Initialize DataValue
Parameters: | data_type (vmware.vapi.data.type.Type) – Type of DataValue |
---|
Applies a visitor to this DataValue
Parameters: | visitor (SimpleValueVisitor) – visitor operating on this DataValue |
---|
Bases: vmware.vapi.data.value.PrimitiveDataValue, vmware.vapi.data.value.ComparableValueMixin
DataValue class for float values
Variables: | value – 64 bit signed float present in DoubleValue |
---|
Initialize DoubleValue
Parameters: | value (float or decimal.Decimal) – Float or decimal.Decimal value to be initialized |
---|
Bases: vmware.vapi.data.value.StructValue
DataValue class for Errors
Initialize ErrorValue
Parameters: | name (str) – Name of the ErrorValue |
---|
Bases: vmware.vapi.data.value.PrimitiveDataValue, vmware.vapi.data.value.ComparableValueMixin
DataValue class for integer values
Variables: | value – 64 bit signed int present in IntegerValue |
---|
Initialize IntegerValue
Parameters: | value (int) – Integer value to be initialized |
---|
Bases: vmware.vapi.data.value.DataValue
DataValue class for lists
Initialize ListValue
Add an element to ListValue
Parameters: | value (DataValue) – DataValue to be added |
---|
Add all the elements from input list to ListValue
Parameters: | values (list of DataValue) – List of DataValues to be added |
---|
Bases: vmware.vapi.data.value.DataValue, vmware.vapi.data.value.ComparableValueMixin
DataValue class for optionals
Variables: | value – DataValue present in this OptionalValue |
---|
Initialize OptionalValue
Parameters: | value (DataValue) – DataValue to be used in OptionalValue |
---|
Bases: vmware.vapi.data.value.DataValue
Base class for all primitive DataValues
Variables: | value – Primitive value |
---|
Bases: vmware.vapi.data.value.PrimitiveDataValue, vmware.vapi.data.value.ComparableValueMixin
DataValue class for secret values. Only strings are allowed to be secrets.
Variables: | value – String present in SecretValue |
---|
Initialize StringValue
Parameters: | value (str) – String value to be initialized |
---|
Bases: vmware.vapi.lib.visitor.VapiVisitor
Base no-op implementation of a DataValue visitor
Initialize SimpleValueVisitor
Visit a BooleanValue
Parameters: | value (BooleanValue) – Data value |
---|
Visit a DoubleValue
Parameters: | value (DoubleValue) – Data value |
---|
Visit an ErrorValue
Parameters: | value (ErrorValue) – Data value |
---|
Visit a IntegerValue
Parameters: | value (IntegerValue) – Data value |
---|
Visit a OptionalValue
Parameters: | value (OptionalValue) – Data value |
---|
Visit a SecretValue
Parameters: | value (SecretValue) – Data value |
---|
Visit a StringValue
Parameters: | value (StringValue) – Data value |
---|
Visit a StructValue
Parameters: | value (StructValue) – Data value |
---|
Bases: vmware.vapi.data.value.PrimitiveDataValue, vmware.vapi.data.value.ComparableValueMixin
DataValue class for strings
Variables: | value – String present in StringValue |
---|
Initialize StringValue
Parameters: | value (str) – String value to be initialized |
---|
Bases: vmware.vapi.data.value.DataValue
DataValue class for Structures
Variables: | name – Name of the structure |
---|
Initialize StructValue
Parameters: | name (str) – Name of the StructValue |
---|
Returns the field value of the field present in the StructValue
Parameters: | field (str) – Name of the field |
---|---|
Return type: | DataValue |
Returns: | Returns the field value of the field present in the StructValue |
Returns the list of field names present in this StructValue. The ordering of fields is not preserved.
Return type: | list of str |
---|---|
Returns: | List of field names present in this StructValue |
Returns the map of field names and values present in this StructValue.
Return type: | dict of str and DataValue |
---|---|
Returns: | Fields in this struct value |
Bases: vmware.vapi.data.value.PrimitiveDataValue
DataValue class for None
Initialize VoidValue