├── .editorconfig ├── .eslintrc ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── daily.yml │ ├── node.js.yml │ ├── on-push-publish-to-npm.yml │ ├── prerelease.yml │ └── version-bump-publish.yml ├── .gitignore ├── .npmrc ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── COPYRIGHT ├── LICENSE ├── README.md ├── RELEASING.md ├── babel.config.js ├── bin ├── run └── run.cmd ├── e2e └── e2e.js ├── package.json ├── src ├── DeployServiceCommand.js ├── RuntimeBaseCommand.js ├── commands │ └── runtime │ │ ├── action │ │ ├── create.js │ │ ├── delete.js │ │ ├── get.js │ │ ├── index.js │ │ ├── invoke.js │ │ ├── list.js │ │ └── update.js │ │ ├── activation │ │ ├── get.js │ │ ├── index.js │ │ ├── list.js │ │ ├── logs.js │ │ └── result.js │ │ ├── api │ │ ├── create.js │ │ ├── delete.js │ │ ├── get.js │ │ ├── index.js │ │ └── list.js │ │ ├── deploy │ │ ├── export.js │ │ ├── index.js │ │ ├── report.js │ │ ├── sync.js │ │ ├── undeploy.js │ │ └── version.js │ │ ├── index.js │ │ ├── namespace │ │ ├── get.js │ │ ├── index.js │ │ ├── list.js │ │ └── log-forwarding │ │ │ ├── errors.js │ │ │ ├── get.js │ │ │ ├── index.js │ │ │ ├── set.js │ │ │ └── set │ │ │ ├── adobe-io-runtime.js │ │ │ ├── azure-log-analytics.js │ │ │ ├── new-relic.js │ │ │ └── splunk-hec.js │ │ ├── package │ │ ├── bind.js │ │ ├── create.js │ │ ├── delete.js │ │ ├── get.js │ │ ├── index.js │ │ ├── list.js │ │ └── update.js │ │ ├── property │ │ ├── get.js │ │ ├── index.js │ │ ├── set.js │ │ └── unset.js │ │ ├── rule │ │ ├── create.js │ │ ├── delete.js │ │ ├── disable.js │ │ ├── enable.js │ │ ├── get.js │ │ ├── index.js │ │ ├── list.js │ │ ├── status.js │ │ └── update.js │ │ └── trigger │ │ ├── create.js │ │ ├── delete.js │ │ ├── fire.js │ │ ├── get.js │ │ ├── index.js │ │ ├── list.js │ │ └── update.js ├── decorators.js ├── kinds.js └── properties.js └── test ├── DeployServiceCommand.test.js ├── RuntimeBaseCommand.test.js ├── __fixtures__ ├── action │ ├── actionFile.js │ ├── get-output.txt │ ├── get-package.json │ ├── get.binary.json │ ├── get.json │ ├── getWebFalse-package.json │ ├── getWebFalse.json │ ├── get_NoWebFlag.json │ ├── getpackage.json │ ├── list-kind-output.txt │ ├── list-name-sort-output.txt │ ├── list-name-sort.json │ ├── list-output-2.txt │ ├── list-output-3-win.txt │ ├── list-output-3.txt │ ├── list-output.txt │ ├── list.json │ ├── list2.json │ └── list3.json ├── activation │ ├── list-activation-cold-output.txt │ ├── list-activation-kind-output.txt │ ├── list-activation-sequence-output-win.txt │ ├── list-activation-sequence-output.txt │ ├── list-activation-timeout-output-win.txt │ ├── list-activation-timeout-output.txt │ ├── list-activation-topmost-output-win.txt │ ├── list-activation-topmost-output.txt │ ├── list-activation-warm-output.txt │ └── list-triggers-output.txt ├── api │ ├── api_swagger.json │ ├── get.json │ ├── get.txt │ ├── list.json │ └── list.txt ├── deploy │ ├── api_manifest.yaml │ ├── apis_not_implemented.yml │ ├── app.zip │ ├── cliversion.txt │ ├── deployment-triggerError.yaml │ ├── deployment.yaml │ ├── deployment.yml │ ├── deployment_actionMissingInputs.yaml │ ├── deployment_correctpackage.yaml │ ├── deployment_dependencies.yaml │ ├── deployment_syncMissingAction.yaml │ ├── deployment_syncSequences.yaml │ ├── deployment_triggersMissing.yaml │ ├── deployment_triggersMissingInputs.yaml │ ├── deployment_wrongPackageName.yaml │ ├── deployment_wrongTrigger.yaml │ ├── deployment_wrongpackage.yaml │ ├── export_yaml.yaml │ ├── export_yaml_Sequence.yaml │ ├── export_yaml_feed.yaml │ ├── export_yaml_noAnnotations.yaml │ ├── hello.js │ ├── hello_plus.js │ ├── main.js │ ├── manifest.yaml │ ├── manifest.yml │ ├── manifest_actionMissingInputs.yaml │ ├── manifest_api.yaml │ ├── manifest_api_incorrect.yaml │ ├── manifest_api_multi.yaml │ ├── manifest_concurrency.yaml │ ├── manifest_conductor.yaml │ ├── manifest_dep.yaml │ ├── manifest_dep_Triggers.yaml │ ├── manifest_dep_Triggers_feeds.yaml │ ├── manifest_dep_dependencies.yaml │ ├── manifest_dependencies.yaml │ ├── manifest_dependencies_error.yaml │ ├── manifest_docker.yaml │ ├── manifest_final.yaml │ ├── manifest_main.yaml │ ├── manifest_multiple_packages.yaml │ ├── manifest_not_present_action.yaml │ ├── manifest_not_webAction.yaml │ ├── manifest_not_webSequence.yaml │ ├── manifest_params.yml │ ├── manifest_report.yaml │ ├── manifest_triggersRules.yaml │ ├── manifest_triggersRules_IncorrectAction.yaml │ ├── manifest_triggersRules_NoTrigger.yaml │ ├── manifest_triggersRules_noInputs.yaml │ ├── manifest_webSequence.yaml │ ├── manifest_with_adobe_auth.yaml │ ├── manifest_zip.yaml │ ├── parameters.json │ ├── reportPackage.txt │ ├── reportPackage_defaultDeployment.txt │ ├── report_packages.txt │ ├── report_triggersMissingInputs.txt │ ├── report_triggersWithFeed.txt │ ├── rules_not_implemented.yml │ ├── sequences_implemented.yml │ ├── sequences_missing_actions.yml │ ├── triggers_not_implemented.yml │ └── wskdeploy_sampleExport.yaml ├── empty-wsk.properties ├── namespace │ ├── get-name-sort.json │ ├── get-name-sort.txt │ ├── get.json │ ├── get.txt │ ├── list.json │ ├── list.txt │ ├── log-forwarding │ │ ├── errors-remote.json │ │ ├── errors-result.txt │ │ ├── get-remote.json │ │ └── get-result.txt │ ├── rule1.json │ └── rule2.json ├── package │ ├── list-name-sort-output.txt │ └── list.json ├── property │ ├── all-empty-wskprops.txt │ ├── all-server-error.txt │ ├── all.txt │ ├── api.json │ ├── apibuild.txt │ ├── apibuildno.txt │ ├── apihost.txt │ ├── apiversion.txt │ ├── auth.txt │ ├── cli-override-wskprops.txt │ ├── cliversion.txt │ ├── config.json │ └── namespace.txt ├── rule │ ├── delete.json │ ├── get-name-sort.json │ ├── get-public.json │ ├── get.json │ ├── list-name-sort-output.txt │ ├── list-name-sort.json │ ├── list-output-public.txt │ ├── list-output.txt │ ├── list-public.json │ └── list.json ├── trigger │ ├── annotations.json │ ├── list-name-sort-output.txt │ ├── list-name-sort.json │ └── list.txt └── wsk.properties ├── __mocks__ ├── @adobe │ ├── aio-lib-core-config.js │ └── aio-lib-runtime.js └── sha1.js ├── commands └── runtime │ ├── action │ ├── create.test.js │ ├── delete.test.js │ ├── get.test.js │ ├── index.test.js │ ├── invoke.test.js │ ├── list.test.js │ └── update.test.js │ ├── activation │ ├── get.test.js │ ├── index.test.js │ ├── list.test.js │ ├── logs.test.js │ └── result.test.js │ ├── api │ ├── create.test.js │ ├── delete.test.js │ ├── get.test.js │ ├── index.test.js │ └── list.test.js │ ├── deploy │ ├── export.test.js │ ├── index.test.js │ ├── report.test.js │ ├── sync.test.js │ ├── undeploy.test.js │ └── version.test.js │ ├── index.test.js │ ├── namespace │ ├── get.test.js │ ├── index.test.js │ ├── list.test.js │ └── log-forwarding │ │ ├── errors.test.js │ │ ├── get.test.js │ │ ├── index.test.js │ │ ├── set.test.js │ │ └── set │ │ ├── adobe-io-runtime.test.js │ │ ├── azure-log-analytics.test.js │ │ ├── new-relic-runtime.test.js │ │ └── splunk-hec.test.js │ ├── package │ ├── bind.test.js │ ├── create.test.js │ ├── delete.test.js │ ├── get.test.js │ ├── index.test.js │ ├── list.test.js │ └── update.test.js │ ├── property │ ├── get.test.js │ ├── index.test.js │ ├── set.test.js │ └── unset.test.js │ ├── rule │ ├── create.test.js │ ├── delete.test.js │ ├── disable.test.js │ ├── enable.test.js │ ├── get.test.js │ ├── index.test.js │ ├── list.test.js │ ├── status.test.js │ └── update.test.js │ └── trigger │ ├── create.test.js │ ├── delete.test.js │ ├── fire.test.js │ ├── get.test.js │ ├── index.test.js │ ├── list.test.js │ └── update.test.js ├── decorators.test.js ├── jest.setup.js ├── kinds.test.js └── properties.test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@adobe/eslint-config-aio-lib-config", 3 | "globals": { 4 | "fixtureFile": true, 5 | "fixtureFileWithTimeZoneAdjustment": true, 6 | "fixtureJson": true, 7 | "fixtureZip": true, 8 | "fakeFileSystem": true, 9 | "createTestBaseFlagsFunction": true, 10 | "createTestFlagsFunction": true 11 | }, 12 | "rules": { 13 | "jsdoc/tag-lines": [ 14 | // The Error level should be `error`, `warn`, or `off` (or 2, 1, or 0) 15 | "error", 16 | "never", 17 | { 18 | "startLines": null 19 | } 20 | ] 21 | } 22 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Browser [e.g. chrome, safari] 26 | - Version [e.g. 22] 27 | 28 | **Smartphone (please complete the following information):** 29 | - Device: [e.g. iPhone6] 30 | - OS: [e.g. iOS8.1] 31 | - Browser [e.g. stock browser, safari] 32 | - Version [e.g. 22] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Description 4 | 5 | 6 | 7 | ## Related Issue 8 | 9 | 10 | 11 | 12 | 13 | 14 | ## Motivation and Context 15 | 16 | 17 | 18 | ## How Has This Been Tested? 19 | 20 | 21 | 22 | 23 | 24 | ## Screenshots (if appropriate): 25 | 26 | ## Types of changes 27 | 28 | 29 | 30 | - [ ] Bug fix (non-breaking change which fixes an issue) 31 | - [ ] New feature (non-breaking change which adds functionality) 32 | - [ ] Breaking change (fix or feature that would cause existing functionality to change) 33 | 34 | ## Checklist: 35 | 36 | 37 | 38 | 39 | - [ ] I have signed the [Adobe Open Source CLA](http://opensource.adobe.com/cla.html). 40 | - [ ] My code follows the code style of this project. 41 | - [ ] My change requires a change to the documentation. 42 | - [ ] I have updated the documentation accordingly. 43 | - [ ] I have read the **CONTRIBUTING** document. 44 | - [ ] I have added tests to cover my changes. 45 | - [ ] All new and existing tests passed. 46 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "npm" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /.github/workflows/daily.yml: -------------------------------------------------------------------------------- 1 | name: Daily - Do npm install and run all unit tests 2 | 3 | on: 4 | schedule: 5 | # run daily at midnight 6 | - cron: '0 0 * * *' 7 | 8 | jobs: 9 | build: 10 | uses: adobe/aio-reusable-workflows/.github/workflows/daily.yml@main 11 | secrets: inherit 12 | 13 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Node.js CI 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: [ master ] 11 | 12 | jobs: 13 | build: 14 | uses: adobe/aio-reusable-workflows/.github/workflows/node.js.yml@main 15 | secrets: inherit 16 | -------------------------------------------------------------------------------- /.github/workflows/on-push-publish-to-npm.yml: -------------------------------------------------------------------------------- 1 | name: on-push-publish-to-npm 2 | on: 3 | push: 4 | branches: 5 | - master # Change this if not your default branch 6 | paths: 7 | - 'package.json' 8 | jobs: 9 | publish: 10 | uses: adobe/aio-reusable-workflows/.github/workflows/on-push-publish-to-npm.yml@main 11 | secrets: inherit 12 | -------------------------------------------------------------------------------- /.github/workflows/prerelease.yml: -------------------------------------------------------------------------------- 1 | name: publish-prerelease 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | pre-release-tag: 6 | description: 'The pre-release tag use in the version' 7 | required: false 8 | default: 'pre' 9 | dist-tag: 10 | description: 'The dist-tag use' 11 | required: false 12 | default: 'next' 13 | dependencies-to-update: 14 | description: 'csv of dependencies to update with the dist-tag' 15 | required: false 16 | default: '@adobe/aio-lib-core-config,@adobe/aio-lib-core-networking,@adobe/aio-lib-runtime' 17 | 18 | jobs: 19 | checkout: 20 | uses: adobe/aio-reusable-workflows/.github/workflows/prerelease.yml@main 21 | secrets: inherit 22 | -------------------------------------------------------------------------------- /.github/workflows/version-bump-publish.yml: -------------------------------------------------------------------------------- 1 | name: version-bump-publish 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | level: 6 | description: ' | major | minor | patch | premajor | preminor | prepatch | prerelease' 7 | required: true 8 | default: 'patch' 9 | tag: 10 | description: 'The tag to publish to.' 11 | required: false 12 | default: 'latest' 13 | jobs: 14 | checkout: 15 | uses: adobe/aio-reusable-workflows/.github/workflows/version-bump-publish.yml@main 16 | secrets: inherit 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *-debug.log 3 | *-error.log 4 | .oclif.manifest.json 5 | /.nyc_output 6 | /dist 7 | /lib 8 | /tmp 9 | /yarn.lock 10 | node_modules 11 | .DS_Store 12 | /test-results.xml 13 | coverage/ 14 | junit.xml 15 | /package-lock.json 16 | oclif.manifest.json 17 | .vscode 18 | .idea 19 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | tag-version-prefix="" 3 | preid="next" 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thanks for choosing to contribute! 4 | 5 | The following are a set of guidelines to follow when contributing to this project. 6 | 7 | ## Code Of Conduct 8 | 9 | This project adheres to the Adobe [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [Grp-opensourceoffice@adobe.com](mailto:Grp-opensourceoffice@adobe.com). 10 | 11 | ## Contributor License Agreement 12 | 13 | All third-party contributions to this project must be accompanied by a signed contributor license agreement. This gives Adobe permission to redistribute your contributions as part of the project. [Sign our CLA](http://opensource.adobe.com/cla.html). You only need to submit an Adobe CLA one time, so if you have submitted one previously, you are good to go! 14 | 15 | ## Code Reviews 16 | 17 | All submissions should come in the form of pull requests and need to be reviewed by project committers. Read [GitHub's pull request documentation](https://help.github.com/articles/about-pull-requests/) for more information on sending pull requests. 18 | 19 | Lastly, please follow the [pull request template](.github/PULL_REQUEST_TEMPLATE.md) when submitting a pull request! 20 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 2019 Adobe 2 | 3 | Adobe holds the copyright for all the files found in this repository. 4 | 5 | See the LICENSE file for licensing information. 6 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | ## 1. Increment a version 2 | 3 | ``` 4 | npm --no-git-tag-version version [major | minor | patch] 5 | # get the package.json version in a variable 6 | export PKG_VER=`node -e "console.log(require('./package.json').version)"` 7 | ``` 8 | ## 2. Commit the changed files 9 | ``` 10 | git commit -m "Incremented version to $PKG_VER" package.json README.md 11 | ``` 12 | 13 | ## 3. Tag a version 14 | 15 | ``` 16 | git tag $PKG_VER 17 | ``` 18 | 19 | ## 4. Push version and tag 20 | 21 | ``` 22 | git push origin master 23 | git push origin $PKG_VER 24 | ``` 25 | 26 | ## 5. publish to npm 27 | 28 | ``` 29 | npm publish 30 | ``` -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | // babel.config.js 2 | module.exports = { 3 | presets: [ 4 | [ 5 | '@babel/preset-env', 6 | { 7 | targets: { 8 | node: 'current' 9 | } 10 | } 11 | ] 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /bin/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Copyright 2019 Adobe Inc. All rights reserved. 5 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. You may obtain a copy 7 | of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | Unless required by applicable law or agreed to in writing, software distributed under 9 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 10 | OF ANY KIND, either express or implied. See the License for the specific language 11 | governing permissions and limitations under the License. 12 | */ 13 | 14 | const oclif = require('@oclif/core') 15 | 16 | oclif.run() 17 | .then(require('@oclif/core/flush')) 18 | .catch(require('@oclif/core/handle')) 19 | -------------------------------------------------------------------------------- /bin/run.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem Copyright 2019 Adobe Inc. All rights reserved. 4 | rem This file is licensed to you under the Apache License, Version 2.0 (the "License"); 5 | rem you may not use this file except in compliance with the License. You may obtain a copy 6 | rem of the License at http://www.apache.org/licenses/LICENSE-2.0 7 | rem 8 | rem Unless required by applicable law or agreed to in writing, software distributed under 9 | rem the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 10 | rem OF ANY KIND, either express or implied. See the License for the specific language 11 | rem governing permissions and limitations under the License. 12 | 13 | node "%~dp0\run" %* 14 | -------------------------------------------------------------------------------- /e2e/e2e.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const execa = require('execa') 13 | const chalk = require('chalk') 14 | const { stdout } = require('stdout-stderr') 15 | const fs = jest.requireActual('fs') 16 | 17 | stdout.print = true 18 | 19 | test('aio-cli-plugin-runtime test', async () => { 20 | const packagejson = JSON.parse(fs.readFileSync('package.json').toString()) 21 | const name = `${packagejson.name}` 22 | console.log(chalk.blue(`> e2e tests for ${chalk.bold(name)}`)) 23 | 24 | console.log(chalk.bold(' - listing actions')) 25 | expect(() => { execa.sync('./bin/run', ['runtime:action:list'], { stderr: 'inherit' }) }).not.toThrow() 26 | console.log(chalk.green(` - done for ${chalk.bold(name)}`)) 27 | }) 28 | -------------------------------------------------------------------------------- /src/commands/runtime/action/delete.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const DeployServiceCommand = require('../../../DeployServiceCommand') 14 | const { Flags } = require('@oclif/core') 15 | 16 | class ActionDelete extends DeployServiceCommand { 17 | async run () { 18 | const { flags, args } = await this.parse(ActionDelete) 19 | const name = args.actionName 20 | try { 21 | const ow = await this.wsk() 22 | const result = await ow.actions.delete(name) 23 | if (flags.json) { 24 | this.logJSON('', result) 25 | } 26 | } catch (err) { 27 | await this.handleError('failed to delete the action', err) 28 | } 29 | } 30 | } 31 | 32 | ActionDelete.args = [ 33 | { 34 | name: 'actionName', 35 | required: true 36 | } 37 | ] 38 | 39 | ActionDelete.flags = { 40 | ...DeployServiceCommand.flags, 41 | json: Flags.boolean({ 42 | description: 'output raw json' 43 | }) 44 | } 45 | 46 | ActionDelete.description = 'Deletes an Action' 47 | 48 | ActionDelete.aliases = ['runtime:action:del', 49 | 'rt:action:delete', 50 | 'rt:action:del'] 51 | 52 | module.exports = ActionDelete 53 | -------------------------------------------------------------------------------- /src/commands/runtime/action/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Help } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 15 | 16 | class IndexCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const help = new Help(this.config) 19 | await help.showHelp(['runtime:action', '--help']) 20 | } 21 | } 22 | 23 | IndexCommand.description = 'Manage your actions' 24 | 25 | IndexCommand.aliases = ['rt:action'] 26 | 27 | module.exports = IndexCommand 28 | -------------------------------------------------------------------------------- /src/commands/runtime/action/update.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const ActionCreate = require('./create') 14 | 15 | class ActionUpdate extends ActionCreate { 16 | isUpdate () { return true } 17 | } 18 | 19 | ActionUpdate.args = [ 20 | { 21 | name: 'actionName', 22 | required: true 23 | }, 24 | { 25 | name: 'actionPath' 26 | } 27 | ] 28 | 29 | ActionUpdate.flags = ActionCreate.flags 30 | 31 | ActionUpdate.description = 'Updates an Action' 32 | 33 | ActionUpdate.aliases = ['rt:action:update'] 34 | 35 | module.exports = ActionUpdate 36 | -------------------------------------------------------------------------------- /src/commands/runtime/activation/get.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | const { Flags } = require('@oclif/core') 13 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 14 | const { printLogs } = require('@adobe/aio-lib-runtime').utils 15 | 16 | class ActivationGet extends RuntimeBaseCommand { 17 | async run () { 18 | const { args, flags } = await this.parse(ActivationGet) 19 | let id = args.activationID 20 | try { 21 | const ow = await this.wsk() 22 | if (flags.last) { 23 | const ax = await ow.activations.list({ limit: 1, skip: 0 }) 24 | if (ax && ax.length > 0) { 25 | id = ax[0].activationId 26 | } else { 27 | await this.handleError('no activations were returned') 28 | } 29 | } 30 | if (!id) { 31 | this.error('missing required argument activationID') 32 | } 33 | 34 | if (flags.logs) { 35 | this.log('activation logs %s', id) 36 | const result = await ow.activations.logs(id) 37 | printLogs(result, true, this.log.bind(this)) 38 | } else { 39 | const result = await ow.activations.get(id) 40 | this.logJSON('', result) 41 | } 42 | } catch (err) { 43 | await this.handleError('failed to retrieve the activation', err) 44 | } 45 | } 46 | } 47 | 48 | ActivationGet.args = [ 49 | { 50 | name: 'activationID' 51 | } 52 | ] 53 | 54 | ActivationGet.flags = { 55 | ...RuntimeBaseCommand.flags, 56 | last: Flags.boolean({ 57 | char: 'l', 58 | description: 'retrieves the most recent activation' 59 | }), 60 | logs: Flags.boolean({ 61 | char: 'g', 62 | description: 'emit only the logs, stripped of time stamps and stream identifier' 63 | }) 64 | } 65 | 66 | ActivationGet.description = 'Retrieves an Activation' 67 | ActivationGet.aliases = [ 68 | 'rt:activation:get' 69 | ] 70 | 71 | module.exports = ActivationGet 72 | -------------------------------------------------------------------------------- /src/commands/runtime/activation/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Help } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 15 | 16 | class IndexCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const help = new Help(this.config) 19 | await help.showHelp(['runtime:activation', '--help']) 20 | } 21 | } 22 | 23 | IndexCommand.description = 'Manage your activations' 24 | 25 | IndexCommand.aliases = ['rt:activation'] 26 | 27 | module.exports = IndexCommand 28 | -------------------------------------------------------------------------------- /src/commands/runtime/activation/result.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Flags } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 15 | 16 | class ActivationResult extends RuntimeBaseCommand { 17 | async run () { 18 | const { args, flags } = await this.parse(ActivationResult) 19 | let id = args.activationID 20 | try { 21 | const ow = await this.wsk() 22 | if (flags.last) { 23 | const ax = await ow.activations.list({ limit: 1, skip: 0 }) 24 | id = ax[0].activationId 25 | } 26 | if (!id) { 27 | this.error('missing required argument activationID') 28 | } 29 | 30 | const result = await ow.activations.result(id) 31 | this.logJSON('', result) 32 | } catch (err) { 33 | await this.handleError('failed to fetch activation result', err) 34 | } 35 | } 36 | } 37 | 38 | ActivationResult.args = [ 39 | { 40 | name: 'activationID' 41 | } 42 | ] 43 | 44 | ActivationResult.flags = { 45 | ...RuntimeBaseCommand.flags, 46 | last: Flags.boolean({ 47 | char: 'l', 48 | description: 'retrieves the most recent activation result' 49 | }) 50 | } 51 | 52 | ActivationResult.description = 'Retrieves the Results for an Activation' 53 | 54 | ActivationResult.aliases = [ 55 | 'rt:activation:result' 56 | ] 57 | 58 | module.exports = ActivationResult 59 | -------------------------------------------------------------------------------- /src/commands/runtime/api/delete.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const DeployServiceCommand = require('../../../DeployServiceCommand') 13 | // eslint-disable-next-line no-unused-vars 14 | 15 | class ApiDelete extends DeployServiceCommand { 16 | async run () { 17 | const { args } = await this.parse(ApiDelete) 18 | 19 | try { 20 | const ow = await this.wsk() 21 | const options = { 22 | basepath: args.basePathOrApiName, 23 | relpath: args.relPath, 24 | operation: args.apiVerb 25 | } 26 | 27 | await ow.routes.delete(options) 28 | } catch (err) { 29 | await this.handleError('failed to delete the api', err) 30 | } 31 | } 32 | } 33 | 34 | ApiDelete.args = [ 35 | { 36 | name: 'basePathOrApiName', 37 | required: true, 38 | description: 'The base path or api name' 39 | }, 40 | { 41 | name: 'relPath', 42 | description: 'The path of the api relative to the base path' 43 | }, 44 | { 45 | name: 'apiVerb', 46 | description: 'The http verb', 47 | options: ['get', 'post', 'put', 'patch', 'delete', 'head', 'options'] 48 | } 49 | ] 50 | 51 | ApiDelete.flags = { 52 | ...DeployServiceCommand.flags 53 | } 54 | 55 | ApiDelete.description = 'delete an API' 56 | 57 | ApiDelete.aliases = [ 58 | 'runtime:route:delete', 59 | 'rt:route:delete', 60 | 'rt:api:delete' 61 | ] 62 | 63 | module.exports = ApiDelete 64 | -------------------------------------------------------------------------------- /src/commands/runtime/api/get.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 13 | // eslint-disable-next-line no-unused-vars 14 | 15 | class ApiGet extends RuntimeBaseCommand { 16 | async run () { 17 | const { args } = await this.parse(ApiGet) 18 | 19 | try { 20 | const ow = await this.wsk() 21 | const options = { 22 | basepath: args.basePathOrApiName 23 | } 24 | 25 | const result = await ow.routes.get(options) 26 | this.logJSON('', result.apis[0].value.apidoc) 27 | } catch (err) { 28 | await this.handleError('failed to get the api', err) 29 | } 30 | } 31 | } 32 | 33 | ApiGet.args = [ 34 | { 35 | name: 'basePathOrApiName', 36 | required: true, 37 | description: 'The base path or api name' 38 | } 39 | ] 40 | 41 | ApiGet.flags = { 42 | ...RuntimeBaseCommand.flags 43 | } 44 | 45 | ApiGet.description = 'get API details' 46 | 47 | ApiGet.aliases = [ 48 | 'runtime:route:get', 49 | 'rt:route:get', 50 | 'rt:api:get' 51 | ] 52 | 53 | module.exports = ApiGet 54 | -------------------------------------------------------------------------------- /src/commands/runtime/api/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Help } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 15 | 16 | class IndexCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const help = new Help(this.config) 19 | await help.showHelp(['runtime:api', '--help']) 20 | } 21 | } 22 | 23 | IndexCommand.description = 'Manage your api routes' 24 | 25 | IndexCommand.aliases = [ 26 | 'rt:api', 27 | 'runtime:route', 28 | 'rt:route' 29 | ] 30 | 31 | module.exports = IndexCommand 32 | -------------------------------------------------------------------------------- /src/commands/runtime/deploy/sync.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const DeployServiceCommand = require('../../../DeployServiceCommand') 14 | const { setPaths, processPackage, syncProject } = require('@adobe/aio-lib-runtime').utils 15 | const { Flags } = require('@oclif/core') 16 | 17 | class DeploySync extends DeployServiceCommand { 18 | async run () { 19 | const { flags } = await this.parse(DeploySync) 20 | try { 21 | // in case of 'aio runtime:deploy' (without the path to the manifest file) the program looks for the manifest file in the current directory. 22 | const components = setPaths(flags) 23 | const packages = components.packages 24 | const deploymentTriggers = components.deploymentTriggers 25 | const deploymentPackages = components.deploymentPackages 26 | if (components.projectName === '') { 27 | throw new Error('The mandatory key [project name] is missing') 28 | } 29 | const params = {} 30 | const options = await this.getOptions() 31 | delete options['use-runtime-auth'] 32 | const entities = processPackage(packages, deploymentPackages, deploymentTriggers, params, false, options) 33 | const ow = await this.wsk() 34 | const logger = this.log 35 | await syncProject(components.projectName, components.manifestPath, components.manifestContent, entities, ow, logger.bind(this), this.getImsOrgId()) 36 | } catch (err) { 37 | await this.handleError('Failed to sync', err) 38 | } 39 | } 40 | } 41 | 42 | DeploySync.flags = { 43 | ...DeployServiceCommand.flags, 44 | manifest: Flags.string({ 45 | char: 'm', 46 | description: 'the manifest file location' // help description for flag 47 | }), 48 | deployment: Flags.string({ 49 | char: 'd', 50 | description: 'the path to the deployment file' 51 | }) 52 | } 53 | 54 | DeploySync.description = 'A tool to sync deployment and undeployment of Runtime packages using a manifest and optional deployment files using YAML' 55 | 56 | DeploySync.aliases = ['rt:deploy:sync'] 57 | 58 | module.exports = DeploySync 59 | -------------------------------------------------------------------------------- /src/commands/runtime/deploy/version.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 14 | 15 | class DeployVersion extends RuntimeBaseCommand { 16 | async run () { 17 | this.log(this.config.userAgent) 18 | } 19 | } 20 | 21 | DeployVersion.description = 'Prints the version number of aio runtime deploy' 22 | 23 | DeployVersion.aliases = ['rt:deploy:version'] 24 | 25 | module.exports = DeployVersion 26 | -------------------------------------------------------------------------------- /src/commands/runtime/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Help } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../RuntimeBaseCommand') 15 | 16 | class IndexCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const help = new Help(this.config) 19 | await help.showHelp(['runtime', '--help']) 20 | } 21 | } 22 | 23 | IndexCommand.description = 'Execute runtime commands' 24 | 25 | IndexCommand.aliases = ['rt'] 26 | 27 | module.exports = IndexCommand 28 | -------------------------------------------------------------------------------- /src/commands/runtime/namespace/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Help } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 15 | 16 | class IndexCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const help = new Help(this.config) 19 | await help.showHelp(['runtime:namespace', '--help']) 20 | } 21 | } 22 | 23 | IndexCommand.description = 'Manage your namespaces' 24 | 25 | IndexCommand.aliases = ['runtime:ns', 'rt:namespace', 'rt:ns'] 26 | 27 | module.exports = IndexCommand 28 | -------------------------------------------------------------------------------- /src/commands/runtime/namespace/list.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 14 | const { Flags, CliUx: cli } = require('@oclif/core') 15 | 16 | class NamespaceList extends RuntimeBaseCommand { 17 | async run () { 18 | try { 19 | const { flags } = await this.parse(NamespaceList) 20 | const ow = await this.wsk() 21 | const result = await ow.namespaces.list() 22 | 23 | if (flags.json) { 24 | this.logJSON('', result) 25 | } else { 26 | const columns = { 27 | namespaces: { 28 | minWidth: 20, 29 | get: row => row 30 | } 31 | } 32 | cli.ux.table(result, columns) 33 | } 34 | } catch (err) { 35 | await this.handleError('failed to list namespaces', err) 36 | } 37 | } 38 | } 39 | 40 | NamespaceList.flags = { 41 | ...RuntimeBaseCommand.flags, 42 | json: Flags.boolean({ 43 | description: 'output raw json' 44 | }) 45 | } 46 | 47 | NamespaceList.description = 'Lists all of your namespaces for Adobe I/O Runtime' 48 | 49 | NamespaceList.aliases = [ 50 | 'runtime:namespace:ls', 51 | 'runtime:ns:list', 52 | 'runtime:ns:ls', 53 | 'rt:namespace:list', 54 | 'rt:namespace:ls', 55 | 'rt:ns:list', 56 | 'rt:ns:ls' 57 | ] 58 | 59 | module.exports = NamespaceList 60 | -------------------------------------------------------------------------------- /src/commands/runtime/namespace/log-forwarding/errors.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeBaseCommand = require('../../../../RuntimeBaseCommand') 14 | 15 | class ErrorsCommand extends RuntimeBaseCommand { 16 | async run () { 17 | const ow = await this.wsk() 18 | try { 19 | const res = await ow.logForwarding.getErrors() 20 | const destinationMessage = res.configured_forwarder !== undefined ? ` for the last configured destination '${res.configured_forwarder}'` : '' 21 | if (res.errors && res.errors.length > 0) { 22 | this.logJSON(`Log forwarding errors${destinationMessage}:\n`, res.errors) 23 | } else { 24 | this.log(`No log forwarding errors${destinationMessage}`) 25 | } 26 | } catch (e) { 27 | await this.handleError('Failed to get log forwarding errors', e) 28 | } 29 | } 30 | } 31 | 32 | ErrorsCommand.description = 'Get log forwarding errors' 33 | 34 | ErrorsCommand.flags = { 35 | ...RuntimeBaseCommand.flags 36 | } 37 | 38 | ErrorsCommand.aliases = [ 39 | 'runtime:ns:log-forwarding:errors', 40 | 'runtime:ns:lf:errors', 41 | 'runtime:namespace:lf:errors', 42 | 'rt:namespace:log-forwarding:errors', 43 | 'rt:namespace:lf:errors', 44 | 'rt:ns:log-forwarding:errors', 45 | 'rt:ns:lf:errors' 46 | ] 47 | 48 | module.exports = ErrorsCommand 49 | -------------------------------------------------------------------------------- /src/commands/runtime/namespace/log-forwarding/get.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeBaseCommand = require('../../../../RuntimeBaseCommand') 14 | 15 | class GetCommand extends RuntimeBaseCommand { 16 | async run () { 17 | const ow = await this.wsk() 18 | try { 19 | const res = await ow.logForwarding.get() 20 | this.logJSON('Log forwarding configuration for this namespace:\n', res) 21 | } catch (e) { 22 | await this.handleError('failed to get log forwarding configuration', e) 23 | } 24 | } 25 | } 26 | 27 | GetCommand.description = 'Get log forwarding destination configuration' 28 | 29 | GetCommand.flags = { 30 | ...RuntimeBaseCommand.flags 31 | } 32 | 33 | GetCommand.aliases = [ 34 | 'runtime:ns:log-forwarding:get', 35 | 'runtime:ns:lf:get', 36 | 'runtime:namespace:lf:get', 37 | 'rt:namespace:log-forwarding:get', 38 | 'rt:namespace:lf:get', 39 | 'rt:ns:log-forwarding:get', 40 | 'rt:ns:lf:get' 41 | ] 42 | 43 | module.exports = GetCommand 44 | -------------------------------------------------------------------------------- /src/commands/runtime/namespace/log-forwarding/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Help } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../../RuntimeBaseCommand') 15 | 16 | class IndexCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const help = new Help(this.config) 19 | await help.showHelp(['runtime:namespace:log-forwarding', '--help']) 20 | } 21 | } 22 | 23 | IndexCommand.description = 'Manage log forwarding settings' 24 | 25 | IndexCommand.aliases = [ 26 | 'runtime:ns:log-forwarding', 27 | 'runtime:ns:lf', 28 | 'runtime:namespace:lf', 29 | 'rt:namespace:log-forwarding', 30 | 'rt:namespace:lf', 31 | 'rt:ns:log-forwarding', 32 | 'rt:ns:lf'] 33 | 34 | module.exports = IndexCommand 35 | -------------------------------------------------------------------------------- /src/commands/runtime/namespace/log-forwarding/set.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const inquirer = require('inquirer') 14 | const RuntimeBaseCommand = require('../../../../RuntimeBaseCommand') 15 | 16 | class SetCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const ow = await this.wsk() 19 | const logForwarding = ow.logForwarding 20 | const destination = await this.promptDestination(logForwarding.getSupportedDestinations()) 21 | const settings = await inquirer.prompt(logForwarding.getDestinationSettings(destination)) 22 | try { 23 | await logForwarding.setDestination(destination, settings) 24 | this.log(`Log forwarding was set to ${destination} for this namespace`) 25 | } catch (e) { 26 | await this.handleError('Failed to update log forwarding configuration', e) 27 | } 28 | } 29 | 30 | async promptDestination (supportedDestinations) { 31 | const responses = await inquirer.prompt([{ 32 | name: 'type', 33 | message: 'select log forwarding destination', 34 | type: 'list', 35 | choices: supportedDestinations 36 | }]) 37 | return responses.type 38 | } 39 | } 40 | 41 | SetCommand.description = 'Configure log forwarding destination (interactive)' 42 | 43 | SetCommand.flags = { 44 | ...RuntimeBaseCommand.flags 45 | } 46 | 47 | SetCommand.aliases = [ 48 | 'runtime:ns:log-forwarding:set', 49 | 'runtime:ns:lf:set', 50 | 'runtime:namespace:lf:set', 51 | 'rt:namespace:log-forwarding:set', 52 | 'rt:namespace:lf:set', 53 | 'rt:ns:log-forwarding:set', 54 | 'rt:ns:lf:set' 55 | ] 56 | 57 | module.exports = SetCommand 58 | -------------------------------------------------------------------------------- /src/commands/runtime/namespace/log-forwarding/set/adobe-io-runtime.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeBaseCommand = require('../../../../../RuntimeBaseCommand') 14 | 15 | class AdobeIoRuntimeCommand extends RuntimeBaseCommand { 16 | async run () { 17 | const ow = await this.wsk() 18 | try { 19 | await ow.logForwarding.setDestination('adobe_io_runtime', {}) 20 | this.log('Log forwarding was set to adobe_io_runtime for this namespace') 21 | } catch (e) { 22 | await this.handleError('failed to update log forwarding configuration', e) 23 | } 24 | } 25 | } 26 | 27 | AdobeIoRuntimeCommand.description = 'Set log forwarding destination to Adobe I/O Runtime (Logs will be accessible via aio CLI)' 28 | 29 | AdobeIoRuntimeCommand.flags = { 30 | ...RuntimeBaseCommand.flags 31 | } 32 | 33 | AdobeIoRuntimeCommand.aliases = [ 34 | 'runtime:ns:log-forwarding:set:adobe-io-runtime', 35 | 'runtime:ns:lf:set:adobe-io-runtime', 36 | 'runtime:namespace:lf:set:adobe-io-runtime', 37 | 'rt:namespace:log-forwarding:set:adobe-io-runtime', 38 | 'rt:namespace:lf:set:adobe-io-runtime', 39 | 'rt:ns:log-forwarding:set:adobe-io-runtime', 40 | 'rt:ns:lf:set:adobe-io-runtime' 41 | ] 42 | 43 | module.exports = AdobeIoRuntimeCommand 44 | -------------------------------------------------------------------------------- /src/commands/runtime/namespace/log-forwarding/set/azure-log-analytics.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Flags } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../../../RuntimeBaseCommand') 15 | 16 | class AzureLogAnalyticsCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const { flags } = await this.parse(AzureLogAnalyticsCommand) 19 | const ow = await this.wsk() 20 | try { 21 | await ow.logForwarding.setDestination('azure_log_analytics', { 22 | customer_id: flags['customer-id'], 23 | shared_key: flags['shared-key'], 24 | log_type: flags['log-type'] 25 | }) 26 | this.log('Log forwarding was set to azure_log_analytics for this namespace') 27 | } catch (e) { 28 | await this.handleError('failed to update log forwarding configuration', e) 29 | } 30 | } 31 | } 32 | 33 | AzureLogAnalyticsCommand.description = 'Set log forwarding destination to Azure Log Analytics' 34 | 35 | AzureLogAnalyticsCommand.flags = { 36 | ...RuntimeBaseCommand.flags, 37 | 'customer-id': Flags.string({ 38 | description: 'Customer ID', 39 | required: true 40 | }), 41 | 'shared-key': Flags.string({ 42 | description: 'Shared key', 43 | required: true 44 | }), 45 | 'log-type': Flags.string({ 46 | description: 'Log type', 47 | required: true 48 | }) 49 | } 50 | 51 | AzureLogAnalyticsCommand.aliases = [ 52 | 'runtime:ns:log-forwarding:set:azure-log-analytics', 53 | 'runtime:ns:lf:set:azure-log-analytics', 54 | 'runtime:namespace:lf:set:azure-log-analytics', 55 | 'rt:namespace:log-forwarding:set:azure-log-analytics', 56 | 'rt:namespace:lf:set:azure-log-analytics', 57 | 'rt:ns:log-forwarding:set:azure-log-analytics', 58 | 'rt:ns:lf:set:azure-log-analytics' 59 | ] 60 | 61 | module.exports = AzureLogAnalyticsCommand 62 | -------------------------------------------------------------------------------- /src/commands/runtime/namespace/log-forwarding/set/new-relic.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Flags } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../../../RuntimeBaseCommand') 15 | 16 | class NewRelicCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const { flags } = await this.parse(NewRelicCommand) 19 | const ow = await this.wsk() 20 | try { 21 | await ow.logForwarding.setDestination('new_relic', { 22 | base_uri: flags['base-uri'], 23 | license_key: flags['license-key'] 24 | }) 25 | this.log('Log forwarding was set to new_relic for this namespace') 26 | } catch (e) { 27 | await this.handleError('failed to update log forwarding configuration', e) 28 | } 29 | } 30 | } 31 | 32 | NewRelicCommand.description = 'Set log forwarding destination to New Relic' 33 | 34 | NewRelicCommand.flags = { 35 | ...RuntimeBaseCommand.flags, 36 | 'base-uri': Flags.string({ 37 | description: 'Base URI', 38 | required: true 39 | }), 40 | 'license-key': Flags.string({ 41 | description: 'License Key', 42 | required: true 43 | }) 44 | } 45 | 46 | NewRelicCommand.aliases = [ 47 | 'runtime:ns:log-forwarding:set:new-relic', 48 | 'runtime:ns:lf:set:new-relic', 49 | 'runtime:namespace:lf:set:new-relic', 50 | 'rt:namespace:log-forwarding:set:new-relic', 51 | 'rt:namespace:lf:set:new-relic', 52 | 'rt:ns:log-forwarding:set:new-relic', 53 | 'rt:ns:lf:set:new-relic' 54 | ] 55 | 56 | module.exports = NewRelicCommand 57 | -------------------------------------------------------------------------------- /src/commands/runtime/namespace/log-forwarding/set/splunk-hec.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Flags } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../../../RuntimeBaseCommand') 15 | 16 | class SplunkHecCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const { flags } = await this.parse(SplunkHecCommand) 19 | const ow = await this.wsk() 20 | try { 21 | await ow.logForwarding.setDestination('splunk_hec', { 22 | host: flags.host, 23 | port: flags.port, 24 | index: flags.index, 25 | hec_token: flags['hec-token'] 26 | }) 27 | this.log('Log forwarding was set to splunk_hec for this namespace') 28 | } catch (e) { 29 | await this.handleError('failed to update log forwarding configuration', e) 30 | } 31 | } 32 | } 33 | 34 | SplunkHecCommand.description = 'Set log forwarding destination to Splunk HEC' 35 | 36 | SplunkHecCommand.flags = { 37 | ...RuntimeBaseCommand.flags, 38 | host: Flags.string({ 39 | description: 'Host', 40 | required: true 41 | }), 42 | port: Flags.string({ 43 | description: 'Port', 44 | required: true 45 | }), 46 | index: Flags.string({ 47 | description: 'Index', 48 | required: true 49 | }), 50 | 'hec-token': Flags.string({ 51 | description: 'HEC token', 52 | required: true 53 | }) 54 | } 55 | 56 | SplunkHecCommand.aliases = [ 57 | 'runtime:ns:log-forwarding:set:splunk-hec', 58 | 'runtime:ns:lf:set:splunk-hec', 59 | 'runtime:namespace:lf:set:splunk-hec', 60 | 'rt:namespace:log-forwarding:set:splunk-hec', 61 | 'rt:namespace:lf:set:splunk-hec', 62 | 'rt:ns:log-forwarding:set:splunk-hec', 63 | 'rt:ns:lf:set:splunk-hec' 64 | ] 65 | 66 | module.exports = SplunkHecCommand 67 | -------------------------------------------------------------------------------- /src/commands/runtime/package/get.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 14 | const { parsePackageName } = require('@adobe/aio-lib-runtime').utils 15 | 16 | class PackageGet extends RuntimeBaseCommand { 17 | async run () { 18 | const { args } = await this.parse(PackageGet) 19 | try { 20 | const ow = await this.wsk() 21 | const options = parsePackageName(args.packageName) 22 | const result = await ow.packages.get(options) 23 | this.logJSON('', result) 24 | } catch (err) { 25 | await this.handleError('failed to retrieve the package', err) 26 | } 27 | } 28 | } 29 | 30 | PackageGet.args = [ 31 | { 32 | name: 'packageName', 33 | required: true 34 | } 35 | ] 36 | 37 | PackageGet.flags = { 38 | ...RuntimeBaseCommand.flags 39 | } 40 | 41 | PackageGet.description = 'Retrieves a Package' 42 | 43 | PackageGet.aliases = [ 44 | 'runtime:pkg:get', 45 | 'rt:package:get', 46 | 'rt:pkg:get' 47 | ] 48 | 49 | module.exports = PackageGet 50 | -------------------------------------------------------------------------------- /src/commands/runtime/package/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Help } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 15 | 16 | class IndexCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const help = new Help(this.config) 19 | await help.showHelp(['runtime:package', '--help']) 20 | } 21 | } 22 | 23 | IndexCommand.description = 'Manage your packages' 24 | 25 | IndexCommand.aliases = [ 26 | 'runtime:pkg', 27 | 'rt:package', 28 | 'rt:pkg' 29 | ] 30 | 31 | module.exports = IndexCommand 32 | -------------------------------------------------------------------------------- /src/commands/runtime/package/update.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const PackageCreate = require('./create') 14 | 15 | class PackageUpdate extends PackageCreate { 16 | isUpdate () { return true } 17 | } 18 | 19 | PackageUpdate.args = [ 20 | { 21 | name: 'packageName', 22 | required: true 23 | } 24 | ] 25 | 26 | PackageUpdate.flags = PackageCreate.flags 27 | 28 | PackageUpdate.description = 'Updates a Package' 29 | 30 | PackageUpdate.aliases = [ 31 | 'runtime:pkg:update', 32 | 'rt:package:update', 33 | 'rt:pkg:update' 34 | ] 35 | 36 | module.exports = PackageUpdate 37 | -------------------------------------------------------------------------------- /src/commands/runtime/property/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Help } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 15 | 16 | class IndexCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const help = new Help(this.config) 19 | await help.showHelp(['runtime:property', '--help']) 20 | } 21 | } 22 | 23 | IndexCommand.description = 'Execute property commands' 24 | 25 | IndexCommand.aliases = [ 26 | 'runtime:prop', 27 | 'rt:prop', 28 | 'rt:property' 29 | ] 30 | 31 | module.exports = IndexCommand 32 | -------------------------------------------------------------------------------- /src/commands/runtime/property/set.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 13 | const { Flags } = require('@oclif/core') 14 | const { PropertyKey, propertiesFile, PropertyEnv } = require('../../../properties') 15 | 16 | class PropertySet extends RuntimeBaseCommand { 17 | async run () { 18 | try { 19 | const { flags } = await this.parse(PropertySet) 20 | const properties = propertiesFile() 21 | 22 | if (flags.auth) { 23 | properties.set(PropertyKey.AUTH, flags.auth) 24 | } 25 | 26 | if (flags.apihost) { 27 | properties.set(PropertyKey.APIHOST, flags.apihost) 28 | } 29 | 30 | if (flags.apiversion) { 31 | properties.set(PropertyKey.APIVERSION, flags.apiversion) 32 | } 33 | 34 | if (flags.namespace) { 35 | properties.set(PropertyKey.NAMESPACE, flags.namespace) 36 | } 37 | 38 | if (flags.cert) { 39 | properties.set(PropertyKey.CERT, flags.cert) 40 | } 41 | 42 | if (flags.key) { 43 | properties.set(PropertyKey.KEY, flags.key) 44 | } 45 | 46 | properties.save() 47 | } catch (err) { 48 | await this.handleError('failed to set the property', err) 49 | } 50 | } 51 | } 52 | 53 | PropertySet.flags = { 54 | ...RuntimeBaseCommand.flags, 55 | namespace: Flags.string({ 56 | description: 'whisk namespace', 57 | env: PropertyEnv.NAMESPACE 58 | }) 59 | } 60 | 61 | PropertySet.description = 'set property' 62 | 63 | PropertySet.aliases = [ 64 | 'runtime:prop:set', 65 | 'rt:property:set', 66 | 'rt:prop:set' 67 | ] 68 | 69 | module.exports = PropertySet 70 | -------------------------------------------------------------------------------- /src/commands/runtime/property/unset.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 13 | const { Flags } = require('@oclif/core') 14 | const { PropertyKey, propertiesFile } = require('../../../properties') 15 | 16 | class PropertyUnset extends RuntimeBaseCommand { 17 | async run () { 18 | try { 19 | const { flags } = await this.parse(PropertyUnset) 20 | const properties = propertiesFile() 21 | 22 | properties.unset = function (key) { 23 | delete this._properties[key] 24 | } 25 | 26 | if (flags.auth) { 27 | properties.unset(PropertyKey.AUTH) 28 | } 29 | 30 | if (flags.apihost) { 31 | properties.unset(PropertyKey.APIHOST) 32 | } 33 | 34 | if (flags.apiversion) { 35 | properties.unset(PropertyKey.APIVERSION) 36 | } 37 | 38 | if (flags.namespace) { 39 | properties.unset(PropertyKey.NAMESPACE) 40 | } 41 | 42 | if (flags.cert) { 43 | properties.unset(PropertyKey.CERT) 44 | } 45 | 46 | if (flags.key) { 47 | properties.unset(PropertyKey.KEY) 48 | } 49 | 50 | properties.save() 51 | } catch (err) { 52 | await this.handleError('failed to unset the property', err) 53 | } 54 | } 55 | } 56 | 57 | PropertyUnset.flags = { 58 | // override property command flags, they need to be boolean type, not string 59 | ...Object.assign(RuntimeBaseCommand.flags, RuntimeBaseCommand.propertyFlags({ asBoolean: true })), 60 | namespace: Flags.boolean({ 61 | description: 'whisk namespace' 62 | }) 63 | } 64 | 65 | PropertyUnset.description = 'unset property' 66 | 67 | PropertyUnset.aliases = [ 68 | 'runtime:prop:unset', 69 | 'rt:property:unset', 70 | 'rt:prop:unset' 71 | ] 72 | 73 | module.exports = PropertyUnset 74 | -------------------------------------------------------------------------------- /src/commands/runtime/rule/create.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const DeployServiceCommand = require('../../../DeployServiceCommand') 13 | const { Flags } = require('@oclif/core') 14 | 15 | class RuleCreate extends DeployServiceCommand { 16 | isUpdate () { return false } 17 | 18 | async run () { 19 | const { args, flags } = await this.parse(RuleCreate) 20 | try { 21 | const ow = await this.wsk() 22 | const RuleCreateObject = { ...args } 23 | const method = this.isUpdate() ? 'update' : 'create' 24 | const result = await ow.rules[method](RuleCreateObject) 25 | if (flags.json) { 26 | this.logJSON('', result) 27 | } 28 | } catch (err) { 29 | const method = this.isUpdate() ? 'update' : 'create' 30 | await this.handleError(`failed to ${method} rule`, err) 31 | } 32 | } 33 | } 34 | 35 | RuleCreate.description = 'Create a Rule' 36 | 37 | RuleCreate.args = [ 38 | { 39 | name: 'name', 40 | required: true, 41 | description: 'Name of the rule' 42 | }, 43 | { 44 | name: 'trigger', 45 | required: true, 46 | description: 'Name of the trigger' 47 | }, 48 | { 49 | name: 'action', 50 | required: true, 51 | description: 'Name of the action' 52 | } 53 | ] 54 | 55 | RuleCreate.flags = { 56 | ...DeployServiceCommand.flags, 57 | json: Flags.boolean({ 58 | description: 'output raw json' 59 | }) 60 | } 61 | 62 | RuleCreate.aliases = [ 63 | 'rt:rule:create' 64 | ] 65 | 66 | module.exports = RuleCreate 67 | -------------------------------------------------------------------------------- /src/commands/runtime/rule/delete.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const DeployServiceCommand = require('../../../DeployServiceCommand') 13 | const { Flags } = require('@oclif/core') 14 | 15 | class RuleDelete extends DeployServiceCommand { 16 | async run () { 17 | const { flags, args } = await this.parse(RuleDelete) 18 | try { 19 | const ow = await this.wsk() 20 | const RuleDeleteObject = { ...args } 21 | const deleteRule = await ow.rules.delete(RuleDeleteObject) 22 | if (flags.json) { 23 | this.logJSON('', deleteRule) 24 | } 25 | } catch (err) { 26 | await this.handleError('failed to delete rules', err) 27 | } 28 | } 29 | } 30 | 31 | RuleDelete.description = 'Delete a Rule' 32 | 33 | RuleDelete.args = [ 34 | { 35 | name: 'name', 36 | required: true, 37 | description: 'Name of the rule' 38 | } 39 | ] 40 | 41 | RuleDelete.flags = { 42 | ...DeployServiceCommand.flags, 43 | json: Flags.boolean({ 44 | description: 'output raw json' 45 | }) 46 | } 47 | 48 | RuleDelete.aliases = [ 49 | 'rt:rule:delete' 50 | ] 51 | 52 | module.exports = RuleDelete 53 | -------------------------------------------------------------------------------- /src/commands/runtime/rule/disable.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const DeployServiceCommand = require('../../../DeployServiceCommand') 13 | 14 | class RuleDisable extends DeployServiceCommand { 15 | async run () { 16 | const { args } = await this.parse(RuleDisable) 17 | try { 18 | const ow = await this.wsk() 19 | const RuleDisableObject = { ...args } 20 | const disableRule = await ow.rules.disable(RuleDisableObject) 21 | this.log(`Rules Disabled! ${JSON.stringify(disableRule, null, 2)}`) 22 | } catch (err) { 23 | await this.handleError('failed to disable rule', err) 24 | } 25 | } 26 | } 27 | 28 | RuleDisable.description = 'Disable a Rule' 29 | 30 | RuleDisable.args = [ 31 | { 32 | name: 'name', 33 | required: true, 34 | description: 'Name of the rule' 35 | } 36 | ] 37 | 38 | RuleDisable.flags = { 39 | ...DeployServiceCommand.flags 40 | } 41 | 42 | RuleDisable.aliases = [ 43 | 'rt:rule:disable' 44 | ] 45 | 46 | module.exports = RuleDisable 47 | -------------------------------------------------------------------------------- /src/commands/runtime/rule/enable.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const DeployServiceCommand = require('../../../DeployServiceCommand') 13 | 14 | class RuleEnable extends DeployServiceCommand { 15 | async run () { 16 | const { args } = await this.parse(RuleEnable) 17 | try { 18 | const ow = await this.wsk() 19 | const RuleEnableObject = { ...args } 20 | const enableRule = await ow.rules.enable(RuleEnableObject) 21 | this.log(`Rule Enabled ${JSON.stringify(enableRule, null, 2)}`) 22 | } catch (err) { 23 | await this.handleError('failed to enable rule', err) 24 | } 25 | } 26 | } 27 | 28 | RuleEnable.description = 'Enable a Rule' 29 | 30 | RuleEnable.args = [ 31 | { 32 | name: 'name', 33 | required: true, 34 | description: 'Name of the rule' 35 | } 36 | ] 37 | 38 | RuleEnable.flags = { 39 | ...DeployServiceCommand.flags 40 | } 41 | 42 | RuleEnable.aliases = [ 43 | 'rt:rule:enable' 44 | ] 45 | 46 | module.exports = RuleEnable 47 | -------------------------------------------------------------------------------- /src/commands/runtime/rule/get.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 13 | 14 | class RuleGet extends RuntimeBaseCommand { 15 | async run () { 16 | const { args } = await this.parse(RuleGet) 17 | try { 18 | const ow = await this.wsk() 19 | const RuleGetObject = { ...args } 20 | const result = await ow.rules.get(RuleGetObject) 21 | this.logJSON('', result) 22 | } catch (err) { 23 | await this.handleError('failed to retrieve rule', err) 24 | } 25 | } 26 | } 27 | 28 | RuleGet.description = 'Retrieves a Rule' 29 | 30 | RuleGet.args = [ 31 | { 32 | name: 'name', 33 | required: true, 34 | description: 'Name of the rule' 35 | } 36 | ] 37 | 38 | RuleGet.flags = { 39 | ...RuntimeBaseCommand.flags 40 | } 41 | 42 | RuleGet.aliases = [ 43 | 'rt:rule:get' 44 | ] 45 | 46 | module.exports = RuleGet 47 | -------------------------------------------------------------------------------- /src/commands/runtime/rule/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Help } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 15 | 16 | class IndexCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const help = new Help(this.config) 19 | await help.showHelp(['runtime:rule', '--help']) 20 | } 21 | } 22 | 23 | IndexCommand.description = 'Manage your rules' 24 | 25 | IndexCommand.aliases = [ 26 | 'rt:rule' 27 | ] 28 | 29 | module.exports = IndexCommand 30 | -------------------------------------------------------------------------------- /src/commands/runtime/rule/status.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 13 | 14 | class RuleStatus extends RuntimeBaseCommand { 15 | async run () { 16 | const { args } = await this.parse(RuleStatus) 17 | try { 18 | const ow = await this.wsk() 19 | const RuleStatusObject = { ...args } 20 | const statusRule = await ow.rules.get(RuleStatusObject) 21 | this.log(statusRule.status) 22 | } catch (err) { 23 | await this.handleError('failed to retrieve rule', err) 24 | } 25 | } 26 | } 27 | 28 | RuleStatus.description = 'Gets the status of a rule' 29 | 30 | RuleStatus.args = [ 31 | { 32 | name: 'name', 33 | required: true, 34 | description: 'Name of the rule' 35 | } 36 | ] 37 | 38 | RuleStatus.flags = { 39 | ...RuntimeBaseCommand.flags 40 | } 41 | 42 | RuleStatus.aliases = [ 43 | 'rt:rule:status' 44 | ] 45 | 46 | module.exports = RuleStatus 47 | -------------------------------------------------------------------------------- /src/commands/runtime/rule/update.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software distributed under 7 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 8 | OF ANY KIND, either express or implied. See the License for the specific language 9 | governing permissions and limitations under the License. 10 | */ 11 | 12 | const RuleCreate = require('./create') 13 | 14 | class RuleUpdate extends RuleCreate { 15 | isUpdate () { return true } 16 | } 17 | 18 | RuleUpdate.description = 'Update a Rule' 19 | 20 | RuleUpdate.args = [ 21 | { 22 | name: 'name', 23 | required: true, 24 | description: 'Name of the rule' 25 | }, 26 | { 27 | name: 'trigger', 28 | required: true, 29 | description: 'Name of the trigger' 30 | }, 31 | { 32 | name: 'action', 33 | required: true, 34 | description: 'Name of the action' 35 | } 36 | ] 37 | 38 | RuleUpdate.flags = RuleCreate.flags 39 | 40 | RuleUpdate.aliases = [ 41 | 'rt:rule:update' 42 | ] 43 | 44 | module.exports = RuleUpdate 45 | -------------------------------------------------------------------------------- /src/commands/runtime/trigger/delete.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const DeployServiceCommand = require('../../../DeployServiceCommand') 14 | const { parsePathPattern } = require('@adobe/aio-lib-runtime').utils 15 | 16 | class TriggerDelete extends DeployServiceCommand { 17 | async run () { 18 | const { args } = await this.parse(TriggerDelete) 19 | const triggerPath = args.triggerPath 20 | const [, namespace, name] = parsePathPattern(triggerPath) 21 | 22 | try { 23 | const ow = await this.wsk() 24 | const obj = { namespace, name } 25 | await ow.triggers.delete(obj) 26 | } catch (err) { 27 | await this.handleError(`Unable to delete trigger '${triggerPath}'`, err) 28 | } 29 | } 30 | } 31 | 32 | TriggerDelete.args = [ 33 | { 34 | name: 'triggerPath', 35 | required: true, 36 | description: 'The name of the trigger, in the format /NAMESPACE/NAME' 37 | } 38 | ] 39 | 40 | TriggerDelete.flags = { 41 | ...DeployServiceCommand.flags 42 | } 43 | 44 | TriggerDelete.description = 'Delete a trigger for Adobe I/O Runtime' 45 | 46 | TriggerDelete.aliases = [ 47 | 'rt:trigger:delete' 48 | ] 49 | 50 | module.exports = TriggerDelete 51 | -------------------------------------------------------------------------------- /src/commands/runtime/trigger/fire.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 14 | const { getKeyValueObjectFromMergedParameters } = require('@adobe/aio-lib-runtime').utils 15 | const { Flags } = require('@oclif/core') 16 | 17 | class TriggerFire extends RuntimeBaseCommand { 18 | async run () { 19 | const { args, flags } = await this.parse(TriggerFire) 20 | 21 | try { 22 | const triggerParams = getKeyValueObjectFromMergedParameters(flags.param, flags['param-file']) 23 | const options = { 24 | name: args.triggerName, 25 | params: triggerParams 26 | } 27 | 28 | const ow = await this.wsk() 29 | const result = await ow.triggers.invoke(options) 30 | this.logJSON('', result) 31 | } catch (err) { 32 | await this.handleError('failed to fire the trigger', err) 33 | } 34 | } 35 | } 36 | 37 | TriggerFire.args = [ 38 | { 39 | name: 'triggerName', 40 | required: true, 41 | description: 'The name of the trigger' 42 | } 43 | ] 44 | 45 | TriggerFire.flags = { 46 | ...RuntimeBaseCommand.flags, 47 | param: Flags.string({ 48 | char: 'p', 49 | description: 'parameter values in KEY VALUE format', // help description for flag 50 | multiple: true // allow setting this flag multiple times 51 | }), 52 | 'param-file': Flags.string({ 53 | char: 'P', 54 | description: 'FILE containing parameter values in JSON format' // help description for flag 55 | }) 56 | } 57 | 58 | TriggerFire.description = 'Fire a trigger for Adobe I/O Runtime' 59 | 60 | TriggerFire.aliases = [ 61 | 'rt:trigger:fire' 62 | ] 63 | 64 | module.exports = TriggerFire 65 | -------------------------------------------------------------------------------- /src/commands/runtime/trigger/get.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 14 | const { parsePathPattern } = require('@adobe/aio-lib-runtime').utils 15 | 16 | class TriggerGet extends RuntimeBaseCommand { 17 | async run () { 18 | const { args } = await this.parse(TriggerGet) 19 | const triggerPath = args.triggerPath 20 | const [, namespace, name] = parsePathPattern(triggerPath) 21 | 22 | try { 23 | const ow = await this.wsk() 24 | const obj = { namespace, name } 25 | const result = await ow.triggers.get(obj) 26 | this.logJSON('', result) 27 | } catch (err) { 28 | await this.handleError(`Unable to get trigger '${triggerPath}'`, err) 29 | } 30 | } 31 | } 32 | 33 | TriggerGet.flags = { 34 | ...RuntimeBaseCommand.flags 35 | } 36 | 37 | TriggerGet.args = [ 38 | { 39 | name: 'triggerPath', 40 | required: true, 41 | description: 'The name/path of the trigger, in the format /NAMESPACE/NAME' 42 | } 43 | ] 44 | 45 | TriggerGet.description = 'Get a trigger for Adobe I/O Runtime' 46 | 47 | TriggerGet.aliases = [ 48 | 'rt:trigger:get' 49 | ] 50 | 51 | module.exports = TriggerGet 52 | -------------------------------------------------------------------------------- /src/commands/runtime/trigger/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { Help } = require('@oclif/core') 14 | const RuntimeBaseCommand = require('../../../RuntimeBaseCommand') 15 | 16 | class IndexCommand extends RuntimeBaseCommand { 17 | async run () { 18 | const help = new Help(this.config) 19 | await help.showHelp(['runtime:trigger', '--help']) 20 | } 21 | } 22 | 23 | IndexCommand.description = 'Manage your triggers' 24 | 25 | IndexCommand.aliases = [ 26 | 'rt:trigger' 27 | ] 28 | 29 | module.exports = IndexCommand 30 | -------------------------------------------------------------------------------- /src/commands/runtime/trigger/update.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TriggerCreate = require('./create') 14 | const cloneDeep = require('lodash.clonedeep') 15 | 16 | class TriggerUpdate extends TriggerCreate { 17 | isUpdate () { return true } 18 | } 19 | 20 | TriggerUpdate.args = [ 21 | { 22 | name: 'triggerName', 23 | required: true, 24 | description: 'The name of the trigger' 25 | } 26 | ] 27 | 28 | TriggerUpdate.flags = cloneDeep(TriggerCreate.flags) 29 | // TODO: Updating a feed is not supported as per wsk cli. Need to check if we can still support it. 30 | delete TriggerUpdate.flags.feed 31 | 32 | TriggerUpdate.description = 'Update or create a trigger for Adobe I/O Runtime' 33 | 34 | TriggerUpdate.aliases = [ 35 | 'rt:trigger:update' 36 | ] 37 | 38 | module.exports = TriggerUpdate 39 | -------------------------------------------------------------------------------- /src/decorators.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { platform } = process 14 | 15 | class Decorators { 16 | } 17 | 18 | Decorators.decorators = (isWin = platform === 'win32') => ({ 19 | lock_with_key: isWin ? '' : '\uD83D\uDD10', 20 | collision: isWin ? '' : '\uD83D\uDCA5', 21 | dot: isWin ? '' : '\u2024', 22 | half_circle_lower: isWin ? '' : '\u25e1' 23 | }) 24 | 25 | module.exports = Decorators 26 | -------------------------------------------------------------------------------- /src/kinds.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const path = require('path') 14 | 15 | /** 16 | * Get the file extension for a kind 17 | * 18 | * @param {string} kind the kind 19 | * @returns {string} the file extension, or '' if not found 20 | */ 21 | function fileExtensionForKind (kind) { 22 | if (kind) { 23 | const [lang] = kind.split(':') 24 | switch (lang.toLowerCase()) { 25 | case 'ballerina': return '.bal' 26 | case 'dotnet': return '.cs' 27 | case 'go': return '.go' 28 | case 'java': return '.java' 29 | case 'nodejs': return '.js' 30 | case 'php': return '.php' 31 | case 'python': return '.py' 32 | case 'ruby': return '.rb' 33 | case 'rust': return '.rs' 34 | case 'swift': return '.swift' 35 | case 'typescript': return '.ts' 36 | } 37 | } 38 | return '' 39 | } 40 | 41 | /** 42 | * Get the kind for a file extension 43 | * 44 | * @param {string} filename the filename 45 | * @returns {string} the kind, or undefined if not found 46 | */ 47 | function kindForFileExtension (filename) { 48 | if (filename) { 49 | const ext = path.extname(filename) 50 | switch (ext.toLowerCase()) { 51 | case '.bal': return 'ballerina:default' 52 | case '.cs': return 'dotnet:default' 53 | case '.go': return 'go:default' 54 | case '.java': return 'java:default' 55 | case '.js': return 'nodejs:default' 56 | case '.php': return 'php:default' 57 | case '.py': return 'python:default' 58 | case '.rb': return 'ruby:default' 59 | case '.rs': return 'rust:default' 60 | case '.swift': return 'swift:default' 61 | case '.ts': return 'typescript:default' 62 | } 63 | } 64 | return undefined 65 | } 66 | 67 | module.exports = { 68 | fileExtensionForKind, 69 | kindForFileExtension 70 | } 71 | -------------------------------------------------------------------------------- /src/properties.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const fs = require('fs') 14 | const path = require('path') 15 | const PropertiesReader = require('properties-reader') 16 | const config = require('@adobe/aio-lib-core-config') 17 | 18 | const PropertyKey = { 19 | AUTH: 'AUTH', 20 | APIHOST: 'APIHOST', 21 | APIVERSION: 'APIVERSION', 22 | NAMESPACE: 'NAMESPACE', 23 | CERT: 'CERT', 24 | KEY: 'KEY' 25 | } 26 | 27 | const PropertyEnv = { 28 | AUTH: 'WHISK_AUTH', 29 | APIHOST: 'WHISK_APIHOST', 30 | APIVERSION: 'WHISK_APIVERSION', 31 | NAMESPACE: 'WHISK_NAMESPACE', 32 | CONFIG_FILE: 'WSK_CONFIG_FILE' 33 | } 34 | 35 | const PropertyDefault = { 36 | AUTH: '', 37 | APIHOST: 'https://adobeioruntime.net', 38 | DEPLOYSERVICEURL: 'https://deploy-service.app-builder.adp.adobe.io', 39 | APIVERSION: 'v1', 40 | NAMESPACE: '_', 41 | CERT: '', 42 | KEY: '', 43 | CONFIG_FILE: path.join(require('os').homedir(), '.wskprops') 44 | } 45 | 46 | /** @private */ 47 | function propertiesFile () { 48 | let properties = { get: () => null } 49 | const wskConfigFile = process.env[PropertyEnv.CONFIG_FILE] || config.get('runtime.config_file') || PropertyDefault.CONFIG_FILE 50 | 51 | if (fs.existsSync(wskConfigFile)) { 52 | properties = PropertiesReader(wskConfigFile) 53 | } 54 | 55 | if (properties.getAllProperties) { 56 | Object.entries(properties.getAllProperties()).forEach((propTuple) => { 57 | properties.set(propTuple[0], propTuple[1].toString().replace(/#.*/, '')) 58 | }) 59 | } 60 | properties.save = function () { 61 | const saved = [] 62 | this.each((key, val) => saved.push(`${key}=${val}`)) 63 | 64 | fs.writeFileSync(wskConfigFile, saved.join('\n')) 65 | } 66 | 67 | return properties 68 | } 69 | 70 | module.exports = { 71 | propertiesFile, 72 | PropertyKey, 73 | PropertyEnv, 74 | PropertyDefault 75 | } 76 | -------------------------------------------------------------------------------- /test/__fixtures__/action/actionFile.js: -------------------------------------------------------------------------------- 1 | /** @private */ 2 | function main (params) { 3 | return { payload: 'Hello ' + params.name } 4 | } 5 | 6 | exports.main = main 7 | -------------------------------------------------------------------------------- /test/__fixtures__/action/get-output.txt: -------------------------------------------------------------------------------- 1 | ok: got action hello 2 | { 3 | "annotations": [ 4 | { 5 | "key": "web-export", 6 | "value": true 7 | }, 8 | { 9 | "key": "raw-http", 10 | "value": true 11 | }, 12 | { 13 | "key": "exec", 14 | "value": "nodejs:10-fat" 15 | } 16 | ], 17 | "exec": { 18 | "binary": false 19 | }, 20 | "limits": { 21 | "concurrency": 1, 22 | "logs": 10, 23 | "memory": 256, 24 | "timeout": 60000 25 | }, 26 | "name": "hello", 27 | "namespace": "53444_41603", 28 | "publish": false, 29 | "updated": 1549408742750, 30 | "version": "0.0.2" 31 | } 32 | -------------------------------------------------------------------------------- /test/__fixtures__/action/get-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": [ 3 | { 4 | "key": "web-export", 5 | "value": true 6 | }, 7 | { 8 | "key": "raw-http", 9 | "value": true 10 | }, 11 | { 12 | "key": "exec", 13 | "value": "nodejs:10-fat" 14 | } 15 | ], 16 | "exec": { 17 | "binary": false, 18 | "kind": "nodejs:10-fat", 19 | "code":"this is the code" 20 | }, 21 | "limits": { 22 | "concurrency": 1, 23 | "logs": 10, 24 | "memory": 256, 25 | "timeout": 60000 26 | }, 27 | "name": "hello", 28 | "namespace": "53444_41603/test", 29 | "publish": false, 30 | "updated": 1549408742750, 31 | "version": "0.0.2" 32 | } 33 | -------------------------------------------------------------------------------- /test/__fixtures__/action/get.binary.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": [ 3 | { 4 | "key": "web-export", 5 | "value": true 6 | }, 7 | { 8 | "key": "raw-http", 9 | "value": true 10 | }, 11 | { 12 | "key": "exec", 13 | "value": "nodejs:10-fat" 14 | } 15 | ], 16 | "exec": { 17 | "binary": true, 18 | "code":"this is the code" 19 | }, 20 | "limits": { 21 | "concurrency": 1, 22 | "logs": 10, 23 | "memory": 256, 24 | "timeout": 60000 25 | }, 26 | "name": "hello", 27 | "namespace": "53444_41603", 28 | "publish": false, 29 | "updated": 1549408742750, 30 | "version": "0.0.2" 31 | } 32 | -------------------------------------------------------------------------------- /test/__fixtures__/action/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": [ 3 | { 4 | "key": "web-export", 5 | "value": true 6 | }, 7 | { 8 | "key": "raw-http", 9 | "value": true 10 | }, 11 | { 12 | "key": "exec", 13 | "value": "nodejs:10-fat" 14 | } 15 | ], 16 | "exec": { 17 | "binary": false, 18 | "kind": "nodejs:10-fat", 19 | "code": "this is the code" 20 | }, 21 | "limits": { 22 | "concurrency": 1, 23 | "logs": 10, 24 | "memory": 256, 25 | "timeout": 60000 26 | }, 27 | "name": "hello", 28 | "namespace": "53444_41603", 29 | "publish": false, 30 | "updated": 1549408742750, 31 | "version": "0.0.2" 32 | } 33 | -------------------------------------------------------------------------------- /test/__fixtures__/action/getWebFalse-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": [ 3 | { 4 | "key": "web-export", 5 | "value": false 6 | }, 7 | { 8 | "key": "raw-http", 9 | "value": false 10 | }, 11 | { 12 | "key": "exec", 13 | "value": "nodejs:10-fat" 14 | } 15 | ], 16 | "exec": { 17 | "binary": false, 18 | "code":"this is the code" 19 | }, 20 | "limits": { 21 | "concurrency": 1, 22 | "logs": 10, 23 | "memory": 256, 24 | "timeout": 60000 25 | }, 26 | "name": "hello", 27 | "namespace": "53444_41603/test", 28 | "publish": false, 29 | "updated": 1549408742750, 30 | "version": "0.0.2" 31 | } 32 | -------------------------------------------------------------------------------- /test/__fixtures__/action/getWebFalse.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": [ 3 | { 4 | "key": "web-export", 5 | "value": false 6 | }, 7 | { 8 | "key": "raw-http", 9 | "value": false 10 | }, 11 | { 12 | "key": "exec", 13 | "value": "nodejs:10-fat" 14 | } 15 | ], 16 | "exec": { 17 | "binary": false, 18 | "code":"this is the code" 19 | }, 20 | "limits": { 21 | "concurrency": 1, 22 | "logs": 10, 23 | "memory": 256, 24 | "timeout": 60000 25 | }, 26 | "name": "hello", 27 | "namespace": "53444_41603", 28 | "publish": false, 29 | "updated": 1549408742750, 30 | "version": "0.0.2" 31 | } 32 | -------------------------------------------------------------------------------- /test/__fixtures__/action/get_NoWebFlag.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": [ 3 | { 4 | "key": "raw-http", 5 | "value": false 6 | }, 7 | { 8 | "key": "exec", 9 | "value": "nodejs:10-fat" 10 | } 11 | ], 12 | "exec": { 13 | "binary": false, 14 | "code":"this is the code" 15 | }, 16 | "limits": { 17 | "concurrency": 1, 18 | "logs": 10, 19 | "memory": 256, 20 | "timeout": 60000 21 | }, 22 | "name": "hello", 23 | "namespace": "53444_41603", 24 | "publish": false, 25 | "updated": 1549408742750, 26 | "version": "0.0.2" 27 | } 28 | -------------------------------------------------------------------------------- /test/__fixtures__/action/getpackage.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": [ 3 | { 4 | "key": "web-export", 5 | "value": true 6 | }, 7 | { 8 | "key": "raw-http", 9 | "value": true 10 | }, 11 | { 12 | "key": "exec", 13 | "value": "nodejs:10-fat" 14 | } 15 | ], 16 | "exec": { 17 | "binary": false, 18 | "kind": "nodejs:10-fat", 19 | "code":"this is the code" 20 | }, 21 | "limits": { 22 | "concurrency": 1, 23 | "logs": 10, 24 | "memory": 256, 25 | "timeout": 60000 26 | }, 27 | "name": "hello", 28 | "namespace": "53444_41603/pkg", 29 | "publish": false, 30 | "updated": 1549408742750, 31 | "version": "0.0.2" 32 | } 33 | -------------------------------------------------------------------------------- /test/__fixtures__/action/list-kind-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Access Kind Version Actions 2 | 02/05 18:19:02 web nodejs:10 (λ) 0.0.2 hello 3 | -------------------------------------------------------------------------------- /test/__fixtures__/action/list-name-sort-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Access Kind Version Actions 2 | ─────────────── ──────── ───────── ──────── ─────────────────────────────────────────────────· 3 | 09/23 00:22:25 private nodejs:10 0.0.1 a-hello 4 | 09/23 00:19:19 private nodejs:10 0.0.1 b-hello 5 | 09/23 00:23:01 private nodejs:10 0.0.1 53444_70361/c-hello 6 | -------------------------------------------------------------------------------- /test/__fixtures__/action/list-name-sort.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "annotations": [ 4 | { 5 | "key": "exec", 6 | "value": "nodejs:10" 7 | } 8 | ], 9 | "exec": { 10 | "binary": false 11 | }, 12 | "limits": { 13 | "concurrency": 200, 14 | "logs": 10, 15 | "memory": 256, 16 | "timeout": 60000 17 | }, 18 | "name": "c-hello", 19 | "namespace": "53444_70361", 20 | "publish": false, 21 | "updated": 1569212581883, 22 | "version": "0.0.1" 23 | }, 24 | { 25 | "annotations": [ 26 | { 27 | "key": "exec", 28 | "value": "nodejs:10" 29 | } 30 | ], 31 | "exec": { 32 | "binary": false 33 | }, 34 | "limits": { 35 | "concurrency": 200, 36 | "logs": 10, 37 | "memory": 256, 38 | "timeout": 60000 39 | }, 40 | "name": "a-hello", 41 | "namespace": "53444_41603", 42 | "publish": false, 43 | "updated": 1569212545646, 44 | "version": "0.0.1" 45 | }, 46 | { 47 | "annotations": [ 48 | { 49 | "key": "exec", 50 | "value": "nodejs:10" 51 | } 52 | ], 53 | "exec": { 54 | "binary": false 55 | }, 56 | "limits": { 57 | "concurrency": 200, 58 | "logs": 10, 59 | "memory": 256, 60 | "timeout": 60000 61 | }, 62 | "name": "b-hello", 63 | "namespace": "53444_41603", 64 | "publish": false, 65 | "updated": 1569212359316, 66 | "version": "0.0.1" 67 | } 68 | ] -------------------------------------------------------------------------------- /test/__fixtures__/action/list-output-2.txt: -------------------------------------------------------------------------------- 1 | Datetime Access Kind Version Actions 2 | 02/05 18:19:02 private nodejs:10-fat 0.0.2 hello 3 | -------------------------------------------------------------------------------- /test/__fixtures__/action/list-output-3-win.txt: -------------------------------------------------------------------------------- 1 | Datetime Access Kind Version Actions 2 | 02/05 18:19:02 web nodejs:10-fat 0.0.2 hello1 3 | 02/05 18:20:42 web nodejs:10-fat 0.0.2 hello2 4 | -------------------------------------------------------------------------------- /test/__fixtures__/action/list-output-3.txt: -------------------------------------------------------------------------------- 1 | Datetime Access Kind Version Actions 2 | 02/05 18:19:02 web 🔐 nodejs:10-fat 0.0.2 hello1 3 | 02/05 18:20:42 web 🔐 nodejs:10-fat 0.0.2 hello2 4 | -------------------------------------------------------------------------------- /test/__fixtures__/action/list-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Access Kind Version Actions 2 | 02/05 18:19:02 web nodejs:10-fat 0.0.2 hello 3 | -------------------------------------------------------------------------------- /test/__fixtures__/action/list.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "annotations": [ 4 | { 5 | "key": "web-export", 6 | "value": true 7 | }, 8 | { 9 | "key": "raw-http", 10 | "value": true 11 | }, 12 | { 13 | "key": "exec", 14 | "value": "nodejs:10-fat" 15 | } 16 | ], 17 | "exec": { 18 | "binary": false 19 | }, 20 | "limits": { 21 | "concurrency": 1, 22 | "logs": 10, 23 | "memory": 256, 24 | "timeout": 60000 25 | }, 26 | "name": "hello", 27 | "namespace": "53444_41603", 28 | "publish": false, 29 | "updated": 1549408742750, 30 | "version": "0.0.2" 31 | } 32 | ] 33 | -------------------------------------------------------------------------------- /test/__fixtures__/action/list2.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "annotations": [ 4 | { 5 | "key": "exec", 6 | "value": "nodejs:10-fat" 7 | } 8 | ], 9 | "exec": { 10 | "binary": false 11 | }, 12 | "limits": { 13 | "concurrency": 1, 14 | "logs": 10, 15 | "memory": 256, 16 | "timeout": 60000 17 | }, 18 | "name": "hello", 19 | "namespace": "53444_41603", 20 | "publish": false, 21 | "updated": 1549408742750, 22 | "version": "0.0.2" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /test/__fixtures__/action/list3.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "annotations": [ 4 | { 5 | "key": "web-export", 6 | "value": true 7 | }, 8 | { 9 | "key": "require-whisk-auth", 10 | "value": true 11 | }, 12 | { 13 | "key": "exec", 14 | "value": "nodejs:10-fat" 15 | } 16 | ], 17 | "exec": { 18 | "binary": false 19 | }, 20 | "limits": { 21 | "concurrency": 1, 22 | "logs": 10, 23 | "memory": 256, 24 | "timeout": 60000 25 | }, 26 | "name": "hello1", 27 | "namespace": "53444_41603", 28 | "publish": false, 29 | "updated": 1549408742750, 30 | "version": "0.0.2" 31 | }, 32 | { 33 | "annotations": [ 34 | { 35 | "key": "web-export", 36 | "value": true 37 | }, 38 | { 39 | "key": "require-whisk-auth", 40 | "value": "abcdef" 41 | }, 42 | { 43 | "key": "exec", 44 | "value": "nodejs:10-fat" 45 | } 46 | ], 47 | "exec": { 48 | "binary": false 49 | }, 50 | "limits": { 51 | "concurrency": 1, 52 | "logs": 10, 53 | "memory": 256, 54 | "timeout": 60000 55 | }, 56 | "name": "hello2", 57 | "namespace": "53444_41603", 58 | "publish": false, 59 | "updated": 1549408842750, 60 | "version": "0.0.2" 61 | } 62 | ] 63 | -------------------------------------------------------------------------------- /test/__fixtures__/activation/list-activation-cold-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Kind Version Activation ID Start Wait Init Duration Entity 2 | 05/22 02:39:38 success nodejs:10 0.0.1 12345 cold 10 20 23ms foo 3 | -------------------------------------------------------------------------------- /test/__fixtures__/activation/list-activation-kind-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Kind Version Activation ID Start Wait Init Duration Entity 2 | 05/22 02:39:38 timeout nodejs:10 (λ) 0.0.1 12345 warm -- 0 23ms foo 3 | -------------------------------------------------------------------------------- /test/__fixtures__/activation/list-activation-sequence-output-win.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Kind Version Activation ID Start Wait Init Duration Entity 2 | 05/22 02:39:38 success nodejs:10 0.0.1 12345 warm -- 0 23ms foo 3 | -------------------------------------------------------------------------------- /test/__fixtures__/activation/list-activation-sequence-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Kind Version Activation ID Start Wait Init Duration Entity 2 | 05/22 02:39:38 success nodejs:10 0.0.1 ․ 12345 warm -- 0 23ms foo 3 | -------------------------------------------------------------------------------- /test/__fixtures__/activation/list-activation-timeout-output-win.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Kind Version Activation ID Start Wait Init Duration Entity 2 | 05/22 02:39:38 timeout nodejs:10 0.0.1 12345 warm -- 0 23ms foo 3 | 05/22 02:39:38 dev error nodejs:10 0.0.1 12346 warm -- 0 23ms foo 4 | 05/22 02:39:38 app error nodejs:10 0.0.1 12347 warm -- 0 23ms foo 5 | 05/22 02:39:38 success nodejs:10 0.0.1 12348 warm -- 0 23ms foo 6 | 05/22 02:39:38 sys error nodejs:10 0.0.1 12349 warm -- 0 23ms foo 7 | -------------------------------------------------------------------------------- /test/__fixtures__/activation/list-activation-timeout-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Kind Version Activation ID Start Wait Init Duration Entity 2 | 05/22 02:39:38 timeout nodejs:10 0.0.1 12345 warm -- 0 23ms foo 3 | 05/22 02:39:38 dev error nodejs:10 0.0.1 12346 warm -- 0 23ms foo 4 | 05/22 02:39:38 app error nodejs:10 0.0.1 12347 warm -- 0 23ms foo 5 | 05/22 02:39:38 success nodejs:10 0.0.1 12348 warm -- 0 23ms foo 6 | 05/22 02:39:38 sys error nodejs:10 0.0.1 12349 warm -- 0 23ms foo 7 | -------------------------------------------------------------------------------- /test/__fixtures__/activation/list-activation-topmost-output-win.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Kind Version Activation ID Start Wait Init Duration Entity 2 | 05/22 02:39:38 success nodejs:10 0.0.1 12345 warm -- 0 23ms foo 3 | -------------------------------------------------------------------------------- /test/__fixtures__/activation/list-activation-topmost-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Kind Version Activation ID Start Wait Init Duration Entity 2 | 05/22 02:39:38 success nodejs:10 0.0.1 ◡ 12345 warm -- 0 23ms foo 3 | -------------------------------------------------------------------------------- /test/__fixtures__/activation/list-activation-warm-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Kind Version Activation ID Start Wait Init Duration Entity 2 | 05/22 02:39:38 success nodejs:10 0.0.1 12345 warm -- 0 23ms foo 3 | -------------------------------------------------------------------------------- /test/__fixtures__/activation/list-triggers-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Kind Version Activation ID Start Wait Init Duration Entity 2 | 11/27 09:35:19 success trigger 0.0.1 a5e7fdaeaa2e4384a7fdaeaa2e438442 -- -- -- -- trigger 3 | -------------------------------------------------------------------------------- /test/__fixtures__/api/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "apis": [ 3 | { 4 | "value": { 5 | "apidoc": { 6 | "swagger": "2.0", 7 | "info": { 8 | "version": "1.0.0" 9 | } 10 | } 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /test/__fixtures__/api/get.txt: -------------------------------------------------------------------------------- 1 | { 2 | "swagger": "2.0", 3 | "info": { 4 | "version": "1.0.0" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/__fixtures__/api/list.json: -------------------------------------------------------------------------------- 1 | { 2 | "apis": [ 3 | { 4 | "value": { 5 | "apidoc": { 6 | "basePath": "/myapi", 7 | "info": { 8 | "title": "/myapi", 9 | "version": "1.0.0" 10 | }, 11 | "paths": { 12 | "openwhisk": {}, 13 | "/mypath": { 14 | "get": { 15 | "operationId": "53444_41603/default/action1.json", 16 | "responses": { 17 | "default": { 18 | "description": "Default response" 19 | } 20 | }, 21 | "x-openwhisk": { 22 | "action": "action1.json", 23 | "namespace": "53444_41603", 24 | "package": "default", 25 | "url": "not-used" 26 | } 27 | } 28 | } 29 | }, 30 | "swagger": "2.0" 31 | }, 32 | "gwApiActivated": true, 33 | "gwApiUrl": "https://runtime.adobe.io:443/apis/53444_41603/myapi", 34 | "namespace": "Not Used", 35 | "tenantId": "Not Used" 36 | } 37 | } 38 | ] 39 | } -------------------------------------------------------------------------------- /test/__fixtures__/api/list.txt: -------------------------------------------------------------------------------- 1 | Action Verb API Name Url 2 | /53444_41603/default/action1.json get /myapi https://runtime.adobe.io:443/apis/53444_41603/myapi/mypath 3 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/api_manifest.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Basic Hello World using a NodeJS (JavaScript) action 5 | packages: 6 | demo_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | sampleAction: 11 | function: /deploy/hello.js 12 | web: true 13 | inputs: 14 | name: Adobe 15 | message: Demo 16 | anotherAction: 17 | function: /deploy/hello_plus.js 18 | web: true 19 | apis: 20 | hello-world: 21 | hello: 22 | world: 23 | sampleAction: 24 | method: GET 25 | goodbye-world: 26 | hello: 27 | world: 28 | anotherAction: 29 | method: DELETE 30 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/apis_not_implemented.yml: -------------------------------------------------------------------------------- 1 | packages: 2 | hello_world_package: 3 | version: 1.0 4 | license: Apache-2.0 5 | actions: 6 | hello_world: 7 | function: /deploy/hello.js 8 | web-export: true 9 | apis: 10 | hello-world: 11 | hello: 12 | world: 13 | hello_world: 14 | method: GET 15 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/aio-cli-plugin-runtime/fd79e91b7cdc4022431fb9e519185b5cf6237614/test/__fixtures__/deploy/app.zip -------------------------------------------------------------------------------- /test/__fixtures__/deploy/cliversion.txt: -------------------------------------------------------------------------------- 1 | 1.0 2 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment-triggerError.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | name: prj 3 | packages: 4 | testSeq: 5 | triggers: 6 | meetPerson: 7 | inputs: -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | name: proj 3 | packages: 4 | testSeq: 5 | triggers: 6 | meetPerson: 7 | inputs: 8 | name: Elrond 9 | children: 3 -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment.yml: -------------------------------------------------------------------------------- 1 | project: 2 | name: prj 3 | packages: 4 | testSeq: 5 | triggers: 6 | meetPerson: 7 | inputs: 8 | name: Elrond 9 | children: 3 -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment_actionMissingInputs.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | name: proj 3 | packages: 4 | testSeq: 5 | actions: 6 | helloAction: 7 | function: /deploy/hello.js 8 | triggers: 9 | meetPerson: 10 | inputs: 11 | name: Elrond 12 | children: 3 -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment_correctpackage.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | packages: 3 | testSeq: 4 | actions: 5 | helloAction: 6 | function: /deploy/hello.js 7 | inputs: 8 | name: Runtime 9 | triggers: 10 | meetPerson: 11 | inputs: 12 | name: Elrond 13 | children: 3 -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment_dependencies.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | packages: 3 | testSeq: 4 | dependencies: 5 | mypackage: 6 | location: /adobeio/oauth 7 | inputs: 8 | client_id: "myclientID123" 9 | mypackage2: 10 | location: /adobeio/oauth -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment_syncMissingAction.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | name: proj 3 | packages: 4 | testSeq: 5 | triggers: 6 | meetPerson: 7 | inputs: 8 | name: Elrond 9 | children: 3 10 | annotations: 11 | val1: value1 12 | val2: value2 -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment_syncSequences.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | name: proj 3 | packages: 4 | testSeq: 5 | actions: 6 | member_join: 7 | function: /deploy/hello.js 8 | inputs: 9 | name: 10 | type: string 11 | description: name of person 12 | default: unknown 13 | place: 14 | type: string 15 | description: location of person 16 | default: unknown 17 | job: 18 | type: string 19 | description: current occupation 20 | default: 0 21 | outputs: 22 | member: 23 | type: json 24 | description: member record 25 | member_process: 26 | function: /deploy/hello.js 27 | inputs: 28 | member: {} 29 | member_equip: 30 | function: /deploy/hello.js 31 | inputs: 32 | member: {} 33 | sequences: 34 | fellowship_membership: 35 | actions: member_join, member_process, member_equip 36 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment_triggersMissing.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | packages: 3 | testSeq: 4 | triggers: -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment_triggersMissingInputs.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | packages: 3 | testSeq: 4 | triggers: 5 | meetPerson: 6 | inputs: -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment_wrongPackageName.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | packages: 3 | testSeq1: 4 | triggers: 5 | meetPerson: 6 | inputs: 7 | name: Elrond 8 | children: 3 -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment_wrongTrigger.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | packages: 3 | testSeq: 4 | triggers: 5 | meetPerson1: 6 | inputs: 7 | name: Elrond 8 | children: 3 -------------------------------------------------------------------------------- /test/__fixtures__/deploy/deployment_wrongpackage.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | packages: 3 | testSeq_differentName: 4 | actions: 5 | helloAction: 6 | function: /deploy/hello.js 7 | inputs: 8 | name: Runtime 9 | triggers: 10 | meetPerson: 11 | inputs: 12 | name: Elrond 13 | children: 3 -------------------------------------------------------------------------------- /test/__fixtures__/deploy/export_yaml.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | name: proj 3 | packages: 4 | testSeq: 5 | version: 0.0.2 6 | namespace: ns 7 | annotations: {} 8 | actions: 9 | helloAction1: 10 | version: 0.0.9 11 | namespace: 53444_51981/testSeq 12 | annotations: 13 | exec: nodejs:10 14 | inputs: 15 | key1: val1 16 | key2: val1 17 | function: testSeq/helloAction1.js 18 | runtime: nodejs:10 19 | main: split 20 | limits: 21 | timeout: 60000 22 | memorySize: 256 23 | logSize: 10 24 | triggers: 25 | meetPerson: 26 | namespace: '53444_51981' 27 | inputs: 28 | name: Sam 29 | place: '' 30 | children: 0 31 | annotations: {} 32 | sequences: {} 33 | rules: 34 | meetPersonRule: 35 | action: three 36 | annotations: {} 37 | trigger: meetPerson 38 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/export_yaml_Sequence.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | name: proj 3 | packages: 4 | testSeq: 5 | version: 0.0.2 6 | namespace: ns 7 | annotations: {} 8 | actions: {} 9 | triggers: 10 | meetPerson: 11 | namespace: '53444_51981' 12 | inputs: 13 | name: Sam 14 | place: '' 15 | children: 0 16 | annotations: {} 17 | sequences: 18 | four: 19 | actions: zero,one,two 20 | rules: 21 | meetPersonRule: 22 | action: three 23 | annotations: {} 24 | trigger: meetPerson 25 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/export_yaml_feed.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | name: proj 3 | packages: 4 | testSeq: 5 | version: 0.0.2 6 | namespace: ns 7 | annotations: {} 8 | actions: 9 | helloAction1: 10 | version: 0.0.9 11 | namespace: 53444_51981/testSeq 12 | annotations: 13 | exec: nodejs:10 14 | inputs: 15 | key1: val1 16 | key2: val1 17 | function: testSeq/helloAction1.js 18 | runtime: nodejs:10 19 | main: split 20 | limits: 21 | timeout: 60000 22 | memorySize: 256 23 | logSize: 10 24 | triggers: 25 | meetPerson: 26 | namespace: '53444_51981' 27 | inputs: 28 | name: Sam 29 | place: '' 30 | children: 0 31 | annotations: {} 32 | feed: /whisk.system/alarms/alarm 33 | sequences: {} 34 | rules: 35 | meetPersonRule: 36 | action: three 37 | annotations: {} 38 | trigger: meetPerson 39 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/export_yaml_noAnnotations.yaml: -------------------------------------------------------------------------------- 1 | project: 2 | name: proj 3 | packages: {} 4 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/hello.js: -------------------------------------------------------------------------------- 1 | /** @private */ 2 | function main (params) { 3 | const msg = 'Hello ' + params.name + ', ' + params.message + '.' 4 | return { msg } 5 | } 6 | 7 | module.exports.main = main 8 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/hello_plus.js: -------------------------------------------------------------------------------- 1 | /** @private */ 2 | function main (params) { 3 | const msg = 'Hello, ' + params.name + ' , ' + params.place + '.' 4 | const employees = 'You have ' + params.employees + ' employees ' 5 | const address = 'and are located at ' + params.address + '.' 6 | return { greeting: msg + employees + address } 7 | } 8 | 9 | module.exports.main = main 10 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/main.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-unused-vars */ 2 | 3 | /** @private */ 4 | function split (params) { 5 | const text = params.text || '' 6 | const words = text.split(' ') 7 | return { words } 8 | } 9 | 10 | /** @private */ 11 | function split1 (params) { 12 | const text = params.text || 'Hello World' 13 | const words = text.split(' ') 14 | return { words } 15 | } 16 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Basic Hello World using a NodeJS (JavaScript) action 5 | packages: 6 | demo_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | sampleAction: 11 | function: /deploy/hello.js 12 | inputs: 13 | name: Adobe 14 | message: Demo 15 | anotherAction: 16 | function: /deploy/hello_plus.js 17 | demo_package_no_actions: 18 | version: 1.0 19 | license: Apache-2.0 20 | demo_package_shared: 21 | public: true -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Basic Hello World using a NodeJS (JavaScript) action 5 | packages: 6 | demo_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | demo_basic_params: 11 | function: /deploy/hello.js 12 | runtime: nodejs:8 13 | web-export: raw 14 | inputs: 15 | name: Adobe 16 | message: Demo 17 | demo_typed_params: 18 | function: /deploy/hello_plus.js 19 | inputs: 20 | name: $NAME 21 | place: string 22 | employees: integer 23 | address: string 24 | limits: 25 | memorySize: 128 26 | logSize: 5 27 | timeout: 10000 28 | web: no 29 | demo_typed_params_for_coverage: 30 | function: /deploy/hello_plus.js 31 | inputs: 32 | name: ${NAME} 33 | place: string 34 | employees: integer 35 | address: string 36 | limits: 37 | unknownKey: 0 38 | require-whisk-auth: true 39 | raw-http: yes 40 | web: false 41 | demo_advanced_params: 42 | runtime: nodejs:10 43 | function: /deploy/hello_plus.js 44 | inputs: 45 | name: 46 | type: string 47 | description: name of person 48 | default: unknown person 49 | place: 50 | type: string 51 | description: location of person 52 | value: California 53 | employees: 54 | type: integer 55 | description: Number of employees 56 | default: 0 57 | address: 58 | type: string 59 | description: Address 60 | default: unknown address 61 | web: true 62 | require-whisk-auth: true 63 | raw-http: true 64 | demo_zip: 65 | function: /deploy/app.zip 66 | runtime: nodejs:10 67 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_actionMissingInputs.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Basic Hello World using a NodeJS (JavaScript) action 5 | packages: 6 | demo_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | sampleAction: 11 | function: /deploy/hello.js 12 | inputs: 13 | name: Adobe 14 | message: Demo 15 | anotherAction: 16 | function: /deploy/hello_plus.js 17 | inputs: 18 | demo_package_no_actions: 19 | version: 1.0 20 | license: Apache-2.0 21 | triggers: 22 | meetPerson: 23 | inputs: 24 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_api.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing APIs 5 | packages: 6 | testAPI: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | hello_world: 11 | function: /deploy/hello.js 12 | web-export: true 13 | apis: 14 | hello-world: 15 | hello: 16 | world: 17 | hello_world: 18 | method: get -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_api_incorrect.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing APIs 5 | packages: 6 | testAPI: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | hello_world: 11 | function: /deploy/hello.js 12 | web-export: true 13 | apis: 14 | hello-world: -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_api_multi.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing APIs 5 | packages: 6 | testAPI: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | hello_world: 11 | function: /deploy/hello.js 12 | web-export: true 13 | hello_universe: 14 | function: /deploy/hello.js 15 | web-export: true 16 | apis: 17 | testAPI: # api name 18 | hello: # base path 19 | helloResource: # resource path 20 | hello_world: # action name reference 21 | method: post 22 | response: http 23 | hello_universe: 24 | method: get 25 | response: http 26 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_concurrency.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: set custom action concurrency 5 | packages: 6 | demo_package: 7 | actions: 8 | sampleAction: 9 | function: /deploy/main.js 10 | limits: 11 | concurrency: 10 12 | 13 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_conductor.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Basic Hello World using a NodeJS (JavaScript) action 5 | packages: 6 | demo_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | anotherAction: 11 | function: /deploy/hello.js 12 | annotations: 13 | conductor: true 14 | anotherAction2: 15 | function: /deploy/hello.js 16 | web: 'yes' 17 | annotations: 18 | conductor: true 19 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_dep.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing data in a sequence 5 | packages: 6 | testSeq: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | helloAction: 11 | function: /deploy/hello.js 12 | inputs: 13 | name: string 14 | place: string 15 | children: integer 16 | height: integer 17 | triggers: 18 | meetPerson: 19 | inputs: 20 | name: string 21 | place: string 22 | children: string 23 | height: string 24 | rules: 25 | meetPersonRule: 26 | trigger: meetPerson 27 | action: helloAction -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_dep_Triggers.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing data in a sequence 5 | packages: 6 | testSeq: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | helloAction: 11 | function: /deploy/hello.js 12 | limits: 13 | unknownkey: 6 14 | inputs: 15 | name: string 16 | place: string 17 | children: integer 18 | height: integer 19 | triggers: 20 | meetPerson: 21 | inputs: 22 | name: string 23 | place: string 24 | children: string 25 | height: string 26 | meetPerson22: 27 | inputs: 28 | name: string 29 | place: string 30 | children: string 31 | height: string 32 | rules: 33 | meetPersonRule: 34 | trigger: meetPerson 35 | action: helloAction -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_dep_Triggers_feeds.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing data in a sequence 5 | packages: 6 | demo_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | triggers: 10 | meetPerson: 11 | feed: /whisk.system/alarms/alarm 12 | inputs: 13 | cron: '* * * * *' -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_dep_dependencies.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing data in a sequence 5 | packages: 6 | testSeq: 7 | version: 1.0 8 | license: Apache-2.0 9 | dependencies: 10 | mypackage: 11 | location: /adobeio/oauth 12 | inputs: 13 | client_id: string 14 | mypackage2: 15 | location: /adobeio/oauth -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_dependencies.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing data in a sequence 5 | packages: 6 | testSeq: 7 | version: 1.0 8 | license: Apache-2.0 9 | dependencies: 10 | mypackage: 11 | location: /adobeio/oauth 12 | inputs: 13 | client_id: "myclientID123" -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_dependencies_error.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing data in a sequence 5 | packages: 6 | testSeq: 7 | version: 1.0 8 | license: Apache-2.0 9 | dependencies: 10 | mypackage: 11 | inputs: 12 | client_id: "myclientID123" -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_docker.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Blackbox action with a custom docker image 5 | packages: 6 | demo_package: 7 | actions: 8 | sampleAction: 9 | function: /deploy/main.js 10 | main: split 11 | web: false 12 | docker: my/docker-image:1.0.0 13 | 14 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_final.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Basic Hello World using a NodeJS (JavaScript) action 5 | packages: 6 | demo_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | anotherAction: 11 | function: /deploy/hello.js 12 | web: true 13 | annotations: 14 | final: true 15 | require-whisk-auth: true 16 | raw-http: true 17 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_main.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Basic Hello World using a NodeJS (JavaScript) action 5 | packages: 6 | demo_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | sampleAction: 11 | function: /deploy/main.js 12 | inputs: 13 | name: string 14 | message: string 15 | main: split 16 | web: false 17 | annotations: 18 | final: true 19 | require-whisk-auth: true 20 | raw-http: true 21 | 22 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_multiple_packages.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing data in a sequence 5 | packages: 6 | testSeq: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | helloAction: 11 | function: /deploy/hello.js 12 | limits: 13 | unknownkey: 6 14 | inputs: 15 | name: string 16 | place: string 17 | children: integer 18 | height: integer 19 | triggers: 20 | meetPerson: 21 | inputs: 22 | name: string 23 | place: string 24 | children: string 25 | height: string 26 | rules: 27 | meetPersonRule: 28 | trigger: meetPerson 29 | action: helloAction 30 | testSeq1: 31 | version: 1.1 32 | triggers: 33 | meetPerson2: 34 | inputs: 35 | sharedpack1: 36 | public: true 37 | sharedpack2: 38 | public: false -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_not_present_action.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing APIs 5 | packages: 6 | testAPI: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | hello_world: 11 | function: /deploy/hello.js 12 | web-export: true 13 | apis: 14 | hello-world: 15 | hello: 16 | world: 17 | hello_world12: 18 | method: GET 19 | response: http -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_not_webAction.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing APIs 5 | packages: 6 | testAPI: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | hello_world: 11 | function: /deploy/hello.js 12 | web-export: false 13 | apis: 14 | hello-world: 15 | hello: 16 | world: 17 | hello_world: 18 | method: GET 19 | response: http -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_not_webSequence.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing APIs 5 | packages: 6 | hello_world_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | hello_validate: 11 | function: /deploy/hello.js 12 | hello: 13 | function: /deploy/hello.js 14 | hello_world: 15 | function: /deploy/hello.js 16 | sequences: 17 | hello_world: 18 | actions: hello_validate, hello, hello_wrap 19 | apis: 20 | hello-world: 21 | hello: 22 | world: 23 | hello_world: 24 | method: GET 25 | response: http 26 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_params.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Basic Hello World using a NodeJS (JavaScript) action 5 | packages: 6 | demo_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | sampleAction: 11 | function: /deploy/hello.js 12 | inputs: 13 | name: $NAME 14 | message: Demo 15 | anotherAction: 16 | function: /deploy/hello.js 17 | inputs: 18 | name: ${NAME} 19 | message: Demo -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_report.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Basic Hello World using a NodeJS (JavaScript) action 5 | project: 6 | packages: 7 | testSeq: 8 | version: 1.0 9 | license: Apache-2.0 10 | actions: 11 | zero: 12 | function: /deploy/hello.js 13 | inputs: 14 | name: 15 | type: string 16 | description: name of person 17 | default: unknown 18 | place: 19 | type: string 20 | description: location of person 21 | default: unknown 22 | job: 23 | type: string 24 | description: current occupation 25 | default: 0 26 | outputs: 27 | member: 28 | type: json 29 | description: member record 30 | one: 31 | function: /deploy/hello.js 32 | inputs: 33 | member: {} 34 | two: 35 | function: /deploy/hello.js 36 | inputs: 37 | member: {} 38 | helloAction: 39 | function: /deploy/hello.js 40 | inputs: 41 | name: string 42 | place: string 43 | children: integer 44 | height: integer 45 | sequences: 46 | three: 47 | actions: zero,one,two 48 | triggers: 49 | meetPerson: 50 | inputs: 51 | name: Sam 52 | place: string 53 | children: integer -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_triggersRules.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing data in a sequence 5 | packages: 6 | testSeq: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | zero: 11 | function: /deploy/hello.js 12 | inputs: 13 | name: 14 | type: string 15 | description: name of person 16 | default: unknown 17 | place: 18 | type: string 19 | description: location of person 20 | default: unknown 21 | job: 22 | type: string 23 | description: current occupation 24 | default: 0 25 | outputs: 26 | member: 27 | type: json 28 | description: member record 29 | one: 30 | function: /deploy/hello.js 31 | inputs: 32 | member: {} 33 | two: 34 | function: /deploy/hello.js 35 | inputs: 36 | member: {} 37 | helloAction: 38 | function: /deploy/hello.js 39 | inputs: 40 | name: string 41 | place: string 42 | children: integer 43 | height: integer 44 | sequences: 45 | three: 46 | actions: zero,one,two 47 | triggers: 48 | meetPerson: 49 | inputs: 50 | name: Sam 51 | rules: 52 | meetPersonRule: 53 | trigger: meetPerson 54 | action: three -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_triggersRules_IncorrectAction.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing data in a sequence 5 | packages: 6 | testSeq: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | zero: 11 | function: /deploy/hello.js 12 | inputs: 13 | name: 14 | type: string 15 | description: name of person 16 | default: unknown 17 | place: 18 | type: string 19 | description: location of person 20 | default: unknown 21 | job: 22 | type: string 23 | description: current occupation 24 | default: 0 25 | outputs: 26 | member: 27 | type: json 28 | description: member record 29 | one: 30 | function: /deploy/hello.js 31 | inputs: 32 | member: {} 33 | two: 34 | function: /deploy/hello.js 35 | inputs: 36 | member: {} 37 | helloAction: 38 | function: /deploy/hello.js 39 | inputs: 40 | name: string 41 | place: string 42 | children: integer 43 | height: integer 44 | sequences: 45 | three: 46 | actions: zero,one,two 47 | triggers: 48 | meetPerson: 49 | inputs: 50 | name: Sam 51 | place: the Shire 52 | children: 13 53 | height: 140 54 | rules: 55 | meetPersonRule: 56 | trigger: meetPerson 57 | action: incorrectActionName -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_triggersRules_NoTrigger.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing data in a sequence 5 | packages: 6 | testSeq: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | zero: 11 | function: /deploy/hello.js 12 | inputs: 13 | name: 14 | type: string 15 | description: name of person 16 | default: unknown 17 | place: 18 | type: string 19 | description: location of person 20 | default: unknown 21 | job: 22 | type: string 23 | description: current occupation 24 | default: 0 25 | outputs: 26 | member: 27 | type: json 28 | description: member record 29 | one: 30 | function: /deploy/hello.js 31 | inputs: 32 | member: {} 33 | two: 34 | function: /deploy/hello.js 35 | inputs: 36 | member: {} 37 | helloAction: 38 | function: /deploy/hello.js 39 | inputs: 40 | name: string 41 | place: string 42 | children: integer 43 | height: integer 44 | sequences: 45 | three: 46 | actions: zero,one,two 47 | triggers: 48 | meetPerson: 49 | inputs: 50 | name: Sam 51 | place: the Shire 52 | children: 13 53 | height: 140 54 | rules: 55 | meetPersonRule: 56 | action: three -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_triggersRules_noInputs.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing data in a sequence 5 | packages: 6 | testSeq: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | zero: 11 | function: /deploy/hello.js 12 | inputs: 13 | name: 14 | type: string 15 | description: name of person 16 | default: unknown 17 | place: 18 | type: string 19 | description: location of person 20 | default: unknown 21 | job: 22 | type: string 23 | description: current occupation 24 | default: 0 25 | outputs: 26 | member: 27 | type: json 28 | description: member record 29 | one: 30 | function: /deploy/hello.js 31 | inputs: 32 | member: {} 33 | two: 34 | function: /deploy/hello.js 35 | inputs: 36 | member: {} 37 | helloAction: 38 | function: /deploy/hello.js 39 | inputs: 40 | name: string 41 | place: string 42 | children: integer 43 | height: integer 44 | sequences: 45 | three: 46 | actions: zero,one,two 47 | triggers: 48 | meetPerson: 49 | inputs: 50 | rules: 51 | meetPersonRule: 52 | trigger: meetPerson 53 | action: helloAction -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_webSequence.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: processing APIs 5 | packages: 6 | hello_world_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | hello_validate: 11 | function: /deploy/hello.js 12 | hello: 13 | function: /deploy/hello.js 14 | hello_wrap: 15 | function: /deploy/hello.js 16 | sequences: 17 | hello_world: 18 | actions: hello_validate, hello, hello_wrap, spackage/saction, /spackage/saction, snamespace/spackage/saction, /snamespace/spackage/saction 19 | web: true 20 | apis: 21 | hello-world: 22 | hello: 23 | world: 24 | hello_world: 25 | method: GET 26 | response: http 27 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_with_adobe_auth.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Hello World action using Adobe auth annotation 5 | packages: 6 | testSeq: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | helloAction: 11 | function: ./hello.js 12 | web-export: 'yes' 13 | annotations: 14 | require-adobe-auth: true 15 | inputs: 16 | name: Elrond 17 | helloAction2: 18 | function: ./hello.js 19 | web: 'yes' 20 | annotations: 21 | require-adobe-auth: true 22 | sequences: 23 | helloSeq: 24 | actions: 'testSeq/helloAction,global/fake/action' # testSeq/helloAction will be converted to a seq 25 | demo_package: 26 | version: 1.0 27 | license: Apache-2.0 28 | actions: 29 | sampleAction: 30 | function: ./hello.js 31 | web-export: 'raw' 32 | annotations: 33 | require-adobe-auth: true 34 | sampleActionNoAnnotation: 35 | function: ./hello.js 36 | web-export: 'yes' 37 | sampleActionNoWeb: 38 | function: ./hello.js 39 | annotations: 40 | require-adobe-auth: true 41 | no_actions_pkg: 42 | version: 1.0 43 | license: Apache-2.0 44 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/manifest_zip.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more contributor 2 | # license agreements; and to You under the Apache License, Version 2.0. 3 | 4 | # Example: Basic Hello World using a NodeJS (JavaScript) action 5 | packages: 6 | demo_package: 7 | version: 1.0 8 | license: Apache-2.0 9 | actions: 10 | sampleAction: 11 | function: ./app.zip -------------------------------------------------------------------------------- /test/__fixtures__/deploy/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "param1value", 3 | "place": "param2value" 4 | } -------------------------------------------------------------------------------- /test/__fixtures__/deploy/reportPackage.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "Inputs": {} 4 | } 5 | { 6 | "name": "testSeq", 7 | "Inputs": {} 8 | } 9 | { 10 | "name": "zero", 11 | "Inputs": { 12 | "name": "unknown", 13 | "place": "unknown", 14 | "job": 0 15 | } 16 | } 17 | { 18 | "name": "one", 19 | "Inputs": { 20 | "member": {} 21 | } 22 | } 23 | { 24 | "name": "two", 25 | "Inputs": { 26 | "member": {} 27 | } 28 | } 29 | { 30 | "name": "helloAction", 31 | "Inputs": { 32 | "name": "", 33 | "place": "", 34 | "children": 0, 35 | "height": 0 36 | } 37 | } 38 | { 39 | "name": "three", 40 | "Inputs": {} 41 | } 42 | { 43 | "name": "meetPerson", 44 | "Inputs": { 45 | "name": "Sam", 46 | "place": "", 47 | "children": 0 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/reportPackage_defaultDeployment.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "Inputs": {} 4 | } 5 | { 6 | "name": "testSeq", 7 | "Inputs": {} 8 | } 9 | { 10 | "name": "zero", 11 | "Inputs": { 12 | "name": "unknown", 13 | "place": "unknown", 14 | "job": 0 15 | } 16 | } 17 | { 18 | "name": "one", 19 | "Inputs": { 20 | "member": {} 21 | } 22 | } 23 | { 24 | "name": "two", 25 | "Inputs": { 26 | "member": {} 27 | } 28 | } 29 | { 30 | "name": "helloAction", 31 | "Inputs": { 32 | "name": "", 33 | "place": "", 34 | "children": 0, 35 | "height": 0 36 | } 37 | } 38 | { 39 | "name": "three", 40 | "Inputs": {} 41 | } 42 | { 43 | "name": "meetPerson", 44 | "Inputs": { 45 | "name": "Elrond", 46 | "place": "", 47 | "children": 3 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/report_packages.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "Inputs": {} 4 | } 5 | { 6 | "name": "demo_package", 7 | "Inputs": {} 8 | } 9 | { 10 | "name": "demo_package_no_actions", 11 | "Inputs": {} 12 | } 13 | { 14 | "name": "demo_package_shared", 15 | "Inputs": {}, 16 | "public": true 17 | } 18 | { 19 | "name": "sampleAction", 20 | "Inputs": { 21 | "name": "Adobe", 22 | "message": "Demo" 23 | } 24 | } 25 | { 26 | "name": "anotherAction", 27 | "Inputs": {} 28 | } 29 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/report_triggersMissingInputs.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "Inputs": {} 4 | } 5 | { 6 | "name": "demo_package", 7 | "Inputs": {} 8 | } 9 | { 10 | "name": "demo_package_no_actions", 11 | "Inputs": {} 12 | } 13 | { 14 | "name": "sampleAction", 15 | "Inputs": { 16 | "name": "Adobe", 17 | "message": "Demo" 18 | } 19 | } 20 | { 21 | "name": "anotherAction", 22 | "Inputs": {} 23 | } 24 | { 25 | "name": "meetPerson", 26 | "Inputs": {} 27 | } 28 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/report_triggersWithFeed.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "Inputs": {} 4 | } 5 | { 6 | "name": "demo_package", 7 | "Inputs": {} 8 | } 9 | { 10 | "name": "meetPerson", 11 | "feed": "/whisk.system/alarms/alarm", 12 | "Inputs": { 13 | "cron": "* * * * *" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/rules_not_implemented.yml: -------------------------------------------------------------------------------- 1 | packages: 2 | hello_world_package: 3 | version: 1.0 4 | license: Apache-2.0 5 | actions: 6 | hello_world: 7 | function: /deploy/hello.js 8 | web-export: true 9 | hello_world_triggerrule: 10 | function: /deploy/hello_plus.js 11 | runtime: nodejs 12 | inputs: 13 | name: string 14 | place: string 15 | children: integer 16 | height: float 17 | outputs: 18 | greeting: string 19 | details: string 20 | triggers: 21 | meetPerson: 22 | inputs: 23 | name: Sam 24 | place: the Shire 25 | children: 13 26 | height: 1.2 27 | rules: 28 | meetPersonRule: 29 | trigger: meetPerson 30 | action: hello_world_triggerrule 31 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/sequences_implemented.yml: -------------------------------------------------------------------------------- 1 | packages: 2 | hello_world_package: 3 | version: 1.0 4 | license: Apache-2.0 5 | actions: 6 | member_join: 7 | function: /deploy/hello.js 8 | inputs: 9 | name: 10 | type: string 11 | description: name of person 12 | default: unknown 13 | place: 14 | type: string 15 | description: location of person 16 | default: unknown 17 | job: 18 | type: string 19 | description: current occupation 20 | default: 0 21 | outputs: 22 | member: 23 | type: json 24 | description: member record 25 | member_process: 26 | function: /deploy/hello.js 27 | inputs: 28 | member: {} 29 | member_equip: 30 | function: /deploy/hello.js 31 | inputs: 32 | member: {} 33 | sequences: 34 | fellowship_membership: 35 | actions: member_join, member_process, member_equip 36 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/sequences_missing_actions.yml: -------------------------------------------------------------------------------- 1 | packages: 2 | hello_world_package: 3 | version: 1.0 4 | license: Apache-2.0 5 | actions: 6 | member_join: 7 | function: /deploy/hello.js 8 | inputs: 9 | name: 10 | type: string 11 | description: name of person 12 | default: unknown 13 | place: 14 | type: string 15 | description: location of person 16 | default: unknown 17 | job: 18 | type: string 19 | description: current occupation 20 | default: 0 21 | outputs: 22 | member: 23 | type: json 24 | description: member record 25 | member_process: 26 | function: /deploy/hello.js 27 | inputs: 28 | member: {} 29 | member_equip: 30 | function: /deploy/hello.js 31 | inputs: 32 | member: {} 33 | sequences: 34 | fellowship_membership: 35 | actions: 36 | -------------------------------------------------------------------------------- /test/__fixtures__/deploy/triggers_not_implemented.yml: -------------------------------------------------------------------------------- 1 | packages: 2 | hello_world_package: 3 | version: 1.0 4 | license: Apache-2.0 5 | actions: 6 | hello_world: 7 | function: /deploy/hello.js 8 | web-export: true 9 | hello_world_triggerrule: 10 | function: /deploy/hello_plus.js 11 | runtime: nodejs 12 | inputs: 13 | name: string 14 | place: string 15 | children: integer 16 | height: float 17 | outputs: 18 | greeting: string 19 | details: string 20 | triggers: 21 | meetPerson: 22 | inputs: 23 | name: Sam 24 | place: the Shire 25 | children: 13 26 | height: 1.2 27 | -------------------------------------------------------------------------------- /test/__fixtures__/empty-wsk.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adobe/aio-cli-plugin-runtime/fd79e91b7cdc4022431fb9e519185b5cf6237614/test/__fixtures__/empty-wsk.properties -------------------------------------------------------------------------------- /test/__fixtures__/namespace/get-name-sort.txt: -------------------------------------------------------------------------------- 1 | Entities in namespace: 2 | packages 3 | ───────────────────────────────────────────────── ─────── ────────────── ───────── 4 | /53444_70361/a-hello private nodejs:10 5 | /53444_70361/b-hello private nodejs:10 6 | /53444_70361/b-hello private nodejs:10 7 | /53444_70361/c-hello private nodejs:10 8 | actions 9 | ───────────────────────────────────────────────── ─────── ────────────── ───────── 10 | /53444_41603/action1 private nodejs:6 11 | /53444_41603/action2 private nodejs:6 12 | /53444_41603/hello private nodejs:10-fat 13 | /53444_41603/my-service-dev-hello private nodejs:6 14 | /53444_41603/timtest private nodejs:10 15 | triggers 16 | ───────────────────────────────────────────────── ─────── ────────────── ───────── 17 | /53444_41603/foo1 private 18 | /53444_41603/foo2 private 19 | rules 20 | ───────────────────────────────────────────────── ─────── ────────────── ───────── 21 | /53444_41603/asdf private inactive 22 | /53444_41603/testRule private active 23 | -------------------------------------------------------------------------------- /test/__fixtures__/namespace/get.txt: -------------------------------------------------------------------------------- 1 | Entities in namespace: 2 | packages 3 | ───────────────────────────────────────────────── ─────── ────────────── ───────── 4 | actions 5 | ───────────────────────────────────────────────── ─────── ────────────── ───────── 6 | /53444_41603/timtest public nodejs:10 7 | /53444_41603/hello private nodejs:10-fat 8 | /53444_41603/my-service-dev-hello private nodejs:6 9 | /53444_41603/action2 private nodejs:6 10 | /53444_41603/action1 private nodejs:6 11 | triggers 12 | ───────────────────────────────────────────────── ─────── ────────────── ───────── 13 | /53444_41603/foo2 private 14 | /53444_41603/foo1 private 15 | rules 16 | ───────────────────────────────────────────────── ─────── ────────────── ───────── 17 | /53444_41603/testRule private active 18 | /53444_41603/asdf private inactive 19 | -------------------------------------------------------------------------------- /test/__fixtures__/namespace/list.json: -------------------------------------------------------------------------------- 1 | [ 2 | "12345_67890", 3 | "99999_11111", 4 | "88888_22222" 5 | ] -------------------------------------------------------------------------------- /test/__fixtures__/namespace/list.txt: -------------------------------------------------------------------------------- 1 | Namespaces 2 | 12345_67890 3 | 99999_11111 4 | 88888_22222 5 | -------------------------------------------------------------------------------- /test/__fixtures__/namespace/log-forwarding/errors-remote.json: -------------------------------------------------------------------------------- 1 | { 2 | "configured_forwarder": "destination", 3 | "errors": [ 4 | "error1", 5 | "error2" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /test/__fixtures__/namespace/log-forwarding/errors-result.txt: -------------------------------------------------------------------------------- 1 | Log forwarding errors for the last configured destination 'destination': 2 | [ 3 | "error1", 4 | "error2" 5 | ] 6 | -------------------------------------------------------------------------------- /test/__fixtures__/namespace/log-forwarding/get-remote.json: -------------------------------------------------------------------------------- 1 | { 2 | "log_destination": { 3 | "updated_at": "2021-08-27T14:40:06.000+00:00", 4 | "some_key": "some_value" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/__fixtures__/namespace/log-forwarding/get-result.txt: -------------------------------------------------------------------------------- 1 | Log forwarding configuration for this namespace: 2 | { 3 | "log_destination": { 4 | "updated_at": "2021-08-27T14:40:06.000+00:00", 5 | "some_key": "some_value" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/__fixtures__/namespace/rule1.json: -------------------------------------------------------------------------------- 1 | { 2 | "action": { 3 | "name": "action2", 4 | "path": "53444_41603" 5 | }, 6 | "annotations": [], 7 | "name": "testRule", 8 | "namespace": "53444_41603", 9 | "publish": false, 10 | "status": "active", 11 | "trigger": { 12 | "name": "foo1", 13 | "path": "53444_41603" 14 | }, 15 | "version": "0.0.3" 16 | } -------------------------------------------------------------------------------- /test/__fixtures__/namespace/rule2.json: -------------------------------------------------------------------------------- 1 | { 2 | "action": { 3 | "name": "foo101", 4 | "path": "53444_41603" 5 | }, 6 | "annotations": [], 7 | "name": "asdf", 8 | "namespace": "53444_41603", 9 | "publish": false, 10 | "status": "inactive", 11 | "trigger": { 12 | "name": "foo2", 13 | "path": "53444_41603" 14 | }, 15 | "version": "0.0.1" 16 | } -------------------------------------------------------------------------------- /test/__fixtures__/package/list-name-sort-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Access Kind Version Packages 2 | 03/07 11:06:38 private package 0.0.5 demo_package 3 | 03/07 11:06:38 public package 0.0.5 demo_package2 4 | 09/23 00:23:01 private binding 0.0.1 demo_package3 5 | -------------------------------------------------------------------------------- /test/__fixtures__/package/list.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "annotations": [], 4 | "binding": false, 5 | "name": "demo_package", 6 | "namespace": "53444_51636", 7 | "publish": false, 8 | "updated": 1551974798513, 9 | "version": "0.0.5" 10 | }, 11 | { 12 | "annotations": [], 13 | "binding": false, 14 | "name": "demo_package2", 15 | "namespace": "53444_51636", 16 | "publish": true, 17 | "updated": 1551974798514, 18 | "version": "0.0.5" 19 | }, 20 | { 21 | "name": "demo_package3", 22 | "namespace": "53444_51636", 23 | "publish": false, 24 | "updated": 1569212581883, 25 | "version": "0.0.1", 26 | "binding": { 27 | "name": "some-binding", 28 | "namespace": "53444_70361" 29 | } 30 | } 31 | ] 32 | -------------------------------------------------------------------------------- /test/__fixtures__/property/all-empty-wskprops.txt: -------------------------------------------------------------------------------- 1 | Property Value 2 | ─────────────────────── ────────────────────────── 3 | whisk auth 4 | whisk API host https://adobeioruntime.net 5 | whisk API version v1 6 | client cert 7 | client key 8 | whisk namespace _ 9 | whisk CLI version 1.0 10 | whisk API build version 2019-02-26 11 | whisk API build number A 12 | -------------------------------------------------------------------------------- /test/__fixtures__/property/all-server-error.txt: -------------------------------------------------------------------------------- 1 | Property Value 2 | ─────────────────────── ───────────────────────────── 3 | whisk auth some-gibberish-not-a-real-key 4 | whisk API host some.host 5 | whisk API version v1 6 | client cert 7 | client key 8 | whisk namespace some_namespace 9 | whisk CLI version 1.0 10 | whisk API build version error 11 | whisk API build number error 12 | -------------------------------------------------------------------------------- /test/__fixtures__/property/all.txt: -------------------------------------------------------------------------------- 1 | Property Value 2 | ─────────────────────── ───────────────────────────── 3 | whisk auth some-gibberish-not-a-real-key 4 | whisk API host some.host 5 | whisk API version v1 6 | client cert 7 | client key 8 | whisk namespace some_namespace 9 | whisk CLI version 1.0 10 | whisk API build version 2019-02-26 11 | whisk API build number A 12 | -------------------------------------------------------------------------------- /test/__fixtures__/property/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": "2019-02-26", 3 | "buildno": "A" 4 | } -------------------------------------------------------------------------------- /test/__fixtures__/property/apibuild.txt: -------------------------------------------------------------------------------- 1 | Property Value 2 | whisk API build version 2019-02-26 3 | -------------------------------------------------------------------------------- /test/__fixtures__/property/apibuildno.txt: -------------------------------------------------------------------------------- 1 | Property Value 2 | whisk API build number A 3 | -------------------------------------------------------------------------------- /test/__fixtures__/property/apihost.txt: -------------------------------------------------------------------------------- 1 | Property Value 2 | whisk API host some.host 3 | -------------------------------------------------------------------------------- /test/__fixtures__/property/apiversion.txt: -------------------------------------------------------------------------------- 1 | Property Value 2 | whisk API version v1 3 | -------------------------------------------------------------------------------- /test/__fixtures__/property/auth.txt: -------------------------------------------------------------------------------- 1 | Property Value 2 | whisk auth some-gibberish-not-a-real-key 3 | -------------------------------------------------------------------------------- /test/__fixtures__/property/cli-override-wskprops.txt: -------------------------------------------------------------------------------- 1 | Property Value 2 | ─────────────────────── ─────────────────── 3 | whisk auth foobar 4 | whisk API host https://google.com 5 | whisk API version v12.4 6 | client cert 7 | client key 8 | whisk namespace 1234_5678 9 | whisk CLI version 1.0 10 | whisk API build version 2019-02-26 11 | whisk API build number A 12 | -------------------------------------------------------------------------------- /test/__fixtures__/property/cliversion.txt: -------------------------------------------------------------------------------- 1 | Property Value 2 | whisk CLI version 1.0 3 | -------------------------------------------------------------------------------- /test/__fixtures__/property/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "userAgent": "1.0" 3 | } -------------------------------------------------------------------------------- /test/__fixtures__/property/namespace.txt: -------------------------------------------------------------------------------- 1 | Property Value 2 | whisk namespace some_namespace 3 | -------------------------------------------------------------------------------- /test/__fixtures__/rule/delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "action": { 3 | "name": "hello", 4 | "path": "abcxyz-81khn753xw7jx" 5 | }, 6 | "annotations": [], 7 | "name": "r", 8 | "namespace": "abcxyz-81khn753xw7jx", 9 | "publish": false, 10 | "status": "inactive", 11 | "trigger": { 12 | "name": "t", 13 | "path": "abcxyz-81khn753xw7jx" 14 | }, 15 | "updated": 1581455653032, 16 | "version": "0.0.1" 17 | } 18 | -------------------------------------------------------------------------------- /test/__fixtures__/rule/get-name-sort.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "action": { 4 | "name": "foo101", 5 | "path": "53444_41603" 6 | }, 7 | "annotations": [], 8 | "name": "bsdf", 9 | "namespace": "53444_41603", 10 | "publish": false, 11 | "status": "active", 12 | "trigger": { 13 | "name": "foo2", 14 | "path": "53444_41603" 15 | }, 16 | "version": "0.0.1", 17 | "updated": 1549408742750 18 | }, 19 | { 20 | "action": { 21 | "name": "foo101", 22 | "path": "53444_41603" 23 | }, 24 | "annotations": [], 25 | "name": "csdf", 26 | "namespace": "53444_41603", 27 | "publish": false, 28 | "status": "active", 29 | "trigger": { 30 | "name": "foo2", 31 | "path": "53444_41603" 32 | }, 33 | "version": "0.0.1", 34 | "updated": 1549408743751 35 | }, 36 | { 37 | "action": { 38 | "name": "foo101", 39 | "path": "53444_41603" 40 | }, 41 | "annotations": [], 42 | "name": "xsdf", 43 | "namespace": "53444_41603", 44 | "publish": false, 45 | "status": "active", 46 | "trigger": { 47 | "name": "foo2", 48 | "path": "53444_41603" 49 | }, 50 | "version": "0.0.1", 51 | "updated": 1549408744752 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /test/__fixtures__/rule/get-public.json: -------------------------------------------------------------------------------- 1 | { 2 | "action": { 3 | "name": "foo101", 4 | "path": "53444_41603" 5 | }, 6 | "annotations": [], 7 | "name": "asdf", 8 | "namespace": "53444_41603", 9 | "publish": true, 10 | "status": "active", 11 | "trigger": { 12 | "name": "foo2", 13 | "path": "53444_41603" 14 | }, 15 | "version": "0.0.1", 16 | "updated": 1549408742750 17 | } 18 | -------------------------------------------------------------------------------- /test/__fixtures__/rule/get.json: -------------------------------------------------------------------------------- 1 | { 2 | "action": { 3 | "name": "foo101", 4 | "path": "53444_41603" 5 | }, 6 | "annotations": [], 7 | "name": "asdf", 8 | "namespace": "53444_41603", 9 | "publish": false, 10 | "status": "active", 11 | "trigger": { 12 | "name": "foo2", 13 | "path": "53444_41603" 14 | }, 15 | "version": "0.0.1", 16 | "updated": 1549408742750 17 | } 18 | -------------------------------------------------------------------------------- /test/__fixtures__/rule/list-name-sort-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Version Rules 2 | 02/05 18:19:02 active 0.0.1 bsdf 3 | 02/05 18:19:03 active 0.0.1 csdf 4 | 02/05 18:19:04 active 0.0.1 xsdf 5 | -------------------------------------------------------------------------------- /test/__fixtures__/rule/list-name-sort.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "action": { 4 | "name": "foo101", 5 | "path": "53444_41603" 6 | }, 7 | "annotations": [], 8 | "name": "csdf", 9 | "namespace": "53444_41603", 10 | "publish": false, 11 | "status": "active", 12 | "trigger": { 13 | "name": "foo2", 14 | "path": "53444_41603" 15 | }, 16 | "version": "0.0.1" 17 | }, 18 | { 19 | "action": { 20 | "name": "foo101", 21 | "path": "53444_41603" 22 | }, 23 | "annotations": [], 24 | "name": "xsdf", 25 | "namespace": "53444_41603", 26 | "publish": false, 27 | "status": "active", 28 | "trigger": { 29 | "name": "foo2", 30 | "path": "53444_41603" 31 | }, 32 | "version": "0.0.1" 33 | }, 34 | { 35 | "action": { 36 | "name": "foo101", 37 | "path": "53444_41603" 38 | }, 39 | "annotations": [], 40 | "name": "bsdf", 41 | "namespace": "53444_41603", 42 | "publish": false, 43 | "status": "active", 44 | "trigger": { 45 | "name": "foo2", 46 | "path": "53444_41603" 47 | }, 48 | "version": "0.0.1", 49 | "updated": 1549408742750 50 | } 51 | ] 52 | -------------------------------------------------------------------------------- /test/__fixtures__/rule/list-output-public.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Version Rules 2 | 02/05 18:19:02 active 0.0.1 asdf 3 | -------------------------------------------------------------------------------- /test/__fixtures__/rule/list-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Version Rules 2 | 02/05 18:19:02 active 0.0.1 asdf 3 | -------------------------------------------------------------------------------- /test/__fixtures__/rule/list-public.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "action": { 4 | "name": "foo101", 5 | "path": "53444_41603" 6 | }, 7 | "annotations": [], 8 | "name": "asdf", 9 | "namespace": "53444_41603", 10 | "publish": true, 11 | "status": "active", 12 | "trigger": { 13 | "name": "foo2", 14 | "path": "53444_41603" 15 | }, 16 | "version": "0.0.1", 17 | "updated": 1549408742750 18 | } 19 | ] 20 | -------------------------------------------------------------------------------- /test/__fixtures__/rule/list.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "action": { 4 | "name": "foo101", 5 | "path": "53444_41603" 6 | }, 7 | "annotations": [], 8 | "name": "asdf", 9 | "namespace": "53444_41603", 10 | "publish": false, 11 | "status": "active", 12 | "trigger": { 13 | "name": "foo2", 14 | "path": "53444_41603" 15 | }, 16 | "version": "0.0.1", 17 | "updated": 1549408742750 18 | } 19 | ] 20 | -------------------------------------------------------------------------------- /test/__fixtures__/trigger/annotations.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotation1": "annotation1value", 3 | "annotation2": "annotation2value" 4 | } -------------------------------------------------------------------------------- /test/__fixtures__/trigger/list-name-sort-output.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Version Trigger 2 | 11/27 09:35:19 inactive 0.0.1 a-hello 3 | 11/27 09:35:19 inactive 0.0.1 b-hello 4 | 11/27 09:35:19 inactive 0.0.1 b-hello 5 | 11/27 09:35:19 inactive 0.0.1 c-hello 6 | -------------------------------------------------------------------------------- /test/__fixtures__/trigger/list-name-sort.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "annotations": [ 4 | { 5 | "key": "exec", 6 | "value": "nodejs:10" 7 | } 8 | ], 9 | "exec": { 10 | "binary": false 11 | }, 12 | "limits": { 13 | "concurrency": 200, 14 | "logs": 10, 15 | "memory": 256, 16 | "timeout": 60000 17 | }, 18 | "name": "c-hello", 19 | "namespace": "53444_70361", 20 | "publish": false, 21 | "updated": 1569212581883, 22 | "version": "0.0.1" 23 | }, 24 | { 25 | "annotations": [ 26 | { 27 | "key": "exec", 28 | "value": "nodejs:10" 29 | } 30 | ], 31 | "exec": { 32 | "binary": false 33 | }, 34 | "limits": { 35 | "concurrency": 200, 36 | "logs": 10, 37 | "memory": 256, 38 | "timeout": 60000 39 | }, 40 | "name": "a-hello", 41 | "namespace": "53444_70361", 42 | "publish": false, 43 | "updated": 1569212545646, 44 | "version": "0.0.1" 45 | }, 46 | { 47 | "annotations": [ 48 | { 49 | "key": "exec", 50 | "value": "nodejs:10" 51 | } 52 | ], 53 | "exec": { 54 | "binary": false 55 | }, 56 | "limits": { 57 | "concurrency": 200, 58 | "logs": 10, 59 | "memory": 256, 60 | "timeout": 60000 61 | }, 62 | "name": "b-hello", 63 | "namespace": "53444_70361", 64 | "publish": false, 65 | "updated": 1569212369316, 66 | "version": "0.0.1" 67 | }, 68 | { 69 | "annotations": [ 70 | { 71 | "key": "exec", 72 | "value": "nodejs:10" 73 | } 74 | ], 75 | "exec": { 76 | "binary": false 77 | }, 78 | "limits": { 79 | "concurrency": 200, 80 | "logs": 10, 81 | "memory": 256, 82 | "timeout": 60000 83 | }, 84 | "name": "b-hello", 85 | "namespace": "53444_70361", 86 | "publish": false, 87 | "updated": 1569212379316, 88 | "version": "0.0.1" 89 | } 90 | ] -------------------------------------------------------------------------------- /test/__fixtures__/trigger/list.txt: -------------------------------------------------------------------------------- 1 | Datetime Status Version Trigger 2 | 11/27 09:35:19 2 active 0.0.1 trigger1 3 | 11/27 09:35:19 inactive 0.0.1 trigger2 4 | 11/27 09:35:19 inactive 0.0.1 trigger3 5 | -------------------------------------------------------------------------------- /test/__fixtures__/wsk.properties: -------------------------------------------------------------------------------- 1 | APIHOST=some.host 2 | NAMESPACE=some_namespace 3 | AUTH=some-gibberish-not-a-real-key -------------------------------------------------------------------------------- /test/__mocks__/@adobe/aio-lib-core-config.js: -------------------------------------------------------------------------------- 1 | const mockConfig = { 2 | get: jest.fn(), 3 | set: jest.fn(), 4 | delete: jest.fn(), 5 | reload: jest.fn(), 6 | dotenv: jest.fn(), 7 | getPipedData: jest.fn() 8 | } 9 | 10 | module.exports = mockConfig 11 | -------------------------------------------------------------------------------- /test/__mocks__/sha1.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 'xyz' 2 | -------------------------------------------------------------------------------- /test/commands/runtime/action/index.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TheCommand = require('../../../../src/commands/runtime/action/index.js') 14 | const RuntimeBaseCommand = require('../../../../src/RuntimeBaseCommand.js') 15 | const { Help } = require('@oclif/core') 16 | 17 | test('exports', async () => { 18 | expect(typeof TheCommand).toEqual('function') 19 | expect(TheCommand.prototype instanceof RuntimeBaseCommand).toBeTruthy() 20 | }) 21 | 22 | test('description', async () => { 23 | expect(TheCommand.description).toBeDefined() 24 | }) 25 | 26 | test('aliases', async () => { 27 | expect(TheCommand.aliases).toBeDefined() 28 | expect(TheCommand.aliases).toBeInstanceOf(Array) 29 | expect(TheCommand.aliases.length).toBeGreaterThan(0) 30 | }) 31 | 32 | test('args', async () => { 33 | expect(TheCommand.args).toBeUndefined() 34 | }) 35 | 36 | describe('instance methods', () => { 37 | let command 38 | 39 | beforeEach(() => { 40 | command = new TheCommand([]) 41 | }) 42 | 43 | describe('run', () => { 44 | test('exists', async () => { 45 | expect(command.run).toBeInstanceOf(Function) 46 | }) 47 | 48 | test('returns help file for runtime command', async () => { 49 | const spy = jest.spyOn(Help.prototype, 'showHelp').mockReturnValue(true) 50 | command.config = {} 51 | command.id = 'pgb' 52 | await command.run() 53 | expect(spy).toHaveBeenCalledWith(['runtime:action', '--help']) 54 | }) 55 | }) 56 | }) 57 | -------------------------------------------------------------------------------- /test/commands/runtime/activation/index.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TheCommand = require('../../../../src/commands/runtime/activation/index.js') 14 | const RuntimeBaseCommand = require('../../../../src/RuntimeBaseCommand.js') 15 | const { Help } = require('@oclif/core') 16 | 17 | test('exports', async () => { 18 | expect(typeof TheCommand).toEqual('function') 19 | expect(TheCommand.prototype instanceof RuntimeBaseCommand).toBeTruthy() 20 | }) 21 | 22 | test('description', async () => { 23 | expect(TheCommand.description).toBeDefined() 24 | }) 25 | 26 | test('aliases', async () => { 27 | expect(TheCommand.aliases).toBeDefined() 28 | expect(TheCommand.aliases).toBeInstanceOf(Array) 29 | expect(TheCommand.aliases.length).toBeGreaterThan(0) 30 | }) 31 | 32 | test('args', async () => { 33 | expect(TheCommand.args).toBeUndefined() 34 | }) 35 | 36 | describe('instance methods', () => { 37 | let command 38 | 39 | beforeEach(() => { 40 | command = new TheCommand([]) 41 | }) 42 | 43 | describe('run', () => { 44 | test('exists', async () => { 45 | expect(command.run).toBeInstanceOf(Function) 46 | }) 47 | 48 | test('returns help file for runtime command', () => { 49 | const spy = jest.spyOn(Help.prototype, 'showHelp').mockReturnValue(true) 50 | command.id = 'pgb' 51 | command.config = {} 52 | return command.run().then(() => { 53 | expect(spy).toHaveBeenCalledWith(['runtime:activation', '--help']) 54 | }) 55 | }) 56 | }) 57 | }) 58 | -------------------------------------------------------------------------------- /test/commands/runtime/api/index.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TheCommand = require('../../../../src/commands/runtime/api/index.js') 14 | const RuntimeBaseCommand = require('../../../../src/RuntimeBaseCommand.js') 15 | const { Help } = require('@oclif/core') 16 | 17 | test('exports', async () => { 18 | expect(typeof TheCommand).toEqual('function') 19 | expect(TheCommand.prototype instanceof RuntimeBaseCommand).toBeTruthy() 20 | }) 21 | 22 | test('description', async () => { 23 | expect(TheCommand.description).toBeDefined() 24 | }) 25 | 26 | test('aliases', async () => { 27 | expect(TheCommand.aliases).toBeDefined() 28 | expect(TheCommand.aliases).toBeInstanceOf(Array) 29 | expect(TheCommand.aliases.length).toBeGreaterThan(0) 30 | }) 31 | 32 | test('args', async () => { 33 | expect(TheCommand.args).toBeUndefined() 34 | }) 35 | 36 | describe('instance methods', () => { 37 | let command 38 | 39 | beforeEach(() => { 40 | command = new TheCommand([]) 41 | }) 42 | 43 | describe('run', () => { 44 | test('exists', async () => { 45 | expect(command.run).toBeInstanceOf(Function) 46 | }) 47 | 48 | test('returns help file for runtime command', () => { 49 | command.config = {} 50 | const spy = jest.spyOn(Help.prototype, 'showHelp').mockReturnValue(true) 51 | return command.run().then(() => { 52 | expect(spy).toHaveBeenCalledWith(['runtime:api', '--help']) 53 | }) 54 | }) 55 | }) 56 | }) 57 | -------------------------------------------------------------------------------- /test/commands/runtime/deploy/version.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const { stdout } = require('stdout-stderr') 14 | const TheCommand = require('../../../../src/commands/runtime/deploy/version.js') 15 | const RuntimeBaseCommand = require('../../../../src/RuntimeBaseCommand.js') 16 | 17 | test('exports', async () => { 18 | expect(typeof TheCommand).toEqual('function') 19 | expect(TheCommand.prototype instanceof RuntimeBaseCommand).toBeTruthy() 20 | }) 21 | 22 | test('description', async () => { 23 | expect(TheCommand.description).toBeDefined() 24 | }) 25 | 26 | test('aliases', async () => { 27 | expect(TheCommand.aliases).toBeDefined() 28 | expect(TheCommand.aliases).toBeInstanceOf(Array) 29 | expect(TheCommand.aliases.length).toBeGreaterThan(0) 30 | }) 31 | 32 | describe('instance methods', () => { 33 | let command 34 | 35 | beforeEach(() => { 36 | command = new TheCommand([]) 37 | }) 38 | 39 | describe('run', () => { 40 | test('exists', async () => { 41 | expect(command.run).toBeInstanceOf(Function) 42 | }) 43 | 44 | test('returns version', () => { 45 | command.config = fixtureJson('property/config.json') 46 | command.argv = [] 47 | return command.run() 48 | .then(() => { 49 | expect(stdout.output).toMatchFixture('deploy/cliversion.txt') 50 | }) 51 | }) 52 | }) 53 | }) 54 | -------------------------------------------------------------------------------- /test/commands/runtime/index.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TheCommand = require('../../../src/commands/runtime/index.js') 14 | const RuntimeBaseCommand = require('../../../src/RuntimeBaseCommand.js') 15 | const { Help } = require('@oclif/core') 16 | 17 | test('exports', async () => { 18 | expect(typeof TheCommand).toEqual('function') 19 | expect(TheCommand.prototype instanceof RuntimeBaseCommand).toBeTruthy() 20 | }) 21 | 22 | test('description', async () => { 23 | expect(TheCommand.description).toBeDefined() 24 | }) 25 | 26 | test('aliases', async () => { 27 | expect(TheCommand.aliases).toBeDefined() 28 | expect(TheCommand.aliases).toBeInstanceOf(Array) 29 | expect(TheCommand.aliases.length).toBeGreaterThan(0) 30 | }) 31 | 32 | test('flags', async () => { 33 | expect(Object.keys(TheCommand.flags)).toMatchObject(Object.keys(RuntimeBaseCommand.flags)) 34 | }) 35 | 36 | test('args', async () => { 37 | expect(TheCommand.args).toBeUndefined() 38 | }) 39 | 40 | describe('instance methods', () => { 41 | let command 42 | 43 | beforeEach(() => { 44 | command = new TheCommand([]) 45 | }) 46 | 47 | describe('run', () => { 48 | test('exists', async () => { 49 | expect(command.run).toBeInstanceOf(Function) 50 | }) 51 | 52 | test('returns help file for runtime command', () => { 53 | const spy = jest.spyOn(Help.prototype, 'showHelp').mockReturnValue(true) 54 | command.config = {} 55 | return command.run().then(() => { 56 | expect(spy).toHaveBeenCalledWith(['runtime', '--help']) 57 | }) 58 | }) 59 | }) 60 | }) 61 | -------------------------------------------------------------------------------- /test/commands/runtime/namespace/index.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TheCommand = require('../../../../src/commands/runtime/namespace/index.js') 14 | const RuntimeBaseCommand = require('../../../../src/RuntimeBaseCommand.js') 15 | const { Help } = require('@oclif/core') 16 | 17 | test('exports', async () => { 18 | expect(typeof TheCommand).toEqual('function') 19 | expect(TheCommand.prototype instanceof RuntimeBaseCommand).toBeTruthy() 20 | }) 21 | 22 | test('description', async () => { 23 | expect(TheCommand.description).toBeDefined() 24 | }) 25 | 26 | test('aliases', async () => { 27 | expect(TheCommand.aliases).toBeDefined() 28 | expect(TheCommand.aliases).toBeInstanceOf(Array) 29 | expect(TheCommand.aliases.length).toBeGreaterThan(0) 30 | }) 31 | 32 | test('args', async () => { 33 | expect(TheCommand.args).toBeUndefined() 34 | }) 35 | 36 | describe('instance methods', () => { 37 | let command 38 | 39 | beforeEach(() => { 40 | command = new TheCommand([]) 41 | }) 42 | 43 | describe('run', () => { 44 | test('exists', async () => { 45 | expect(command.run).toBeInstanceOf(Function) 46 | }) 47 | 48 | test('returns help file for runtime command', () => { 49 | command.config = {} 50 | const spy = jest.spyOn(Help.prototype, 'showHelp').mockReturnValue(true) 51 | return command.run().then(() => { 52 | expect(spy).toHaveBeenCalledWith(['runtime:namespace', '--help']) 53 | }) 54 | }) 55 | }) 56 | }) 57 | -------------------------------------------------------------------------------- /test/commands/runtime/namespace/log-forwarding/errors.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeLib = require('@adobe/aio-lib-runtime') 14 | const TheCommand = require('../../../../../src/commands/runtime/namespace/log-forwarding/errors') 15 | const { stdout } = require('stdout-stderr') 16 | 17 | let command, rtLib 18 | beforeEach(async () => { 19 | command = new TheCommand([]) 20 | rtLib = await RuntimeLib.init({ apihost: 'fakehost', api_key: 'fakekey' }) 21 | }) 22 | 23 | test('get log forwarding errors', () => { 24 | return new Promise(resolve => { 25 | rtLib.logForwarding.getErrors = jest.fn().mockReturnValue(fixtureJson('namespace/log-forwarding/errors-remote.json')) 26 | return command.run() 27 | .then(() => { 28 | expect(stdout.output).toMatchFixtureIgnoreWhite('namespace/log-forwarding/errors-result.txt') 29 | resolve() 30 | }) 31 | }) 32 | }) 33 | 34 | test.each([ 35 | [ 36 | 'no errors', 37 | { configured_forwarder: 'destination', errors: [] }, 38 | "No log forwarding errors for the last configured destination 'destination'\n" 39 | ], 40 | [ 41 | 'empty response', 42 | { }, 43 | 'No log forwarding errors\n' 44 | ] 45 | ])('get log forwarding errors (%s)', (test, libResponse, expected) => { 46 | return new Promise(resolve => { 47 | rtLib.logForwarding.getErrors = jest.fn().mockResolvedValue(libResponse) 48 | return command.run() 49 | .then(() => { 50 | expect(stdout.output).toBe(expected) 51 | resolve() 52 | }) 53 | }) 54 | }) 55 | 56 | test('failed to get log forwarding errors', async () => { 57 | rtLib.logForwarding.getErrors = jest.fn().mockRejectedValue(new Error('mocked error')) 58 | await expect(command.run()).rejects.toThrow('Failed to get log forwarding errors: mocked error') 59 | }) 60 | -------------------------------------------------------------------------------- /test/commands/runtime/namespace/log-forwarding/get.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeLib = require('@adobe/aio-lib-runtime') 14 | const TheCommand = require('../../../../../src/commands/runtime/namespace/log-forwarding/get') 15 | const { stdout } = require('stdout-stderr') 16 | 17 | let command, rtLib 18 | beforeEach(async () => { 19 | command = new TheCommand([]) 20 | rtLib = await RuntimeLib.init({ apihost: 'fakehost', api_key: 'fakekey' }) 21 | }) 22 | 23 | test('get log forwarding settings', () => { 24 | return new Promise(resolve => { 25 | rtLib.logForwarding.get = jest.fn().mockReturnValue(fixtureJson('namespace/log-forwarding/get-remote.json')) 26 | return command.run() 27 | .then(() => { 28 | expect(stdout.output).toMatchFixtureIgnoreWhite('namespace/log-forwarding/get-result.txt') 29 | resolve() 30 | }) 31 | }) 32 | }) 33 | 34 | test('failed to get log forwarding settings', async () => { 35 | rtLib.logForwarding.get = jest.fn().mockRejectedValue(new Error('mocked error')) 36 | await expect(command.run()).rejects.toThrow('failed to get log forwarding configuration: mocked error') 37 | }) 38 | -------------------------------------------------------------------------------- /test/commands/runtime/namespace/log-forwarding/index.test.js: -------------------------------------------------------------------------------- 1 | const TheCommand = require('../../../../../src/commands/runtime/namespace/log-forwarding/index') 2 | const { Help } = require('@oclif/core') 3 | 4 | test('returns help for log-forwarding commands', () => { 5 | const spy = jest.spyOn(Help.prototype, 'showHelp').mockReturnValue(true) 6 | const command = new TheCommand([]) 7 | command.config = {} 8 | return command.run().then(() => { 9 | expect(spy).toHaveBeenCalledWith(['runtime:namespace:log-forwarding', '--help']) 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /test/commands/runtime/namespace/log-forwarding/set/adobe-io-runtime.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeLib = require('@adobe/aio-lib-runtime') 14 | const TheCommand = require('../../../../../../src/commands/runtime/namespace/log-forwarding/set/adobe-io-runtime') 15 | const { stdout } = require('stdout-stderr') 16 | 17 | let command, rtLib 18 | beforeEach(async () => { 19 | command = new TheCommand([]) 20 | rtLib = await RuntimeLib.init({ apihost: 'fakehost', api_key: 'fakekey' }) 21 | }) 22 | 23 | test('set log forwarding settings to adobe_io_runtime', () => { 24 | return new Promise(resolve => { 25 | const setCall = jest.fn() 26 | rtLib.logForwarding.setDestination = setCall 27 | return command.run() 28 | .then(() => { 29 | expect(stdout.output).toMatch(/Log forwarding was set to adobe_io_runtime for this namespace/) 30 | expect(setCall).toHaveBeenCalledTimes(1) 31 | expect(setCall).toHaveBeenCalledWith('adobe_io_runtime', {}) 32 | resolve() 33 | }) 34 | }) 35 | }) 36 | 37 | test('failed to set log forwarding settings to adobe_io_runtime', async () => { 38 | rtLib.logForwarding.setDestination = jest.fn().mockRejectedValue(new Error('mocked error')) 39 | await expect(command.run()).rejects.toThrow('failed to update log forwarding configuration: mocked error') 40 | }) 41 | -------------------------------------------------------------------------------- /test/commands/runtime/namespace/log-forwarding/set/azure-log-analytics.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeLib = require('@adobe/aio-lib-runtime') 14 | const TheCommand = require('../../../../../../src/commands/runtime/namespace/log-forwarding/set/azure-log-analytics') 15 | const { stdout } = require('stdout-stderr') 16 | 17 | let command, rtLib 18 | beforeEach(async () => { 19 | command = new TheCommand([]) 20 | rtLib = await RuntimeLib.init({ apihost: 'fakehost', api_key: 'fakekey' }) 21 | }) 22 | 23 | test('set log forwarding settings to azure_log_analytics', () => { 24 | return new Promise(resolve => { 25 | const setCall = jest.fn() 26 | rtLib.logForwarding.setDestination = setCall 27 | command.argv = ['--customer-id', 'customer1', '--shared-key', 'key1', '--log-type', 'mylog'] 28 | return command.run() 29 | .then(() => { 30 | expect(stdout.output).toMatch(/Log forwarding was set to azure_log_analytics for this namespace/) 31 | expect(setCall).toHaveBeenCalledTimes(1) 32 | expect(setCall).toHaveBeenCalledWith('azure_log_analytics', { customer_id: 'customer1', shared_key: 'key1', log_type: 'mylog' }) 33 | resolve() 34 | }) 35 | }) 36 | }) 37 | 38 | test('failed to set log forwarding settings to azure_log_analytics', async () => { 39 | rtLib.logForwarding.setDestination = jest.fn().mockRejectedValue(new Error('mocked error')) 40 | command.argv = ['--customer-id', 'customer1', '--shared-key', 'key1', '--log-type', 'mylog'] 41 | await expect(command.run()).rejects.toThrow('failed to update log forwarding configuration: mocked error') 42 | }) 43 | -------------------------------------------------------------------------------- /test/commands/runtime/namespace/log-forwarding/set/new-relic-runtime.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeLib = require('@adobe/aio-lib-runtime') 14 | const TheCommand = require('../../../../../../src/commands/runtime/namespace/log-forwarding/set/new-relic') 15 | const { stdout } = require('stdout-stderr') 16 | 17 | let command, rtLib 18 | beforeEach(async () => { 19 | command = new TheCommand([]) 20 | rtLib = await RuntimeLib.init({ apihost: 'fakehost', api_key: 'fakekey' }) 21 | }) 22 | 23 | test('set log forwarding settings to new_relic', () => { 24 | return new Promise(resolve => { 25 | const setCall = jest.fn() 26 | rtLib.logForwarding.setDestination = setCall 27 | command.argv = ['--base-uri', 'uri1', '--license-key', 'key1'] 28 | return command.run() 29 | .then(() => { 30 | expect(stdout.output).toMatch(/Log forwarding was set to new_relic for this namespace/) 31 | expect(setCall).toHaveBeenCalledTimes(1) 32 | expect(setCall).toHaveBeenCalledWith('new_relic', { base_uri: 'uri1', license_key: 'key1' }) 33 | resolve() 34 | }) 35 | }) 36 | }) 37 | 38 | test('failed to set log forwarding settings to new_relic', async () => { 39 | rtLib.logForwarding.setDestination = jest.fn().mockRejectedValue(new Error('mocked error')) 40 | command.argv = ['--base-uri', 'uri1', '--license-key', 'key1'] 41 | await expect(command.run()).rejects.toThrow('failed to update log forwarding configuration: mocked error') 42 | }) 43 | -------------------------------------------------------------------------------- /test/commands/runtime/namespace/log-forwarding/set/splunk-hec.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const RuntimeLib = require('@adobe/aio-lib-runtime') 14 | const TheCommand = require('../../../../../../src/commands/runtime/namespace/log-forwarding/set/splunk-hec') 15 | const { stdout } = require('stdout-stderr') 16 | 17 | let command, rtLib 18 | beforeEach(async () => { 19 | command = new TheCommand([]) 20 | rtLib = await RuntimeLib.init({ apihost: 'fakehost', api_key: 'fakekey' }) 21 | }) 22 | 23 | test('set log forwarding settings to splunk_hec', () => { 24 | return new Promise(resolve => { 25 | const setCall = jest.fn() 26 | rtLib.logForwarding.setDestination = setCall 27 | command.argv = ['--host', 'host1', '--port', 'port1', '--index', 'index1', '--hec-token', 'token1'] 28 | return command.run() 29 | .then(() => { 30 | expect(stdout.output).toMatch(/Log forwarding was set to splunk_hec for this namespace/) 31 | expect(setCall).toHaveBeenCalledTimes(1) 32 | expect(setCall).toHaveBeenCalledWith('splunk_hec', { host: 'host1', port: 'port1', index: 'index1', hec_token: 'token1' }) 33 | resolve() 34 | }) 35 | }) 36 | }) 37 | 38 | test('failed to set log forwarding settings to splunk_hec', async () => { 39 | rtLib.logForwarding.setDestination = jest.fn().mockRejectedValue(new Error('mocked error')) 40 | command.argv = ['--host', 'host1', '--port', 'port1', '--index', 'index1', '--hec-token', 'token1'] 41 | await expect(command.run()).rejects.toThrow('failed to update log forwarding configuration: mocked error') 42 | }) 43 | -------------------------------------------------------------------------------- /test/commands/runtime/package/index.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TheCommand = require('../../../../src/commands/runtime/package/index.js') 14 | const RuntimeBaseCommand = require('../../../../src/RuntimeBaseCommand.js') 15 | const { Help } = require('@oclif/core') 16 | 17 | test('exports', async () => { 18 | expect(typeof TheCommand).toEqual('function') 19 | expect(TheCommand.prototype instanceof RuntimeBaseCommand).toBeTruthy() 20 | }) 21 | 22 | test('description', async () => { 23 | expect(TheCommand.description).toBeDefined() 24 | }) 25 | 26 | test('aliases', async () => { 27 | expect(TheCommand.aliases).toBeDefined() 28 | expect(TheCommand.aliases).toBeInstanceOf(Array) 29 | expect(TheCommand.aliases.length).toBeGreaterThan(0) 30 | }) 31 | 32 | test('args', async () => { 33 | expect(TheCommand.args).toBeUndefined() 34 | }) 35 | 36 | describe('instance methods', () => { 37 | let command 38 | 39 | beforeEach(() => { 40 | command = new TheCommand([]) 41 | }) 42 | 43 | describe('run', () => { 44 | test('exists', async () => { 45 | expect(command.run).toBeInstanceOf(Function) 46 | }) 47 | 48 | test('returns help file for runtime command', async () => { 49 | const spy = jest.spyOn(Help.prototype, 'showHelp').mockReturnValue(true) 50 | command.id = 'pgb' 51 | command.config = {} 52 | await command.run() 53 | expect(spy).toHaveBeenCalledWith(['runtime:package', '--help']) 54 | }) 55 | }) 56 | }) 57 | -------------------------------------------------------------------------------- /test/commands/runtime/property/index.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TheCommand = require('../../../../src/commands/runtime/property/index.js') 14 | const RuntimeBaseCommand = require('../../../../src/RuntimeBaseCommand.js') 15 | const { Help } = require('@oclif/core') 16 | 17 | test('exports', async () => { 18 | expect(typeof TheCommand).toEqual('function') 19 | expect(TheCommand.prototype instanceof RuntimeBaseCommand).toBeTruthy() 20 | }) 21 | 22 | test('description', async () => { 23 | expect(TheCommand.description).toBeDefined() 24 | }) 25 | 26 | test('aliases', async () => { 27 | expect(TheCommand.aliases).toBeDefined() 28 | expect(TheCommand.aliases).toBeInstanceOf(Array) 29 | expect(TheCommand.aliases.length).toBeGreaterThan(0) 30 | }) 31 | 32 | test('flags', async () => { 33 | expect(Object.keys(TheCommand.flags)).toMatchObject(Object.keys(RuntimeBaseCommand.flags)) 34 | }) 35 | 36 | test('args', async () => { 37 | expect(TheCommand.args).toBeUndefined() 38 | }) 39 | 40 | describe('instance methods', () => { 41 | let command 42 | 43 | beforeEach(() => { 44 | command = new TheCommand([]) 45 | }) 46 | 47 | describe('run', () => { 48 | test('exists', async () => { 49 | expect(command.run).toBeInstanceOf(Function) 50 | }) 51 | 52 | test('returns help file for runtime:trigger command', () => { 53 | command.config = {} 54 | const spy = jest.spyOn(Help.prototype, 'showHelp').mockReturnValue(true) 55 | return command.run().then(() => { 56 | expect(spy).toHaveBeenCalledWith(['runtime:property', '--help']) 57 | }) 58 | }) 59 | }) 60 | }) 61 | -------------------------------------------------------------------------------- /test/commands/runtime/rule/index.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TheCommand = require('../../../../src/commands/runtime/rule/index.js') 14 | const RuntimeBaseCommand = require('../../../../src/RuntimeBaseCommand.js') 15 | const { Help } = require('@oclif/core') 16 | 17 | test('exports', async () => { 18 | expect(typeof TheCommand).toEqual('function') 19 | expect(TheCommand.prototype instanceof RuntimeBaseCommand).toBeTruthy() 20 | }) 21 | 22 | test('description', async () => { 23 | expect(TheCommand.description).toBeDefined() 24 | }) 25 | 26 | test('aliases', async () => { 27 | expect(TheCommand.aliases).toBeDefined() 28 | expect(TheCommand.aliases).toBeInstanceOf(Array) 29 | expect(TheCommand.aliases.length).toBeGreaterThan(0) 30 | }) 31 | 32 | test('args', async () => { 33 | expect(TheCommand.args).toBeUndefined() 34 | }) 35 | 36 | describe('instance methods', () => { 37 | let command 38 | 39 | beforeEach(() => { 40 | command = new TheCommand([]) 41 | }) 42 | 43 | describe('run', () => { 44 | test('exists', async () => { 45 | expect(command.run).toBeInstanceOf(Function) 46 | }) 47 | 48 | test('returns help file for runtime command', () => { 49 | const spy = jest.spyOn(Help.prototype, 'showHelp').mockReturnValue(true) 50 | command.config = {} 51 | return command.run().then(() => { 52 | expect(spy).toHaveBeenCalledWith(['runtime:rule', '--help']) 53 | }) 54 | }) 55 | }) 56 | }) 57 | -------------------------------------------------------------------------------- /test/commands/runtime/trigger/index.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TheCommand = require('../../../../src/commands/runtime/trigger/index.js') 14 | const RuntimeBaseCommand = require('../../../../src/RuntimeBaseCommand.js') 15 | const { Help } = require('@oclif/core') 16 | 17 | test('exports', async () => { 18 | expect(typeof TheCommand).toEqual('function') 19 | expect(TheCommand.prototype instanceof RuntimeBaseCommand).toBeTruthy() 20 | }) 21 | 22 | test('description', async () => { 23 | expect(TheCommand.description).toBeDefined() 24 | }) 25 | 26 | test('aliases', async () => { 27 | expect(TheCommand.aliases).toBeDefined() 28 | expect(TheCommand.aliases).toBeInstanceOf(Array) 29 | expect(TheCommand.aliases.length).toBeGreaterThan(0) 30 | }) 31 | 32 | test('flags', async () => { 33 | expect(Object.keys(TheCommand.flags)).toMatchObject(Object.keys(RuntimeBaseCommand.flags)) 34 | }) 35 | 36 | test('args', async () => { 37 | expect(TheCommand.args).toBeUndefined() 38 | }) 39 | 40 | describe('instance methods', () => { 41 | let command 42 | 43 | beforeEach(() => { 44 | command = new TheCommand([]) 45 | }) 46 | 47 | describe('run', () => { 48 | test('exists', async () => { 49 | expect(command.run).toBeInstanceOf(Function) 50 | }) 51 | 52 | test('returns help file for runtime:trigger command', () => { 53 | const spy = jest.spyOn(Help.prototype, 'showHelp').mockReturnValue(true) 54 | command.config = {} 55 | return command.run().then(() => { 56 | expect(spy).toHaveBeenCalledWith(['runtime:trigger', '--help']) 57 | }) 58 | }) 59 | }) 60 | }) 61 | -------------------------------------------------------------------------------- /test/decorators.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TheCommand = require('../src/decorators.js') 14 | 15 | test('standard decorators', async () => { 16 | const decorators = TheCommand.decorators(false) 17 | expect(decorators.collision).toEqual('\uD83D\uDCA5') 18 | expect(decorators.dot).toEqual('\u2024') 19 | expect(decorators.half_circle_lower).toEqual('\u25e1') 20 | expect(decorators.lock_with_key).toEqual('\uD83D\uDD10') 21 | }) 22 | 23 | test('windows decorators', async () => { 24 | const decorators = TheCommand.decorators(true) 25 | expect(decorators.collision).toEqual('') 26 | expect(decorators.dot).toEqual('') 27 | expect(decorators.half_circle_lower).toEqual('') 28 | expect(decorators.lock_with_key).toEqual('') 29 | }) 30 | -------------------------------------------------------------------------------- /test/properties.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 Adobe Inc. All rights reserved. 3 | This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. You may obtain a copy 5 | of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software distributed under 8 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | OF ANY KIND, either express or implied. See the License for the specific language 10 | governing permissions and limitations under the License. 11 | */ 12 | 13 | const TheHelper = require('../src/properties.js') 14 | 15 | test('exports', async () => { 16 | expect(typeof TheHelper).toEqual('object') 17 | expect(typeof TheHelper.propertiesFile).toEqual('function') 18 | expect(typeof TheHelper.PropertyKey).toEqual('object') 19 | expect(typeof TheHelper.PropertyEnv).toEqual('object') 20 | expect(typeof TheHelper.PropertyDefault).toEqual('object') 21 | }) 22 | 23 | test('propertiesFile', () => { 24 | const properties = TheHelper.propertiesFile() 25 | expect(typeof properties.save).toEqual('function') 26 | }) 27 | --------------------------------------------------------------------------------