From 7265d8e124b887421da28f3e654b8ec94334f589 Mon Sep 17 00:00:00 2001 From: Axel Pavageau Date: Tue, 17 Mar 2020 13:59:03 +0100 Subject: [PATCH] Adding new AWS::Cassandra resources, per March 16 2020 update --- README.rst | 1 + troposphere/cassandra.py | 79 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 troposphere/cassandra.py diff --git a/README.rst b/README.rst index 4ebc1afc9..5d5f3f160 100644 --- a/README.rst +++ b/README.rst @@ -161,6 +161,7 @@ Currently supported AWS resource types - `AWS::AutoScalingPlans`_ - `AWS::Batch`_ - `AWS::Budgets`_ +- `AWS::Cassandra`_ - `AWS::CertificateManager`_ - `AWS::Cloud9`_ - `AWS::CloudFormation`_ diff --git a/troposphere/cassandra.py b/troposphere/cassandra.py new file mode 100644 index 000000000..41f625ce0 --- /dev/null +++ b/troposphere/cassandra.py @@ -0,0 +1,79 @@ +# Copyright (c) 2012-2020, Mark Peek +# All rights reserved. +# +# See LICENSE file for full license. +# +# *** Do not modify - this file is autogenerated *** +# Resource specification version: 10.2.0 + + +from . import AWSObject +from . import AWSProperty +from .validators import integer + + +VALID_CLUSTERINGKEYCOLUMN_ORDERBY = ('ASC', 'DESC') +VALID_BILLINGMODE_MODE = ('ON_DEMAND', 'PROVISIONED') + + +def validate_clusteringkeycolumn_orderby(clusteringkeycolumn_orderby): + if clusteringkeycolumn_orderby not in VALID_CLUSTERINGKEYCOLUMN_ORDERBY: + raise ValueError("ClusteringKeyColumn OrderBy must be one of: %s" % + ', '.join(VALID_CLUSTERINGKEYCOLUMN_ORDERBY)) + return clusteringkeycolumn_orderby + + +def validate_billingmode_mode(billingmode_mode): + if billingmode_mode not in VALID_BILLINGMODE_MODE: + raise ValueError("BillingMode Mode must be one of: %s" % + ', '.join(VALID_BILLINGMODE_MODE)) + return billingmode_mode + + +class Keyspace(AWSObject): + resource_type = "AWS::Cassandra::Keyspace" + + props = { + 'KeyspaceName': (basestring, False), + } + + +class Column(AWSProperty): + props = { + "ColumnName": (basestring, True), + "ColumnType": (basestring, True), + } + + +class ClusteringKeyColumn(AWSProperty): + props = { + "Column": (Column, True), + "OrderBy": (validate_clusteringkeycolumn_orderby, False), + } + + +class ProvisionedThroughput(AWSProperty): + props = { + "ReadCapacityUnits": (integer, True), + "WriteCapacityUnits": (integer, True), + } + + +class BillingMode(AWSProperty): + props = { + "Mode": (validate_billingmode_mode, True), + "ProvisionedThroughput": (ProvisionedThroughput, False), + } + + +class Table(AWSObject): + resource_type = "AWS::Cassandra::Table" + + props = { + "BillingMode": (BillingMode, False), + "ClusteringKeyColumns": ([ClusteringKeyColumn], False), + "KeyspaceName": (basestring, True), + "PartitionKeyColumns": ([Column], True), + "RegularColumns": ([Column], False), + "TableName": (basestring, False), + }