Skip to content

Commit

Permalink
feat(aws-constructs-factories): add a factory for sqs queues (#1131)
Browse files Browse the repository at this point in the history
* Refactor buildQueue to include creating Dead Letter Queues

* Include id in dlg id, refresh integ tests

* Update for  DLQ id

* Clean up test details from DLQ id change, ignore files

* Implement construct and tests

* Inexplicable typo?!?

* Final edits

* Enable key rotation on existing key test
  • Loading branch information
biffgaut committed Jun 11, 2024
1 parent 65028ad commit b35b9b8
Show file tree
Hide file tree
Showing 240 changed files with 8,835 additions and 4,646 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,24 +211,19 @@ export class ApiGatewayToSqs extends Construct {
`'deleteRequestTemplate', 'additionalDeleteRequestTemplates', 'deleteIntegrationResponses'`);
}

// Setup the dead letter queue, if applicable
this.deadLetterQueue = defaults.buildDeadLetterQueue(this, {
existingQueueObj: props.existingQueueObj,
deployDeadLetterQueue: props.deployDeadLetterQueue,
deadLetterQueueProps: props.deadLetterQueueProps,
maxReceiveCount: props.maxReceiveCount
});

// Setup the queue
const buildQueueResponse = defaults.buildQueue(this, 'queue', {
existingQueueObj: props.existingQueueObj,
queueProps: props.queueProps,
deadLetterQueue: this.deadLetterQueue,
deployDeadLetterQueue: props.deployDeadLetterQueue,
deadLetterQueueProps: props.deadLetterQueueProps,
maxReceiveCount: props.maxReceiveCount,
enableEncryptionWithCustomerManagedKey: props.enableEncryptionWithCustomerManagedKey,
encryptionKey: props.encryptionKey,
encryptionKeyProps: props.encryptionKeyProps
});
this.sqsQueue = buildQueueResponse.queue;
this.deadLetterQueue = buildQueueResponse.dlq;

// Setup the API Gateway
const globalRestApiResponse = defaults.GlobalRestApi(this, props.apiGatewayProps, props.logGroupProps);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "36.0.0",
"files": {
"2a042bc52d33519c4d240ec0cf74ff8ef74c42183f6dd3eb7e4ab111f1923884": {
"237b55862d962ca52c24fc3d92e931335fcdc7468cd58135ac481ef86c66d367": {
"source": {
"path": "apisqs-additional-request-templates.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "2a042bc52d33519c4d240ec0cf74ff8ef74c42183f6dd3eb7e4ab111f1923884.json",
"objectKey": "237b55862d962ca52c24fc3d92e931335fcdc7468cd58135ac481ef86c66d367.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"Description": "Integration Test for aws-apigateway-sqs",
"Resources": {
"testapigatewaysqsdefaultdeadLetterQueue24467CAD": {
"testapigatewaysqsdefaultqueuedlqF08203A7": {
"Type": "AWS::SQS::Queue",
"Properties": {
"KmsMasterKeyId": "alias/aws/sqs"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"testapigatewaysqsdefaultdeadLetterQueuePolicyEF507332": {
"testapigatewaysqsdefaultqueuedlqPolicy3E4AECEE": {
"Type": "AWS::SQS::QueuePolicy",
"Properties": {
"PolicyDocument": {
Expand Down Expand Up @@ -45,7 +45,7 @@
},
"Resource": {
"Fn::GetAtt": [
"testapigatewaysqsdefaultdeadLetterQueue24467CAD",
"testapigatewaysqsdefaultqueuedlqF08203A7",
"Arn"
]
},
Expand All @@ -64,7 +64,7 @@
},
"Resource": {
"Fn::GetAtt": [
"testapigatewaysqsdefaultdeadLetterQueue24467CAD",
"testapigatewaysqsdefaultqueuedlqF08203A7",
"Arn"
]
},
Expand All @@ -75,7 +75,7 @@
},
"Queues": [
{
"Ref": "testapigatewaysqsdefaultdeadLetterQueue24467CAD"
"Ref": "testapigatewaysqsdefaultqueuedlqF08203A7"
}
]
}
Expand All @@ -87,7 +87,7 @@
"RedrivePolicy": {
"deadLetterTargetArn": {
"Fn::GetAtt": [
"testapigatewaysqsdefaultdeadLetterQueue24467CAD",
"testapigatewaysqsdefaultqueuedlqF08203A7",
"Arn"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/2a042bc52d33519c4d240ec0cf74ff8ef74c42183f6dd3eb7e4ab111f1923884.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/237b55862d962ca52c24fc3d92e931335fcdc7468cd58135ac481ef86c66d367.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand All @@ -82,16 +82,16 @@
"apisqs-additional-request-templates.assets"
],
"metadata": {
"/apisqs-additional-request-templates/test-api-gateway-sqs-default/deadLetterQueue/Resource": [
"/apisqs-additional-request-templates/test-api-gateway-sqs-default/queue-dlq/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "testapigatewaysqsdefaultdeadLetterQueue24467CAD"
"data": "testapigatewaysqsdefaultqueuedlqF08203A7"
}
],
"/apisqs-additional-request-templates/test-api-gateway-sqs-default/deadLetterQueue/Policy/Resource": [
"/apisqs-additional-request-templates/test-api-gateway-sqs-default/queue-dlq/Policy/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "testapigatewaysqsdefaultdeadLetterQueuePolicyEF507332"
"data": "testapigatewaysqsdefaultqueuedlqPolicy3E4AECEE"
}
],
"/apisqs-additional-request-templates/test-api-gateway-sqs-default/queue/Resource": [
Expand Down Expand Up @@ -189,6 +189,24 @@
"type": "aws:cdk:logicalId",
"data": "CheckBootstrapVersion"
}
],
"testapigatewaysqsdefaultdeadLetterQueue24467CAD": [
{
"type": "aws:cdk:logicalId",
"data": "testapigatewaysqsdefaultdeadLetterQueue24467CAD",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
}
],
"testapigatewaysqsdefaultdeadLetterQueuePolicyEF507332": [
{
"type": "aws:cdk:logicalId",
"data": "testapigatewaysqsdefaultdeadLetterQueuePolicyEF507332",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
}
]
},
"displayName": "apisqs-additional-request-templates"
Expand Down
Loading

0 comments on commit b35b9b8

Please sign in to comment.