(serverless, options, pluginUtils)
| 7 | |
| 8 | class AwsInvoke { |
| 9 | constructor(serverless, options, pluginUtils) { |
| 10 | this.serverless = serverless |
| 11 | this.options = options || {} |
| 12 | this.provider = this.serverless.getProvider('aws') |
| 13 | this.logger = pluginUtils.log |
| 14 | this.progress = pluginUtils.progress |
| 15 | |
| 16 | Object.assign(this, validate) |
| 17 | |
| 18 | this.hooks = { |
| 19 | 'invoke:invoke': async () => { |
| 20 | // Ensure at least one of --function or --agent is provided |
| 21 | if (!this.options.function && !this.options.agent) { |
| 22 | throw new ServerlessError( |
| 23 | 'One of the required options must be provided: --function (-f) or --agent (-a)', |
| 24 | 'INVOKE_MISSING_OPTION', |
| 25 | ) |
| 26 | } |
| 27 | |
| 28 | // Skip if --agent is provided (handled by invoke-agent plugin) |
| 29 | if (this.options.agent) { |
| 30 | return |
| 31 | } |
| 32 | |
| 33 | this.progress.notice('Invoking function') |
| 34 | await this.extendedValidate() |
| 35 | this.log(await this.invoke()) |
| 36 | }, |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | async validateFile(key) { |
| 41 | const absolutePath = path.resolve( |
nothing calls this directly
no test coverage detected