@adobe/aio-lib-console-project-installation
v3.0.1
Published
A library to configure Adobe Console Projects from a file.
Downloads
13,583
Maintainers
Keywords
Readme
Adobe I/O Lib Console Project Installation
This is an internal helper library to create and configure remote Developer Console resources, like services and credentials, based on a template's install.yaml
configuration file.
The following keys are supported in the install.yaml
file:
categories
: (Required) Categories are informational and at least one category must be defined. See a list of supported categories here.workspaces
: (Optional) A list of workspace names to create. Runtime namespaces are added by default for each workspace, if the runtime key is set to true. Staging and Production workspaces are created by default if not defined.runtime
: (Optional) Defines whether Runtime should be configured for each workspace. If not defined, the default isfalse
.apis
: (Optional) A list of Adobe services, identified by their SDK code required by the template to work. By default, all services are attached to all configured workspaces.
A note on
apis
: Developer Console supports three types of services: AdobeIO, Enterprise and Analytics. Currently, only AdobeIO and Enterprise services are supported for configuration by this library.
Installing
$ npm install @adobe/aio-lib-console-project-installation
Usage
- Initialize the template handler
const { getToken } = require('@adobe/aio-lib-ims')
const { CLI } = require('@adobe/aio-lib-ims/src/context')
const templateHandler = require('@adobe/aio-lib-console-project-installation')
// Instantiate Adobe Developer Console SDK
const accessToken = await getToken(CLI)
// Instantiate App Builder Template Manager
const installConfigFile = 'install.yml'
const templateManager = await templateHandler.init(accessToken, installConfigFile)
- Call methods using the initialized Template Manager
// Install the template
try {
const orgId = 'org-id'
const templateId = 'template-id'
const result = await templateManager.installTemplate(orgId, templateId)
console.log(result)
} catch (e) {
console.error(e)
}
Template validation
You can use this library to validate the App Builder application install.yaml
file.
const templateHandler = require('@adobe/aio-lib-console-project-installation')
const pathToInstallConfigFile = 'install.yml'
// Second parameter is optional. Set it to `true` if you want to get prettified errors.
const { valid, errors } = await templateHandler.validate(path, true)
Functions
init(accessToken, templateConfigurationFile) ⇒ TemplateInstallManager
Returns a new TemplateInstallManager object.
Kind: global function
Returns: TemplateInstallManager - A new TemplateInstallManager object.
| Param | Type | Description | | --- | --- | --- | | accessToken | string | The Adobe Console API client. | | templateConfigurationFile | string | The path to the configuration file. |
validate(templateConfigurationFile, pretty) ⇒ object
Kind: global function
Returns: object - Object with properties valid
, configuration
and errors
| Param | Type | Default | Description | | --- | --- | --- | --- | | templateConfigurationFile | string | | The path to the configuration file. | | pretty | boolean | false | Prettify errors. |
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.