awspec 1.27.0 → 1.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/doc/_resource_types/cloudformation_stack.md +8 -0
- data/doc/_resource_types/eip.md +1 -1
- data/doc/_resource_types/rds_db_cluster.md +47 -0
- data/doc/_resource_types/rds_db_subnet_group.md +25 -0
- data/doc/_resource_types/rds_global_cluster.md +37 -0
- data/doc/_resource_types/vpc_endpoints.md +11 -7
- data/doc/resource_types.md +168 -19
- data/lib/awspec/command/generate.rb +12 -0
- data/lib/awspec/generator/doc/type/rds_db_cluster.rb +21 -0
- data/lib/awspec/generator/doc/type/rds_db_subnet_group.rb +19 -0
- data/lib/awspec/generator/doc/type/rds_global_cluster.rb +21 -0
- data/lib/awspec/generator/doc/type/vpc_endpoints.rb +5 -2
- data/lib/awspec/generator/spec/rds_db_cluster.rb +46 -0
- data/lib/awspec/generator/spec/rds_global_cluster.rb +40 -0
- data/lib/awspec/generator/template.rb +1 -1
- data/lib/awspec/generator.rb +2 -0
- data/lib/awspec/helper/finder/ec2.rb +0 -14
- data/lib/awspec/helper/finder/eip.rb +26 -0
- data/lib/awspec/helper/finder/rds.rb +21 -0
- data/lib/awspec/helper/finder.rb +2 -0
- data/lib/awspec/helper/type.rb +3 -2
- data/lib/awspec/matcher/belong_to_subnet.rb +21 -0
- data/lib/awspec/matcher/have_cluster_member.rb +11 -0
- data/lib/awspec/matcher.rb +1 -0
- data/lib/awspec/stub/eip.rb +7 -1
- data/lib/awspec/stub/rds_db_cluster.rb +119 -0
- data/lib/awspec/stub/rds_db_subnet_group.rb +81 -0
- data/lib/awspec/stub/rds_global_cluster.rb +39 -0
- data/lib/awspec/type/cloudformation_stack.rb +3 -0
- data/lib/awspec/type/eip.rb +1 -1
- data/lib/awspec/type/rds_db_cluster.rb +75 -0
- data/lib/awspec/type/rds_db_subnet_group.rb +19 -0
- data/lib/awspec/type/rds_global_cluster.rb +36 -0
- data/lib/awspec/version.rb +1 -1
- metadata +18 -2
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Helper
|
4
|
+
module Finder
|
5
|
+
module Eip
|
6
|
+
def select_eip_by_instance_id(id)
|
7
|
+
res = ec2_client.describe_addresses({
|
8
|
+
filters: [{ name: 'instance-id', values: [id] }]
|
9
|
+
})
|
10
|
+
res.addresses
|
11
|
+
end
|
12
|
+
|
13
|
+
def select_eip(id)
|
14
|
+
res = ec2_client.describe_addresses({
|
15
|
+
filters: [{ name: 'public-ip', values: [id] }]
|
16
|
+
})
|
17
|
+
return res.addresses unless res.addresses.empty?
|
18
|
+
|
19
|
+
res = ec2_client.describe_addresses({
|
20
|
+
filters: [{ name: 'tag:Name', values: [id] }]
|
21
|
+
})
|
22
|
+
res.addresses
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -71,6 +71,27 @@ module Awspec::Helper
|
|
71
71
|
db_proxy.vpc_id == vpc_id
|
72
72
|
end
|
73
73
|
end
|
74
|
+
|
75
|
+
def find_db_cluster(db_cluster_identifier)
|
76
|
+
res = rds_client.describe_db_clusters({
|
77
|
+
db_cluster_identifier: db_cluster_identifier
|
78
|
+
})
|
79
|
+
res.db_clusters.single_resource(db_cluster_identifier)
|
80
|
+
end
|
81
|
+
|
82
|
+
def find_global_cluster(global_cluster_identifier)
|
83
|
+
res = rds_client.describe_global_clusters({
|
84
|
+
global_cluster_identifier: global_cluster_identifier
|
85
|
+
})
|
86
|
+
res.global_clusters.single_resource(global_cluster_identifier)
|
87
|
+
end
|
88
|
+
|
89
|
+
def find_db_subnet_group(db_subnet_group_name)
|
90
|
+
res = rds_client.describe_db_subnet_groups({
|
91
|
+
db_subnet_group_name: db_subnet_group_name
|
92
|
+
})
|
93
|
+
res.db_subnet_groups.single_resource(db_subnet_group_name)
|
94
|
+
end
|
74
95
|
end
|
75
96
|
end
|
76
97
|
end
|
data/lib/awspec/helper/finder.rb
CHANGED
@@ -10,6 +10,7 @@ require 'awspec/helper/finder/ec2'
|
|
10
10
|
require 'awspec/helper/finder/ecr'
|
11
11
|
require 'awspec/helper/finder/ecs'
|
12
12
|
require 'awspec/helper/finder/efs'
|
13
|
+
require 'awspec/helper/finder/eip'
|
13
14
|
require 'awspec/helper/finder/security_group'
|
14
15
|
require 'awspec/helper/finder/rds'
|
15
16
|
require 'awspec/helper/finder/route53'
|
@@ -70,6 +71,7 @@ module Awspec::Helper
|
|
70
71
|
include Awspec::Helper::Finder::Ecr
|
71
72
|
include Awspec::Helper::Finder::Ecs
|
72
73
|
include Awspec::Helper::Finder::Efs
|
74
|
+
include Awspec::Helper::Finder::Eip
|
73
75
|
include Awspec::Helper::Finder::Firehose
|
74
76
|
include Awspec::Helper::Finder::SecurityGroup
|
75
77
|
include Awspec::Helper::Finder::Rds
|
data/lib/awspec/helper/type.rb
CHANGED
@@ -17,8 +17,9 @@ module Awspec
|
|
17
17
|
efs eks eks_nodegroup elasticache elasticache_cache_parameter_group elasticsearch elb emr firehose iam_group
|
18
18
|
iam_policy iam_role iam_user kinesis kms lambda launch_configuration launch_template mq nat_gateway
|
19
19
|
network_acl network_interface nlb nlb_listener nlb_target_group
|
20
|
-
rds rds_proxy rds_db_cluster_parameter_group rds_db_parameter_group
|
21
|
-
|
20
|
+
rds rds_proxy rds_db_cluster_parameter_group rds_db_parameter_group rds_db_subnet_group
|
21
|
+
rds_db_cluster rds_global_cluster
|
22
|
+
route53_hosted_zone route_table s3_bucket security_group ses_identity subnet vpc cloudfront_distribution
|
22
23
|
elastictranscoder_pipeline waf_web_acl wafregional_web_acl customer_gateway vpn_gateway vpn_connection
|
23
24
|
internet_gateway acm cloudwatch_logs dynamodb_table eip sqs ssm_parameter cloudformation_stack
|
24
25
|
codebuild sns_topic redshift redshift_cluster_parameter_group codedeploy codedeploy_deployment_group
|
@@ -33,6 +33,27 @@ RSpec::Matchers.define :belong_to_subnet do |subnet_id|
|
|
33
33
|
return ret[:subnet_availability_zone][:name] == type.availability_zone if ret
|
34
34
|
end
|
35
35
|
|
36
|
+
# RDS DB Subnet Group
|
37
|
+
if type.instance_of?(Awspec::Type::RdsDbSubnetGroup)
|
38
|
+
subnets = type.resource_via_client[:subnets]
|
39
|
+
ret = subnets.find do |s|
|
40
|
+
s[:subnet_identifier] == subnet_id
|
41
|
+
end
|
42
|
+
|
43
|
+
return true if ret
|
44
|
+
|
45
|
+
res = type.ec2_client.describe_subnets({
|
46
|
+
filters: [{ name: 'tag:Name', values: [subnet_id] }]
|
47
|
+
})
|
48
|
+
return false unless res
|
49
|
+
|
50
|
+
ret = subnets.find do |s|
|
51
|
+
s[:subnet_identifier] == res[:subnets][0][:subnet_id]
|
52
|
+
end
|
53
|
+
|
54
|
+
return ret ? true : false
|
55
|
+
end
|
56
|
+
|
36
57
|
# RDS Proxy
|
37
58
|
if type.instance_of?(Awspec::Type::RdsProxy)
|
38
59
|
subnet_ids = type.resource_via_client[:vpc_subnet_ids]
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec::Matchers.define :have_cluster_member do |name|
|
4
|
+
match do |cluster_identifier|
|
5
|
+
cluster_identifier.has_cluster_member?(name, @is_writer)
|
6
|
+
end
|
7
|
+
|
8
|
+
chain :is_writer do |is_writer|
|
9
|
+
@is_writer = is_writer
|
10
|
+
end
|
11
|
+
end
|
data/lib/awspec/matcher.rb
CHANGED
@@ -13,6 +13,7 @@ require 'awspec/matcher/belong_to_subnets'
|
|
13
13
|
require 'awspec/matcher/belong_to_db_subnet_group'
|
14
14
|
require 'awspec/matcher/have_db_parameter_group'
|
15
15
|
require 'awspec/matcher/have_option_group'
|
16
|
+
require 'awspec/matcher/have_cluster_member'
|
16
17
|
|
17
18
|
# SecurityGroup
|
18
19
|
require 'awspec/matcher/be_opened'
|
data/lib/awspec/stub/eip.rb
CHANGED
@@ -0,0 +1,119 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:rds] = {
|
4
|
+
stub_responses: {
|
5
|
+
describe_db_clusters: {
|
6
|
+
db_clusters: [
|
7
|
+
{
|
8
|
+
allocated_storage: 1,
|
9
|
+
availability_zones: %w[ap-northeast-1a ap-northeast-1c ap-northeast-1d],
|
10
|
+
backup_retention_period: 1,
|
11
|
+
character_set_name: nil,
|
12
|
+
database_name: 'example_db',
|
13
|
+
db_cluster_identifier: 'my-rds-db-cluster',
|
14
|
+
db_cluster_parameter_group: 'default.aurora-mysql5.7',
|
15
|
+
db_subnet_group: 'default',
|
16
|
+
status: 'available',
|
17
|
+
automatic_restart_time: nil,
|
18
|
+
percent_progress: nil,
|
19
|
+
earliest_restorable_time: Time.local(2022),
|
20
|
+
endpoint: 'my-rds-db-cluster.cluster-abcdefghij12.ap-northeast-1.rds.amazonaws.com',
|
21
|
+
reader_endpoint: 'my-rds-db-cluster.cluster-ro-abcdefghij12.ap-northeast-1.rds.amazonaws.com',
|
22
|
+
custom_endpoints: [],
|
23
|
+
multi_az: false,
|
24
|
+
engine: 'aurora-mysql',
|
25
|
+
engine_version: '5.7.mysql_aurora.2.10.2',
|
26
|
+
latest_restorable_time: Time.local(2022),
|
27
|
+
port: 3306,
|
28
|
+
master_username: 'username',
|
29
|
+
db_cluster_option_group_memberships: [],
|
30
|
+
preferred_backup_window: '14:09-14:39',
|
31
|
+
preferred_maintenance_window: 'sun:17:01-sun:17:31',
|
32
|
+
replication_source_identifier: nil,
|
33
|
+
read_replica_identifiers: [
|
34
|
+
'arn:aws:rds:ap-northeast-3:123456789012:cluster:my-rds-secondary-cluster'
|
35
|
+
],
|
36
|
+
db_cluster_members: [
|
37
|
+
{
|
38
|
+
db_instance_identifier: 'my-rds-db-cluster-instance-1',
|
39
|
+
is_cluster_writer: true,
|
40
|
+
db_cluster_parameter_group_status: 'in-sync',
|
41
|
+
promotion_tier: 0
|
42
|
+
},
|
43
|
+
{
|
44
|
+
db_instance_identifier: 'my-rds-db-cluster-instance-2',
|
45
|
+
is_cluster_writer: false,
|
46
|
+
db_cluster_parameter_group_status: 'in-sync',
|
47
|
+
promotion_tier: 0
|
48
|
+
}
|
49
|
+
],
|
50
|
+
vpc_security_groups: [
|
51
|
+
{
|
52
|
+
vpc_security_group_id: 'sg-5a6b7cd8',
|
53
|
+
status: 'active'
|
54
|
+
}
|
55
|
+
],
|
56
|
+
hosted_zone_id: 'Z24O6O9L7SGTNB',
|
57
|
+
storage_encrypted: false,
|
58
|
+
kms_key_id: nil,
|
59
|
+
db_cluster_resource_id: 'cluster-ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
60
|
+
db_cluster_arn: 'arn:aws:rds:ap-northeast-1:123456789012:cluster:my-rds-db-cluster',
|
61
|
+
associated_roles: [],
|
62
|
+
iam_database_authentication_enabled: false,
|
63
|
+
clone_group_id: nil,
|
64
|
+
cluster_create_time: Time.local(2022),
|
65
|
+
earliest_backtrack_time: nil,
|
66
|
+
backtrack_window: nil,
|
67
|
+
backtrack_consumed_change_records: nil,
|
68
|
+
enabled_cloudwatch_logs_exports: [],
|
69
|
+
capacity: nil,
|
70
|
+
engine_mode: 'provisioned',
|
71
|
+
scaling_configuration_info: nil,
|
72
|
+
deletion_protection: false,
|
73
|
+
http_endpoint_enabled: false,
|
74
|
+
activity_stream_mode: nil,
|
75
|
+
activity_stream_status: 'stopped',
|
76
|
+
activity_stream_kms_key_id: nil,
|
77
|
+
activity_stream_kinesis_stream_name: nil,
|
78
|
+
copy_tags_to_snapshot: false,
|
79
|
+
cross_account_clone: false,
|
80
|
+
domain_memberships: [],
|
81
|
+
tag_list: [],
|
82
|
+
global_write_forwarding_status: nil,
|
83
|
+
global_write_forwarding_requested: false,
|
84
|
+
pending_modified_values: nil,
|
85
|
+
db_cluster_instance_class: nil,
|
86
|
+
storage_type: nil,
|
87
|
+
iops: nil,
|
88
|
+
publicly_accessible: nil,
|
89
|
+
monitoring_interval: nil,
|
90
|
+
monitoring_role_arn: nil,
|
91
|
+
performance_insights_enabled: nil,
|
92
|
+
performance_insights_kms_key_id: nil,
|
93
|
+
performance_insights_retention_period: nil,
|
94
|
+
serverless_v2_scaling_configuration: nil
|
95
|
+
}
|
96
|
+
],
|
97
|
+
marker: nil
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
Aws.config[:ec2] = {
|
103
|
+
stub_responses: {
|
104
|
+
describe_security_groups: {
|
105
|
+
security_groups: [
|
106
|
+
{
|
107
|
+
group_id: 'sg-5a6b7cd8',
|
108
|
+
group_name: 'group-name-sg',
|
109
|
+
tags: [
|
110
|
+
{
|
111
|
+
key: 'Name',
|
112
|
+
value: 'my-db-sg'
|
113
|
+
}
|
114
|
+
]
|
115
|
+
}
|
116
|
+
]
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:rds] = {
|
4
|
+
stub_responses: {
|
5
|
+
describe_db_subnet_groups: {
|
6
|
+
db_subnet_groups: [
|
7
|
+
{
|
8
|
+
db_subnet_group_name: 'my-rds-db-subnet-group',
|
9
|
+
db_subnet_group_description: 'Created from the RDS Management Console',
|
10
|
+
vpc_id: 'vpc-ab123cde',
|
11
|
+
subnet_group_status: 'Complete',
|
12
|
+
subnets: [
|
13
|
+
{
|
14
|
+
subnet_identifier: 'subnet-1234a567',
|
15
|
+
subnet_availability_zone: {
|
16
|
+
name: 'ap-northeast-1a'
|
17
|
+
},
|
18
|
+
subnet_outpost: {
|
19
|
+
arn: nil
|
20
|
+
},
|
21
|
+
subnet_status: 'Active'
|
22
|
+
},
|
23
|
+
{
|
24
|
+
subnet_identifier: 'subnet-1234b567',
|
25
|
+
subnet_availability_zone: {
|
26
|
+
name: 'ap-northeast-1c'
|
27
|
+
},
|
28
|
+
subnet_outpost: {
|
29
|
+
arn: nil
|
30
|
+
},
|
31
|
+
subnet_status: 'Active'
|
32
|
+
},
|
33
|
+
{
|
34
|
+
subnet_identifier: 'subnet-1234c567',
|
35
|
+
subnet_availability_zone: {
|
36
|
+
name: 'ap-northeast-1d'
|
37
|
+
},
|
38
|
+
subnet_outpost: {
|
39
|
+
arn: nil
|
40
|
+
},
|
41
|
+
subnet_status: 'Active'
|
42
|
+
}
|
43
|
+
],
|
44
|
+
db_subnet_group_arn: 'arn:aws:rds:ap-northeast-1:123456789012:subgrp:my-rds-db-subnet-group'
|
45
|
+
}
|
46
|
+
],
|
47
|
+
marker: nil
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
Aws.config[:ec2] = {
|
53
|
+
stub_responses: {
|
54
|
+
describe_vpcs: {
|
55
|
+
vpcs: [
|
56
|
+
{
|
57
|
+
vpc_id: 'vpc-ab123cde',
|
58
|
+
tags: [
|
59
|
+
{
|
60
|
+
key: 'Name',
|
61
|
+
value: 'my-vpc'
|
62
|
+
}
|
63
|
+
]
|
64
|
+
}
|
65
|
+
]
|
66
|
+
},
|
67
|
+
describe_subnets: {
|
68
|
+
subnets: [
|
69
|
+
{
|
70
|
+
subnet_id: 'subnet-1234a567',
|
71
|
+
tags: [
|
72
|
+
{
|
73
|
+
key: 'Name',
|
74
|
+
value: 'db-subnet-a'
|
75
|
+
}
|
76
|
+
]
|
77
|
+
}
|
78
|
+
]
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:rds] = {
|
4
|
+
stub_responses: {
|
5
|
+
describe_global_clusters: {
|
6
|
+
global_clusters: [
|
7
|
+
{
|
8
|
+
global_cluster_identifier: 'my-rds-global-cluster',
|
9
|
+
global_cluster_resource_id: 'cluster-1234567890abcdef',
|
10
|
+
global_cluster_arn: 'arn:aws:rds::123456789012:global-cluster:my-rds-global-cluster',
|
11
|
+
status: 'available',
|
12
|
+
engine: 'aurora-mysql',
|
13
|
+
engine_version: '5.7.mysql_aurora.2.10.2',
|
14
|
+
database_name: 'example_db',
|
15
|
+
storage_encrypted: false,
|
16
|
+
deletion_protection: false,
|
17
|
+
global_cluster_members: [
|
18
|
+
{
|
19
|
+
db_cluster_arn: 'arn:aws:rds:ap-northeast-1:123456789012:cluster:my-primary-cluster',
|
20
|
+
readers: [
|
21
|
+
'arn:aws:rds:ap-northeast-3:123456789012:cluster:my-secondary-cluster'
|
22
|
+
],
|
23
|
+
is_writer: true,
|
24
|
+
global_write_forwarding_status: nil
|
25
|
+
},
|
26
|
+
{
|
27
|
+
db_cluster_arn: 'arn:aws:rds:ap-northeast-3:123456789012:cluster:my-secondary-cluster',
|
28
|
+
readers: [],
|
29
|
+
is_writer: false,
|
30
|
+
global_write_forwarding_status: 'disabled'
|
31
|
+
}
|
32
|
+
],
|
33
|
+
failover_state: nil
|
34
|
+
}
|
35
|
+
],
|
36
|
+
marker: nil
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
data/lib/awspec/type/eip.rb
CHANGED
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class RdsDbCluster < ResourceBase
|
5
|
+
aws_resource Aws::RDS::Types::DBCluster
|
6
|
+
|
7
|
+
def resource_via_client
|
8
|
+
@resource_via_client ||= find_db_cluster(@display_name)
|
9
|
+
end
|
10
|
+
|
11
|
+
def id
|
12
|
+
@id ||= resource_via_client.db_cluster_identifier if resource_via_client
|
13
|
+
end
|
14
|
+
|
15
|
+
STATES = %w[
|
16
|
+
available creating deleting
|
17
|
+
]
|
18
|
+
|
19
|
+
STATES.each do |state|
|
20
|
+
define_method "#{state.tr('-', '_')}?" do
|
21
|
+
resource_via_client.status == state
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def has_security_group?(sg_id)
|
26
|
+
return true if has_vpc_security_group_id?(sg_id)
|
27
|
+
return true if has_vpc_security_group_name?(sg_id)
|
28
|
+
return true if has_vpc_security_group_tag_name?(sg_id)
|
29
|
+
end
|
30
|
+
|
31
|
+
def has_cluster_member?(db_instance_identifier, is_writer = nil)
|
32
|
+
members = resource_via_client.db_cluster_members
|
33
|
+
members.find do |member|
|
34
|
+
if is_writer.nil?
|
35
|
+
member.db_instance_identifier == db_instance_identifier
|
36
|
+
else
|
37
|
+
member.db_instance_identifier == db_instance_identifier && member.is_cluster_writer == is_writer
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def has_vpc_security_group_id?(sg_id)
|
45
|
+
sgs = resource_via_client.vpc_security_groups
|
46
|
+
sgs.find do |sg|
|
47
|
+
sg.vpc_security_group_id == sg_id
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def has_vpc_security_group_name?(sg_id)
|
52
|
+
sgs = resource_via_client.vpc_security_groups
|
53
|
+
res = ec2_client.describe_security_groups({
|
54
|
+
filters: [{ name: 'group-name', values: [sg_id] }]
|
55
|
+
})
|
56
|
+
return false unless res.security_groups.count == 1
|
57
|
+
|
58
|
+
sgs.find do |sg|
|
59
|
+
sg.vpc_security_group_id == res.security_groups.first.group_id
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def has_vpc_security_group_tag_name?(sg_id)
|
64
|
+
sgs = resource_via_client.vpc_security_groups
|
65
|
+
res = ec2_client.describe_security_groups({
|
66
|
+
filters: [{ name: 'tag:Name', values: [sg_id] }]
|
67
|
+
})
|
68
|
+
return false unless res.security_groups.count == 1
|
69
|
+
|
70
|
+
sgs.find do |sg|
|
71
|
+
sg.vpc_security_group_id == res.security_groups.first.group_id
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class RdsDbSubnetGroup < ResourceBase
|
5
|
+
aws_resource Aws::RDS::Types::DBSubnetGroup
|
6
|
+
|
7
|
+
def resource_via_client
|
8
|
+
@resource_via_client ||= find_db_subnet_group(@display_name)
|
9
|
+
end
|
10
|
+
|
11
|
+
def id
|
12
|
+
@id ||= resource_via_client.db_subnet_group_name if resource_via_client
|
13
|
+
end
|
14
|
+
|
15
|
+
def vpc_id
|
16
|
+
resource_via_client.vpc_id
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class RdsGlobalCluster < ResourceBase
|
5
|
+
aws_resource Aws::RDS::Types::GlobalCluster
|
6
|
+
|
7
|
+
def resource_via_client
|
8
|
+
@resource_via_client ||= find_global_cluster(@display_name)
|
9
|
+
end
|
10
|
+
|
11
|
+
def id
|
12
|
+
@id ||= resource_via_client.global_cluster_identifier if resource_via_client
|
13
|
+
end
|
14
|
+
|
15
|
+
STATES = %w[
|
16
|
+
available creating deleting
|
17
|
+
]
|
18
|
+
|
19
|
+
STATES.each do |state|
|
20
|
+
define_method "#{state.tr('-', '_')}?" do
|
21
|
+
resource_via_client.status == state
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def has_cluster_member?(db_cluster_arn, is_writer = nil)
|
26
|
+
members = resource_via_client.global_cluster_members
|
27
|
+
members.find do |member|
|
28
|
+
if is_writer.nil?
|
29
|
+
member.db_cluster_arn == db_cluster_arn
|
30
|
+
else
|
31
|
+
member.db_cluster_arn == db_cluster_arn && member.is_writer == is_writer
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/awspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.28.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -309,8 +309,11 @@ files:
|
|
309
309
|
- doc/_resource_types/nlb_target_group.md
|
310
310
|
- doc/_resource_types/rds.md
|
311
311
|
- doc/_resource_types/rds_account_attributes.md
|
312
|
+
- doc/_resource_types/rds_db_cluster.md
|
312
313
|
- doc/_resource_types/rds_db_cluster_parameter_group.md
|
313
314
|
- doc/_resource_types/rds_db_parameter_group.md
|
315
|
+
- doc/_resource_types/rds_db_subnet_group.md
|
316
|
+
- doc/_resource_types/rds_global_cluster.md
|
314
317
|
- doc/_resource_types/rds_proxy.md
|
315
318
|
- doc/_resource_types/redshift.md
|
316
319
|
- doc/_resource_types/redshift_cluster_parameter_group.md
|
@@ -416,8 +419,11 @@ files:
|
|
416
419
|
- lib/awspec/generator/doc/type/nlb_target_group.rb
|
417
420
|
- lib/awspec/generator/doc/type/rds.rb
|
418
421
|
- lib/awspec/generator/doc/type/rds_account_attributes.rb
|
422
|
+
- lib/awspec/generator/doc/type/rds_db_cluster.rb
|
419
423
|
- lib/awspec/generator/doc/type/rds_db_cluster_parameter_group.rb
|
420
424
|
- lib/awspec/generator/doc/type/rds_db_parameter_group.rb
|
425
|
+
- lib/awspec/generator/doc/type/rds_db_subnet_group.rb
|
426
|
+
- lib/awspec/generator/doc/type/rds_global_cluster.rb
|
421
427
|
- lib/awspec/generator/doc/type/rds_proxy.rb
|
422
428
|
- lib/awspec/generator/doc/type/redshift.rb
|
423
429
|
- lib/awspec/generator/doc/type/redshift_cluster_parameter_group.rb
|
@@ -469,8 +475,10 @@ files:
|
|
469
475
|
- lib/awspec/generator/spec/nlb.rb
|
470
476
|
- lib/awspec/generator/spec/nlb_listener.rb
|
471
477
|
- lib/awspec/generator/spec/rds.rb
|
478
|
+
- lib/awspec/generator/spec/rds_db_cluster.rb
|
472
479
|
- lib/awspec/generator/spec/rds_db_cluster_parameter_group.rb
|
473
480
|
- lib/awspec/generator/spec/rds_db_parameter_group.rb
|
481
|
+
- lib/awspec/generator/spec/rds_global_cluster.rb
|
474
482
|
- lib/awspec/generator/spec/rds_proxy.rb
|
475
483
|
- lib/awspec/generator/spec/redshift.rb
|
476
484
|
- lib/awspec/generator/spec/redshift_cluster_parameter_group.rb
|
@@ -509,6 +517,7 @@ files:
|
|
509
517
|
- lib/awspec/helper/finder/ecr.rb
|
510
518
|
- lib/awspec/helper/finder/ecs.rb
|
511
519
|
- lib/awspec/helper/finder/efs.rb
|
520
|
+
- lib/awspec/helper/finder/eip.rb
|
512
521
|
- lib/awspec/helper/finder/eks.rb
|
513
522
|
- lib/awspec/helper/finder/elasticache.rb
|
514
523
|
- lib/awspec/helper/finder/elasticsearch.rb
|
@@ -562,6 +571,7 @@ files:
|
|
562
571
|
- lib/awspec/matcher/belong_to_subnets.rb
|
563
572
|
- lib/awspec/matcher/belong_to_vpc.rb
|
564
573
|
- lib/awspec/matcher/have_attribute_definition.rb
|
574
|
+
- lib/awspec/matcher/have_cluster_member.rb
|
565
575
|
- lib/awspec/matcher/have_cluster_parameter_group.rb
|
566
576
|
- lib/awspec/matcher/have_custom_response_error_code.rb
|
567
577
|
- lib/awspec/matcher/have_db_parameter_group.rb
|
@@ -654,8 +664,11 @@ files:
|
|
654
664
|
- lib/awspec/stub/nlb_listener.rb
|
655
665
|
- lib/awspec/stub/nlb_target_group.rb
|
656
666
|
- lib/awspec/stub/rds.rb
|
667
|
+
- lib/awspec/stub/rds_db_cluster.rb
|
657
668
|
- lib/awspec/stub/rds_db_cluster_parameter_group.rb
|
658
669
|
- lib/awspec/stub/rds_db_parameter_group.rb
|
670
|
+
- lib/awspec/stub/rds_db_subnet_group.rb
|
671
|
+
- lib/awspec/stub/rds_global_cluster.rb
|
659
672
|
- lib/awspec/stub/rds_proxy.rb
|
660
673
|
- lib/awspec/stub/redshift.rb
|
661
674
|
- lib/awspec/stub/redshift_cluster_parameter_group.rb
|
@@ -747,8 +760,11 @@ files:
|
|
747
760
|
- lib/awspec/type/nlb_target_group.rb
|
748
761
|
- lib/awspec/type/rds.rb
|
749
762
|
- lib/awspec/type/rds_account_attributes.rb
|
763
|
+
- lib/awspec/type/rds_db_cluster.rb
|
750
764
|
- lib/awspec/type/rds_db_cluster_parameter_group.rb
|
751
765
|
- lib/awspec/type/rds_db_parameter_group.rb
|
766
|
+
- lib/awspec/type/rds_db_subnet_group.rb
|
767
|
+
- lib/awspec/type/rds_global_cluster.rb
|
752
768
|
- lib/awspec/type/rds_proxy.rb
|
753
769
|
- lib/awspec/type/redshift.rb
|
754
770
|
- lib/awspec/type/redshift_cluster_parameter_group.rb
|