Skip to content

Commit

Permalink
[Integration] Initial implementation of AWS::RDS::Integration
Browse files Browse the repository at this point in the history
Contract tests are not passing yet but the basic functionality works.

Co-authored-by: Valentin Shirshov <[email protected]>
  • Loading branch information
wbkang and Valentin Shirshov committed Nov 21, 2023
1 parent 3d17c43 commit 3849b75
Show file tree
Hide file tree
Showing 31 changed files with 2,399 additions and 0 deletions.
25 changes: 25 additions & 0 deletions aws-rds-integration/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# macOS
.DS_Store
._*

# Maven outputs
.classpath
/aws-rds-integration.zip

# IntelliJ
*.iml
.idea
out.java
out/
.settings
.project

# auto-generated files
target/
/build/

# our logs
rpdk.log

# contains credentials
sam-tests/
20 changes: 20 additions & 0 deletions aws-rds-integration/.rpdk-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"artifact_type": "RESOURCE",
"typeName": "AWS::RDS::Integration",
"language": "java",
"runtime": "java8",
"entrypoint": "software.amazon.rds.integration.HandlerWrapper::handleRequest",
"testEntrypoint": "software.amazon.rds.integration.HandlerWrapper::testEntrypoint",
"settings": {
"namespace": [
"software",
"amazon",
"rds",
"integration"
],
"codegen_template_path": "guided_aws",
"protocolVersion": "2.0.0"
},
"logProcessorEnabled": "true",
"executableEntrypoint": "software.amazon.rds.integration.HandlerWrapperExecutable"
}
12 changes: 12 additions & 0 deletions aws-rds-integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# AWS::RDS::Integration

This is the resource for creating an Aurora zero-ETL integration with Redshift. The feature documentation can be found [here](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/zero-etl.html).


## Notes from RPDK

The RPDK will automatically generate the correct resource model from the schema whenever the project is built via Maven. You can also do this manually with the following command: `cfn generate`.

> Please don't modify files under `target/generated-sources/rpdk`, as they will be automatically overwritten.
The code uses [Lombok](https://projectlombok.org/), and [you may have to install IDE integrations](https://projectlombok.org/setup/overview) to enable auto-complete for Lombok-annotated classes.
153 changes: 153 additions & 0 deletions aws-rds-integration/aws-rds-integration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"typeName": "AWS::RDS::Integration",
"description": "An example resource schema demonstrating some basic constructs and validation rules.",
"sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
"properties": {
"IntegrationName": {
"description": "The name of the integration.",
"type": "string",
"minLength": 1,
"maxLength": 64
},
"Tags": {
"type": "array",
"maxItems": 50,
"uniqueItems": true,
"insertionOrder": false,
"description": "An array of key-value pairs to apply to this resource.",
"items": {
"$ref": "#/definitions/Tag"
}
},
"SourceArn": {
"type": "string",
"description": "The Amazon Resource Name (ARN) of the Aurora DB cluster to use as the source for replication."
},
"TargetArn": {
"type": "string",
"description": "The ARN of the Redshift data warehouse to use as the target for replication."
},
"IntegrationArn": {
"type": "string",
"description": "The ARN of the integration."
},
"KMSKeyId": {
"type": "string",
"description": "The AWS Key Management System (AWS KMS) key identifier for the key used to to encrypt the integration. The resource accepts any form of KeyId that is accepted by the KMS API DescribeKey. The key ID and alias name forms can be used if the KMS key is owned by te same account. If the KMS key belongs to a different account than the calling account, the full key ARN must be specified."
},
"AdditionalEncryptionContext": {
"$ref": "#/definitions/EncryptionContextMap"
},
"CreateTime": {
"type": "string"
}
},
"required": [
"SourceArn",
"TargetArn",
"IntegrationName"
],
"definitions": {
"Tags": {
"type": "array",
"maxItems": 50,
"uniqueItems": true,
"insertionOrder": false,
"description": "An array of key-value pairs to apply to this resource.",
"items": {
"$ref": "#/definitions/Tag"
}
},
"Tag": {
"description": "A key-value pair to associate with a resource.",
"type": "object",
"additionalProperties": false,
"properties": {
"Key": {
"type": "string",
"description": "The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -. ",
"minLength": 1,
"maxLength": 128
},
"Value": {
"type": "string",
"description": "The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -. ",
"minLength": 0,
"maxLength": 256
}
},
"required": [
"Key"
]
},
"EncryptionContextMap": {
"type": "object",
"patternProperties": {
"^[\\s\\S]*$": {
"type": "string",
"maxLength": 131072,
"minLength": 0
}
},
"description": "An optional set of non-secret key\u2013value pairs that contains additional contextual information about the data.",
"additionalProperties": false
}
},
"propertyTransform": {
"/properties/SourceArn": "$lowercase(SourceArn)"
},
"createOnlyProperties": [
"/properties/SourceArn",
"/properties/TargetArn",
"/properties/KMSKeyId",
"/properties/AdditionalEncryptionContext"
],
"readOnlyProperties": [
"/properties/IntegrationArn",
"/properties/CreateTime"
],
"primaryIdentifier": [
"/properties/IntegrationArn"
],
"handlers": {
"create": {
"permissions": [
"rds:CreateIntegration",
"rds:DescribeIntegrations",
"rds:AddTagsToResource",
"kms:CreateGrant",
"kms:DescribeKey"
]
},
"read": {
"permissions": [
"rds:DescribeIntegrations"
]
},
"update": {
"permissions": [
"rds:DescribeIntegrations",
"rds:AddTagsToResource",
"rds:RemoveTagsFromResource"
]
},
"delete": {
"permissions": [
"rds:DeleteIntegration",
"rds:DescribeIntegrations"
]
},
"list": {
"permissions": [
"rds:DescribeIntegrations"
]
}
},
"tagging": {
"taggable": true,
"tagOnCreate": true,
"tagUpdatable": true,
"tagProperty": "/properties/Tags"
},
"additionalProperties": false
}
123 changes: 123 additions & 0 deletions aws-rds-integration/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# AWS::RDS::Integration

