Skip to content

Commit

Permalink
Merge branch 'main' into fix/stepfunctions-tasks-logs-polocy
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Oct 24, 2023
2 parents d19d3a2 + 2316877 commit 6cb06f3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/aws-cdk-lib/aws-ec2/lib/instance-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,16 @@ export enum InstanceClass {
*/
I4I = 'i4i',

/**
* Storage optimized instances powered by Graviton2 processor, 4th generation
*/
STORAGE4_GRAVITON = 'storage4_graviton',

/**
* Storage optimized instances powered by Graviton2 processor, 4th generation
*/
I4G = 'i4g',

/**
* Storage optimized instances powered by Graviton2 processor, 4th generation
*/
Expand Down Expand Up @@ -1291,6 +1301,8 @@ export class InstanceType {
[InstanceClass.I3]: 'i3',
[InstanceClass.IO3_DENSE_NVME_DRIVE]: 'i3en',
[InstanceClass.I3EN]: 'i3en',
[InstanceClass.STORAGE4_GRAVITON]: 'i4g',
[InstanceClass.I4G]: 'i4g',
[InstanceClass.STORAGE4_GRAVITON_NETWORK_OPTIMIZED]: 'im4gn',
[InstanceClass.IM4GN]: 'im4gn',
[InstanceClass.STORAGE4_GRAVITON_NETWORK_STORAGE_OPTIMIZED]: 'is4gen',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ export class CallAwsService extends sfn.TaskStateBase {
if (this.props.integrationPattern === sfn.IntegrationPattern.RUN_JOB) {
throw new Error('The RUN_JOB integration pattern is not supported for CallAwsService');
}
if (!Token.isUnresolved(this.props.action) && !this.props.action.startsWith(this.props.action[0]?.toLowerCase())) {
throw new Error(`action must be camelCase, got: ${this.props.action}`);
}
if (this.props.parameters) {
const invalidKeys = Object.keys(this.props.parameters).filter(key => !key.startsWith(key[0]?.toUpperCase()));
if (invalidKeys.length) {
throw new Error(`parameter names must be PascalCase, got: ${invalidKeys.join(', ')}`);
}
}

const iamServiceMap: Record<string, string> = {
sfn: 'states',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,30 @@ test('throws with invalid integration pattern', () => {
})).toThrow(/The RUN_JOB integration pattern is not supported for CallAwsService/);
});

test('throws if action is not camelCase', () => {
expect(() => new tasks.CallAwsService(stack, 'GetObject', {
service: 's3',
action: 'GetObject',
parameters: {
Bucket: 'my-bucket',
Key: sfn.JsonPath.stringAt('$.key'),
},
iamResources: ['*'],
})).toThrow(/action must be camelCase, got: GetObject/);
});

test('throws if parameters has keys as not PascalCase', () => {
expect(() => new tasks.CallAwsService(stack, 'GetObject', {
service: 's3',
action: 'getObject',
parameters: {
bucket: 'my-bucket',
key: sfn.JsonPath.stringAt('$.key'),
},
iamResources: ['*'],
})).toThrow(/parameter names must be PascalCase, got: bucket, key/);
});

test('can pass additional IAM statements', () => {
// WHEN
const task = new tasks.CallAwsService(stack, 'DetectLabels', {
Expand Down

0 comments on commit 6cb06f3

Please sign in to comment.