awspec 1.30.0 → 1.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -5
- data/.rubocop.yml +1 -0
- data/Rakefile +0 -1
- data/awspec.gemspec +3 -1
- data/doc/_resource_types/codebuild.md +14 -0
- data/doc/_resource_types/codedeploy.md +6 -0
- data/doc/_resource_types/codepipeline.md +7 -0
- data/doc/_resource_types/wafv2_ip_set.md +17 -0
- data/doc/resource_types.md +92 -32
- data/lib/awspec/command/generate.rb +12 -0
- data/lib/awspec/generator/doc/type/codepipeline.rb +19 -0
- data/lib/awspec/generator/doc/type/rds_db_cluster.rb +5 -5
- data/lib/awspec/generator/doc/type/rds_db_cluster_parameter_group.rb +2 -2
- data/lib/awspec/generator/doc/type/rds_db_parameter_group.rb +2 -2
- data/lib/awspec/generator/doc/type/rds_db_subnet_group.rb +3 -3
- data/lib/awspec/generator/doc/type/wafv2_ip_set.rb +19 -0
- data/lib/awspec/generator/spec/codepipeline.rb +29 -0
- data/lib/awspec/generator/spec/iam_group.rb +1 -1
- data/lib/awspec/generator/spec/iam_policy.rb +1 -1
- data/lib/awspec/generator/spec/iam_role.rb +1 -1
- data/lib/awspec/generator/spec/iam_user.rb +1 -1
- data/lib/awspec/generator/spec/rds_db_cluster.rb +1 -1
- data/lib/awspec/generator/spec/rds_db_cluster_parameter_group.rb +1 -1
- data/lib/awspec/generator/spec/rds_db_parameter_group.rb +1 -1
- data/lib/awspec/generator/spec/wafv2_ip_set.rb +35 -0
- data/lib/awspec/generator.rb +2 -0
- data/lib/awspec/helper/finder/codebuild.rb +2 -4
- data/lib/awspec/helper/finder/codepipeline.rb +25 -0
- data/lib/awspec/helper/finder/vpc_endpoints.rb +3 -5
- data/lib/awspec/helper/finder/wafv2.rb +27 -0
- data/lib/awspec/helper/finder.rb +7 -1
- data/lib/awspec/helper/type.rb +1 -1
- data/lib/awspec/matcher/belong_to_subnet.rb +1 -1
- data/lib/awspec/shared_context.rb +6 -0
- data/lib/awspec/stub/cloudfront_distribution.rb +0 -2
- data/lib/awspec/stub/codebuild.rb +56 -0
- data/lib/awspec/stub/codepipeline.rb +104 -0
- data/lib/awspec/stub/wafv2_ip_set.rb +32 -0
- data/lib/awspec/type/codebuild.rb +3 -0
- data/lib/awspec/type/codepipeline.rb +13 -0
- data/lib/awspec/type/rds_db_cluster.rb +1 -1
- data/lib/awspec/type/rds_db_cluster_parameter_group.rb +1 -1
- data/lib/awspec/type/rds_db_parameter_group.rb +4 -4
- data/lib/awspec/type/rds_db_subnet_group.rb +1 -1
- data/lib/awspec/type/wafv2_ip_set.rb +23 -0
- data/lib/awspec/version.rb +2 -2
- metadata +44 -7
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Doc
|
5
|
+
module Type
|
6
|
+
class Wafv2IpSet < Base
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
@type_name = 'Wafv2IpSet'
|
10
|
+
@type = Awspec::Type::Wafv2IpSet.new('my-ip-set')
|
11
|
+
@ret = @type.resource_via_client
|
12
|
+
@matchers = []
|
13
|
+
@ignore_matchers = []
|
14
|
+
@describes = []
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Spec
|
5
|
+
class Codepipeline
|
6
|
+
include Awspec::Helper::Finder
|
7
|
+
def generate_all
|
8
|
+
pipelines = select_all_codepipelines
|
9
|
+
raise 'Not Found CodePipeline' if pipelines.empty?
|
10
|
+
|
11
|
+
ERB.new(codepipeline_spec_template, nil, '-').result(binding).chomp
|
12
|
+
end
|
13
|
+
|
14
|
+
def codepipeline_spec_template
|
15
|
+
<<-'EOF'
|
16
|
+
<% pipelines.each do |pipeline| %>
|
17
|
+
describe codepipeline('<%= pipeline.name %>') do
|
18
|
+
it { should exist }
|
19
|
+
its(:name) { should eq '<%= pipeline.name %>' }
|
20
|
+
its(:version) { should eq <%= pipeline.version %> }
|
21
|
+
its(:pipeline_type) { should eq '<%= pipeline.pipeline_type %>' }
|
22
|
+
its(:execution_mode) { should eq '<%= pipeline.execution_mode %>' }
|
23
|
+
end
|
24
|
+
<% end %>
|
25
|
+
EOF
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -27,7 +27,7 @@ module Awspec::Generator
|
|
27
27
|
describe iam_group('<%= group.group_name %>') do
|
28
28
|
it { should exist }
|
29
29
|
its(:arn) { should eq '<%= group.arn %>' }
|
30
|
-
its(:create_date) { should eq Time.parse('<%= group.create_date %>') }
|
30
|
+
its(:create_date) { should eq Time.parse('<%= group.create_date.utc %>') }
|
31
31
|
<% select_iam_policy_by_group_name(group.group_name).each do |policy| %> it { should have_iam_policy('<%= policy.policy_name %>') }
|
32
32
|
<% end %>
|
33
33
|
<%- inline_policies.each do |line| -%>
|
@@ -23,7 +23,7 @@ describe iam_policy('<%= policy.policy_name %>') do
|
|
23
23
|
it { should_not be_attachable }
|
24
24
|
<%- end -%>
|
25
25
|
its(:arn) { should eq '<%= policy.arn %>' }
|
26
|
-
its(:update_date) { should eq Time.parse('<%= policy.update_date %>') }
|
26
|
+
its(:update_date) { should eq Time.parse('<%= policy.update_date.utc %>') }
|
27
27
|
its(:attachment_count) { should eq <%= policy.attachment_count %> }
|
28
28
|
<%- users = select_attached_users(policy.arn) -%>
|
29
29
|
<%- if users.empty? -%>
|
@@ -27,7 +27,7 @@ module Awspec::Generator
|
|
27
27
|
describe iam_role('<%= role.role_name %>') do
|
28
28
|
it { should exist }
|
29
29
|
its(:arn) { should eq '<%= role.arn %>' }
|
30
|
-
its(:create_date) { should eq Time.parse('<%= role.create_date %>') }
|
30
|
+
its(:create_date) { should eq Time.parse('<%= role.create_date.utc %>') }
|
31
31
|
<% select_iam_policy_by_role_name(role.role_name).each do |policy| %> it { should have_iam_policy('<%= policy.policy_name %>') }
|
32
32
|
<% end %>
|
33
33
|
<%- inline_policies.each do |line| -%>
|
@@ -27,7 +27,7 @@ module Awspec::Generator
|
|
27
27
|
describe iam_user('<%= user.user_name %>') do
|
28
28
|
it { should exist }
|
29
29
|
its(:arn) { should eq '<%= user.arn %>' }
|
30
|
-
its(:create_date) { should eq Time.parse('<%= user.create_date %>') }
|
30
|
+
its(:create_date) { should eq Time.parse('<%= user.create_date.utc %>') }
|
31
31
|
<% select_iam_policy_by_user_name(user.user_name).each do |policy| %> it { should have_iam_policy('<%= policy.policy_name %>') }
|
32
32
|
<% end %>
|
33
33
|
<%- inline_policies.each do |line| -%>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Spec
|
5
|
+
class Wafv2IpSet
|
6
|
+
include Awspec::Helper::Finder
|
7
|
+
def generate_by_scope(scope)
|
8
|
+
ip_sets = select_all_ip_sets(scope)
|
9
|
+
raise 'Not Found WAFV2 IP sets' if ip_sets.empty?
|
10
|
+
|
11
|
+
specs = ip_sets.map do |i|
|
12
|
+
ip_set = get_ip_set(scope, i.name, i.id)
|
13
|
+
ERB.new(wafv2_ip_set_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
|
14
|
+
end
|
15
|
+
specs.join("\n")
|
16
|
+
end
|
17
|
+
|
18
|
+
def wafv2_ip_set_spec_template
|
19
|
+
<<-'EOF'
|
20
|
+
describe wafv2_ip_set('<%= ip_set.name %>'), scope: '<%= scope %>' do
|
21
|
+
it { should exist }
|
22
|
+
its(:name) { should eq '<%= ip_set.name %>' }
|
23
|
+
its(:id) { should eq '<%= ip_set.id %>' }
|
24
|
+
its(:arn) { should eq '<%= ip_set.arn %>' }
|
25
|
+
its(:description) { should eq '<%= ip_set.description %>' }
|
26
|
+
its(:ip_address_version) { should eq '<%= ip_set.ip_address_version %>' }
|
27
|
+
<% ip_set.addresses.each do |address| %>
|
28
|
+
it { should have_ip_address('<%= address %>') }
|
29
|
+
<% end %>
|
30
|
+
end
|
31
|
+
EOF
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/awspec/generator.rb
CHANGED
@@ -44,6 +44,8 @@ require 'awspec/generator/spec/rds_proxy'
|
|
44
44
|
require 'awspec/generator/spec/rds_db_cluster'
|
45
45
|
require 'awspec/generator/spec/rds_global_cluster'
|
46
46
|
require 'awspec/generator/spec/managed_prefix_list'
|
47
|
+
require 'awspec/generator/spec/codepipeline'
|
48
|
+
require 'awspec/generator/spec/wafv2_ip_set'
|
47
49
|
|
48
50
|
# Doc
|
49
51
|
require 'awspec/generator/doc/type'
|
@@ -4,10 +4,8 @@ module Awspec::Helper
|
|
4
4
|
module Finder
|
5
5
|
module Codebuild
|
6
6
|
def find_codebuild_project(id)
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
projects.single_resource(id)
|
7
|
+
res = codebuild_client.batch_get_projects({ names: [id] })
|
8
|
+
res.projects.single_resource(id)
|
11
9
|
end
|
12
10
|
|
13
11
|
def select_all_codebuild_projects
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Helper
|
4
|
+
module Finder
|
5
|
+
module Codepipeline
|
6
|
+
def find_codepipeline(id)
|
7
|
+
res = codepipeline_client.get_pipeline({ name: id })
|
8
|
+
res.pipeline
|
9
|
+
end
|
10
|
+
|
11
|
+
def select_all_codepipelines
|
12
|
+
req = {}
|
13
|
+
pipelines = []
|
14
|
+
loop do
|
15
|
+
res = codepipeline_client.list_pipelines(req)
|
16
|
+
pipelines.push(*res.pipelines)
|
17
|
+
break if res.next_token.nil?
|
18
|
+
|
19
|
+
req[:next_token] = res.next_token
|
20
|
+
end
|
21
|
+
pipelines
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -4,17 +4,15 @@ module Awspec::Helper
|
|
4
4
|
module Finder
|
5
5
|
module VpcEndpoints
|
6
6
|
def find_vpc_endpoint(id)
|
7
|
-
res = ec2_client.describe_vpc_endpoints({
|
8
|
-
filters: [{ name: 'vpc-endpoint-id', values: [id] }]
|
9
|
-
})
|
7
|
+
res = ec2_client.describe_vpc_endpoints({ vpc_endpoint_ids: [id] })
|
10
8
|
|
11
9
|
ret = res.vpc_endpoints.select do |vpce|
|
12
10
|
vpce.vpc_endpoint_id == id
|
13
11
|
end
|
14
12
|
|
15
13
|
resource = ret.single_resource(id)
|
16
|
-
|
17
|
-
|
14
|
+
resource if resource
|
15
|
+
rescue Aws::EC2::Errors::InvalidVpcEndpointIdNotFound, Aws::EC2::Errors::InvalidVpcEndpointIdMalformed
|
18
16
|
res = ec2_client.describe_vpc_endpoints({
|
19
17
|
filters: [{ name: 'tag:Name', values: [id] }]
|
20
18
|
})
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Helper
|
4
|
+
module Finder
|
5
|
+
module Wafv2
|
6
|
+
def find_ip_set(scope, name)
|
7
|
+
ip_sets = select_all_ip_sets(scope)
|
8
|
+
ip_set = ip_sets.find do |i|
|
9
|
+
i.name == name
|
10
|
+
end
|
11
|
+
return false unless ip_set
|
12
|
+
|
13
|
+
get_ip_set(scope, name, ip_set.id)
|
14
|
+
end
|
15
|
+
|
16
|
+
def select_all_ip_sets(scope)
|
17
|
+
res = wafv2_client.list_ip_sets({ scope: scope })
|
18
|
+
res.ip_sets
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_ip_set(scope, name, id)
|
22
|
+
res = wafv2_client.get_ip_set({ name: name, scope: scope, id: id })
|
23
|
+
res.ip_set
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/awspec/helper/finder.rb
CHANGED
@@ -55,6 +55,8 @@ require 'awspec/helper/finder/cognito_user_pool'
|
|
55
55
|
require 'awspec/helper/finder/msk'
|
56
56
|
require 'awspec/helper/finder/cognito_identity_pool'
|
57
57
|
require 'awspec/helper/finder/transfer'
|
58
|
+
require 'awspec/helper/finder/codepipeline'
|
59
|
+
require 'awspec/helper/finder/wafv2'
|
58
60
|
|
59
61
|
require 'awspec/helper/finder/account_attributes'
|
60
62
|
|
@@ -117,6 +119,8 @@ module Awspec::Helper
|
|
117
119
|
include Awspec::Helper::Finder::Msk
|
118
120
|
include Awspec::Helper::Finder::CognitoIdentityPool
|
119
121
|
include Awspec::Helper::Finder::Transfer
|
122
|
+
include Awspec::Helper::Finder::Codepipeline
|
123
|
+
include Awspec::Helper::Finder::Wafv2
|
120
124
|
|
121
125
|
CLIENTS = {
|
122
126
|
ec2_client: Aws::EC2::Client,
|
@@ -165,7 +169,9 @@ module Awspec::Helper
|
|
165
169
|
msk_client: Aws::Kafka::Client,
|
166
170
|
cognito_identity_client: Aws::CognitoIdentity::Client,
|
167
171
|
cognito_identity_provider_client: Aws::CognitoIdentityProvider::Client,
|
168
|
-
transfer_client: Aws::Transfer::Client
|
172
|
+
transfer_client: Aws::Transfer::Client,
|
173
|
+
codepipeline_client: Aws::CodePipeline::Client,
|
174
|
+
wafv2_client: Aws::WAFV2::Client
|
169
175
|
}
|
170
176
|
|
171
177
|
CLIENT_OPTIONS = {
|
data/lib/awspec/helper/type.rb
CHANGED
@@ -24,7 +24,7 @@ module Awspec
|
|
24
24
|
internet_gateway acm cloudwatch_logs dynamodb_table eip sqs ssm_parameter cloudformation_stack
|
25
25
|
codebuild sns_topic redshift redshift_cluster_parameter_group codedeploy codedeploy_deployment_group
|
26
26
|
secretsmanager msk transit_gateway cognito_identity_pool cognito_user_pool vpc_endpoints
|
27
|
-
transfer_server managed_prefix_list
|
27
|
+
transfer_server managed_prefix_list codepipeline wafv2_ip_set
|
28
28
|
]
|
29
29
|
|
30
30
|
ACCOUNT_ATTRIBUTES = %w[
|
@@ -34,7 +34,7 @@ RSpec::Matchers.define :belong_to_subnet do |subnet_id|
|
|
34
34
|
end
|
35
35
|
|
36
36
|
# RDS DB Subnet Group
|
37
|
-
if type.instance_of?(Awspec::Type::
|
37
|
+
if type.instance_of?(Awspec::Type::RdsDBSubnetGroup)
|
38
38
|
subnets = type.resource_via_client[:subnets]
|
39
39
|
ret = subnets.find do |s|
|
40
40
|
s[:subnet_identifier] == subnet_id
|
@@ -38,3 +38,9 @@ shared_context 'application_name', :application_name do
|
|
38
38
|
example.metadata[:described_class].application_name = example.metadata[:application_name]
|
39
39
|
end
|
40
40
|
end
|
41
|
+
|
42
|
+
shared_context 'scope', :scope do
|
43
|
+
before do |example|
|
44
|
+
example.metadata[:described_class].scope = example.metadata[:scope]
|
45
|
+
end
|
46
|
+
end
|
@@ -17,7 +17,6 @@ Aws.config[:cloudfront] = {
|
|
17
17
|
status: 'Deployed',
|
18
18
|
last_modified_time: Time.new(2015, 1, 2, 10, 00, 00, '+00:00'),
|
19
19
|
domain_name: 'abcdefghijklmn.cloudfront.net',
|
20
|
-
staging: false,
|
21
20
|
aliases: {
|
22
21
|
quantity: 0,
|
23
22
|
items: []
|
@@ -117,7 +116,6 @@ Aws.config[:cloudfront] = {
|
|
117
116
|
status: 'Deployed',
|
118
117
|
last_modified_time: Time.new(2016, 3, 2, 10, 00, 00, '+00:00'),
|
119
118
|
domain_name: '123456789zyxw.cloudfront.net',
|
120
|
-
staging: false,
|
121
119
|
aliases: {
|
122
120
|
quantity: 1,
|
123
121
|
items: ['cf-s3-origin-hosting.dev.example.com']
|
@@ -2,6 +2,62 @@
|
|
2
2
|
|
3
3
|
Aws.config[:codebuild] = {
|
4
4
|
stub_responses: {
|
5
|
+
batch_get_projects: {
|
6
|
+
projects: [
|
7
|
+
{
|
8
|
+
name: 'my-codebuild1',
|
9
|
+
arn: 'arn:aws:codebuild:ap-northeast-1:123456789012:project/my-codebuild1',
|
10
|
+
source: {
|
11
|
+
type: 'S3',
|
12
|
+
location: 'example-bucket/test.zip',
|
13
|
+
insecure_ssl: false
|
14
|
+
},
|
15
|
+
secondary_sources: [],
|
16
|
+
secondary_source_versions: [],
|
17
|
+
artifacts: {
|
18
|
+
type: 'NO_ARTIFACTS'
|
19
|
+
},
|
20
|
+
secondary_artifacts: [],
|
21
|
+
cache: {
|
22
|
+
type: 'NO_CACHE'
|
23
|
+
},
|
24
|
+
environment: {
|
25
|
+
type: 'LINUX_CONTAINER',
|
26
|
+
image: 'aws/codebuild/amazonlinux2-x86_64-standard:5.0',
|
27
|
+
compute_type: 'BUILD_GENERAL1_SMALL',
|
28
|
+
environment_variables: [],
|
29
|
+
privileged_mode: false,
|
30
|
+
image_pull_credentials_type: 'CODEBUILD'
|
31
|
+
},
|
32
|
+
service_role: 'arn:aws:iam::123456789012:role/service-role/codebuild-my-codebuild1-service-role',
|
33
|
+
timeout_in_minutes: 60,
|
34
|
+
queued_timeout_in_minutes: 480,
|
35
|
+
encryption_key: 'arn:aws:kms:ap-northeast-1:123456789012:alias/aws/s3',
|
36
|
+
tags: [
|
37
|
+
{
|
38
|
+
key: 'env',
|
39
|
+
value: 'dev'
|
40
|
+
}
|
41
|
+
],
|
42
|
+
created: Time.local(2024),
|
43
|
+
last_modified: Time.local(2024),
|
44
|
+
badge: {
|
45
|
+
badge_enabled: false
|
46
|
+
},
|
47
|
+
logs_config: {
|
48
|
+
cloud_watch_logs: {
|
49
|
+
status: 'ENABLED'
|
50
|
+
},
|
51
|
+
s3_logs: {
|
52
|
+
status: 'DISABLED',
|
53
|
+
encryption_disabled: false
|
54
|
+
}
|
55
|
+
},
|
56
|
+
project_visibility: 'PRIVATE'
|
57
|
+
}
|
58
|
+
],
|
59
|
+
projects_not_found: []
|
60
|
+
},
|
5
61
|
list_projects: {
|
6
62
|
projects: %w[
|
7
63
|
my-codebuild1
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:codepipeline] = {
|
4
|
+
stub_responses: {
|
5
|
+
get_pipeline: {
|
6
|
+
pipeline: {
|
7
|
+
name: 'my-codepipeline',
|
8
|
+
role_arn: 'arn:aws:iam::123456789012:role/service-role/AWSCodePipelineServiceRole-my-codepipeline',
|
9
|
+
artifact_store: {
|
10
|
+
type: 'S3',
|
11
|
+
location: 'codepipeline-ap-northeast-1-12345678901'
|
12
|
+
},
|
13
|
+
stages: [
|
14
|
+
{
|
15
|
+
name: 'Source',
|
16
|
+
actions: [
|
17
|
+
{
|
18
|
+
name: 'Source',
|
19
|
+
action_type_id: {
|
20
|
+
category: 'Source',
|
21
|
+
owner: 'AWS',
|
22
|
+
provider: 'S3',
|
23
|
+
version: '1'
|
24
|
+
},
|
25
|
+
run_order: 1,
|
26
|
+
configuration: {
|
27
|
+
'PollForSourceChanges' => 'false',
|
28
|
+
'S3Bucket' => 'example-bucket',
|
29
|
+
'S3ObjectKey' => 'test.zip'
|
30
|
+
},
|
31
|
+
output_artifacts: [
|
32
|
+
{
|
33
|
+
name: 'SourceArtifact'
|
34
|
+
}
|
35
|
+
],
|
36
|
+
input_artifacts: [],
|
37
|
+
region: 'ap-northeast-1',
|
38
|
+
namespace: 'SourceVariables'
|
39
|
+
}
|
40
|
+
]
|
41
|
+
},
|
42
|
+
{
|
43
|
+
name: 'Build',
|
44
|
+
actions: [
|
45
|
+
{
|
46
|
+
name: 'Build',
|
47
|
+
action_type_id: {
|
48
|
+
category: 'Build',
|
49
|
+
owner: 'AWS',
|
50
|
+
provider: 'CodeBuild',
|
51
|
+
version: '1'
|
52
|
+
},
|
53
|
+
run_order: 1,
|
54
|
+
configuration: {
|
55
|
+
'ProjectName' => 'my-codebuild1'
|
56
|
+
},
|
57
|
+
output_artifacts: [
|
58
|
+
{
|
59
|
+
name: 'BuildArtifact'
|
60
|
+
}
|
61
|
+
],
|
62
|
+
input_artifacts: [
|
63
|
+
{
|
64
|
+
name: 'SourceArtifact'
|
65
|
+
}
|
66
|
+
],
|
67
|
+
region: 'ap-northeast-1',
|
68
|
+
namespace: 'BuildVariables'
|
69
|
+
}
|
70
|
+
]
|
71
|
+
}
|
72
|
+
],
|
73
|
+
version: 1,
|
74
|
+
execution_mode: 'QUEUED',
|
75
|
+
pipeline_type: 'V2'
|
76
|
+
},
|
77
|
+
metadata: {
|
78
|
+
pipeline_arn: 'arn:aws:codepipeline:ap-northeast-1:123456789012:my-codepipeline',
|
79
|
+
created: Time.local(2024),
|
80
|
+
updated: Time.local(2024)
|
81
|
+
}
|
82
|
+
},
|
83
|
+
list_pipelines: {
|
84
|
+
pipelines: [
|
85
|
+
{
|
86
|
+
name: 'my-codepipeline1',
|
87
|
+
version: 1,
|
88
|
+
pipeline_type: 'V2',
|
89
|
+
execution_mode: 'QUEUED',
|
90
|
+
created: Time.local(2024),
|
91
|
+
updated: Time.local(2024)
|
92
|
+
},
|
93
|
+
{
|
94
|
+
name: 'my-codepipeline2',
|
95
|
+
version: 1,
|
96
|
+
pipeline_type: 'V2',
|
97
|
+
execution_mode: 'QUEUED',
|
98
|
+
created: Time.local(2024),
|
99
|
+
updated: Time.local(2024)
|
100
|
+
}
|
101
|
+
]
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:wafv2] = {
|
4
|
+
stub_responses: {
|
5
|
+
get_ip_set: {
|
6
|
+
ip_set: {
|
7
|
+
name: 'my-ip-set',
|
8
|
+
id: '01234567-89ab-cdef-0123-456789abcdef',
|
9
|
+
arn: 'arn:aws:wafv2:ap-northeast-1:123456789012:regional/ipset/my-ip-set/01234567-89ab-cdef-0123-456789abcdef',
|
10
|
+
description: 'dev ips',
|
11
|
+
ip_address_version: 'IPV4',
|
12
|
+
addresses: [
|
13
|
+
'10.0.0.0/32',
|
14
|
+
'10.0.0.1/32'
|
15
|
+
]
|
16
|
+
},
|
17
|
+
lock_token: '01234567-89ab-cdef-0123456789abcdef0'
|
18
|
+
},
|
19
|
+
list_ip_sets: {
|
20
|
+
next_marker: 'my-ip-set',
|
21
|
+
ip_sets: [
|
22
|
+
{
|
23
|
+
name: 'my-ip-set',
|
24
|
+
id: '01234567-89ab-cdef-0123-456789abcdef',
|
25
|
+
description: 'dev ips',
|
26
|
+
lock_token: '01234567-89ab-cdef-0123456789abcdef0',
|
27
|
+
arn: 'arn:aws:wafv2:ap-northeast-1:123456789012:regional/ipset/my-ip-set/01234567-89ab-cdef-0123-456789abcdef'
|
28
|
+
}
|
29
|
+
]
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class Codepipeline < ResourceBase
|
5
|
+
def resource_via_client
|
6
|
+
@resource_via_client ||= find_codepipeline(@display_name)
|
7
|
+
end
|
8
|
+
|
9
|
+
def id
|
10
|
+
@id ||= resource_via_client if resource_via_client.name
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Awspec::Type
|
4
|
-
class
|
4
|
+
class InvalidRdsDBParameter < StandardError
|
5
5
|
##
|
6
6
|
# Overrides the superclass initialize method to include more information
|
7
7
|
# and default error message.
|
@@ -19,7 +19,7 @@ module Awspec::Type
|
|
19
19
|
##
|
20
20
|
# Thanks to AWS for creating parameters names like
|
21
21
|
# 'rds.accepted_password_auth_method', which would be caught as method 'rds'
|
22
|
-
# by method_missing in
|
22
|
+
# by method_missing in RdsDBParameterGroup class, this class was created
|
23
23
|
# See https://github.com/k1LoW/awspec/issues/527 for more details
|
24
24
|
def initialize(params)
|
25
25
|
@params = params
|
@@ -33,11 +33,11 @@ module Awspec::Type
|
|
33
33
|
param_name = name.to_sym
|
34
34
|
return @params[param_name] if @params.include?(param_name)
|
35
35
|
|
36
|
-
raise
|
36
|
+
raise InvalidRdsDBParameter, name
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
class
|
40
|
+
class RdsDBParameterGroup < ResourceBase
|
41
41
|
def resource_via_client
|
42
42
|
return @resource_via_client if @resource_via_client
|
43
43
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class Wafv2IpSet < ResourceBase
|
5
|
+
attr_accessor :scope
|
6
|
+
|
7
|
+
def resource_via_client
|
8
|
+
@resource_via_client ||= find_ip_set(scope, @display_name)
|
9
|
+
end
|
10
|
+
|
11
|
+
def id
|
12
|
+
@id ||= resource_via_client.id if resource_via_client
|
13
|
+
end
|
14
|
+
|
15
|
+
def scope
|
16
|
+
@scope || 'REGIONAL'
|
17
|
+
end
|
18
|
+
|
19
|
+
def has_ip_address?(ip_address)
|
20
|
+
resource_via_client.addresses.include?(ip_address)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/awspec/version.rb
CHANGED