An example resource schema demonstrating some basic constructs and validation rules.

## Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

### JSON

<pre>
{
"Type" : "AWS::RDS::Integration",
"Properties" : {
"<a href="#integrationname" title="IntegrationName">IntegrationName</a>" : <i>String</i>,
"<a href="#tags" title="Tags">Tags</a>" : <i>[ <a href="tag.md">Tag</a>, ... ]</i>,
"<a href="#sourcearn" title="SourceArn">SourceArn</a>" : <i>String</i>,
"<a href="#targetarn" title="TargetArn">TargetArn</a>" : <i>String</i>,
"<a href="#kmskeyid" title="KMSKeyId">KMSKeyId</a>" : <i>String</i>,
"<a href="#additionalencryptioncontext" title="AdditionalEncryptionContext">AdditionalEncryptionContext</a>" : <i><a href="additionalencryptioncontext.md">AdditionalEncryptionContext</a></i>,
}
}
</pre>

### YAML

<pre>
Type: AWS::RDS::Integration
Properties:
<a href="#integrationname" title="IntegrationName">IntegrationName</a>: <i>String</i>
<a href="#tags" title="Tags">Tags</a>: <i>
- <a href="tag.md">Tag</a></i>
<a href="#sourcearn" title="SourceArn">SourceArn</a>: <i>String</i>
<a href="#targetarn" title="TargetArn">TargetArn</a>: <i>String</i>
<a href="#kmskeyid" title="KMSKeyId">KMSKeyId</a>: <i>String</i>
<a href="#additionalencryptioncontext" title="AdditionalEncryptionContext">AdditionalEncryptionContext</a>: <i><a href="additionalencryptioncontext.md">AdditionalEncryptionContext</a></i>
</pre>

## Properties

#### IntegrationName

The name of the integration.

_Required_: Yes

_Type_: String

_Minimum Length_: <code>1</code>

_Maximum Length_: <code>64</code>

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### Tags

An array of key-value pairs to apply to this resource.

_Required_: No

_Type_: List of <a href="tag.md">Tag</a>

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### SourceArn

The Amazon Resource Name (ARN) of the Aurora DB cluster to use as the source for replication.

_Required_: Yes

_Type_: String

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

#### TargetArn

The ARN of the Redshift data warehouse to use as the target for replication.

_Required_: Yes

_Type_: String

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

#### KMSKeyId

The AWS Key Management System (AWS KMS) key identifier for the key used to to encrypt the integration. The resource accepts any form of KeyId that is accepted by the KMS API DescribeKey. The key ID and alias name forms can be used if the KMS key is owned by te same account. If the KMS key belongs to a different account than the calling account, the full key ARN must be specified.

_Required_: No

_Type_: String

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

#### AdditionalEncryptionContext

An optional set of non-secret key–value pairs that contains additional contextual information about the data.

_Required_: No

_Type_: <a href="additionalencryptioncontext.md">AdditionalEncryptionContext</a>

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return Values

### Ref

When you pass the logical ID of this resource to the intrinsic `Ref` function, Ref returns the IntegrationArn.

### Fn::GetAtt

The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the `Fn::GetAtt` intrinsic function, see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html).

#### IntegrationArn

The ARN of the integration.

#### CreateTime

Returns the <code>CreateTime</code> value.
51 changes: 51 additions & 0 deletions aws-rds-integration/docs/tag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# AWS::RDS::Integration Tag

A key-value pair to associate with a resource.

## Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

### JSON

<pre>
{
"<a href="#key" title="Key">Key</a>" : <i>String</i>,
"<a href="#value" title="Value">Value</a>" : <i>String</i>
}
</pre>

### YAML

<pre>
<a href="#key" title="Key">Key</a>: <i>String</i>
<a href="#value" title="Value">Value</a>: <i>String</i>
</pre>

## Properties

#### Key

The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.

_Required_: Yes

_Type_: String

_Minimum Length_: <code>1</code>

_Maximum Length_: <code>128</code>

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### Value

The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.

_Required_: No

_Type_: String

_Maximum Length_: <code>256</code>

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
1 change: 1 addition & 0 deletions aws-rds-integration/lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lombok.addLombokGeneratedAnnotation = true
Loading

0 comments on commit 3849b75

Please sign in to comment.