@adobe/aio-lib-cloudmanager

Adobe I/O Cloud Manager Library

Usage no npm install needed!

<script type="module">
  import adobeAioLibCloudmanager from 'https://cdn.skypack.dev/@adobe/aio-lib-cloudmanager';
</script>

README

Version Downloads/week Build Status License Codecov Coverage

Adobe I/O Cloud Manager Library

JavaScript SDK wrapping the Adobe Cloud Manager API.

Installing

$ npm install @adobe/aio-lib-cloudmanager

Usage

  1. Initialize the SDK
const sdk = require('@adobe/aio-lib-cloudmanager')

async function sdkTest() {
  //initialize sdk
  const client = await sdk.init('<orgId>', 'x-api-key', '<valid auth token>')
}
  1. Call methods using the initialized SDK
const sdk = require('@adobe/aio-lib-cloudmanager')

async function sdkTest() {
  // initialize sdk
  const client = await sdk.init('<orgId>', 'x-api-key', '<valid auth token>')

  // call methods
  try {
    // get... something
    const result = await client.getSomething({})
    console.log(result)

  } catch (e) {
    console.error(e)
  }
}

Classes

CloudManagerAPI

This class provides methods to call your Cloud Manager APIs. Before calling any method initialize the instance by calling the init method on it with valid values for tenantId, apiKey and accessToken

Functions

getCurrentStep(execution)PipelineExecutionStepState

Find the first non-finished step in a pipeline execution

getWaitingStep(execution)PipelineExecutionStepState

Find the first waiting step in a pipeline execution

init(orgId, apiKey, accessToken, baseUrl)Promise.<CloudManagerAPI>

Returns a Promise that resolves with a new CloudManagerAPI object.

Typedefs

EmbeddedProgram : object

A lightweight representation of a Program

Pipeline : object

A representation of a CI/CD Pipeline

PipelinePhase : object

Describes a phase of a pipeline

PipelineExecution : object

A representation of an execution of a CI/CD Pipeline.

PipelineExecutionStepState : object

Describes the status of a particular pipeline execution step for display purposes

PipelineStepMetrics : object
Metric : object

A representation of a specific metric generated by a CI/CD Pipeline step.

Environment : object

A representation of an Environment known to Cloud Manager.

Variable : object

A named value than can be set on an Environment or Pipeline

LogOptionRepresentation : object
IPAllowedListBinding : object

Describes an IP Allowed List Binding

IPAllowedList : object

Describes an IP Allowed List

ListPipelineOptions : object

Options to the listPipeline function

DownloadedLog : object
PipelineUpdate : object

CloudManagerAPI

This class provides methods to call your Cloud Manager APIs. Before calling any method initialize the instance by calling the init method on it with valid values for tenantId, apiKey and accessToken

Kind: global class

cloudManagerAPI.orgId : string

The organization id

Kind: instance property of CloudManagerAPI

cloudManagerAPI.apiKey : string

The api key from your integration

Kind: instance property of CloudManagerAPI

cloudManagerAPI.accessToken : string

The access token from your integration

Kind: instance property of CloudManagerAPI

cloudManagerAPI.baseUrl : string

The base URL for the API endpoint

Kind: instance property of CloudManagerAPI

cloudManagerAPI.addIpAllowlistBinding(programId, ipAllowlistId, environmentId, service) ⇒ Promise.<object>

Bind an IP Allow List to an environment

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id
ipAllowlistId string the allow list id
environmentId string the environment id
service string the service name

cloudManagerAPI.advanceCurrentExecution(programId, pipelineId) ⇒ Promise.<object>

Advance current execution

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id
pipelineId string the pipeline id

cloudManagerAPI.cancelCurrentExecution(programId, pipelineId) ⇒ Promise.<object>

Cancel current execution

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id
pipelineId string the pipeline id

cloudManagerAPI.createExecution(programId, pipelineId, mode) ⇒ Promise.<PipelineExecution>

Create a new execution for a pipeline, returning the execution.

Kind: instance method of CloudManagerAPI
Returns: Promise.<PipelineExecution> - the new execution

Param Type Description
programId string the program id
pipelineId string the pipeline id
mode string the pipeline execution mode

