pfSense-pkg-RESTAPI

ServiceUnavailableError extends Response
in package

Exception class that indicates the requested services is temporarily unavailable. This exception generally corresponds with a 503 Service Unavailable error code.

Table of Contents

Properties

$_links  : ResourceLinkSet
$code  : int
$data  : Model|ModelSet
$help_text  : string
$message  : mixed
$response_id  : string
$status  : string
$__log_level  : int

Methods

__construct()  : mixed
Constructs a new Response object.
get_class_fqn()  : string
Obtains the fully qualified name of the called class.
get_class_shortname()  : string
Obtains the shortname of the called class.
get_classes_in_namespace()  : array<string|int, mixed>
Obtains all classes associated with this class's current namespace.
get_http_status_message()  : string
Fetch HTTP status message associated with a given HTTP status code.
log()  : void
Writes a log entry to the applicable log file
to_openapi_schema()  : array<string|int, mixed>
Represents the Response object as an OpenAPI schema.
to_representation()  : array<string|int, mixed>
Converts this Response object to an array representation of its contents.

Properties

$help_text

public string $help_text = 'The requested service is temporarily unavailable.'

A help text message that can be used to describe the API response in more detail.

$response_id

public string $response_id

$status

public string $status

The HTTP status message that corresponds with the HTTP status code.

Methods

__construct()

Constructs a new Response object.

public __construct(mixed $message, string $response_id[, int $retry_after = 5 ][, Model|ModelSet $data = new ModelSet() ][, ResourceLinkSet $_links = new ResourceLinkSet() ]) : mixed
Parameters
$message : mixed

The verbose message to include in the Response.

$response_id : string

A unique response ID that can be used to identify this specific response. This should be unique from any other Response object in the codebase!

$retry_after : int = 5

The amount of time (in seconds) we expect the service to become available again.

$data : Model|ModelSet = new ModelSet()

A Model or ModelSet this Response relates to. This is typically only included for successful Responses.

$_links : ResourceLinkSet = new ResourceLinkSet()

A ResourceLinkSet containing applicable ResourceLinks for this response.

get_class_fqn()

Obtains the fully qualified name of the called class.

public static get_class_fqn() : string
Return values
string —

The FQN for this object's class.

get_class_shortname()

Obtains the shortname of the called class.

public static get_class_shortname() : string
Return values
string —

The shortname for this object's class.

get_classes_in_namespace()

Obtains all classes associated with this class's current namespace.

public get_classes_in_namespace([bool $shortnames = false ]) : array<string|int, mixed>
Parameters
$shortnames : bool = false
Return values
array<string|int, mixed> —

An array of classes currently in this object's namespace

get_http_status_message()

Fetch HTTP status message associated with a given HTTP status code.

public final static get_http_status_message(int $http_status) : string
Parameters
$http_status : int

The HTTP status code to fetch the descriptive message for.

Return values
string —

The HTTP status message associated with the give HTTP response code OR unknown if not found.

log()

Writes a log entry to the applicable log file

public static log(int $level, string $message[, string $logfile = 'restapi' ]) : void
Parameters
$level : int

The log level to write. This should be one of the LOG_* constants defined by syslog.

$message : string

The message to write to the log file.

$logfile : string = 'restapi'

The log file to write to. This must be a valid logging facility defined in the package's info.xml file.

to_openapi_schema()

Represents the Response object as an OpenAPI schema.

public to_openapi_schema() : array<string|int, mixed>
Return values
array<string|int, mixed> —

This Response object as an OpenAPI schema.

to_representation()

Converts this Response object to an array representation of its contents.

public to_representation() : array<string|int, mixed>
Return values
array<string|int, mixed> —

An array containing the response details.


        
On this page

Search results