ironic.api.validation package

Submodules

Module contents

API request/response validating middleware.

class ironic.api.validation.Schemas[source]

Bases: object

A microversion-aware schema container.

Allow definition and retrieval of schemas on a microversion-aware basis.

__call__()[source]

Call self as a function.

add_schema(schema, min_version, max_version)[source]
validate_schemas()[source]

Ensure there are no overlapping schemas.

ironic.api.validation.api_version(min_version, max_version=None, message=None, exception_class=<class 'webob.exc.HTTPNotFound'>)[source]

Decorator for marking lower and upper bounds on API methods.

Parameters:
  • min_version – An integer representing the minimum API version that the API is available under.

  • max_version – An integer representing the maximum API version that the API is available under.

  • message – A message to return if the API is not supported.

  • exception_class – The exception class to raise if the API version is not supported (default is HTTPNotFound).

ironic.api.validation.request_body_schema(schema, min_version=None, max_version=None)[source]

Decorator for registering a request body schema on API methods.

schema will be used for validating the request body just before the API method is executed.

Parameters:
  • schema – The JSON Schema schema used to validate the target.

  • min_version – An integer indicating the minimum API version schema applies against.

  • max_version – An integer indicating the maximum API version schema applies against.

ironic.api.validation.request_parameter_schema(schema, min_version=None, max_version=None)[source]

Decorator for registering a request parameter schema on API methods.

schema will be used for validating request parameters just before the API method is executed.

Parameters:
  • schema – The JSON Schema schema used to validate the target.

  • min_version – An integer indicating the minimum API version schema applies against.

  • max_version – An integer indicating the maximum API version schema applies against.

ironic.api.validation.request_query_schema(schema, min_version=None, max_version=None)[source]

Decorator for registering a request query string schema on API methods.

schema will be used for validating request query strings just before the API method is executed.

Parameters:
  • schema – The JSON Schema schema used to validate the target.

  • min_version – An integer indicating the minimum API version schema applies against.

  • max_version – An integer indicating the maximum API version schema applies against.

ironic.api.validation.response_body_schema(schema, min_version=None, max_version=None)[source]

Decorator for registering a response body schema on API methods.

schema will be used for validating the response body just after the API method is executed.

Parameters:
  • schema – The JSON Schema schema used to validate the target.

  • min_version – An integer indicating the minimum API version schema applies against.

  • max_version – An integer indicating the maximum API version schema applies against.