awspec 1.31.0 → 1.33.0
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/.rubocop.yml +2 -0
- data/doc/_resource_types/backup_plan.md +7 -0
- data/doc/_resource_types/backup_selection.md +7 -0
- data/doc/_resource_types/backup_vault.md +35 -0
- data/doc/_resource_types/codedeploy.md +6 -0
- data/doc/_resource_types/codepipeline.md +7 -0
- data/doc/_resource_types/rds_db_cluster.md +8 -0
- data/doc/_resource_types/rds_global_cluster.md +8 -0
- data/doc/_resource_types/transfer_server.md +4 -0
- data/doc/_resource_types/wafv2_ip_set.md +21 -0
- data/doc/_resource_types/wafv2_web_acl.md +25 -0
- data/doc/contributing.md +2 -2
- data/doc/resource_types.md +168 -27
- data/lib/awspec/command/generate.rb +12 -0
- data/lib/awspec/generator/doc/type/backup_plan.rb +19 -0
- data/lib/awspec/generator/doc/type/backup_selection.rb +19 -0
- data/lib/awspec/generator/doc/type/backup_vault.rb +19 -0
- data/lib/awspec/generator/doc/type/codepipeline.rb +19 -0
- data/lib/awspec/generator/doc/type/wafv2_ip_set.rb +19 -0
- data/lib/awspec/generator/doc/type/wafv2_web_acl.rb +19 -0
- data/lib/awspec/generator/spec/codepipeline.rb +29 -0
- data/lib/awspec/generator/spec/wafv2_ip_set.rb +35 -0
- data/lib/awspec/generator/spec/wafv2_web_acl.rb +39 -0
- data/lib/awspec/generator.rb +3 -0
- data/lib/awspec/helper/finder/backup.rb +88 -0
- data/lib/awspec/helper/finder/codepipeline.rb +25 -0
- data/lib/awspec/helper/finder/transfer.rb +21 -1
- data/lib/awspec/helper/finder/vpc_endpoints.rb +2 -2
- data/lib/awspec/helper/finder/wafv2.rb +47 -0
- data/lib/awspec/helper/finder.rb +10 -1
- data/lib/awspec/helper/type.rb +2 -1
- data/lib/awspec/matcher/belong_to_backup_plan.rb +12 -0
- data/lib/awspec/matcher/have_rule.rb +5 -0
- data/lib/awspec/matcher.rb +3 -0
- data/lib/awspec/shared_context.rb +6 -0
- data/lib/awspec/stub/backup_plan.rb +33 -0
- data/lib/awspec/stub/backup_selection.rb +33 -0
- data/lib/awspec/stub/backup_vault.rb +53 -0
- data/lib/awspec/stub/cloudfront_distribution.rb +0 -2
- data/lib/awspec/stub/codepipeline.rb +104 -0
- data/lib/awspec/stub/rds_db_cluster.rb +6 -1
- data/lib/awspec/stub/rds_global_cluster.rb +7 -1
- data/lib/awspec/stub/transfer_server.rb +25 -6
- data/lib/awspec/stub/wafv2_ip_set.rb +34 -0
- data/lib/awspec/stub/wafv2_web_acl.rb +151 -0
- data/lib/awspec/type/backup_plan.rb +13 -0
- data/lib/awspec/type/backup_selection.rb +13 -0
- data/lib/awspec/type/backup_vault.rb +13 -0
- data/lib/awspec/type/base.rb +5 -1
- data/lib/awspec/type/codepipeline.rb +13 -0
- data/lib/awspec/type/rds_db_cluster.rb +1 -0
- data/lib/awspec/type/rds_global_cluster.rb +1 -0
- data/lib/awspec/type/transfer_server.rb +4 -7
- data/lib/awspec/type/wafv2_ip_set.rb +23 -0
- data/lib/awspec/type/wafv2_web_acl.rb +33 -0
- data/lib/awspec/version.rb +1 -1
- metadata +33 -2
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Doc
|
5
|
+
module Type
|
6
|
+
class BackupPlan < Base
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
@type_name = 'BackupPlan'
|
10
|
+
@type = Awspec::Type::BackupPlan.new('my-backup-plan')
|
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,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Doc
|
5
|
+
module Type
|
6
|
+
class BackupSelection < Base
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
@type_name = 'BackupSelection'
|
10
|
+
@type = Awspec::Type::BackupSelection.new('my-backup-selection')
|
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,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Doc
|
5
|
+
module Type
|
6
|
+
class BackupVault < Base
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
@type_name = 'BackupVault'
|
10
|
+
@type = Awspec::Type::BackupVault.new('my-backup-vault')
|
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,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Doc
|
5
|
+
module Type
|
6
|
+
class Codepipeline < Base
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
@type_name = 'Codepipeline'
|
10
|
+
@type = Awspec::Type::Codepipeline.new('my-codepipeline')
|
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,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-wafv2-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,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Doc
|
5
|
+
module Type
|
6
|
+
class Wafv2WebAcl < Base
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
@type_name = 'Wafv2WebAcl'
|
10
|
+
@type = Awspec::Type::Wafv2WebAcl.new('my-wafv2-web-acl')
|
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
|
@@ -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
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Generator
|
4
|
+
module Spec
|
5
|
+
class Wafv2WebAcl
|
6
|
+
include Awspec::Helper::Finder
|
7
|
+
def generate_by_scope(scope)
|
8
|
+
web_acls = select_all_web_acls(scope)
|
9
|
+
raise 'Not Found WAFV2 Web ACL' if web_acls.empty?
|
10
|
+
|
11
|
+
specs = web_acls.map do |acl|
|
12
|
+
web_acl = get_web_acl(scope, acl.name, acl.id)
|
13
|
+
ERB.new(wafv2_web_acl_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
|
14
|
+
end
|
15
|
+
specs.join("\n")
|
16
|
+
end
|
17
|
+
|
18
|
+
def wafv2_web_acl_spec_template
|
19
|
+
<<-'EOF'
|
20
|
+
describe wafv2_web_acl('<%= web_acl.name %>'), scope: '<%= scope %>' do
|
21
|
+
it { should exist }
|
22
|
+
its(:name) { should eq '<%= web_acl.name %>' }
|
23
|
+
its(:id) { should eq '<%= web_acl.id %>' }
|
24
|
+
its(:arn) { should eq '<%= web_acl.arn %>' }
|
25
|
+
its(:default_action) { should eq '<%= web_acl.default_action.allow ? 'ALLOW' : 'BLOCK' %>' }
|
26
|
+
its(:description) { should eq '<%= web_acl.description %>' }
|
27
|
+
its(:capacity) { should eq <%= web_acl.capacity %> }
|
28
|
+
its(:managed_by_firewall_manager) { should eq <%= web_acl.managed_by_firewall_manager %> }
|
29
|
+
its(:label_namespace) { should eq '<%= web_acl.label_namespace %>' }
|
30
|
+
its(:retrofitted_by_firewall_manager) { should eq <%= web_acl.retrofitted_by_firewall_manager %> }
|
31
|
+
<% web_acl.rules.each do |rule| %>
|
32
|
+
it { should have_rule('<%= rule.name %>').order(<%= rule.priority %>) }
|
33
|
+
<% end %>
|
34
|
+
end
|
35
|
+
EOF
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/awspec/generator.rb
CHANGED
@@ -44,6 +44,9 @@ 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'
|
49
|
+
require 'awspec/generator/spec/wafv2_web_acl'
|
47
50
|
|
48
51
|
# Doc
|
49
52
|
require 'awspec/generator/doc/type'
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Helper
|
4
|
+
module Finder
|
5
|
+
module Backup
|
6
|
+
def find_backup_vault(id)
|
7
|
+
selected = []
|
8
|
+
req = {}
|
9
|
+
loop do
|
10
|
+
res = backup_client.list_backup_vaults(req)
|
11
|
+
selected += res.backup_vault_list.select do |v|
|
12
|
+
v.backup_vault_name == id || v.backup_vault_arn == id
|
13
|
+
end
|
14
|
+
break if res.next_token.nil?
|
15
|
+
|
16
|
+
req[:next_token] = res.next_token
|
17
|
+
end
|
18
|
+
selected.single_resource(id)
|
19
|
+
rescue Aws::Backup::Errors::ResourceNotFoundException
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def find_backup_plan(id)
|
24
|
+
selected = []
|
25
|
+
req = {}
|
26
|
+
loop do
|
27
|
+
res = backup_client.list_backup_plans(req)
|
28
|
+
selected += res.backup_plans_list.select do |p|
|
29
|
+
p.backup_plan_name == id || p.backup_plan_arn == id || p.backup_plan_id == id
|
30
|
+
end
|
31
|
+
break if res.next_token.nil?
|
32
|
+
|
33
|
+
req[:next_token] = res.next_token
|
34
|
+
end
|
35
|
+
selected.single_resource(id)
|
36
|
+
rescue Aws::Backup::Errors::ResourceNotFoundException
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def find_backup_selection(id)
|
41
|
+
backup_plans = []
|
42
|
+
req = {}
|
43
|
+
loop do
|
44
|
+
res = backup_client.list_backup_plans(req)
|
45
|
+
backup_plans += res.backup_plans_list.map { |p| p.backup_plan_id }
|
46
|
+
break if res.next_token.nil?
|
47
|
+
|
48
|
+
req[:next_token] = res.next_token
|
49
|
+
end
|
50
|
+
|
51
|
+
selected = []
|
52
|
+
next_token = nil
|
53
|
+
|
54
|
+
backup_plans.each do |plan_id|
|
55
|
+
loop do
|
56
|
+
res = backup_client.list_backup_selections({ backup_plan_id: plan_id, next_token: next_token })
|
57
|
+
selected += res.backup_selections_list.select do |s|
|
58
|
+
s.selection_id == id || s.selection_name == id
|
59
|
+
end
|
60
|
+
break if res.next_token.nil?
|
61
|
+
|
62
|
+
next_token = res.next_token
|
63
|
+
end
|
64
|
+
end
|
65
|
+
selected.single_resource(id)
|
66
|
+
rescue Aws::Backup::Errors::ResourceNotFoundException
|
67
|
+
nil
|
68
|
+
end
|
69
|
+
|
70
|
+
def locked?
|
71
|
+
resource_via_client.locked
|
72
|
+
end
|
73
|
+
|
74
|
+
def airgapped?
|
75
|
+
resource_via_client.vault_type == 'LOGICALLY_AIR_GAPPED_BACKUP_VAULT'
|
76
|
+
end
|
77
|
+
|
78
|
+
STATES = %w[
|
79
|
+
creating available failed
|
80
|
+
]
|
81
|
+
STATES.each do |state|
|
82
|
+
define_method "#{state}?" do
|
83
|
+
resource_via_client.vault_state.downcase == state
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -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,8 +4,28 @@ module Awspec::Helper
|
|
4
4
|
module Finder
|
5
5
|
module Transfer
|
6
6
|
def find_transfer_server(id)
|
7
|
-
res = transfer_client.describe_server(server_id: id)
|
7
|
+
res = transfer_client.describe_server({ server_id: id })
|
8
8
|
res.server
|
9
|
+
rescue Aws::Transfer::Errors::ValidationException, Aws::Transfer::Errors::ResourceNotFoundException
|
10
|
+
req = {}
|
11
|
+
servers = []
|
12
|
+
loop do
|
13
|
+
res = transfer_client.list_servers(req)
|
14
|
+
servers.push(*res.servers)
|
15
|
+
break if res.next_token.nil?
|
16
|
+
|
17
|
+
req[:next_token] = res.next_token
|
18
|
+
end
|
19
|
+
|
20
|
+
servers.each do |s|
|
21
|
+
server = transfer_client.describe_server({ server_id: s.server_id }).server
|
22
|
+
server.tags.each do |tag|
|
23
|
+
if tag.key == 'Name' && tag.value == id
|
24
|
+
return server
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
nil
|
9
29
|
end
|
10
30
|
end
|
11
31
|
end
|
@@ -11,8 +11,8 @@ module Awspec::Helper
|
|
11
11
|
end
|
12
12
|
|
13
13
|
resource = ret.single_resource(id)
|
14
|
-
|
15
|
-
|
14
|
+
resource if resource
|
15
|
+
rescue Aws::EC2::Errors::InvalidVpcEndpointIdNotFound, Aws::EC2::Errors::InvalidVpcEndpointIdMalformed
|
16
16
|
res = ec2_client.describe_vpc_endpoints({
|
17
17
|
filters: [{ name: 'tag:Name', values: [id] }]
|
18
18
|
})
|
@@ -0,0 +1,47 @@
|
|
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
|
+
|
26
|
+
def find_web_acl(scope, name)
|
27
|
+
web_acls = select_all_web_acls(scope)
|
28
|
+
web_acl = web_acls.find do |acl|
|
29
|
+
acl.name == name
|
30
|
+
end
|
31
|
+
return false unless web_acl
|
32
|
+
|
33
|
+
get_web_acl(scope, name, web_acl.id)
|
34
|
+
end
|
35
|
+
|
36
|
+
def select_all_web_acls(scope)
|
37
|
+
res = wafv2_client.list_web_acls({ scope: scope })
|
38
|
+
res.web_acls
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_web_acl(scope, name, id)
|
42
|
+
res = wafv2_client.get_web_acl({ name: name, scope: scope, id: id })
|
43
|
+
res.web_acl
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/awspec/helper/finder.rb
CHANGED
@@ -55,6 +55,9 @@ 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'
|
60
|
+
require 'awspec/helper/finder/backup'
|
58
61
|
|
59
62
|
require 'awspec/helper/finder/account_attributes'
|
60
63
|
|
@@ -117,6 +120,9 @@ module Awspec::Helper
|
|
117
120
|
include Awspec::Helper::Finder::Msk
|
118
121
|
include Awspec::Helper::Finder::CognitoIdentityPool
|
119
122
|
include Awspec::Helper::Finder::Transfer
|
123
|
+
include Awspec::Helper::Finder::Codepipeline
|
124
|
+
include Awspec::Helper::Finder::Wafv2
|
125
|
+
include Awspec::Helper::Finder::Backup
|
120
126
|
|
121
127
|
CLIENTS = {
|
122
128
|
ec2_client: Aws::EC2::Client,
|
@@ -165,7 +171,10 @@ module Awspec::Helper
|
|
165
171
|
msk_client: Aws::Kafka::Client,
|
166
172
|
cognito_identity_client: Aws::CognitoIdentity::Client,
|
167
173
|
cognito_identity_provider_client: Aws::CognitoIdentityProvider::Client,
|
168
|
-
transfer_client: Aws::Transfer::Client
|
174
|
+
transfer_client: Aws::Transfer::Client,
|
175
|
+
codepipeline_client: Aws::CodePipeline::Client,
|
176
|
+
wafv2_client: Aws::WAFV2::Client,
|
177
|
+
backup_client: Aws::Backup::Client
|
169
178
|
}
|
170
179
|
|
171
180
|
CLIENT_OPTIONS = {
|
data/lib/awspec/helper/type.rb
CHANGED
@@ -24,7 +24,8 @@ 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 wafv2_web_acl
|
28
|
+
backup_vault backup_plan backup_selection
|
28
29
|
]
|
29
30
|
|
30
31
|
ACCOUNT_ATTRIBUTES = %w[
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec::Matchers.define :belong_to_backup_plan do |plan|
|
4
|
+
match do |type|
|
5
|
+
return true if type.backup_plan_id == plan
|
6
|
+
|
7
|
+
ret = type.find_backup_plan(plan)
|
8
|
+
return false unless ret
|
9
|
+
|
10
|
+
type.backup_plan_id == (ret.backup_plan_id)
|
11
|
+
end
|
12
|
+
end
|
@@ -4,6 +4,7 @@ RSpec::Matchers.define :have_rule do |rule_id|
|
|
4
4
|
match do |type|
|
5
5
|
return type.has_rule?(rule_id, @priority, @action) if type.instance_of?(Awspec::Type::WafWebAcl)
|
6
6
|
return type.has_rule?(rule_id, @priority, @action) if type.instance_of?(Awspec::Type::WafregionalWebAcl)
|
7
|
+
return type.has_rule?(rule_id, @priority, @action, @override_action) if type.instance_of?(Awspec::Type::Wafv2WebAcl)
|
7
8
|
return type.has_rule?(rule_id, @priority, @conditions, @actions) if type.instance_of?(Awspec::Type::AlbListener)
|
8
9
|
|
9
10
|
type.has_rule?(rule_id, @priority, @conditions, @actions) if type.instance_of?(Awspec::Type::NlbListener)
|
@@ -21,6 +22,10 @@ RSpec::Matchers.define :have_rule do |rule_id|
|
|
21
22
|
@action = action
|
22
23
|
end
|
23
24
|
|
25
|
+
chain :override_action do |override_action|
|
26
|
+
@override_action = override_action
|
27
|
+
end
|
28
|
+
|
24
29
|
chain :conditions do |conditions|
|
25
30
|
@conditions = conditions
|
26
31
|
end
|
data/lib/awspec/matcher.rb
CHANGED
@@ -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
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:backup] = {
|
4
|
+
stub_responses: {
|
5
|
+
list_backup_plans: {
|
6
|
+
backup_plans_list: [
|
7
|
+
{
|
8
|
+
backup_plan_arn: 'arn:aws:backup:us-west-2:111122223333:backup-plan:a460d5d5-d30b-4631-8014-38c58e3c72ca',
|
9
|
+
backup_plan_id: 'a460d5d5-d30b-4631-8014-38c58e3c72ca',
|
10
|
+
creation_date: Time.new(2016, 4, 4, 9, 00, 00, '+00:00'),
|
11
|
+
deletion_date: nil,
|
12
|
+
version_id: 'kMlWPgkmipEb4I9gOEZpdoQiMgxP5KIizKLDhhblGiixgahy',
|
13
|
+
backup_plan_name: 'old-obsolete-plan',
|
14
|
+
creator_request_id: nil,
|
15
|
+
last_execution_date: Time.new(2016, 10, 4, 9, 00, 00, '+00:00'),
|
16
|
+
advanced_backup_settings: nil
|
17
|
+
},
|
18
|
+
{
|
19
|
+
backup_plan_arn: 'arn:aws:backup:us-west-2:111122223333:backup-plan:fff3e784-1a0f-4e7c-8fe9-ba69825f7c00',
|
20
|
+
backup_plan_id: 'fff3e784-1a0f-4e7c-8fe9-ba69825f7c00',
|
21
|
+
creation_date: Time.new(2016, 10, 4, 9, 00, 00, '+00:00'),
|
22
|
+
deletion_date: nil,
|
23
|
+
version_id: 'disFW7K0dOAjTaMWKYlhEyScjBhmi5kKGf7BrY7i1BG8F8wB',
|
24
|
+
backup_plan_name: 'my-backup-plan',
|
25
|
+
creator_request_id: nil,
|
26
|
+
last_execution_date: Time.new(2025, 10, 4, 9, 00, 00, '+00:00'),
|
27
|
+
advanced_backup_settings: nil
|
28
|
+
}
|
29
|
+
],
|
30
|
+
next_token: nil
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:backup] = {
|
4
|
+
stub_responses: {
|
5
|
+
list_backup_plans: {
|
6
|
+
backup_plans_list: [
|
7
|
+
{
|
8
|
+
backup_plan_arn: 'arn:aws:backup:us-west-2:111122223333:backup-plan:fff3e784-1a0f-4e7c-8fe9-ba69825f7c00',
|
9
|
+
backup_plan_id: 'fff3e784-1a0f-4e7c-8fe9-ba69825f7c00',
|
10
|
+
creation_date: Time.new(2016, 10, 4, 9, 00, 00, '+00:00'),
|
11
|
+
deletion_date: nil,
|
12
|
+
version_id: 'disFW7K0dOAjTaMWKYlhEyScjBhmi5kKGf7BrY7i1BG8F8wB',
|
13
|
+
backup_plan_name: 'my-backup-plan',
|
14
|
+
creator_request_id: nil,
|
15
|
+
last_execution_date: Time.new(2025, 10, 4, 9, 00, 00, '+00:00'),
|
16
|
+
advanced_backup_settings: nil
|
17
|
+
}
|
18
|
+
],
|
19
|
+
next_token: nil
|
20
|
+
},
|
21
|
+
list_backup_selections: {
|
22
|
+
backup_selections_list: [
|
23
|
+
selection_id: '01dfb41f-c3ca-4b45-91e7-63ef43fe7231',
|
24
|
+
selection_name: 'my-backup-selection',
|
25
|
+
backup_plan_id: 'fff3e784-1a0f-4e7c-8fe9-ba69825f7c00',
|
26
|
+
creation_date: Time.new(2016, 10, 4, 9, 00, 00, '+00:00'),
|
27
|
+
creator_request_id: nil,
|
28
|
+
iam_role_arn: 'arn:aws:iam::111122223333:role/service-role/my-backup-service-role'
|
29
|
+
],
|
30
|
+
next_token: nil
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:backup] = {
|
4
|
+
stub_responses: {
|
5
|
+
list_backup_vaults: {
|
6
|
+
backup_vault_list: [
|
7
|
+
{
|
8
|
+
backup_vault_name: 'Default',
|
9
|
+
backup_vault_arn: 'arn:aws:backup:us-west-2:111122223333:backup-vault:Default',
|
10
|
+
vault_type: 'BACKUP_VAULT',
|
11
|
+
vault_state: 'AVAILABLE',
|
12
|
+
creation_date: Time.new(2024, 4, 4, 9, 00, 00, '+00:00'),
|
13
|
+
encryption_key_arn: 'arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab',
|
14
|
+
creator_request_id: 'Default',
|
15
|
+
number_of_recovery_points: 0,
|
16
|
+
locked: false,
|
17
|
+
min_retention_days: nil,
|
18
|
+
max_retention_days: nil,
|
19
|
+
lock_date: nil
|
20
|
+
},
|
21
|
+
{
|
22
|
+
backup_vault_name: 'my-backup-vault',
|
23
|
+
backup_vault_arn: 'arn:aws:backup:us-west-2:111122223333:backup-vault:my-vault',
|
24
|
+
vault_type: 'BACKUP_VAULT',
|
25
|
+
vault_state: 'AVAILABLE',
|
26
|
+
creation_date: Time.new(2024, 4, 4, 9, 00, 00, '+00:00'),
|
27
|
+
encryption_key_arn: 'arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab',
|
28
|
+
creator_request_id: 'Default',
|
29
|
+
number_of_recovery_points: 123,
|
30
|
+
locked: true,
|
31
|
+
min_retention_days: 7,
|
32
|
+
max_retention_days: 35,
|
33
|
+
lock_date: Time.new(2024, 10, 4, 9, 00, 00, '+00:00')
|
34
|
+
},
|
35
|
+
{
|
36
|
+
backup_vault_name: 'my-airgapped-vault',
|
37
|
+
backup_vault_arn: 'arn:aws:backup:us-west-2:111122223333:backup-vault:my-airgapped-vault',
|
38
|
+
vault_type: 'LOGICALLY_AIR_GAPPED_BACKUP_VAULT',
|
39
|
+
vault_state: 'AVAILABLE',
|
40
|
+
creation_date: Time.new(2024, 4, 4, 9, 00, 00, '+00:00'),
|
41
|
+
encryption_key_arn: 'arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab',
|
42
|
+
creator_request_id: nil,
|
43
|
+
number_of_recovery_points: 12,
|
44
|
+
locked: false,
|
45
|
+
min_retention_days: 30,
|
46
|
+
max_retention_days: 30,
|
47
|
+
lock_date: nil
|
48
|
+
}
|
49
|
+
],
|
50
|
+
next_token: nil
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
@@ -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']
|