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,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
|
+
}
|
@@ -78,7 +78,12 @@ Aws.config[:rds] = {
|
|
78
78
|
copy_tags_to_snapshot: false,
|
79
79
|
cross_account_clone: false,
|
80
80
|
domain_memberships: [],
|
81
|
-
tag_list: [
|
81
|
+
tag_list: [
|
82
|
+
{
|
83
|
+
key: 'env',
|
84
|
+
value: 'dev'
|
85
|
+
}
|
86
|
+
],
|
82
87
|
global_write_forwarding_status: nil,
|
83
88
|
global_write_forwarding_requested: false,
|
84
89
|
pending_modified_values: nil,
|
@@ -3,10 +3,10 @@
|
|
3
3
|
Aws.config[:transfer] = {
|
4
4
|
stub_responses: {
|
5
5
|
describe_server: {
|
6
|
-
server:
|
6
|
+
server: {
|
7
7
|
arn: 'arn:aws:transfer:us-east-1:1234567890:server/s-4dc0a424f0154fa89',
|
8
8
|
domain: 'S3',
|
9
|
-
endpoint_details:
|
9
|
+
endpoint_details: {
|
10
10
|
address_allocation_ids: %w[
|
11
11
|
eipalloc-00000000000000001
|
12
12
|
eipalloc-00000000000000002
|
@@ -19,7 +19,7 @@ Aws.config[:transfer] = {
|
|
19
19
|
],
|
20
20
|
vpc_endpoint_id: 'vpce-00000000000000001',
|
21
21
|
vpc_id: 'vpc-0123456789abcdefg'
|
22
|
-
|
22
|
+
},
|
23
23
|
endpoint_type: 'VPC',
|
24
24
|
host_key_fingerprint: 'SHA256:0pj2UnuoFAKEfHrCZwfPwuFinG3RJEVir/m8bPRINTo=',
|
25
25
|
identity_provider_type: 'SERVICE_MANAGED',
|
@@ -29,13 +29,32 @@ Aws.config[:transfer] = {
|
|
29
29
|
server_id: 's-4dc0a424f0154fa89',
|
30
30
|
state: 'ONLINE',
|
31
31
|
tags: [
|
32
|
-
|
32
|
+
{
|
33
33
|
key: 'env',
|
34
34
|
value: 'dev'
|
35
|
-
|
35
|
+
},
|
36
|
+
{
|
37
|
+
key: 'Name',
|
38
|
+
value: 'my-transfer-server'
|
39
|
+
}
|
36
40
|
],
|
37
41
|
user_count: 13
|
38
|
-
|
42
|
+
}
|
43
|
+
},
|
44
|
+
list_servers: {
|
45
|
+
next_token: nil,
|
46
|
+
servers: [
|
47
|
+
{
|
48
|
+
arn: 'arn:aws:transfer:us-east-1:1234567890:server/s-4dc0a424f0154fa89',
|
49
|
+
domain: 'S3',
|
50
|
+
identity_provider_type: 'SERVICE_MANAGED',
|
51
|
+
endpoint_type: 'VPC',
|
52
|
+
logging_role: 'arn:aws:iam::1234567890:role/service-role/AWSTransferLoggingAccess',
|
53
|
+
server_id: 's-4dc0a424f0154fa89',
|
54
|
+
state: 'ONLINE',
|
55
|
+
user_count: 13
|
56
|
+
}
|
57
|
+
]
|
39
58
|
}
|
40
59
|
}
|
41
60
|
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:wafv2] = {
|
4
|
+
stub_responses: {
|
5
|
+
get_ip_set: {
|
6
|
+
ip_set: {
|
7
|
+
name: 'my-wafv2-ip-set',
|
8
|
+
id: '01234567-89ab-cdef-0123-456789abcdef',
|
9
|
+
arn: 'arn:aws:wafv2:ap-northeast-1:123456789012:regional/ipset/'\
|
10
|
+
'my-wafv2-ip-set/01234567-89ab-cdef-0123-456789abcdef',
|
11
|
+
description: 'dev ips',
|
12
|
+
ip_address_version: 'IPV4',
|
13
|
+
addresses: [
|
14
|
+
'10.0.0.0/32',
|
15
|
+
'10.0.0.1/32'
|
16
|
+
]
|
17
|
+
},
|
18
|
+
lock_token: '01234567-89ab-cdef-0123456789abcdef0'
|
19
|
+
},
|
20
|
+
list_ip_sets: {
|
21
|
+
next_marker: 'my-wafv2-ip-set',
|
22
|
+
ip_sets: [
|
23
|
+
{
|
24
|
+
name: 'my-wafv2-ip-set',
|
25
|
+
id: '01234567-89ab-cdef-0123-456789abcdef',
|
26
|
+
description: 'dev ips',
|
27
|
+
lock_token: '01234567-89ab-cdef-0123456789abcdef0',
|
28
|
+
arn: 'arn:aws:wafv2:ap-northeast-1:123456789012:regional/ipset/'\
|
29
|
+
'my-wafv2-ip-set/01234567-89ab-cdef-0123-456789abcdef'
|
30
|
+
}
|
31
|
+
]
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,151 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Aws.config[:wafv2] = {
|
4
|
+
stub_responses: {
|
5
|
+
get_web_acl: {
|
6
|
+
web_acl: {
|
7
|
+
name: 'my-wafv2-web-acl',
|
8
|
+
id: 'a64cc988-40ec-4c4e-ab80-c9acbea42103',
|
9
|
+
arn: 'arn:aws:wafv2:ap-northeast-1:123456789012:regional/webacl/'\
|
10
|
+
'my-wafv2-web-acl/a64cc988-40ec-4c4e-ab80-c9acbea42103',
|
11
|
+
default_action: {
|
12
|
+
allow: {}
|
13
|
+
},
|
14
|
+
description: 'test web acl',
|
15
|
+
rules: [
|
16
|
+
{
|
17
|
+
name: 'AWS-AWSManagedRulesCommonRuleSet',
|
18
|
+
priority: 0,
|
19
|
+
statement: {
|
20
|
+
managed_rule_group_statement: {
|
21
|
+
vendor_name: 'AWS',
|
22
|
+
name: 'AWSManagedRulesCommonRuleSet'
|
23
|
+
}
|
24
|
+
},
|
25
|
+
override_action: {
|
26
|
+
none: {}
|
27
|
+
},
|
28
|
+
visibility_config: {
|
29
|
+
sampled_requests_enabled: true,
|
30
|
+
cloud_watch_metrics_enabled: true,
|
31
|
+
metric_name: 'AWS-AWSManagedRulesCommonRuleSet'
|
32
|
+
}
|
33
|
+
},
|
34
|
+
{
|
35
|
+
name: 'AWS-AWSManagedRulesKnownBadInputsRuleSet',
|
36
|
+
priority: 1,
|
37
|
+
statement: {
|
38
|
+
managed_rule_group_statement: {
|
39
|
+
vendor_name: 'AWS',
|
40
|
+
name: 'AWSManagedRulesKnownBadInputsRuleSet'
|
41
|
+
}
|
42
|
+
},
|
43
|
+
override_action: {
|
44
|
+
none: {}
|
45
|
+
},
|
46
|
+
visibility_config: {
|
47
|
+
sampled_requests_enabled: true,
|
48
|
+
cloud_watch_metrics_enabled: true,
|
49
|
+
metric_name: 'AWS-AWSManagedRulesKnownBadInputsRuleSet'
|
50
|
+
}
|
51
|
+
},
|
52
|
+
{
|
53
|
+
name: 'AWS-AWSManagedRulesLinuxRuleSet',
|
54
|
+
priority: 2,
|
55
|
+
statement: {
|
56
|
+
managed_rule_group_statement: {
|
57
|
+
vendor_name: 'AWS',
|
58
|
+
name: 'AWSManagedRulesLinuxRuleSet'
|
59
|
+
}
|
60
|
+
},
|
61
|
+
override_action: {
|
62
|
+
none: {}
|
63
|
+
},
|
64
|
+
visibility_config: {
|
65
|
+
sampled_requests_enabled: true,
|
66
|
+
cloud_watch_metrics_enabled: true,
|
67
|
+
metric_name: 'AWS-AWSManagedRulesLinuxRuleSet'
|
68
|
+
}
|
69
|
+
},
|
70
|
+
{
|
71
|
+
name: 'AWS-AWSManagedRulesUnixRuleSet',
|
72
|
+
priority: 3,
|
73
|
+
statement: {
|
74
|
+
managed_rule_group_statement: {
|
75
|
+
vendor_name: 'AWS',
|
76
|
+
name: 'AWSManagedRulesUnixRuleSet'
|
77
|
+
}
|
78
|
+
},
|
79
|
+
override_action: {
|
80
|
+
none: {}
|
81
|
+
},
|
82
|
+
visibility_config: {
|
83
|
+
sampled_requests_enabled: true,
|
84
|
+
cloud_watch_metrics_enabled: true,
|
85
|
+
metric_name: 'AWS-AWSManagedRulesUnixRuleSet'
|
86
|
+
}
|
87
|
+
},
|
88
|
+
{
|
89
|
+
name: 'AWS-AWSManagedRulesAnonymousIpList',
|
90
|
+
priority: 4,
|
91
|
+
statement: {
|
92
|
+
managed_rule_group_statement: {
|
93
|
+
vendor_name: 'AWS',
|
94
|
+
name: 'AWSManagedRulesAnonymousIpList'
|
95
|
+
}
|
96
|
+
},
|
97
|
+
override_action: {
|
98
|
+
none: {}
|
99
|
+
},
|
100
|
+
visibility_config: {
|
101
|
+
sampled_requests_enabled: true,
|
102
|
+
cloud_watch_metrics_enabled: true,
|
103
|
+
metric_name: 'AWS-AWSManagedRulesAnonymousIpList'
|
104
|
+
}
|
105
|
+
},
|
106
|
+
{
|
107
|
+
name: 'AWS-AWSManagedRulesAmazonIpReputationList',
|
108
|
+
priority: 5,
|
109
|
+
statement: {
|
110
|
+
managed_rule_group_statement: {
|
111
|
+
vendor_name: 'AWS',
|
112
|
+
name: 'AWSManagedRulesAmazonIpReputationList'
|
113
|
+
}
|
114
|
+
},
|
115
|
+
override_action: {
|
116
|
+
none: {}
|
117
|
+
},
|
118
|
+
visibility_config: {
|
119
|
+
sampled_requests_enabled: true,
|
120
|
+
cloud_watch_metrics_enabled: true,
|
121
|
+
metric_name: 'AWS-AWSManagedRulesAmazonIpReputationList'
|
122
|
+
}
|
123
|
+
}
|
124
|
+
],
|
125
|
+
visibility_config: {
|
126
|
+
sampled_requests_enabled: true,
|
127
|
+
cloud_watch_metrics_enabled: true,
|
128
|
+
metric_name: 'my-wafv2-web-acl'
|
129
|
+
},
|
130
|
+
capacity: 1275,
|
131
|
+
managed_by_firewall_manager: false,
|
132
|
+
label_namespace: 'awswaf:123456789012:webacl:my-wafv2-web-acl:',
|
133
|
+
retrofitted_by_firewall_manager: false
|
134
|
+
},
|
135
|
+
'lock_token': '8060f9d3-6437-4457-934c-e20bc0440e04'
|
136
|
+
},
|
137
|
+
list_web_acls: {
|
138
|
+
next_marker: 'my-wafv2-web-acl',
|
139
|
+
web_acls: [
|
140
|
+
{
|
141
|
+
name: 'my-wafv2-web-acl',
|
142
|
+
id: 'a64cc988-40ec-4c4e-ab80-c9acbea42103',
|
143
|
+
description: '',
|
144
|
+
lock_token: '8060f9d3-6437-4457-934c-e20bc0440e04',
|
145
|
+
arn: 'arn:aws:wafv2:ap-northeast-1:123456789012:regional/webacl/'\
|
146
|
+
'my-wafv2-web-acl/a64cc988-40ec-4c4e-ab80-c9acbea42103'
|
147
|
+
}
|
148
|
+
]
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class BackupPlan < ResourceBase
|
5
|
+
def resource_via_client
|
6
|
+
@resource_via_client ||= find_backup_plan(@display_name)
|
7
|
+
end
|
8
|
+
|
9
|
+
def id
|
10
|
+
@id ||= resource_via_client.backup_plan_id if resource_via_client
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class BackupSelection < ResourceBase
|
5
|
+
def resource_via_client
|
6
|
+
@resource_via_client ||= find_backup_selection(@display_name)
|
7
|
+
end
|
8
|
+
|
9
|
+
def id
|
10
|
+
@id ||= resource_via_client.selection_id if resource_via_client
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class BackupVault < ResourceBase
|
5
|
+
def resource_via_client
|
6
|
+
@resource_via_client ||= find_backup_vault(@display_name)
|
7
|
+
end
|
8
|
+
|
9
|
+
def id
|
10
|
+
@id ||= resource_via_client.backup_vault_arn if resource_via_client
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/awspec/type/base.rb
CHANGED
@@ -33,7 +33,11 @@ module Awspec::Type
|
|
33
33
|
begin
|
34
34
|
tags = resource_via_client.tags
|
35
35
|
rescue NoMethodError
|
36
|
-
|
36
|
+
begin
|
37
|
+
tags = resource_via_client.tag_set
|
38
|
+
rescue NoMethodError
|
39
|
+
tags = resource_via_client.tag_list
|
40
|
+
end
|
37
41
|
end
|
38
42
|
return false unless tags
|
39
43
|
|
@@ -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.name if resource_via_client
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -2,17 +2,14 @@
|
|
2
2
|
|
3
3
|
module Awspec::Type
|
4
4
|
class TransferServer < ResourceBase
|
5
|
-
attr_reader :id
|
6
|
-
|
7
5
|
tags_allowed
|
8
6
|
|
9
|
-
def
|
10
|
-
|
11
|
-
@id = id
|
7
|
+
def resource_via_client
|
8
|
+
@resource_via_client ||= find_transfer_server(@display_name)
|
12
9
|
end
|
13
10
|
|
14
|
-
def
|
15
|
-
@
|
11
|
+
def id
|
12
|
+
@id ||= resource_via_client.server_id if resource_via_client
|
16
13
|
end
|
17
14
|
|
18
15
|
STATES = %w[
|
@@ -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
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Awspec::Type
|
4
|
+
class Wafv2WebAcl < ResourceBase
|
5
|
+
attr_accessor :scope
|
6
|
+
|
7
|
+
def resource_via_client
|
8
|
+
@resource_via_client ||= find_web_acl(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 default_action
|
20
|
+
resource_via_client.default_action.allow ? 'ALLOW' : 'BLOCK'
|
21
|
+
end
|
22
|
+
|
23
|
+
def has_rule?(name, priority = nil, action = nil, override_action = nil)
|
24
|
+
resource_via_client.rules.find do |rule|
|
25
|
+
next false if !priority.nil? && rule.priority != priority
|
26
|
+
next false if !action.nil? && !rule.action.reject { |v| v.nil? }.first.class.to_s.include?(action.capitalize)
|
27
|
+
next false if !override_action.nil? &&
|
28
|
+
!rule.override_action.reject { |v| v.nil? }.first.class.to_s.include?(override_action.capitalize)
|
29
|
+
next true if rule.name == name
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/awspec/version.rb
CHANGED