Class: IControl

IControl(optionsopt)

new IControl(optionsopt)

Creates an IControl object

Parameters:
Name Type Attributes Description
options Object <optional>

Options for the creation.

Properties
Name Type Attributes Description
host String <optional>

IP Address to connect to. Default 127.0.0.1

port Number <optional>

Port to use. Default 443.

user String <optional>

User to use for auth. Default admin.

password String <optional>

Password to use for auth. Default admin.

authToken String <optional>

Auth token to use rather than user and password.

basePath String <optional>

Base path to prepend to paths for all requests. Default /mgmt

strict Boolean <optional>

Whether or not to validate SSL certificates.

logger Object <optional>

Logger to use. Or, pass loggerOptions to get your own logger.

loggerOptions Object <optional>

Options for the logger. See module:logger.getLogger for details.

Methods

create(path, bodyopt, optionsopt) → {Promise}

Executes a create (POST) request

Parameters:
Name Type Attributes Description
path String

Path for the request.

body Object <optional>

Body of the request.

options Object <optional>

Options for the request.

Properties
Name Type Attributes Description
noWait Boolean <optional>

Don't wait for a response. Default false (wait for a response).

headers Object <optional>

Headers to use in the request. Default { 'Content-Type': 'application/json' }

Returns:

A promise which is resolved with the results of the request or rejected if an error occurs.

Type
Promise

delete(path, bodyopt, optionsopt) → {Promise}

Executes a delete (DELETE) request

Parameters:
Name Type Attributes Description
path String

Path for the request.

body Object <optional>

Body of the request.

options Object <optional>

Options for the request.

Properties
Name Type Attributes Description
noWait Boolean <optional>

Don't wait for a response. Default false (wait for a response).

headers Object <optional>

Headers to use in the request. Default { 'Content-Type': 'application/json' }

Returns:

A promise which is resolved with the results of the request or rejected if an error occurs. If the response is JSON that has 'items' in it, only the items are returned.

Type
Promise

list(path, optionsopt) → {Promise}

Executes a list (GET) request

Parameters:
Name Type Attributes Description
path String

Path for the request.

options Object <optional>

Options for the request.

Properties
Name Type Attributes Description
noWait Boolean <optional>

Don't wait for a response. Default false (wait for a response).

headers Object <optional>

Headers to use in the request. Default { 'Content-Type': 'application/json' }

Returns:

A promise which is resolved with the results of the request or rejected if an error occurs. If the response is JSON that has 'items' in it, only the items are returned.

Type
Promise

modify(path, bodyopt, optionsopt) → {Promise}

Executes a modify (PATCH) request

Parameters:
Name Type Attributes Description
path String

Path for the request.

body Object <optional>

Body of the request.

options Object <optional>

Options for the request.

Properties
Name Type Attributes Description
noWait Boolean <optional>

Don't wait for a response. Default false (wait for a response).

headers Object <optional>

Headers to use in the request. Default { 'Content-Type': 'application/json' }

Returns:

A promise which is resolved with the results of the request or rejected if an error occurs.

Type
Promise

replace(path, bodyopt, optionsopt) → {Promise}

Executes a replace (PUT) request

Parameters:
Name Type Attributes Description
path String

Path for the request.

body Object <optional>

Body of the request.

options Object <optional>

Options for the request.

Properties
Name Type Attributes Description
noWait Boolean <optional>

Don't wait for a response. Default false (wait for a response).

headers Object <optional>

Headers to use in the request. Default { 'Content-Type': 'application/json' }

Returns:

A promise which is resolved with the results of the request or rejected if an error occurs.

Type
Promise

request(method, path, bodyopt, optionsopt, existingDeferredopt) → {Promise}

Executes a request

Parameters:
Name Type Attributes Description
method String

HTTP method for the request.

path String

Path for the request.

body Object <optional>

Body of the request.

options Object <optional>

Options for the request.

Properties
Name Type Attributes Description
noWait Boolean <optional>

Don't wait for a response. Default false (wait for a response).

headers Object <optional>

Headers to use in the request.

{
    'Content-Type': 'application/json'
}
existingDeferred Object <optional>

An existing deferred to use instead of creating a new one. Used for recursion (for retrying the request).

options.noRefresh Boolean <optional>

Do not try to refresh the auth token if the request gets a 401

Returns:

A promise which is resolved with the results of the request or rejected if an error occurs.

Type
Promise