JavaScript SDK wrapping the Adobe Cloud Manager API.
$ npm install @adobe/aio-lib-cloudmanager
- 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>')
}
- 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)
}
}
- 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
- 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.
- 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
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
- .apiKey :
string
- .accessToken :
string
- .baseUrl :
string
- .init(orgId, apiKey, accessToken, baseUrl) ⇒
Promise.<CloudManagerAPI>
- .listPrograms() ⇒
Promise.<Array.<EmbeddedProgram>>
- .listPipelines(programId, options) ⇒
Promise.<Array.<Pipeline>>
- .createExecution(programId, pipelineId) ⇒
Promise.<PipelineExecution>
.startExecution(programId, pipelineId) ⇒Promise.<string>
- .getCurrentExecution(programId, pipelineId) ⇒
Promise.<PipelineExecution>
- .listExecutions(programId, pipelineId, limit) ⇒
Promise.<Array.<PipelineExecution>>
- .getExecution(programId, pipelineId, executionId) ⇒
Promise.<PipelineExecution>
- .getQualityGateResults(programId, pipelineId, executionId, action) ⇒
Promise.<PipelineStepMetrics>
- .cancelCurrentExecution(programId, pipelineId) ⇒
Promise.<object>
- .advanceCurrentExecution(programId, pipelineId) ⇒
Promise.<object>
- .listEnvironments(programId) ⇒
Promise.<Array.<Environment>>
- .getExecutionStepLog(programId, pipelineId, executionId, action, logFile, outputStream) ⇒
Promise.<object>
- .listAvailableLogOptions(programId, environmentId) ⇒
Promise.<Array.<LogOptionRepresentation>>
- .downloadLogs(programId, environmentId, service, name, days, outputDirectory) ⇒
Promise.<Array.<DownloadedLog>>
- .deletePipeline(programId, pipelineId) ⇒
Promise.<object>
- .updatePipeline(programId, pipelineId, changes) ⇒
Promise.<Pipeline>
- .getDeveloperConsoleUrl(programId, environmentId) ⇒
Promise.<string>
- .getEnvironmentVariables(programId, environmentId) ⇒
Promise.<Array.<Variable>>
- .setEnvironmentVariables(programId, environmentId, variables) ⇒
Promise.<object>
- .getPipelineVariables(programId, pipelineId) ⇒
Promise.<Array.<Variable>>
- .setPipelineVariables(programId, pipelineId, variables) ⇒
Promise.<object>
- .deleteProgram(programId) ⇒
Promise.<object>
- .deleteEnvironment(programId, environmentId) ⇒
Promise.<object>
- .listIpAllowlists(programId) ⇒
Promise.<IPAllowedList>
- .createIpAllowlist(programId, name, cidrBlocks) ⇒
Promise.<IPAllowedList>
- .updateIpAllowlist(programId, ipAllowlistId, cidrBlocks) ⇒
Promise.<object>
- .deleteIpAllowlist(programId, ipAllowlistId) ⇒
Promise.<object>
- .addIpAllowlistBinding(programId, ipAllowlistId, environmentId, service) ⇒
Promise.<object>
- .removeIpAllowlistBinding(programId, ipAllowlistId, environmentId, service) ⇒
Promise.<object>
- .orgId :
The organization id
Kind: instance property of CloudManagerAPI
The api key from your integration
Kind: instance property of CloudManagerAPI
The access token from your integration
Kind: instance property of CloudManagerAPI
The base URL for the API endpoint
Kind: instance property of CloudManagerAPI
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) |
Obtain a list of programs for the target organization.
Kind: instance method of CloudManagerAPI
Returns: Promise.<Array.<EmbeddedProgram>>
- an array of Programs
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.createExecution(programId, pipelineId) ⇒ 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 |
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 |
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 |
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.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.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 |
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 |
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 |
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.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.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.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 |
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.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 |
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 |
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 |
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 |
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 |
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 |
Delete a program
Kind: instance method of CloudManagerAPI
Returns: Promise.<object>
- a truthy value
Param | Type | Description |
---|---|---|
programId | string |
the program id |
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.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.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 |
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 |
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.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.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 |
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) |
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 |
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 |
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 |
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. |
createdAt | string |
Start time |
updatedAt | string |
Date of last status change |
finishedAt | string |
Date the execution reached a final state |
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 |
Start time |
finishedAt | string |
Date the execution reached a final state |
details | object |
Information about step result |
status | string |
Action status |
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
metrics | Array.<Metric> |
metrics |
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 |
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 |
availableLogOptions | Array.<LogOptionRepresentation> |
List of logs available in the environment |
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. Of a-z, A-Z, _ and 0-9 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. |
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 only the values 'author' and 'publish' are supported. Note - this value is case-sensitive. |
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 |
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. |
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 |
Options to the listPipeline function
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
busy | boolean |
if true, only busy pipelines will be returned |
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 |
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
branch | string |
the new branch |
repositoryId | string |
the new repository id |
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.
Contributions are welcome! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.