module documentation

Module implementing the parameter types code.

Function CombinationDesc Build description for combinating operator.
Function Comment Builds wrapper for adding comment to description text.
Function EmptyDict Returns an empty dict.
Function EmptyList Returns an empty list.
Function Parens Enclose text in parens if necessary.
Function TAnd Combine multiple functions using an AND operation.
Function TAny Accepts any value.
Function TBool Checks if the given value is a boolean.
Function TDict Checks if the given value is a dictionary.
Function TDictOf Checks a dict type for the type of its key/values.
Function TElemOf Builds a function that checks if a given value is a member of a list.
Function TFloat Checks if the given value is a float.
Function TInstanceOf Checks if a given value is an instance of cls.
Function TInt Checks if the given value is an integer.
Function TIsLength Check is the given container is of the given size.
Function TItems Checks individual items of a container.
Function TList Checks if the given value is a list.
Function TListOf Checks if a given value is a list with all elements of the same type.
Function TMap Checks that a modified version of the argument passes the given test.
Function TMaybe Wrap a test in a TOr(TNone, test).
Function TMaybeValueNone Used for unsetting values.
Function TNone Checks if the given value is None.
Function TNonNegative Undocumented
Function TNotNone Checks if the given value is not None.
Function TObject Undocumented
Function TObjectCheck Helper to generate type checks for objects.
Function TOr Combine multiple functions using an OR operation.
Function TPositive Undocumented
Function TPrivate Checks if a given value is an instance of Private.
Function TRegex Checks whether a string matches a specific regular expression.
Function TSecret Checks if a given value is an instance of Private.
Function TSetOf Checks if a given value is a list with all elements of the same type and eliminates duplicated elements.
Function TSetParamsMods Generates a check for modification lists.
Function TStorageType Builds a function that checks if a given value is a valid storage type.
Function TStrictDict Strict dictionary check with specific keys.
Function TString Checks if the given value is a string.
Function TTrue Checks if a given value evaluates to a boolean True value.
Function TTuple Checks if the given value is a tuple.
Function TTupleOf Checks if a given value is a list with the proper size and its elements match the given types.
Function TValueNone Checks if the given value is constants.VALUE_NONE.
Function WithDesc Builds wrapper class with description text.
Variable NoDefault Undocumented
Variable TAdminStateSource Undocumented
Variable TAllocPolicy Undocumented
Variable TCVErrorCode Undocumented
Variable TDdmSimple Undocumented
Variable TDiskChanges Undocumented
Variable TDiskIndex Undocumented
Variable TDiskParams Undocumented
Variable TDiskTemplate Undocumented
Variable TEvacMode Undocumented
Variable TExportMode Undocumented
Variable TExportTarget Undocumented
Variable TFileDriver Undocumented
Variable THypervisor Undocumented
Variable TIAllocatorMode Undocumented
Variable TIAllocatorTestDir Undocumented
Variable TIDiskParams Undocumented
Variable TImportExportCompression Undocumented
Variable TINicParams Undocumented
Variable TInstanceMultiAllocResponse Undocumented
Variable TInstCreateMode Undocumented
Variable TIPv4Address Undocumented
Variable TIPv4Network Undocumented
Variable TIPv6Address Undocumented
Variable TIPv6Network Undocumented
Variable TJobId Undocumented
Variable TJobIdList Undocumented
Variable TJobIdListItem Undocumented
Variable TJobIdListOnly Undocumented
Variable TMaxValue Undocumented
Variable TMaybeBool Undocumented
Variable TMaybeDict Undocumented
Variable TMaybeList Undocumented
Variable TMaybeListOf Undocumented
Variable TMaybePositiveInt Undocumented
Variable TMaybeString Undocumented
Variable TMigrationMode Undocumented
Variable TNegativeInt Undocumented
Variable TNICMode Undocumented
Variable TNonEmptyString Undocumented
Variable TNonNegativeFloat Undocumented
Variable TNonNegativeInt Undocumented
Variable TNumber Undocumented
Variable TOobCommand Undocumented
Variable TPositiveInt Undocumented
Variable TQueryFieldDef Undocumented
Variable TQueryFieldsResponse Undocumented
Variable TQueryResponse Undocumented
Variable TQueryResult Undocumented
Variable TQueryResultCode Undocumented
Variable TQueryRow Undocumented
Variable TQueryTypeOp Undocumented
Variable TRebootType Undocumented
Variable TRecreateDisksInfo Undocumented
Variable TRelativeJobId Undocumented
Variable TReplaceDisksMode Undocumented
Variable TSshKeyType Undocumented
Variable TTagKind Undocumented
Variable TVerifyOptionalChecks Undocumented
Class _CommentWrapper Wrapper class for comment.
Class _DescWrapper Wrapper class for description text.
Class _WrapperBase No class docstring; 0/2 instance variable, 0/1 class variable, 1/2 method documented
Function _CheckCIDR6AddrNotation Ensure a given CIDR notation type is valid.
Function _CheckCIDR6NetNotation Ensure a given CIDR notation type is valid.
Function _CheckCIDRAddrNotation Ensure a given CIDR notation type is valid.
Function _CheckCIDRNetNotation Ensure a given CIDR notation type is valid.
Function _TStrictDictCheck Helper function for TStrictDict.
Constant _PAREN_RE Undocumented
def CombinationDesc(op, args, fn):

