The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::OpenStack::Client::Request is an request class for Net::OpenStack.

Boolean logic is overloaded using _boolean method (as inverse of is_error).

Public functions

mkrequest

A Net::OpenStack::Client::Request factory

parse_endpoint

Parse endpoint and look for templates and parameters.

Return (possibly modified) endpoint, arrayref of template names and arrayref of parameter names.

If logger is passed, report an error and return; else die on failure.

Public methods

new

Create new request instance from options for command endpoint and REST HTTP method.

The endpoint is the URL to use (can be templated with tpls)

Options

tpls: template names and values
opts: optional arguments
error: an error (no default)
service: service name
version: service version
result: result path for the response
endpoint

Parses the endpoint attribute, look for any templates, and replace them with values from tpls attribute hashref. Any parameters defined in the endpoint are removed, and only those that are present in the params attribute are readded with the values from the attribute.

The data can contain more keys than what is required for templating, those keys and their values will be ignored.

This does not modify the endpoint attribute.

Return templated endpoint on success or undef on failure.

If host is defined, try to make a full URL

if you provide only fqdn, make a https://<fqdn>/v<version/<endpoint>
if you provide URL, check for version suffix, return <url>/<endpoint>
opts_data

Generate hashref from options, to be used for JSON encoding. If raw attribute is defined, ignore all options and return it.

Returns empty hasref, even if no options existed.

headers

Return headers for the request.

Supported options:

token: authentication token stored in X-Auth-Token
headers: hashref with headers to add that take precedence over the defaults. Headers with an undef value will be removed.
is_error

Test if this is an error or not (based on error attribute).