Class: GenericNodeProvider

GenericNodeProvider(optionsopt)

Generic node provider implementation.

Constructor

new GenericNodeProvider(optionsopt)

Constructor

Parameters:
Name Type Attributes Description
options Object <optional>

Options for the instance.

Properties
Name Type Attributes Description
clOptions Object <optional>

Command line options if called from a script.

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

getNodesFromUri(uri, optionsopt) → {Promise}

Gets nodes from the provided URI. The resource should be in JSON format as an array of objects. JSON strings that parse to an array of objects are also supported.

Parameters:
Name Type Attributes Description
uri String

The URI of the resource.

options Object <optional>

http/https request options

Returns:

A promise which will be resolved with an array of instances. Each instance value should be:

{
    id: Node ID,
    ip: {
        public: public IP,
        private: private IP
    }
}
Type
Promise

init(providerOptions, optionsopt) → {Promise}

Initialize class

Override for implementation specific initialization needs (read info from cloud provider, read database, etc.). Called at the start of processing.

Parameters:
Name Type Attributes Description
providerOptions Object

Provider specific options.

Properties
Name Type Attributes Description
propertyPathId String

Object property path ('.' separated) that describes how to fetch the ID from the provided resource. An empty property name in the path fetches all keys in the current object.

"example.uuid",
propertyPathIpPrivate String

Object property path ('.' separated) that describes how to fetch the private IP from the provided resource. An empty property name in the path fetches all keys in the current object.

"example.address.private"
propertyPathIpPublic String <optional>

Object property path ('.' separated) that describes how to fetch the public IP from the provided resource. An empty property name in the path fetches all keys in the current object.

"example.address.public"
options Object <optional>

Options for this instance.

Returns:

A promise which will be resolved when init is complete.

Type
Promise