Build description for combinating operator.

Parameters
op:stringOperator as text (e.g. "and")
args:listOperator arguments
fn:callableWrapped function
def Comment(text):

Builds wrapper for adding comment to description text.

Parameters
text:stringComment text
Returns
Callable class
@WithDesc(str({}))
def EmptyDict():

Returns an empty dict.

@WithDesc(str([]))
def EmptyList():

Returns an empty list.

def Parens(text):

Enclose text in parens if necessary.

Parameters
textText
def TAnd(*args):

Combine multiple functions using an AND operation.

@WithDesc('Anything')
def TAny(_):

Accepts any value.

@WithDesc('Boolean')
def TBool(val):

Checks if the given value is a boolean.

@WithDesc('Dictionary')
def TDict(val):

Checks if the given value is a dictionary.

Note that PrivateDicts subclass dict and pass this check.

def TDictOf(key_type, val_type):

Checks a dict type for the type of its key/values.

def TElemOf(target_list):

Builds a function that checks if a given value is a member of a list.

@WithDesc('Float')
def TFloat(val):

Checks if the given value is a float.

def TInstanceOf(cls):

Checks if a given value is an instance of cls.

Parameters
cls:classClass object
@WithDesc('Integer')
def TInt(val):

Checks if the given value is an integer.

def TIsLength(size):

Check is the given container is of the given size.

def TItems(items):

Checks individual items of a container.

If the verified value and the list of expected items differ in length, this check considers only as many items as are contained in the shorter list. Use TIsLength to enforce a certain length.

Parameters
items:listList of checks
@WithDesc('List')
def TList(val):

Checks if the given value is a list.

def TListOf(my_type):

Checks if a given value is a list with all elements of the same type.

def TMap(fn, test):

Checks that a modified version of the argument passes the given test.

def TMaybe(test):

Wrap a test in a TOr(TNone, test).

This makes it easier to define TMaybe* types.

def TMaybeValueNone(test):

Used for unsetting values.

@WithDesc('None')
def TNone(val):

Checks if the given value is None.

def TNonNegative(val_type):

Undocumented

@WithDesc('NotNone')
def TNotNone(val):

Checks if the given value is not None.

def TObject(val_type):

Undocumented

def TObjectCheck(obj, fields_types):

Helper to generate type checks for objects.

Parameters
objThe object to generate type checks
fields_typesThe fields and their types as a dict
Returns
A ht type check function
def TOr(*args):

Combine multiple functions using an OR operation.

def TPositive(val_type):

Undocumented

def TPrivate(val_type):

Checks if a given value is an instance of Private.

def TRegex(pobj):

Checks whether a string matches a specific regular expression.

Parameters
pobjCompiled regular expression as returned by re.compile
def TSecret(val_type):

Checks if a given value is an instance of Private.

However, the type is named Secret in the Haskell equivalent.

def TSetOf(val_type):

