Skip to content

Add support for snapshot resource to Redshift Serverless. #75

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

Merged
merged 3 commits into from
May 14, 2025
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
26 changes: 26 additions & 0 deletions aws-redshiftserverless-snapshot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# macOS
.DS_Store
._*
*.jar
.hypothesis
example_inputs

# Maven outputs
.classpath

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

# auto-generated files
target/
# our logs
rpdk.log*
# contains credentials
sam-tests/
.pytest_cache
31 changes: 31 additions & 0 deletions aws-redshiftserverless-snapshot/.rpdk-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"artifact_type": "RESOURCE",
"typeName": "AWS::RedshiftServerless::Snapshot",
"language": "java",
"runtime": "java17",
"entrypoint": "software.amazon.redshiftserverless.snapshot.HandlerWrapper::handleRequest",
"testEntrypoint": "software.amazon.redshiftserverless.snapshot.HandlerWrapper::testEntrypoint",
"settings": {
"version": false,
"subparser_name": null,
"verbose": 0,
"force": false,
"type_name": null,
"artifact_type": null,
"endpoint_url": null,
"region": null,
"target_schemas": [],
"namespace": [
"software",
"amazon",
"redshiftserverless",
"snapshot"
],
"codegen_template_path": "guided_aws",
"protocolVersion": "2.0.0"
},
"logProcessorEnabled": "true",
"executableEntrypoint": "software.amazon.redshiftserverless.snapshot.HandlerWrapperExecutable",
"contractSettings": {},
"canarySettings": {}
}
12 changes: 12 additions & 0 deletions aws-redshiftserverless-snapshot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# AWS::RedshiftServerless::Snapshot

Congratulations on starting development! Next steps:

1. Write the JSON schema describing your resource, `aws-redshiftserverless-snapshot.json`
1. Implement your resource handlers.

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.
203 changes: 203 additions & 0 deletions aws-redshiftserverless-snapshot/aws-redshiftserverless-snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
{
"typeName": "AWS::RedshiftServerless::Snapshot",
"description": "Resource Type definition for AWS::RedshiftServerless::Snapshot Resource Type.",
"sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-redshift-serverless",
"definitions": {
"SnapshotStatus": {
"type": "string",
"enum": [
"AVAILABLE",
"CREATING",
"DELETED",
"CANCELLED",
"FAILED",
"COPYING"
]
},
"Snapshot": {
"type": "object",
"properties": {
"NamespaceArn": {
"type": "string"
},
"NamespaceName": {
"type": "string",
"maxLength": 64,
"minLength": 3,
"pattern": "^[a-z0-9-]+$"
},
"SnapshotName": {
"type": "string",
"maxLength": 64,
"minLength": 3,
"pattern": "^[a-z0-9-]+$"
},
"SnapshotCreateTime": {
"type": "string"
},
"Status": {
"$ref": "#/definitions/SnapshotStatus"
},
"AdminUsername": {
"type": "string"
},
"KmsKeyId": {
"type": "string"
},
"OwnerAccount": {
"type": "string"
},
"RetentionPeriod": {
"type": "integer"
},
"SnapshotArn": {
"type": "string"
}
},
"additionalProperties": false
},
"Tag": {
"type": "object",
"properties": {
"Key": {
"type": "string",
"maxLength": 128,
"minLength": 1
},
"Value": {
"type": "string",
"maxLength": 256,
"minLength": 0
}
},
"required": [
"Key",
"Value"
],
"additionalProperties": false
}
},
"properties": {
"SnapshotName": {
"description": "The name of the snapshot.",
"type": "string",
"pattern": "^(?=^[a-z0-9-]+$).{3,64}$",
"maxLength": 64,
"minLength": 3
},
"NamespaceName": {
"description": "The namespace the snapshot is associated with.",
"type": "string",
"pattern": "^(?=^[a-z0-9-]+$).{3,64}$",
"maxLength": 64,
"minLength": 3
},
"OwnerAccount": {
"description": "The owner account of the snapshot.",
"type": "string"
},
"RetentionPeriod": {
"description": "The retention period of the snapshot.",
"type": "integer"
},
"Tags": {
"description": "An array of key-value pairs to apply to this resource.",
"type": "array",
"insertionOrder": false,
"items": {
"$ref": "#/definitions/Tag"
},
"maxItems": 200,
"minItems": 0
},
"Snapshot": {
"description": "Definition for snapshot resource",
"$ref": "#/definitions/Snapshot"
}
},
"tagging": {
"taggable": true,
"tagOnCreate": true,
"tagUpdatable": false,
"cloudFormationSystemTags": false,
"tagProperty": "/properties/Tags",
"permissions": [
"redshift-serverless:ListTagsForResource",
"redshift-serverless:TagResource",
"redshift-serverless:UntagResource"
]
},
"required": [
"SnapshotName"
],
"createOnlyProperties": [
"/properties/NamespaceName",
"/properties/SnapshotName",
"/properties/Tags",
"/properties/Tags/*/Key",
"/properties/Tags/*/Value"
],
"readOnlyProperties": [
"/properties/Snapshot",
"/properties/OwnerAccount",
"/properties/Snapshot/SnapshotName",
"/properties/Snapshot/NamespaceName",
"/properties/Snapshot/NamespaceArn",
"/properties/Snapshot/SnapshotArn",
"/properties/Snapshot/SnapshotCreateTime",
"/properties/Snapshot/Status",
"/properties/Snapshot/AdminUsername",
"/properties/Snapshot/KmsKeyId",
"/properties/Snapshot/OwnerAccount",
"/properties/Snapshot/RetentionPeriod"
],
"primaryIdentifier": [
"/properties/SnapshotName"
],
"handlers": {
"create": {
"permissions": [
"redshift-serverless:CreateSnapshot",
"redshift-serverless:GetSnapshot",
"redshift-serverless:ListTagsForResource",
"redshift-serverless:TagResource",
"redshift-serverless:GetNamespace"
]
},
"read": {
"permissions": [
"redshift-serverless:GetSnapshot",
"redshift-serverless:ListTagsForResource",
"redshift-serverless:GetNamespace"
]
},
"update": {
"permissions": [
"redshift-serverless:UpdateSnapshot",
"redshift-serverless:GetSnapshot",
"redshift-serverless:ListTagsForResource",
"redshift-serverless:TagResource",
"redshift-serverless:UntagResource",
"redshift-serverless:GetNamespace"
]
},
"delete": {
"permissions": [
"redshift-serverless:DeleteSnapshot",
"redshift-serverless:GetSnapshot",
"redshift-serverless:ListTagsForResource",
"redshift-serverless:UntagResource",
"redshift-serverless:GetNamespace"
]
},
"list": {
"permissions": [
"redshift-serverless:ListSnapshots",
"redshift-serverless:GetSnapshot",
"redshift-serverless:ListTagsForResource",
"redshift-serverless:GetNamespace"
]
}
},
"additionalProperties": false
}
Loading