MCPcopy
hub / github.com/serverless/serverless / constructor

Method constructor

packages/serverless/lib/plugins/aws/invoke.js:9–38  ·  view source on GitHub ↗
(serverless, options, pluginUtils)

Source from the content-addressed store, hash-verified

7
8class 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(

Callers

nothing calls this directly

Calls 5

extendedValidateMethod · 0.95
logMethod · 0.95
invokeMethod · 0.95
getProviderMethod · 0.45
noticeMethod · 0.45

Tested by

no test coverage detected