Checks if a given value is a list with all elements of the same type and eliminates duplicated elements.

def TSetParamsMods(fn):

Generates a check for modification lists.

def TStorageType(val):

Builds a function that checks if a given value is a valid storage type.

def TStrictDict(require_all, exclusive, items):

Strict dictionary check with specific keys.

Parameters
require_all:booleanWhether all keys in items are required
exclusive:booleanWhether only keys listed in items should be accepted
items:dictionaryMapping from key (string) to verification function
@WithDesc('String')
def TString(val):

Checks if the given value is a string.

@WithDesc('EvalToTrue')
def TTrue(val):

Checks if a given value evaluates to a boolean True value.

@WithDesc('Tuple')
def TTuple(val):

Checks if the given value is a tuple.

def TTupleOf(*val_types):

Checks if a given value is a list with the proper size and its elements match the given types.

@WithDesc('ValueNone')
def TValueNone(val):

Checks if the given value is constants.VALUE_NONE.

def WithDesc(text):

Builds wrapper class with description text.

Parameters
text:stringDescription text
Returns
Callable class
NoDefault =

Undocumented

TAdminStateSource =

Undocumented

TAllocPolicy =

Undocumented

TCVErrorCode =

Undocumented

TDdmSimple =

Undocumented

TDiskChanges =

Undocumented

TDiskIndex =

Undocumented

TDiskParams =

Undocumented

TDiskTemplate =

Undocumented

TEvacMode =

Undocumented

TExportMode =

Undocumented

TExportTarget =

Undocumented

TFileDriver =

Undocumented

THypervisor =

Undocumented

TIAllocatorMode =

Undocumented

TIAllocatorTestDir =

Undocumented

TIDiskParams =

Undocumented

TImportExportCompression =

Undocumented

TINicParams =

Undocumented

TInstanceMultiAllocResponse =

Undocumented

TInstCreateMode =

Undocumented

TIPv4Address =

Undocumented

TIPv4Network =

Undocumented

TIPv6Address =

Undocumented

TIPv6Network =

Undocumented

TJobId =

Undocumented

TJobIdList =

Undocumented

TJobIdListItem =

Undocumented

TJobIdListOnly =

Undocumented

TMaxValue =

Undocumented

TMaybeBool =

Undocumented

TMaybeDict =

Undocumented

TMaybeList =

Undocumented

TMaybeListOf =

Undocumented

TMaybePositiveInt =

Undocumented

TMaybeString =

Undocumented

TMigrationMode =

Undocumented

TNegativeInt =

Undocumented

TNICMode =

Undocumented

TNonEmptyString =

Undocumented

TNonNegativeFloat =

Undocumented

TNonNegativeInt =

Undocumented

TNumber =

Undocumented

TOobCommand =

Undocumented

TPositiveInt =

Undocumented

TQueryFieldDef =

Undocumented

TQueryFieldsResponse =

Undocumented

TQueryResponse =

Undocumented

TQueryResult =

Undocumented

TQueryResultCode =

Undocumented

TQueryRow =

Undocumented

TQueryTypeOp =

Undocumented

TRebootType =

Undocumented

TRecreateDisksInfo =

Undocumented

TRelativeJobId =

Undocumented

TReplaceDisksMode =

Undocumented

TSshKeyType =

Undocumented

TTagKind =

Undocumented

TVerifyOptionalChecks =

Undocumented

@WithDesc('IPv6 address')
def _CheckCIDR6AddrNotation(value):

Ensure a given CIDR notation type is valid.

@WithDesc('IPv6 network')
def _CheckCIDR6NetNotation(value):

Ensure a given CIDR notation type is valid.

@WithDesc('IPv4 address')
def _CheckCIDRAddrNotation(value):

Ensure a given CIDR notation type is valid.

@WithDesc('IPv4 network')
def _CheckCIDRNetNotation(value):

Ensure a given CIDR notation type is valid.

def _TStrictDictCheck(require_all, exclusive, items, val):

Helper function for TStrictDict.

_PAREN_RE =

Undocumented

Value
re.compile(r'^[a-zA-Z0-9_-]+$')