DynamicHttpResponseBody

class oci.waf.models.DynamicHttpResponseBody(**kwargs)

Bases: HttpResponseBody

Allows returning dynamically generated HTTP response body based on the provided template. The template allows variable interpolation by specifying variable name between the ‘${‘ and ‘}’ delimiters. Escape sequences using ‘’ are supported to allow usage of ‘' and ‘${‘ in the template to return ‘’ and ‘${‘ in final response.

The following variables are supported:

  • http.request.id - the HTTP request ID. For example: “d5fa953f75ef417e4c8008ef9336d779”.

Example: { “type”: “DYNAMIC”, “template”: “{ “code”: 403, “message”:”Unauthorised”, “incidentId”: “${http.request.id}” }” }

Example with escape sequence: { “type”: “DYNAMIC”, “template”: “\${Returned as plain text}” }

Attributes:

TYPE_DYNAMIC

A constant which can be used with the type property of a HttpResponseBody.

TYPE_STATIC_TEXT

A constant which can be used with the type property of a HttpResponseBody.

template

[Required] Gets the template of this DynamicHttpResponseBody.

type

[Required] Gets the type of this HttpResponseBody.

Methods:

__init__(**kwargs)

Initializes a new DynamicHttpResponseBody object with values from keyword arguments.

get_subtype(object_dictionary)

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.

TYPE_DYNAMIC = 'DYNAMIC'

A constant which can be used with the type property of a HttpResponseBody. This constant has a value of “DYNAMIC”

TYPE_STATIC_TEXT = 'STATIC_TEXT'

A constant which can be used with the type property of a HttpResponseBody. This constant has a value of “STATIC_TEXT”

__init__(**kwargs)

Initializes a new DynamicHttpResponseBody object with values from keyword arguments. The default value of the type attribute of this class is DYNAMIC and it should not be changed. The following keyword arguments are supported (corresponding to the getters/setters of this class):

Parameters
  • type (str) – The value to assign to the type property of this DynamicHttpResponseBody. Allowed values for this property are: “STATIC_TEXT”, “DYNAMIC”

  • template (str) – The value to assign to the template property of this DynamicHttpResponseBody.

static get_subtype(object_dictionary)

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.

property template

[Required] Gets the template of this DynamicHttpResponseBody. Dynamic response body

Returns

The template of this DynamicHttpResponseBody.

Return type

str

property type

[Required] Gets the type of this HttpResponseBody. Type of HttpResponseBody.

Allowed values for this property are: “STATIC_TEXT”, “DYNAMIC”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.

Returns

The type of this HttpResponseBody.

Return type

str