Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use InputPayload for ssm entry of aws:invokeLambdaFunction #58

Merged
merged 2 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -9294,7 +9294,6 @@ new InvokeLambdaFunctionStep(scope: Construct, id: string, props: InvokeLambdaFu
| <code><a href="#@cdklabs/cdk-ssm-documents.InvokeLambdaFunctionStep.addToDocument">addToDocument</a></code> | *No description.* |
| <code><a href="#@cdklabs/cdk-ssm-documents.InvokeLambdaFunctionStep.listUserOutputs">listUserOutputs</a></code> | Lists the outputs defined by the user for this step. |
| <code><a href="#@cdklabs/cdk-ssm-documents.InvokeLambdaFunctionStep.variables">variables</a></code> | *No description.* |
| <code><a href="#@cdklabs/cdk-ssm-documents.InvokeLambdaFunctionStep.formatInputMap">formatInputMap</a></code> | *No description.* |

---

Expand Down Expand Up @@ -9356,12 +9355,6 @@ Lists the outputs defined by the user for this step.
public variables(): {[ key: string ]: any}
```

##### `formatInputMap` <a name="formatInputMap" id="@cdklabs/cdk-ssm-documents.InvokeLambdaFunctionStep.formatInputMap"></a>

```typescript
public formatInputMap(): {[ key: string ]: any}
```

#### Static Functions <a name="Static Functions" id="Static Functions"></a>

| **Name** | **Description** |
Expand Down
4 changes: 2 additions & 2 deletions src/parent-steps/automation/invoke-lambda-function-step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ export class InvokeLambdaFunctionStep extends AutomationStep {
return super.prepareSsmEntry(entries);
}

public formatInputMap(): Record<string, any> {
private formatInputMap(): Record<string, any> {
return {
FunctionName: this.functionName,
Qualifier: this.qualifier,
InvocationType: this.invocationType,
LogType: this.logType,
ClientContext: this.clientContext,
Payload: this.payload,
InputPayload: this.payload,
};
}
}
13 changes: 12 additions & 1 deletion src/simulation/automation/invoke-lambda-function-simulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class InvokeLambdaFunctionSimulation extends AutomationSimulationBase {
}

public executeStep(inputs: Record<string, any>): Record<string, any> {
const inputMap = this.invokeLambdaFunctionStep.formatInputMap();
const inputMap = this.formatInputMap();
const stepInputs = pruneAndTransformRecord(inputMap, x => x.resolve(inputs));
stepInputs.InvocationType = stepInputs.InvocationType ?? 'RequestResponse';
stepInputs.LogType = stepInputs.LogType ?? 'Tail';
Expand Down Expand Up @@ -55,4 +55,15 @@ export class InvokeLambdaFunctionSimulation extends AutomationSimulationBase {
};
}

private formatInputMap(): Record<string, any> {
const step = this.invokeLambdaFunctionStep;
return {
FunctionName: step.functionName,
Qualifier: step.qualifier,
InvocationType: step.invocationType,
LogType: step.logType,
ClientContext: step.clientContext,
Payload: step.payload,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('InvokeLambdaFunctionStep', () => {
InvocationType: 'type',
LogType: 'none',
ClientContext: 'context',
Payload: { a: 1 },
InputPayload: { a: 1 },
},
name: 'id2',
});
Expand Down