Class: Fog::Parsers::AWS::RDS::DbClusterParser

Inherits:
Base
  • Object
show all
Defined in:
lib/fog/aws/parsers/rds/db_cluster_parser.rb

Instance Method Summary collapse

Instance Method Details

#end_element(name) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/fog/aws/parsers/rds/db_cluster_parser.rb', line 32

def end_element(name)
  case name
  when 'Port', 'Engine', 'Status', 'BackupRetentionPeriod', 'DBSubnetGroup', 'EngineVersion', 'Endpoint', 'DBClusterParameterGroup', 'DBClusterIdentifier', 'PreferredBackupWindow', 'PreferredMaintenanceWindow', 'AllocatedStorage', 'MasterUsername'
    @db_cluster[name] = value
  when 'VpcSecurityGroups'
    @in_vpc_security_groups = false
    @db_cluster['VpcSecurityGroups'] = @vpc_security_groups
  when 'VpcSecurityGroupMembership'
    @vpc_security_groups << @vpc_security_group
    @vpc_security_group = {}
  when 'VpcSecurityGroupId'
    @vpc_security_group[name] = value
  when 'Status'
    # Unfortunately, status is used in VpcSecurityGroupMembership and
    # DBSecurityGroups
    if @in_db_security_groups
      @db_security_group[name]=value
    end
    if @in_vpc_security_groups
      @vpc_security_group[name] = value
    end
  when 'DBClusterMembers'
    @in_db_cluster_members = false
    @db_cluster['DBClusterMembers'] = @db_cluster_members
  when 'DBClusterMember'
    @db_cluster_members << @db_cluster_member
    @db_cluster_member = {}
  when 'IsClusterWriter'
    @db_cluster_member['master'] = value == "true"
  when 'DBInstanceIdentifier'
    @db_cluster_member[name] = value
  when 'DBCluster'
    @db_cluster = fresh_cluster
  end
end

#fresh_clusterObject



10
11
12
# File 'lib/fog/aws/parsers/rds/db_cluster_parser.rb', line 10

def fresh_cluster
  {'AvailabilityZones' => [], 'VpcSecurityGroups' => []}
end

#resetObject



6
7
8
# File 'lib/fog/aws/parsers/rds/db_cluster_parser.rb', line 6

def reset
  @db_cluster = fresh_cluster
end

#start_element(name, attrs = []) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/aws/parsers/rds/db_cluster_parser.rb', line 14

def start_element(name, attrs=[])
  super
  case name
  when 'AvailabilityZones'
    @in_availability_zones = true
  when 'DBClusterMembers'
    @in_db_cluster_members = true
    @db_cluster_members = []
  when 'DBClusterMember'
    @db_cluster_member = {}
  when 'VpcSecurityGroupMembership'
    @vpc_security_group = {}
  when 'VpcSecurityGroups'
    @in_vpc_security_groups = true
    @vpc_security_groups = []
  end
end