Class: ApiManager

ApiManager

Public API class for the library.


new ApiManager(config)

Builds a new API Manager toolset class.

Parameters:
Name Type Description
config Configuration
Source:

Methods


applyTemplate(source, target, placeholders [, clean])

Applies the given placeholder values to the template.

Parameters:
Name Type Argument Default Description
source string

A directory where the template files are located.

target string

The target directory (if it does not exist, it is created).

placeholders object

A map between the placeholder names and values (as strings).

clean boolean <optional>
false

Flag indicating if the target directory should be cleaned.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

deployManifest(path)

Deploys the API manager artifacts described in the given manifest.

Parameters:
Name Type Description
path string

The absolute or relative path of the manifest file.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

deployManifestsMatching(pattern [, force])

Deploys all the manifests matching the given glob pattern.

Parameters:
Name Type Argument Default Description
pattern string

A glob pattern.

force boolean <optional>
false

If true, the method continues execution even if one
manifest deployment fails.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

deployProxy(path [, templated] [, placeholders])

Deploys the API manager proxy files located in the given directory.

Parameters:
Name Type Argument Default Description
path string

The absolute or relative path of the directory.

templated boolean <optional>
false

Flag indicating if the files are part of a template.

placeholders object <optional>
{}

A map between the placeholder names and values (as
strings). Only relevant if templated is set to true.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

downloadProxy(name, path [, clean])

Downloads an existing API Proxy from the API Portal.

Parameters:
Name Type Argument Default Description
name string

The name of the existing API proxy.

path string

A directory where the results will be stored (if it does not exist,
it is created).

clean boolean <optional>
false

Flag indicating if the target directory should be cleaned.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

extractTemplate(source, target, placeholders [, clean])

Extracts ("reverse-engineers") a template from existing proxy files.

Parameters:
Name Type Argument Default Description
source string

A directory where the source files are located.

target string

A directory where the results will be stored (if it does not exist,
it is created).

placeholders object

A map between the placeholder names and values.

clean boolean <optional>
false

Flag indicating if the target directory should be cleaned.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

extractTemplateFromManifest(manifestPath, target [, clean])

Extracts ("reverse-engineers") a template from existing deployed API proxy.

Parameters:
Name Type Argument Default Description
manifestPath string

The path to the manifest describing the API proxy.

target string

A directory where the results will be stored (if it does not exist,
it is created).

clean boolean <optional>
false

Flag indicating if the target directory should be cleaned.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

getAllVirtualHostInfo()

Reads the information for the all virtual hosts.

Source:
Returns:

A promise which resolves with the virtual host information.

Type
Promise.<Array.<VirtualHost>>

getConfiguredHost()

Returns the configured API Manager host.

Source:
Returns:

The host of the API Manager.

Type
string

getDefaultVirtualHostInfo()

Reads the information for the default virtual hosts.

Source:
Returns:

A promise which resolves with the virtual host information.

Type
Promise.<VirtualHost>

getManifestUrl(path)

Reads the full base URL for a proxy described by the given manifest.

Parameters:
Name Type Description
path string

The path of the manifest file.

Source:
Returns:

A promise which resolves with the URL as a string.

Type
Promise

getProxyUrl(name)

Reads the full base URL for a given API proxy.

Parameters:
Name Type Description
name string

The name of the API proxy.

Source:
Returns:

A promise which resolves with the URL as a string.

Type
Promise

getVirtualHostInfoById(id)

Reads the information for a virtual host (given by id).

Parameters:
Name Type Description
id string

The id of the host.

Source:
Returns:

A promise which resolves with the virtual host information.

Type
Promise.<VirtualHost>

packageManifest(manifestPath, target)

Packages an API proxy described by the given manifest into an archive.

Parameters:
Name Type Description
manifestPath string

The path to the manifest describing the API proxy.

target string

The path (including the filename) where to store the zip file.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

packageManifestsMatching(pattern [, force])

Packages all the manifests matched by the given glob pattern.

Parameters:
Name Type Argument Default Description
pattern string

The glob pattern to be expanded.

force boolean <optional>
false

If true, the method continues execution even if one
operation fails.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

packageProxy(path [, templated] [, placeholders])

Packages the API proxy files located at the given directory into a zip stream.

Parameters:
Name Type Argument Default Description
path string

The path to the directory containing the proxy files.

templated boolean <optional>
false

Flag indicating if the files are part of a template.

placeholders object <optional>
{}

A map between the placeholder names and values (as
strings). Only relevant if templated is set to true.

Source:
Returns:

A promise that is resolved when the operation has finised. The
Promise will return a stream containing the zip archive when resolved.

Type
Promise

packageProxyToFile(path, target [, templated] [, placeholders])

Packages the API proxy files located at the given directory into a zip file.

Parameters:
Name Type Argument Default Description
path string

The path to the directory containing the proxy files.

target string

The path (including the filename) where to store the zip file.

templated boolean <optional>
false

Flag indicating if the files are part of a template.

placeholders object <optional>
{}

A map between the placeholder names and values (as
strings). Only relevant if templated is set to true.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

updateMap(name, keys)

Update a key-value map on the API Manager. If the map does not exist, it is created.

Parameters:
Name Type Description
name string

The name of the key-value map.

keys object

A map between the keys and the values. If a given value is
a string, then it is sent as-is to the API Manager. Otherwise, it is serialized
into JSON.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

updateMapsFromObject(maps)

Updates several key-value maps on the API Manager.

Parameters:
Name Type Description
maps object

A map between the key-value map name and the keys.

Source:
See:
  • updateMap
Returns:

A promise that is resolved when the operation has finised.

Type
Promise

uploadProxy(pathOrStream)

Uploads an API Proxy archive to the API Portal.

Parameters:
Name Type Description
pathOrStream string | stream

Either the path to a zip file or a stream
containing the archive.

Source:
Returns:

A promise that is resolved when the operation has finised.

Type
Promise