ironic.api.functions module

class ironic.api.functions.FunctionArgument(name, datatype, mandatory, default)[source]

Bases: object

An argument definition of an api entry

datatype

Data type

default

Default value if argument is omitted

mandatory

True if the argument is mandatory

name

argument name

resolve_type(registry)[source]
class ironic.api.functions.FunctionDefinition(func)[source]

Bases: object

An api entry definition

arguments

The function arguments (list of FunctionArgument)

body_type

If the body carry the data of a single argument, its type

doc

Function documentation

extra_options

Dictionary of protocol-specific options.

static get(func)[source]

Returns the FunctionDefinition of a method.

get_arg(name)[source]

Returns a FunctionArgument from its name

ignore_extra_args

True if extra arguments should be ignored, NOT inserted in the kwargs of the function and not raise UnknownArgument exceptions

name

Function name

resolve_types(registry)[source]
return_type

Return type

set_arg_types(argspec, arg_types)[source]
set_options(body=None, ignore_extra_args=False, status_code=200, rest_content_types=('json', 'xml'), **extra_options)[source]
status_code

Status code

ironic.api.functions.getargspec(f)[source]
ironic.api.functions.iswsmefunction(f)[source]
ironic.api.functions.sig

alias of signature

class ironic.api.functions.signature(*types, **options)[source]

Bases: object

Decorator that specify the argument types of an exposed function.

Parameters:
  • return_type – Type of the value returned by the function

  • argN – Type of the Nth argument

  • body – If the function takes a final argument that is supposed to be the request body by itself, its type.

  • status_code – HTTP return status code of the function.

  • ignore_extra_args – Allow extra/unknown arguments (default to False)

Most of the time this decorator is not supposed to be used directly, unless you are not using WSME on top of another framework.

If an adapter is used, it will provide either a specialised version of this decororator, either a new decorator named @wsexpose that takes the same parameters (it will in addition expose the function, hence its name).

__call__(func)[source]

Call self as a function.

ironic.api.functions.wrapfunc(f)[source]