Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into sm-g6-instance-support
Browse files Browse the repository at this point in the history
mergify[bot] authored Jul 29, 2024
2 parents b970a1a + da2ec75 commit e99b020
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/aws-cdk-lib/aws-ecs/lib/container-image.ts
Original file line number Diff line number Diff line change
@@ -18,6 +18,8 @@ export abstract class ContainerImage {

/**
* Reference an image in an ECR repository
*
* @param tag If you don't specify this parameter, `latest` is used as default.
*/
public static fromEcrRepository(repository: ecr.IRepository, tag: string = 'latest') {
return new EcrImage(repository, tag);
7 changes: 7 additions & 0 deletions packages/aws-cdk-lib/aws-sns/lib/topic.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,9 @@ export interface TopicProps {
/**
* A developer-defined string that can be used to identify this SNS topic.
*
* The display name must be maximum 100 characters long, including hyphens (-),
* underscores (_), spaces, and tabs.
*
* @default None
*/
readonly displayName?: string;
@@ -296,6 +299,10 @@ export class Topic extends TopicBase {
throw new Error(`signatureVersion must be "1" or "2", received: "${props.signatureVersion}"`);
}

if (props.displayName && !Token.isUnresolved(props.displayName) && props.displayName.length > 100) {
throw new Error(`displayName must be less than or equal to 100 characters, got ${props.displayName.length}`);
}

const resource = new CfnTopic(this, 'Resource', {
archivePolicy: props.messageRetentionPeriodInDays ? {
MessageRetentionPeriod: props.messageRetentionPeriodInDays,
10 changes: 10 additions & 0 deletions packages/aws-cdk-lib/aws-sns/test/sns.test.ts
Original file line number Diff line number Diff line change
@@ -176,6 +176,16 @@ describe('Topic', () => {
signatureVersion: '3',
})).toThrow(/signatureVersion must be "1" or "2", received: "3"/);
});

test('throw error when displayName is too long', () => {
const stack = new cdk.Stack();

expect(() => {
new sns.Topic(stack, 'MyTopic', {
displayName: 'a'.repeat(101),
});
}).toThrow('displayName must be less than or equal to 100 characters, got 101');
});
});

test('can add a policy to the topic', () => {

0 comments on commit e99b020

Please sign in to comment.