Class: CfnGuardian::Resource::RDSCluster

Inherits:
Base
  • Object
show all
Defined in:
lib/cfnguardian/resources/rds_cluster.rb

Instance Method Summary collapse

Methods inherited from Base

#default_alarms, #default_checks, #default_events, #default_metric_filters, #get_alarms, #get_checks, #get_cost, #get_event_subscriptions, #get_events, #get_metric_filters, #initialize

Methods included from Logging

colors, included, logger, #logger, logger=

Constructor Details

This class inherits a constructor from CfnGuardian::Resource::Base

Instance Method Details

#default_event_subscriptionsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cfnguardian/resources/rds_cluster.rb', line 4

def default_event_subscriptions()
  event_subscription = CfnGuardian::Models::RDSClusterEventSubscription.new(@resource)
  event_subscription.name = 'FailoverFailed'
  event_subscription.event_id = 'RDS-EVENT-0069'
  @event_subscriptions.push(event_subscription)

  event_subscription = CfnGuardian::Models::RDSClusterEventSubscription.new(@resource)
  event_subscription.name = 'FailoverFinished'
  event_subscription.event_id = 'RDS-EVENT-0071'
  @event_subscriptions.push(event_subscription)

  event_subscription = CfnGuardian::Models::RDSClusterEventSubscription.new(@resource)
  event_subscription.name = 'FailoverStartedSameAZ'
  event_subscription.event_id = 'RDS-EVENT-0072'
  @event_subscriptions.push(event_subscription)

  event_subscription = CfnGuardian::Models::RDSClusterEventSubscription.new(@resource)
  event_subscription.name = 'FailoverStartedDifferentAZ'
  event_subscription.event_id = 'RDS-EVENT-0073'
  @event_subscriptions.push(event_subscription)
end

#resource_exists?Boolean

Returns:

  • (Boolean)


26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/cfnguardian/resources/rds_cluster.rb', line 26

def resource_exists?
  client = Aws::RDS::Client.new
  resource = Aws::RDS::Resource.new(client: client)
  instance = resource.db_cluster(@resource['Id'])
  
  begin
    instance.load
  rescue Aws::RDS::Errors::DBClusterNotFoundFault
    return false
  end
  
  return true
end