cloudManagerAPI.createIpAllowlist(programId, name, cidrBlocks) ⇒ Promise.<IPAllowedList>

Create IP Allow List

Kind: instance method of CloudManagerAPI
Returns: Promise.<IPAllowedList> - a truthy value

Param Type Description
programId string the program id
name string the name
cidrBlocks Array.<string> the CIDR blocks

cloudManagerAPI.deleteEnvironment(programId, environmentId) ⇒ Promise.<object>

Delete an environment

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id
environmentId string the environment id

cloudManagerAPI.deleteIpAllowlist(programId, ipAllowlistId) ⇒ Promise.<object>

Update the CIDR blocks of an IP Allow List

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id
ipAllowlistId string the allow list id

cloudManagerAPI.deletePipeline(programId, pipelineId) ⇒ Promise.<object>

Delete a pipeline

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy object

Param Type Description
programId string the program id
pipelineId string the pipeline id

cloudManagerAPI.deleteProgram(programId) ⇒ Promise.<object>

Delete a program

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id

cloudManagerAPI.downloadLogs(programId, environmentId, service, name, days, outputDirectory) ⇒ Promise.<Array.<DownloadedLog>>

Download log files from the environment to a specified directory.

Kind: instance method of CloudManagerAPI
Returns: Promise.<Array.<DownloadedLog>> - the list of downloaded logs

Param Type Description
programId string the program id
environmentId string the environment id
service string the service specification
name string the log name
days number the number of days
outputDirectory string the output directory

cloudManagerAPI.getCommerceCommandExecution(programId, environmentId, commandExecutionId) ⇒ Promise.<object>

Get status for an existing Commerce execution

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value of the commerce execution

Param Type Description
programId string the program id
environmentId string the environment id
commandExecutionId string the command execution id

cloudManagerAPI.getCommerceCommandExecutions(programId, environmentId, type, status, command) ⇒ Promise.<object>

Get status for an existing Commerce execution

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value of the commerce execution

Param Type Default Description
programId string the program id
environmentId string the environment id
type string null filter for type of command
status string null filter for status of command
command string null filter for the type of command

cloudManagerAPI.getCurrentExecution(programId, pipelineId) ⇒ Promise.<PipelineExecution>

Get the current execution for a pipeline

Kind: instance method of CloudManagerAPI
Returns: Promise.<PipelineExecution> - the execution

Param Type Description
programId string the program id
pipelineId string the pipeline id

cloudManagerAPI.getDeveloperConsoleUrl(programId, environmentId) ⇒ Promise.<string>

Get the link to the developer console

Kind: instance method of CloudManagerAPI
Returns: Promise.<string> - the console url

Param Type Description
programId string the program id
environmentId string the environment id

cloudManagerAPI.getEnvironmentVariables(programId, environmentId) ⇒ Promise.<Array.<Variable>>

Get the list of variables for an environment

Kind: instance method of CloudManagerAPI
Returns: Promise.<Array.<Variable>> - the variables

Param Type Description
programId string the program id
environmentId string the environment id

cloudManagerAPI.getExecution(programId, pipelineId, executionId) ⇒ Promise.<PipelineExecution>

Get an execution for a pipeline

Kind: instance method of CloudManagerAPI
Returns: Promise.<PipelineExecution> - the execution

Param Type Description
programId string the program id
pipelineId string the pipeline id
executionId string the execution id

cloudManagerAPI.getExecutionStepLog(programId, pipelineId, executionId, action, logFile, outputStream) ⇒ Promise.<object>

Write step log to an output stream.

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id
pipelineId string the pipeline id
executionId string the execution id
action string the action
logFile string the log file to select a non-default value
outputStream object the output stream to write to

cloudManagerAPI.getPipelineVariables(programId, pipelineId) ⇒ Promise.<Array.<Variable>>

Get the list of variables for a pipeline

Kind: instance method of CloudManagerAPI
Returns: Promise.<Array.<Variable>> - the variables

Param Type Description
programId string the program id
pipelineId string the pipeline id

cloudManagerAPI.getQualityGateResults(programId, pipelineId, executionId, action) ⇒ Promise.<PipelineStepMetrics>

Get the quality gate results for a pipeline step

