-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathaws_wafv2_byte_match_set.rb
66 lines (53 loc) · 1.66 KB
/
aws_wafv2_byte_match_set.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require "aws_backend"
class AWSWAFV2ByteMatchSet < AwsResourceBase
name "aws_wafv2_byte_match_set"
desc "Describes one WAF byte set."
example "
describe aws_wafv2_byte_match_set(byte_match_set_id: 'BYTE_MATCH_SET_ID') do
it { should exits }
end
"
def initialize(opts = {})
opts = { byte_match_set_id: opts } if opts.is_a?(String)
super(opts)
validate_parameters(required: %i(byte_match_set_id))
raise ArgumentError, "#{@__resource_name__}: byte_match_set_id must be provided" unless opts[:byte_match_set_id] && !opts[:byte_match_set_id].empty?
@display_name = opts[:byte_match_set_id]
catch_aws_errors do
resp = @aws.waf_client_v2.get_byte_match_set({ byte_match_set_id: opts[:byte_match_set_id] })
@resp = resp.byte_match_set.to_h
create_resource_methods(@resp)
end
end
def byte_match_set_id
return nil unless exists?
@resp[:byte_match_set_id]
end
def exists?
!@resp.nil? && !@resp.empty?
end
def to_s
"Byte Match Set ID: #{@display_name}"
end
def byte_match_tuples_field_to_matches
byte_match_tuples.map(&:field_to_match)
end
def byte_match_tuples_field_to_match_types
byte_match_tuples.map(&:field_to_match).map(&:type)
end
def byte_match_tuples_field_to_match_data
byte_match_tuples.map(&:field_to_match).map(&:data)
end
def byte_match_tuples_target_strings
byte_match_tuples.map(&:target_string)
end
def byte_match_tuples_text_transformations
byte_match_tuples.map(&:text_transformation)
end
def byte_match_tuples_positional_constraints
byte_match_tuples.map(&:positional_constraint)
end
def resource_id
@display_name
end
end