Skip to content

Commit 64f2577

Browse files
Support for triggers (#245)
* Add triggers support 1. Incorporate deployer 4.3.1 2. Use the deployer to delete functions. * Move to deployer 4.3.2 (always overwrite triggers)
1 parent ea3c754 commit 64f2577

File tree

3 files changed

+36
-26
lines changed

3 files changed

+36
-26
lines changed

package-lock.json

+19-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@adobe/aio-cli-plugin-runtime": "github:nimbella/aio-cli-plugin-runtime#v2021-11-19-1",
1818
"@adobe/aio-lib-core-config": "^2.0.0",
1919
"@adobe/aio-lib-runtime": "^3.3.0",
20-
"@nimbella/nimbella-deployer": "4.2.1",
20+
"@nimbella/nimbella-deployer": "4.3.2",
2121
"@nimbella/storage": "^0.0.7",
2222
"@oclif/command": "^1",
2323
"@oclif/config": "^1",

src/commands/action/delete.ts

+16-18
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,31 @@
1111
* governing permissions and limitations under the License.
1212
*/
1313

14-
import { inBrowser } from '@nimbella/nimbella-deployer'
1514
import { NimBaseCommand, NimLogger } from '../../NimBaseCommand'
16-
import RuntimeBaseCommand from '@adobe/aio-cli-plugin-runtime/src/RuntimeBaseCommand'
17-
import { prompt } from '../../ui'
18-
import { flags } from '@oclif/command'
19-
const AioCommand: typeof RuntimeBaseCommand = require('@adobe/aio-cli-plugin-runtime/src/commands/runtime/action/delete')
15+
import { getCredentials, authPersister, deleteAction } from '@nimbella/nimbella-deployer'
16+
import openwhisk from 'openwhisk'
2017

2118
export default class ActionDelete extends NimBaseCommand {
2219
async runCommand(rawArgv: string[], argv: string[], args: any, flags: any, logger: NimLogger): Promise<void> {
23-
if (inBrowser && flags.json) { // behave correctly when invoked from sidecar delete button
24-
if (!flags.force) {
25-
const ans = await prompt(`type 'yes' to really delete '${args.actionName}'`)
26-
if (ans !== 'yes') {
27-
logger.log('doing nothing')
28-
return
29-
}
30-
}
20+
const arg = args.actionName
21+
const creds = await getCredentials(authPersister).catch(err => logger.handleError('', err))
22+
const owClient = openwhisk(creds.ow)
23+
const deletedAction = await deleteAction(arg, owClient)
24+
if (flags.json) {
25+
logger.logJSON(deletedAction)
3126
}
32-
await this.runAio(rawArgv, argv, args, flags, logger, AioCommand)
3327
}
3428

35-
static args = AioCommand.args
29+
static args = [
30+
{
31+
name: 'actionName',
32+
required: true
33+
}
34+
]
3635

3736
static flags = {
38-
force: flags.boolean({ char: 'f', description: 'Just do it, omitting confirmatory prompt' }),
39-
...AioCommand.flags
37+
...NimBaseCommand.flags // includes json flag
4038
}
4139

42-
static description = AioCommand.description
40+
static description = 'deletes an action'
4341
}

0 commit comments

Comments
 (0)