fastly 18.0.0 → 18.1.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/CHANGELOG.md +41 -11
- data/Gemfile.lock +4 -4
- data/README.md +4 -1
- data/docs/Backend.md +5 -0
- data/docs/BackendApi.md +20 -0
- data/docs/BackendResponse.md +5 -0
- data/docs/BotManagementApi.md +44 -2
- data/docs/BotManagementCategoryBots.md +10 -0
- data/docs/BotManagementCategoryBotsAction.md +10 -0
- data/docs/DdosProtectionRule.md +1 -0
- data/docs/DdosProtectionRuleAllOf.md +1 -0
- data/docs/DdosProtectionRuleWithStats.md +1 -0
- data/docs/HistoricalApi.md +10 -10
- data/docs/RealtimeEntryAggregated.md +2 -0
- data/docs/RealtimeEntryDatacenter.md +2 -0
- data/docs/RealtimeMeasurements.md +2 -0
- data/docs/Results.md +2 -0
- data/lib/fastly/api/backend_api.rb +38 -0
- data/lib/fastly/api/bot_management_api.rb +86 -4
- data/lib/fastly/api/bot_requests_metrics_api.rb +1 -1
- data/lib/fastly/api/domain_inspector_historical_api.rb +1 -1
- data/lib/fastly/api/historical_api.rb +15 -15
- data/lib/fastly/api/metrics_platform_api.rb +2 -2
- data/lib/fastly/api/origin_inspector_historical_api.rb +1 -1
- data/lib/fastly/configuration.rb +6 -0
- data/lib/fastly/models/backend.rb +90 -1
- data/lib/fastly/models/backend_response.rb +90 -1
- data/lib/fastly/models/bot_management_category_bots.rb +222 -0
- data/lib/fastly/models/bot_management_category_bots_action.rb +257 -0
- data/lib/fastly/models/ddos_protection_rule.rb +12 -1
- data/lib/fastly/models/ddos_protection_rule_all_of.rb +12 -1
- data/lib/fastly/models/ddos_protection_rule_with_stats.rb +12 -1
- data/lib/fastly/models/pop.rb +6 -6
- data/lib/fastly/models/realtime_entry_aggregated.rb +24 -4
- data/lib/fastly/models/realtime_entry_datacenter.rb +24 -4
- data/lib/fastly/models/realtime_measurements.rb +24 -4
- data/lib/fastly/models/results.rb +21 -1
- data/lib/fastly/version.rb +1 -1
- data/lib/fastly.rb +2 -0
- data/sig.json +1 -1
- metadata +2502 -2498
|
@@ -43,6 +43,21 @@ module Fastly
|
|
|
43
43
|
# The hostname of the backend. May be used as an alternative to `address` to set the backend location.
|
|
44
44
|
attr_accessor :hostname
|
|
45
45
|
|
|
46
|
+
# If the backend is using IAM authentication and the IAM system policy requires a matching external identifier, it should match this value. Your Fastly customer ID will be used if this attribute is not set.
|
|
47
|
+
attr_accessor :iam_external_id
|
|
48
|
+
|
|
49
|
+
# If the backend is using IAM authentication, the IAM signature will use this as the product element.
|
|
50
|
+
attr_accessor :iam_product
|
|
51
|
+
|
|
52
|
+
# If the backend is using IAM authentication, this region will be used for signing and access.
|
|
53
|
+
attr_accessor :iam_region
|
|
54
|
+
|
|
55
|
+
# If the backend is using IAM authentication, the fully qualified role string supplied by the storage vendor.
|
|
56
|
+
attr_accessor :iam_role
|
|
57
|
+
|
|
58
|
+
# A label that identifies the storage vendor. Providing a value in this field enables IAM usage, and all other IAM fields depend on its value.
|
|
59
|
+
attr_accessor :iam_vendor
|
|
60
|
+
|
|
46
61
|
# IPv4 address of the backend. May be used as an alternative to `address` to set the backend location.
|
|
47
62
|
attr_accessor :ipv4
|
|
48
63
|
|
|
@@ -146,6 +161,28 @@ module Fastly
|
|
|
146
161
|
# Indicates whether the version of the service this backend is attached to accepts edits.
|
|
147
162
|
attr_accessor :locked
|
|
148
163
|
|
|
164
|
+
class EnumAttributeValidator
|
|
165
|
+
attr_reader :datatype
|
|
166
|
+
attr_reader :allowable_values
|
|
167
|
+
|
|
168
|
+
def initialize(datatype, allowable_values)
|
|
169
|
+
@allowable_values = allowable_values.map do |value|
|
|
170
|
+
case datatype.to_s
|
|
171
|
+
when /Integer/i
|
|
172
|
+
value.to_i
|
|
173
|
+
when /Float/i
|
|
174
|
+
value.to_f
|
|
175
|
+
else
|
|
176
|
+
value
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def valid?(value)
|
|
182
|
+
!value || allowable_values.include?(value)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
149
186
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
150
187
|
def self.attribute_map
|
|
151
188
|
{
|
|
@@ -159,6 +196,11 @@ module Fastly
|
|
|
159
196
|
:'fetch_timeout' => :'fetch_timeout',
|
|
160
197
|
:'healthcheck' => :'healthcheck',
|
|
161
198
|
:'hostname' => :'hostname',
|
|
199
|
+
:'iam_external_id' => :'iam_external_id',
|
|
200
|
+
:'iam_product' => :'iam_product',
|
|
201
|
+
:'iam_region' => :'iam_region',
|
|
202
|
+
:'iam_role' => :'iam_role',
|
|
203
|
+
:'iam_vendor' => :'iam_vendor',
|
|
162
204
|
:'ipv4' => :'ipv4',
|
|
163
205
|
:'ipv6' => :'ipv6',
|
|
164
206
|
:'keepalive_time' => :'keepalive_time',
|
|
@@ -215,6 +257,11 @@ module Fastly
|
|
|
215
257
|
:'fetch_timeout' => :'Integer',
|
|
216
258
|
:'healthcheck' => :'String',
|
|
217
259
|
:'hostname' => :'String',
|
|
260
|
+
:'iam_external_id' => :'String',
|
|
261
|
+
:'iam_product' => :'String',
|
|
262
|
+
:'iam_region' => :'String',
|
|
263
|
+
:'iam_role' => :'String',
|
|
264
|
+
:'iam_vendor' => :'String',
|
|
218
265
|
:'ipv4' => :'String',
|
|
219
266
|
:'ipv6' => :'String',
|
|
220
267
|
:'keepalive_time' => :'Integer',
|
|
@@ -260,6 +307,11 @@ module Fastly
|
|
|
260
307
|
:'comment',
|
|
261
308
|
:'healthcheck',
|
|
262
309
|
:'hostname',
|
|
310
|
+
:'iam_external_id',
|
|
311
|
+
:'iam_product',
|
|
312
|
+
:'iam_region',
|
|
313
|
+
:'iam_role',
|
|
314
|
+
:'iam_vendor',
|
|
263
315
|
:'ipv4',
|
|
264
316
|
:'ipv6',
|
|
265
317
|
:'keepalive_time',
|
|
@@ -353,6 +405,26 @@ module Fastly
|
|
|
353
405
|
self.hostname = attributes[:'hostname']
|
|
354
406
|
end
|
|
355
407
|
|
|
408
|
+
if attributes.key?(:'iam_external_id')
|
|
409
|
+
self.iam_external_id = attributes[:'iam_external_id']
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
if attributes.key?(:'iam_product')
|
|
413
|
+
self.iam_product = attributes[:'iam_product']
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
if attributes.key?(:'iam_region')
|
|
417
|
+
self.iam_region = attributes[:'iam_region']
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
if attributes.key?(:'iam_role')
|
|
421
|
+
self.iam_role = attributes[:'iam_role']
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
if attributes.key?(:'iam_vendor')
|
|
425
|
+
self.iam_vendor = attributes[:'iam_vendor']
|
|
426
|
+
end
|
|
427
|
+
|
|
356
428
|
if attributes.key?(:'ipv4')
|
|
357
429
|
self.ipv4 = attributes[:'ipv4']
|
|
358
430
|
end
|
|
@@ -517,10 +589,22 @@ module Fastly
|
|
|
517
589
|
# Check to see if the all the properties in the model are valid
|
|
518
590
|
# @return true if the model is valid
|
|
519
591
|
def valid?
|
|
592
|
+
iam_vendor_validator = EnumAttributeValidator.new('String', ["aws"])
|
|
593
|
+
return false unless iam_vendor_validator.valid?(@iam_vendor)
|
|
520
594
|
return false if !@share_key.nil? && @share_key !~ Regexp.new(/^[A-Za-z0-9]+$/)
|
|
521
595
|
true
|
|
522
596
|
end
|
|
523
597
|
|
|
598
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
599
|
+
# @param [Object] iam_vendor Object to be assigned
|
|
600
|
+
def iam_vendor=(iam_vendor)
|
|
601
|
+
validator = EnumAttributeValidator.new('String', ["aws"])
|
|
602
|
+
unless validator.valid?(iam_vendor)
|
|
603
|
+
fail ArgumentError, "invalid value for \"iam_vendor\", must be one of #{validator.allowable_values}."
|
|
604
|
+
end
|
|
605
|
+
@iam_vendor = iam_vendor
|
|
606
|
+
end
|
|
607
|
+
|
|
524
608
|
# Custom attribute writer method with validation
|
|
525
609
|
# @param [Object] share_key Value to be assigned
|
|
526
610
|
def share_key=(share_key)
|
|
@@ -547,6 +631,11 @@ module Fastly
|
|
|
547
631
|
fetch_timeout == o.fetch_timeout &&
|
|
548
632
|
healthcheck == o.healthcheck &&
|
|
549
633
|
hostname == o.hostname &&
|
|
634
|
+
iam_external_id == o.iam_external_id &&
|
|
635
|
+
iam_product == o.iam_product &&
|
|
636
|
+
iam_region == o.iam_region &&
|
|
637
|
+
iam_role == o.iam_role &&
|
|
638
|
+
iam_vendor == o.iam_vendor &&
|
|
550
639
|
ipv4 == o.ipv4 &&
|
|
551
640
|
ipv6 == o.ipv6 &&
|
|
552
641
|
keepalive_time == o.keepalive_time &&
|
|
@@ -593,7 +682,7 @@ module Fastly
|
|
|
593
682
|
# Calculates hash code according to all attributes.
|
|
594
683
|
# @return [Integer] Hash code
|
|
595
684
|
def hash
|
|
596
|
-
[address, auto_loadbalance, between_bytes_timeout, client_cert, comment, connect_timeout, first_byte_timeout, fetch_timeout, healthcheck, hostname, ipv4, ipv6, keepalive_time, max_conn, max_lifetime, max_tls_version, min_tls_version, max_use, name, override_host, port, prefer_ipv6, request_condition, share_key, shield, ssl_ca_cert, ssl_cert_hostname, ssl_check_cert, ssl_ciphers, ssl_client_cert, ssl_client_key, ssl_hostname, ssl_sni_hostname, tcp_keepalive_enable, tcp_keepalive_interval, tcp_keepalive_probes, tcp_keepalive_time, use_ssl, weight, created_at, deleted_at, updated_at, service_id, version, locked].hash
|
|
685
|
+
[address, auto_loadbalance, between_bytes_timeout, client_cert, comment, connect_timeout, first_byte_timeout, fetch_timeout, healthcheck, hostname, iam_external_id, iam_product, iam_region, iam_role, iam_vendor, ipv4, ipv6, keepalive_time, max_conn, max_lifetime, max_tls_version, min_tls_version, max_use, name, override_host, port, prefer_ipv6, request_condition, share_key, shield, ssl_ca_cert, ssl_cert_hostname, ssl_check_cert, ssl_ciphers, ssl_client_cert, ssl_client_key, ssl_hostname, ssl_sni_hostname, tcp_keepalive_enable, tcp_keepalive_interval, tcp_keepalive_probes, tcp_keepalive_time, use_ssl, weight, created_at, deleted_at, updated_at, service_id, version, locked].hash
|
|
597
686
|
end
|
|
598
687
|
|
|
599
688
|
# Builds the object from hash
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Fastly API
|
|
3
|
+
|
|
4
|
+
#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: oss@fastly.com
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require 'date'
|
|
12
|
+
require 'time'
|
|
13
|
+
|
|
14
|
+
module Fastly
|
|
15
|
+
# An action to apply to every bot in a category.
|
|
16
|
+
class BotManagementCategoryBots
|
|
17
|
+
attr_accessor :action
|
|
18
|
+
|
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
20
|
+
def self.attribute_map
|
|
21
|
+
{
|
|
22
|
+
:'action' => :'action'
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Returns all the JSON keys this model knows about
|
|
27
|
+
def self.acceptable_attributes
|
|
28
|
+
attribute_map.values
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Attribute type mapping.
|
|
32
|
+
def self.fastly_types
|
|
33
|
+
{
|
|
34
|
+
:'action' => :'BotManagementCategoryBotsAction'
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# List of attributes with nullable: true
|
|
39
|
+
def self.fastly_nullable
|
|
40
|
+
Set.new([
|
|
41
|
+
])
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Initializes the object
|
|
45
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
46
|
+
def initialize(attributes = {})
|
|
47
|
+
if (!attributes.is_a?(Hash))
|
|
48
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::BotManagementCategoryBots` initialize method"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
53
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
54
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::BotManagementCategoryBots`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
55
|
+
end
|
|
56
|
+
h[k.to_sym] = v
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if attributes.key?(:'action')
|
|
60
|
+
self.action = attributes[:'action']
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
65
|
+
# @return Array for valid properties with the reasons
|
|
66
|
+
def list_invalid_properties
|
|
67
|
+
invalid_properties = Array.new
|
|
68
|
+
if @action.nil?
|
|
69
|
+
invalid_properties.push('invalid value for "action", action cannot be nil.')
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
invalid_properties
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Check to see if the all the properties in the model are valid
|
|
76
|
+
# @return true if the model is valid
|
|
77
|
+
def valid?
|
|
78
|
+
return false if @action.nil?
|
|
79
|
+
true
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Checks equality by comparing each attribute.
|
|
83
|
+
# @param [Object] Object to be compared
|
|
84
|
+
def ==(o)
|
|
85
|
+
return true if self.equal?(o)
|
|
86
|
+
self.class == o.class &&
|
|
87
|
+
action == o.action
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# @see the `==` method
|
|
91
|
+
# @param [Object] Object to be compared
|
|
92
|
+
def eql?(o)
|
|
93
|
+
self == o
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Calculates hash code according to all attributes.
|
|
97
|
+
# @return [Integer] Hash code
|
|
98
|
+
def hash
|
|
99
|
+
[action].hash
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Builds the object from hash
|
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
104
|
+
# @return [Object] Returns the model itself
|
|
105
|
+
def self.build_from_hash(attributes)
|
|
106
|
+
new.build_from_hash(attributes)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Builds the object from hash
|
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
111
|
+
# @return [Object] Returns the model itself
|
|
112
|
+
def build_from_hash(attributes)
|
|
113
|
+
return nil unless attributes.is_a?(Hash)
|
|
114
|
+
self.class.fastly_types.each_pair do |key, type|
|
|
115
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
|
|
116
|
+
self.send("#{key}=", nil)
|
|
117
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
118
|
+
# check to ensure the input is an array given that the attribute
|
|
119
|
+
# is documented as an array but the input is not
|
|
120
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
121
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
122
|
+
end
|
|
123
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
124
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
self
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Deserializes the data based on type
|
|
132
|
+
# @param string type Data type
|
|
133
|
+
# @param string value Value to be deserialized
|
|
134
|
+
# @return [Object] Deserialized data
|
|
135
|
+
def _deserialize(type, value)
|
|
136
|
+
case type.to_sym
|
|
137
|
+
when :Time
|
|
138
|
+
Time.parse(value)
|
|
139
|
+
when :Date
|
|
140
|
+
Date.parse(value)
|
|
141
|
+
when :String
|
|
142
|
+
value.to_s
|
|
143
|
+
when :Integer
|
|
144
|
+
value.to_i
|
|
145
|
+
when :Float
|
|
146
|
+
value.to_f
|
|
147
|
+
when :Boolean
|
|
148
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
149
|
+
true
|
|
150
|
+
else
|
|
151
|
+
false
|
|
152
|
+
end
|
|
153
|
+
when :Object
|
|
154
|
+
# generic object (usually a Hash), return directly
|
|
155
|
+
value
|
|
156
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
157
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
158
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
159
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
160
|
+
k_type = Regexp.last_match[:k_type]
|
|
161
|
+
v_type = Regexp.last_match[:v_type]
|
|
162
|
+
{}.tap do |hash|
|
|
163
|
+
value.each do |k, v|
|
|
164
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
else # model
|
|
168
|
+
# models (e.g. Pet) or oneOf
|
|
169
|
+
klass = Fastly.const_get(type)
|
|
170
|
+
klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Returns the string representation of the object
|
|
175
|
+
# @return [String] String presentation of the object
|
|
176
|
+
def to_s
|
|
177
|
+
to_hash.to_s
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
181
|
+
# @return [Hash] Returns the object in the form of hash
|
|
182
|
+
def to_body
|
|
183
|
+
to_hash
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Returns the object in the form of hash
|
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
|
188
|
+
def to_hash
|
|
189
|
+
hash = {}
|
|
190
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
191
|
+
value = self.send(attr)
|
|
192
|
+
if value.nil?
|
|
193
|
+
is_nullable = self.class.fastly_nullable.include?(attr)
|
|
194
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
hash[param] = _to_hash(value)
|
|
198
|
+
end
|
|
199
|
+
hash
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Outputs non-array value in the form of hash
|
|
203
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
204
|
+
# @param [Object] value Any valid value
|
|
205
|
+
# @return [Hash] Returns the value in the form of hash
|
|
206
|
+
def _to_hash(value)
|
|
207
|
+
if value.is_a?(Array)
|
|
208
|
+
value.compact.map { |v| _to_hash(v) }
|
|
209
|
+
elsif value.is_a?(Hash)
|
|
210
|
+
{}.tap do |hash|
|
|
211
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
212
|
+
end
|
|
213
|
+
elsif value.respond_to? :to_hash
|
|
214
|
+
value.to_hash
|
|
215
|
+
else
|
|
216
|
+
value
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
end
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Fastly API
|
|
3
|
+
|
|
4
|
+
#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: oss@fastly.com
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require 'date'
|
|
12
|
+
require 'time'
|
|
13
|
+
|
|
14
|
+
module Fastly
|
|
15
|
+
# The action to apply to every bot in a category.
|
|
16
|
+
class BotManagementCategoryBotsAction
|
|
17
|
+
# The type of action to apply. Only `inherit` is supported.
|
|
18
|
+
attr_accessor :type
|
|
19
|
+
|
|
20
|
+
class EnumAttributeValidator
|
|
21
|
+
attr_reader :datatype
|
|
22
|
+
attr_reader :allowable_values
|
|
23
|
+
|
|
24
|
+
def initialize(datatype, allowable_values)
|
|
25
|
+
@allowable_values = allowable_values.map do |value|
|
|
26
|
+
case datatype.to_s
|
|
27
|
+
when /Integer/i
|
|
28
|
+
value.to_i
|
|
29
|
+
when /Float/i
|
|
30
|
+
value.to_f
|
|
31
|
+
else
|
|
32
|
+
value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def valid?(value)
|
|
38
|
+
!value || allowable_values.include?(value)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
43
|
+
def self.attribute_map
|
|
44
|
+
{
|
|
45
|
+
:'type' => :'type'
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Returns all the JSON keys this model knows about
|
|
50
|
+
def self.acceptable_attributes
|
|
51
|
+
attribute_map.values
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Attribute type mapping.
|
|
55
|
+
def self.fastly_types
|
|
56
|
+
{
|
|
57
|
+
:'type' => :'String'
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# List of attributes with nullable: true
|
|
62
|
+
def self.fastly_nullable
|
|
63
|
+
Set.new([
|
|
64
|
+
])
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Initializes the object
|
|
68
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
69
|
+
def initialize(attributes = {})
|
|
70
|
+
if (!attributes.is_a?(Hash))
|
|
71
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::BotManagementCategoryBotsAction` initialize method"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
75
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
76
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
77
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::BotManagementCategoryBotsAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
78
|
+
end
|
|
79
|
+
h[k.to_sym] = v
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if attributes.key?(:'type')
|
|
83
|
+
self.type = attributes[:'type']
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
88
|
+
# @return Array for valid properties with the reasons
|
|
89
|
+
def list_invalid_properties
|
|
90
|
+
invalid_properties = Array.new
|
|
91
|
+
if @type.nil?
|
|
92
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
invalid_properties
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Check to see if the all the properties in the model are valid
|
|
99
|
+
# @return true if the model is valid
|
|
100
|
+
def valid?
|
|
101
|
+
return false if @type.nil?
|
|
102
|
+
type_validator = EnumAttributeValidator.new('String', ["inherit"])
|
|
103
|
+
return false unless type_validator.valid?(@type)
|
|
104
|
+
true
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
108
|
+
# @param [Object] type Object to be assigned
|
|
109
|
+
def type=(type)
|
|
110
|
+
validator = EnumAttributeValidator.new('String', ["inherit"])
|
|
111
|
+
unless validator.valid?(type)
|
|
112
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
113
|
+
end
|
|
114
|
+
@type = type
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Checks equality by comparing each attribute.
|
|
118
|
+
# @param [Object] Object to be compared
|
|
119
|
+
def ==(o)
|
|
120
|
+
return true if self.equal?(o)
|
|
121
|
+
self.class == o.class &&
|
|
122
|
+
type == o.type
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# @see the `==` method
|
|
126
|
+
# @param [Object] Object to be compared
|
|
127
|
+
def eql?(o)
|
|
128
|
+
self == o
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Calculates hash code according to all attributes.
|
|
132
|
+
# @return [Integer] Hash code
|
|
133
|
+
def hash
|
|
134
|
+
[type].hash
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Builds the object from hash
|
|
138
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
139
|
+
# @return [Object] Returns the model itself
|
|
140
|
+
def self.build_from_hash(attributes)
|
|
141
|
+
new.build_from_hash(attributes)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Builds the object from hash
|
|
145
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
146
|
+
# @return [Object] Returns the model itself
|
|
147
|
+
def build_from_hash(attributes)
|
|
148
|
+
return nil unless attributes.is_a?(Hash)
|
|
149
|
+
self.class.fastly_types.each_pair do |key, type|
|
|
150
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
|
|
151
|
+
self.send("#{key}=", nil)
|
|
152
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
153
|
+
# check to ensure the input is an array given that the attribute
|
|
154
|
+
# is documented as an array but the input is not
|
|
155
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
156
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
157
|
+
end
|
|
158
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
159
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
self
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Deserializes the data based on type
|
|
167
|
+
# @param string type Data type
|
|
168
|
+
# @param string value Value to be deserialized
|
|
169
|
+
# @return [Object] Deserialized data
|
|
170
|
+
def _deserialize(type, value)
|
|
171
|
+
case type.to_sym
|
|
172
|
+
when :Time
|
|
173
|
+
Time.parse(value)
|
|
174
|
+
when :Date
|
|
175
|
+
Date.parse(value)
|
|
176
|
+
when :String
|
|
177
|
+
value.to_s
|
|
178
|
+
when :Integer
|
|
179
|
+
value.to_i
|
|
180
|
+
when :Float
|
|
181
|
+
value.to_f
|
|
182
|
+
when :Boolean
|
|
183
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
184
|
+
true
|
|
185
|
+
else
|
|
186
|
+
false
|
|
187
|
+
end
|
|
188
|
+
when :Object
|
|
189
|
+
# generic object (usually a Hash), return directly
|
|
190
|
+
value
|
|
191
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
192
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
193
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
194
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
195
|
+
k_type = Regexp.last_match[:k_type]
|
|
196
|
+
v_type = Regexp.last_match[:v_type]
|
|
197
|
+
{}.tap do |hash|
|
|
198
|
+
value.each do |k, v|
|
|
199
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
else # model
|
|
203
|
+
# models (e.g. Pet) or oneOf
|
|
204
|
+
klass = Fastly.const_get(type)
|
|
205
|
+
klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Returns the string representation of the object
|
|
210
|
+
# @return [String] String presentation of the object
|
|
211
|
+
def to_s
|
|
212
|
+
to_hash.to_s
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
216
|
+
# @return [Hash] Returns the object in the form of hash
|
|
217
|
+
def to_body
|
|
218
|
+
to_hash
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Returns the object in the form of hash
|
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
|
223
|
+
def to_hash
|
|
224
|
+
hash = {}
|
|
225
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
226
|
+
value = self.send(attr)
|
|
227
|
+
if value.nil?
|
|
228
|
+
is_nullable = self.class.fastly_nullable.include?(attr)
|
|
229
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
hash[param] = _to_hash(value)
|
|
233
|
+
end
|
|
234
|
+
hash
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Outputs non-array value in the form of hash
|
|
238
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
239
|
+
# @param [Object] value Any valid value
|
|
240
|
+
# @return [Hash] Returns the value in the form of hash
|
|
241
|
+
def _to_hash(value)
|
|
242
|
+
if value.is_a?(Array)
|
|
243
|
+
value.compact.map { |v| _to_hash(v) }
|
|
244
|
+
elsif value.is_a?(Hash)
|
|
245
|
+
{}.tap do |hash|
|
|
246
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
247
|
+
end
|
|
248
|
+
elsif value.respond_to? :to_hash
|
|
249
|
+
value.to_hash
|
|
250
|
+
else
|
|
251
|
+
value
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
end
|
|
@@ -49,6 +49,9 @@ module Fastly
|
|
|
49
49
|
# Source IP prefix attribute.
|
|
50
50
|
attr_accessor :source_ip_prefix
|
|
51
51
|
|
|
52
|
+
# URL path attribute.
|
|
53
|
+
attr_accessor :path
|
|
54
|
+
|
|
52
55
|
# Attribute category for additional, unlisted attributes used in a rule.
|
|
53
56
|
attr_accessor :additional_attributes
|
|
54
57
|
|
|
@@ -67,6 +70,7 @@ module Fastly
|
|
|
67
70
|
:'host' => :'host',
|
|
68
71
|
:'asn' => :'asn',
|
|
69
72
|
:'source_ip_prefix' => :'source_ip_prefix',
|
|
73
|
+
:'path' => :'path',
|
|
70
74
|
:'additional_attributes' => :'additional_attributes'
|
|
71
75
|
}
|
|
72
76
|
end
|
|
@@ -91,6 +95,7 @@ module Fastly
|
|
|
91
95
|
:'host' => :'String',
|
|
92
96
|
:'asn' => :'String',
|
|
93
97
|
:'source_ip_prefix' => :'String',
|
|
98
|
+
:'path' => :'String',
|
|
94
99
|
:'additional_attributes' => :'Array<String>'
|
|
95
100
|
}
|
|
96
101
|
end
|
|
@@ -105,6 +110,7 @@ module Fastly
|
|
|
105
110
|
:'host',
|
|
106
111
|
:'asn',
|
|
107
112
|
:'source_ip_prefix',
|
|
113
|
+
:'path',
|
|
108
114
|
])
|
|
109
115
|
end
|
|
110
116
|
|
|
@@ -181,6 +187,10 @@ module Fastly
|
|
|
181
187
|
self.source_ip_prefix = attributes[:'source_ip_prefix']
|
|
182
188
|
end
|
|
183
189
|
|
|
190
|
+
if attributes.key?(:'path')
|
|
191
|
+
self.path = attributes[:'path']
|
|
192
|
+
end
|
|
193
|
+
|
|
184
194
|
if attributes.key?(:'additional_attributes')
|
|
185
195
|
if (value = attributes[:'additional_attributes']).is_a?(Array)
|
|
186
196
|
self.additional_attributes = value
|
|
@@ -218,6 +228,7 @@ module Fastly
|
|
|
218
228
|
host == o.host &&
|
|
219
229
|
asn == o.asn &&
|
|
220
230
|
source_ip_prefix == o.source_ip_prefix &&
|
|
231
|
+
path == o.path &&
|
|
221
232
|
additional_attributes == o.additional_attributes
|
|
222
233
|
end
|
|
223
234
|
|
|
@@ -230,7 +241,7 @@ module Fastly
|
|
|
230
241
|
# Calculates hash code according to all attributes.
|
|
231
242
|
# @return [Integer] Hash code
|
|
232
243
|
def hash
|
|
233
|
-
[created_at, updated_at, id, name, action, customer_id, service_id, source_ip, country_code, host, asn, source_ip_prefix, additional_attributes].hash
|
|
244
|
+
[created_at, updated_at, id, name, action, customer_id, service_id, source_ip, country_code, host, asn, source_ip_prefix, path, additional_attributes].hash
|
|
234
245
|
end
|
|
235
246
|
|
|
236
247
|
# Builds the object from hash
|