Kind: instance method of CloudManagerAPI
Returns: Promise.<PipelineStepMetrics> - the execution

Param Type Description
programId string the program id
pipelineId string the pipeline id
executionId string the execution id
action string the action name

cloudManagerAPI.init(orgId, apiKey, accessToken, baseUrl) ⇒ Promise.<CloudManagerAPI>

Initializes a CloudManagerAPI object and returns it.

Kind: instance method of CloudManagerAPI
Returns: Promise.<CloudManagerAPI> - a CloudManagerAPI object

Param Type Description
orgId string the organization id
apiKey string the API key for your integration
accessToken string the access token for your integration
baseUrl string the base URL to access the API (defaults to https://cloudmanager.adobe.io)

cloudManagerAPI.invalidatePipelineCache(programId, pipelineId) ⇒ Promise.<object>

Invalidate the cache for a pipeline

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy object

Param Type Description
programId string the program id
pipelineId string the pipeline id

cloudManagerAPI.listAvailableLogOptions(programId, environmentId) ⇒ Promise.<Array.<LogOptionRepresentation>>

List the log options available for an environment

Kind: instance method of CloudManagerAPI
Returns: Promise.<Array.<LogOptionRepresentation>> - the log options for the environment

Param Type Description
programId string the program id
environmentId string the environment id

cloudManagerAPI.listEnvironments(programId) ⇒ Promise.<Array.<Environment>>

List environments for a program

Kind: instance method of CloudManagerAPI
Returns: Promise.<Array.<Environment>> - a list of environments

Param Type Description
programId string the program id

cloudManagerAPI.listExecutions(programId, pipelineId, limit) ⇒ Promise.<Array.<PipelineExecution>>

List the most recent executions for a pipeline

Kind: instance method of CloudManagerAPI
Returns: Promise.<Array.<PipelineExecution>> - the list of executions

Param Type Default Description
programId string the program id
pipelineId string the pipeline id
limit number 20 the maximum number of executions to return (defaults to 20)

cloudManagerAPI.listIpAllowlists(programId) ⇒ Promise.<IPAllowedList>

List the program's defined IP Allow Lists

Kind: instance method of CloudManagerAPI
Returns: Promise.<IPAllowedList> - - the IP Allow Lists

Param Type Description
programId string the program id

cloudManagerAPI.listPipelines(programId, options) ⇒ Promise.<Array.<Pipeline>>

Obtain a list of pipelines for the target program.

Kind: instance method of CloudManagerAPI
Returns: Promise.<Array.<Pipeline>> - an array of Pipelines

Param Type Description
programId string the program id
options ListPipelineOptions options

cloudManagerAPI.listPrograms() ⇒ Promise.<Array.<EmbeddedProgram>>

Obtain a list of programs for the target organization.

Kind: instance method of CloudManagerAPI
Returns: Promise.<Array.<EmbeddedProgram>> - an array of Programs

cloudManagerAPI.postCommerceCommandExecution(programId, environmentId, options) ⇒ Promise.<object>

Make a Post to Commerce API

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id
environmentId string the environment id
options object options

cloudManagerAPI.removeIpAllowlistBinding(programId, ipAllowlistId, environmentId, service) ⇒ Promise.<object>

Unbind an IP Allow List from an environment

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id
ipAllowlistId string the allow list id
environmentId string the environment id
service string the service name

cloudManagerAPI.setEnvironmentVariables(programId, environmentId, variables) ⇒ Promise.<object>

Set the variables for an environment

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id
environmentId string the environment id
variables Array.<Variable> the variables

cloudManagerAPI.setPipelineVariables(programId, pipelineId, variables) ⇒ Promise.<object>

Set the variables for a pipeline

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id
pipelineId string the pipeline id
variables Array.<Variable> the variables

cloudManagerAPI.startExecution(programId, pipelineId, mode) ⇒ Promise.<string>

Deprecated

Start an execution for a pipeline, returning the url of the new execution

Kind: instance method of CloudManagerAPI
Returns: Promise.<string> - the execution url

Param Type Description
programId string the program id
pipelineId string the pipeline id
mode string the pipeline execution mode

cloudManagerAPI.tailExecutionStepLog(programId, pipelineId, action, logFile, outputStream) ⇒ Promise.<PipelineExecutionStepState>

Tail step log to an output stream.

Kind: instance method of CloudManagerAPI
Returns: Promise.<PipelineExecutionStepState> - the completed step state

Param Type Description
programId string the program id
pipelineId string the pipeline id
action string the action
logFile string the log file to select a non-default value
outputStream object the output stream to write to

cloudManagerAPI.updateIpAllowlist(programId, ipAllowlistId, cidrBlocks) ⇒ Promise.<object>

Update the CIDR blocks of an IP Allow List

Kind: instance method of CloudManagerAPI
Returns: Promise.<object> - a truthy value

Param Type Description
programId string the program id
ipAllowlistId string the allow list id
cidrBlocks Array.<string> the replacement CIDR blocks

cloudManagerAPI.updatePipeline(programId, pipelineId, changes) ⇒ Promise.<Pipeline>

Update a pipeline

Kind: instance method of CloudManagerAPI
Returns: Promise.<Pipeline> - the new pipeline definition

Param Type Description
programId string the program id
pipelineId string the pipeline id
changes PipelineUpdate the changes

getCurrentStep(execution) ⇒ PipelineExecutionStepState

Find the first non-finished step in a pipeline execution

Kind: global function
Returns: PipelineExecutionStepState - the step state or a falsy object if all steps are finished

Param Type Description
execution PipelineExecution the execution

getWaitingStep(execution) ⇒ PipelineExecutionStepState

Find the first waiting step in a pipeline execution

Kind: global function
Returns: PipelineExecutionStepState - the step state or a falsy object if no step is waiting

Param Type Description
execution PipelineExecution the execution

init(orgId, apiKey, accessToken, baseUrl) ⇒ Promise.<CloudManagerAPI>

Returns a Promise that resolves with a new CloudManagerAPI object.

Kind: global function
Returns: Promise.<CloudManagerAPI> - a Promise with a CloudManagerAPI object

Param Type Description
orgId string the organization id
apiKey string the API key for your integration
accessToken string the access token for your integration
baseUrl string the base URL to access the API (defaults to https://cloudmanager.adobe.io)

EmbeddedProgram : object

A lightweight representation of a Program

Kind: global typedef
Properties

Name Type Description
id string Identifier of the program. Unique within the space.
name string Name of the program
enabled boolean Whether this Program has been enabled for Cloud Manager usage
tenantId string Tenant Id
status string Status of the program
createdAt string Created time
updatedAt string Date of last change

Pipeline : object

A representation of a CI/CD Pipeline

Kind: global typedef
Properties

Name Type Description
id string Identifier of the pipeline. Unique within the program.
programId string Identifier of the program. Unique within the space.
name string Name of the pipeline
trigger string How should the execution be triggered. ON_COMMIT: each time one or more commits are pushed and the Pipeline is idle then a execution is triggered. MANUAL: triggerd through UI or API.
status string Pipeline status
createdAt string Create date
updatedAt string Update date
lastStartedAt string Last pipeline execution start
lastFinishedAt string Last pipeline execution end
phases Array.<PipelinePhase> Pipeline phases in execution order
type string Pipeline type

PipelinePhase : object

Describes a phase of a pipeline

Kind: global typedef
Properties

Name Type Description
name string Name of the phase
type string Type of the phase
repositoryId string Identifier of the source repository. The code from this repository will be build at the start of this phase. Mandatory if type=BUILD
branch string Name of the tracked branch or a fully qualified git tag (e.g. refs/tags/v1). Assumed to be master if missing.
environmentId string Identifier of the target environment. Mandatory if type=DEPLOY
environmentType string Type of environment (for example stage or prod, readOnly = true)
steps Array.<PipelineStep> Steps to be included in the phase in execution order. Might be added or not, depending on permissions or configuration

PipelineExecution : object

A representation of an execution of a CI/CD Pipeline.

Kind: global typedef
Properties

Name Type Description
id string Pipeline execution identifier
programId string Identifier of the program. Unique within the space.
pipelineId string Identifier of the pipeline. Unique within the space.
artifactsVersion string Version of the artifacts generated during this execution
user string AdobeID who started the pipeline. Empty for auto triggered builds
status string Status of the execution
trigger string How the execution was triggered.
pipelineExecutionMode string The mode in which the execution occurred. EMERGENCY mode will skip certain steps and is only available to select AMS customers
createdAt string Timestamp at which the execution was created
updatedAt string Timestamp at which the status of the execution last changed
finishedAt string Timestamp at which the execution completed
pipelineType string Pipeline type

PipelineExecutionStepState : object

Describes the status of a particular pipeline execution step for display purposes

Kind: global typedef
Properties

Name Type Description
id string
stepId string
phaseId string
action string Name of the action
repository string Target repository
branch string Target branch
environment string Target environment
environmentId string Target environment id
environmentType string Target environment type
startedAt string Timestamp at which the step state started running
finishedAt string Timestamp at which the step completed
commitId string Target commit id
details object Additional details of the step
status string Action status

PipelineStepMetrics : object

Kind: global typedef
Properties

Name Type Description
metrics Array.<Metric> metrics

Metric : object

A representation of a specific metric generated by a CI/CD Pipeline step.

Kind: global typedef
Properties

Name Type Description
id string KPI result identifier
severity string Severity of the metric
passed boolean Whether metric is considered passed
override boolean Whether user override the failed metric
actualValue string Expected value for the metric
expectedValue string Expected value for the metric
comparator string Comparator used for the metric
kpi string KPI identifier

Environment : object

A representation of an Environment known to Cloud Manager.

Kind: global typedef
Properties

Name Type Description
id string id
programId string Identifier of the program. Unique within the space.
name string Name of the environment
description string Description of the environment
type string Type of the environment
status string Status of the environment
region string Region of the environment
availableLogOptions Array.<LogOptionRepresentation> List of logs available in the environment

Variable : object

A named value than can be set on an Environment or Pipeline

Kind: global typedef
Properties

Name Type Description
name string Name of the variable. Can only consist of a-z, A-Z, _ and 0-9 and cannot begin with a number.
value string Value of the variable. Read-Write for non-secrets, write-only for secrets. The length of secretString values must be less than 500 characters. An empty value causes a variable to be deleted.
type string Type of the variable. Default string if missing. secretString variables are encrypted at rest. The type of a variable be changed after creation; the variable must be deleted and recreated.
service string Service of the variable. When not provided, the variable applies to all services. Currently the values 'author', 'publish', and 'preview' are supported. Note - this value is case-sensitive.
status string Status of the variable

LogOptionRepresentation : object

Kind: global typedef
Properties

Name Type Description
service string Name of the service in environment. Example: author
name string Name of the log for service in environment. Example: aemerror

IPAllowedListBinding : object

Describes an IP Allowed List Binding

Kind: global typedef
Properties

Name Type Description
id string Identifier of the IP Allowed List Binding to an Environment
tier string Tier of the environment.
status string Status of the binding.
programId string Identifier of the program.
ipAllowListId string Identifier of the IP allow list.
environmentId string Identifier of the environment.

IPAllowedList : object

Describes an IP Allowed List

Kind: global typedef
Properties

Name Type Description
id string Identifier of the IP Allowed List
name string Name of the IP Allowed List
ipCidrSet Array.<string> IP CIDR Set
programId string Identifier of the program.
bindings Array.<IPAllowedListBinding> IP Allowlist bindings

ListPipelineOptions : object

Options to the listPipeline function

Kind: global typedef
Properties

Name Type Description
busy boolean if true, only busy pipelines will be returned

DownloadedLog : object

Kind: global typedef
Properties

Name Type Description
path string the path where the log was stored
url string the url of the log that was downloaded

PipelineUpdate : object

Kind: global typedef
Properties

Name Type Description
branch string the new branch
repositoryId string the new repository id
devEnvironmentId string the new dev environment id
stageEnvironmentId string the new stage environment id
prodEnvironmentId string the new prod environment id

Debug Logs

LOG_LEVEL=debug <your_call_here>

Prepend the LOG_LEVEL environment variable and debug value to the call that invokes your function, on the command line. This should output a lot of debug data for your SDK calls.

Contributing

Contributions are welcome! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.