Skip to content

Commit a151ea9

Browse files
authored
Added support for RDS DBCluster (Aurora) (#106)
* Added support for RDS DBCluster (Aurora) * Version bump
1 parent 334211e commit a151ea9

6 files changed

Lines changed: 42 additions & 2 deletions

File tree

lib/openstax/aws/rds_cluster.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module OpenStax::Aws
2+
class RdsCluster
3+
4+
attr_reader :raw
5+
6+
delegate_missing_to :@raw
7+
8+
def self.physical_resource_id_attribute
9+
:db_cluster_identifier
10+
end
11+
12+
def initialize(db_cluster_identifier:, region:)
13+
@raw = Aws::RDS::DBCluster.new(
14+
db_cluster_identifier,
15+
client: Aws::RDS::Client.new(region: region)
16+
)
17+
end
18+
19+
def set_master_password(password:)
20+
raw.modify({
21+
apply_immediately: true,
22+
master_user_password: password
23+
})
24+
end
25+
26+
end
27+
end

lib/openstax/aws/resource_factory.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class ResourceFactory
66
'AWS::CloudWatch::Alarm' => OpenStax::Aws::Alarm,
77
'AWS::Events::Rule' => OpenStax::Aws::EventRule,
88
'AWS::RDS::DBInstance' => OpenStax::Aws::RdsInstance,
9+
'AWS::RDS::DBCluster' => OpenStax::Aws::RdsCluster,
910
'AWS::MSK::Cluster' => OpenStax::Aws::MskCluster
1011
}
1112

lib/openstax/aws/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module OpenStax
22
module Aws
3-
VERSION = "2.1.0"
3+
VERSION = "2.2.0"
44
end
55
end

lib/openstax_aws.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def without_required_stack_tags
158158
require "openstax/aws/event_rule"
159159
require "openstax/aws/msk_cluster"
160160
require "openstax/aws/rds_instance"
161+
require "openstax/aws/rds_cluster"
161162
require "openstax/aws/resource_factory"
162163
require "openstax/aws/packer_1_2_5"
163164
require "openstax/aws/packer_1_4_1"

spec/rds_cluster_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require 'spec_helper'
2+
3+
RSpec.describe OpenStax::Aws::RdsCluster do
4+
let(:cluster) { described_class.new(db_cluster_identifier: "foo", region: "us-east-1") }
5+
6+
it "changes the master password" do
7+
expect(cluster.raw).to receive(:modify).with({apply_immediately: true, master_user_password: "bar"})
8+
cluster.set_master_password(password: "bar")
9+
end
10+
end

spec/spec_helper.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require "bundler/setup"
2-
require 'dotenv/load'
32
require "byebug"
3+
require "dotenv/load"
4+
require "ostruct"
45

56
require_relative "../lib/openstax_aws"
67

0 commit comments

Comments
 (0)