-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
088978e
commit bb48fc2
Showing
10 changed files
with
220 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
### exist | ||
|
||
```ruby | ||
describe rds_db_subnet_group('my-rds-db-subnet-group') do | ||
it { should exist } | ||
end | ||
``` | ||
|
||
### belong_to_subnet | ||
|
||
```ruby | ||
describe rds_db_subnet_group('my-rds-db-subnet-group') do | ||
it { should belong_to_subnet('subnet-1234a567') } | ||
it { should belong_to_subnet('db-subnet-a') } | ||
end | ||
``` | ||
|
||
### belong_to_vpc | ||
|
||
```ruby | ||
describe rds_db_subnet_group('my-rds-db-subnet-group') do | ||
it { should belong_to_vpc('vpc-ab123cde') } | ||
it { should belong_to_vpc('my-vpc') } | ||
end | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Awspec::Generator | ||
module Doc | ||
module Type | ||
class RdsDbSubnetGroup < Base | ||
def initialize | ||
super | ||
@type_name = 'RdsDbSubnetGroup' | ||
@type = Awspec::Type::RdsDbSubnetGroup.new('my-rds-db-subnet-group') | ||
@ret = @type.resource_via_client | ||
@matchers = %w[belong_to_vpc belong_to_subnet] | ||
@ignore_matchers = [] | ||
@describes = %w[vpc_id] | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# frozen_string_literal: true | ||
|
||
Aws.config[:rds] = { | ||
stub_responses: { | ||
describe_db_subnet_groups: { | ||
db_subnet_groups: [ | ||
{ | ||
db_subnet_group_name: 'my-rds-db-subnet-group', | ||
db_subnet_group_description: 'Created from the RDS Management Console', | ||
vpc_id: 'vpc-ab123cde', | ||
subnet_group_status: 'Complete', | ||
subnets: [ | ||
{ | ||
subnet_identifier: 'subnet-1234a567', | ||
subnet_availability_zone: { | ||
name: 'ap-northeast-1a' | ||
}, | ||
subnet_outpost: { | ||
arn: nil | ||
}, | ||
subnet_status: 'Active' | ||
}, | ||
{ | ||
subnet_identifier: 'subnet-1234b567', | ||
subnet_availability_zone: { | ||
name: 'ap-northeast-1c' | ||
}, | ||
subnet_outpost: { | ||
arn: nil | ||
}, | ||
subnet_status: 'Active' | ||
}, | ||
{ | ||
subnet_identifier: 'subnet-1234c567', | ||
subnet_availability_zone: { | ||
name: 'ap-northeast-1d' | ||
}, | ||
subnet_outpost: { | ||
arn: nil | ||
}, | ||
subnet_status: 'Active' | ||
} | ||
], | ||
db_subnet_group_arn: 'arn:aws:rds:ap-northeast-1:123456789012:subgrp:my-rds-db-subnet-group' | ||
} | ||
], | ||
marker: nil | ||
} | ||
} | ||
} | ||
|
||
Aws.config[:ec2] = { | ||
stub_responses: { | ||
describe_vpcs: { | ||
vpcs: [ | ||
{ | ||
vpc_id: 'vpc-ab123cde', | ||
tags: [ | ||
{ | ||
key: 'Name', | ||
value: 'my-vpc' | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
describe_subnets: { | ||
subnets: [ | ||
{ | ||
subnet_id: 'subnet-1234a567', | ||
tags: [ | ||
{ | ||
key: 'Name', | ||
value: 'db-subnet-a' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Awspec::Type | ||
class RdsDbSubnetGroup < ResourceBase | ||
aws_resource Aws::RDS::Types::DBSubnetGroup | ||
|
||
def resource_via_client | ||
@resource_via_client ||= find_db_subnet_group(@display_name) | ||
end | ||
|
||
def id | ||
@id ||= resource_via_client.db_subnet_group_name if resource_via_client | ||
end | ||
|
||
def vpc_id | ||
resource_via_client.vpc_id | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
Awspec::Stub.load 'rds_db_subnet_group' | ||
|
||
describe rds_db_subnet_group('my-rds-db-subnet-group') do | ||
it { should exist } | ||
it { should belong_to_vpc('vpc-ab123cde') } | ||
it { should belong_to_vpc('my-vpc') } | ||
it { should belong_to_subnet('subnet-1234a567') } | ||
it { should belong_to_subnet('db-subnet-a') } | ||
end |