Class: CfnManage::StartStopHandlerFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/cfn_manage/start_stop_handler_factory.rb

Class Method Summary collapse

Class Method Details

.get_start_stop_handler(resource_type, resource_id, options) ⇒ Object

Factory method to get start/stop handler based on CloudFormation resource type. If resource_id passed in does not exist, it is very likely that exception will be raised



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/cfn_manage/start_stop_handler_factory.rb', line 18

def self.get_start_stop_handler(resource_type, resource_id, options)
  case resource_type
    when 'AWS::AutoScaling::AutoScalingGroup'
      return CfnManage::StartStopHandler::Asg.new(resource_id,options)

    when 'AWS::EC2::Instance'
      return CfnManage::StartStopHandler::Ec2.new(resource_id,options)

    when 'AWS::RDS::DBInstance'
      return CfnManage::StartStopHandler::Rds.new(resource_id,options)

    when 'AWS::RDS::DBCluster'
      return CfnManage::StartStopHandler::AuroraCluster.new(resource_id,options)

    when 'AWS::DocDB::DBCluster'
      return CfnManage::StartStopHandler::DocumentDb.new(resource_id,options)

    when 'AWS::CloudWatch::Alarm'
      return CfnManage::StartStopHandler::Alarm.new(resource_id,options)

    when 'AWS::EC2::SpotFleet'
      return CfnManage::StartStopHandler::SpotFleet.new(resource_id,options)

    when 'AWS::ECS::Cluster'
      return CfnManage::StartStopHandler::EcsCluster.new(resource_id,options)

    when 'AWS::Transfer::Server'
      return CfnManage::StartStopHandler::Transfer.new(resource_id,options)

    else
      return nil
  end
end