fastly 7.1.1 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +2 -2
- data/README.md +6 -5
- data/docs/HistoricalDdos.md +13 -0
- data/docs/HistoricalDdosMeta.md +13 -0
- data/docs/HistoricalFieldResultsAttributes.md +9 -0
- data/docs/KvStoreApi.md +15 -15
- data/docs/LoggingLogentriesAdditional.md +1 -1
- data/docs/LoggingLogentriesApi.md +4 -4
- data/docs/LoggingLogentriesResponse.md +1 -1
- data/docs/PlatformDdosDataItems.md +10 -0
- data/docs/PlatformDdosEntry.md +10 -0
- data/docs/PlatformDdosResponse.md +13 -0
- data/docs/PlatformDdosResponseAllOf.md +10 -0
- data/docs/RealtimeEntryAggregated.md +9 -0
- data/docs/RealtimeMeasurements.md +9 -0
- data/docs/Results.md +9 -0
- data/docs/SchemasSnippetResponse.md +1 -1
- data/docs/SchemasSnippetResponseCommon.md +15 -0
- data/docs/Snippet.md +1 -1
- data/docs/SnippetAllOf.md +10 -0
- data/docs/SnippetApi.md +6 -6
- data/docs/SnippetCommon.md +13 -0
- data/docs/SnippetResponse.md +1 -1
- data/docs/SnippetResponseCommon.md +15 -0
- data/docs/{SnippetResponseAllOf.md → SnippetResponseCommonAllOf.md} +1 -1
- data/docs/SnippetResponsePost.md +20 -0
- data/docs/SnippetWithDynamicNumber.md +14 -0
- data/docs/SnippetWithDynamicNumberAllOf.md +10 -0
- data/docs/ValuesDdos.md +15 -0
- data/docs/WholePlatformDdosHistoricalApi.md +56 -0
- data/lib/fastly/api/kv_store_api.rb +14 -14
- data/lib/fastly/api/logging_logentries_api.rb +4 -4
- data/lib/fastly/api/snippet_api.rb +17 -17
- data/lib/fastly/api/whole_platform_ddos_historical_api.rb +89 -0
- data/lib/fastly/configuration.rb +6 -0
- data/lib/fastly/models/historical_ddos.rb +249 -0
- data/lib/fastly/models/historical_ddos_meta.rb +248 -0
- data/lib/fastly/models/historical_field_results_attributes.rb +91 -1
- data/lib/fastly/models/logging_logentries_additional.rb +1 -1
- data/lib/fastly/models/logging_logentries_response.rb +1 -1
- data/lib/fastly/models/platform_ddos_data_items.rb +216 -0
- data/lib/fastly/models/platform_ddos_entry.rb +219 -0
- data/lib/fastly/models/platform_ddos_response.rb +257 -0
- data/lib/fastly/models/platform_ddos_response_all_of.rb +219 -0
- data/lib/fastly/models/realtime_entry_aggregated.rb +94 -4
- data/lib/fastly/models/realtime_measurements.rb +94 -4
- data/lib/fastly/models/results.rb +94 -4
- data/lib/fastly/models/schemas_snippet_response.rb +25 -26
- data/lib/fastly/models/schemas_snippet_response_common.rb +276 -0
- data/lib/fastly/models/snippet.rb +34 -26
- data/lib/fastly/models/snippet_all_of.rb +251 -0
- data/lib/fastly/models/snippet_common.rb +283 -0
- data/lib/fastly/models/snippet_response.rb +24 -25
- data/lib/fastly/models/snippet_response_common.rb +276 -0
- data/lib/fastly/models/{snippet_response_all_of.rb → snippet_response_common_all_of.rb} +3 -3
- data/lib/fastly/models/snippet_response_post.rb +374 -0
- data/lib/fastly/models/snippet_with_dynamic_number.rb +313 -0
- data/lib/fastly/models/snippet_with_dynamic_number_all_of.rb +251 -0
- data/lib/fastly/models/values_ddos.rb +268 -0
- data/lib/fastly/version.rb +1 -1
- data/lib/fastly.rb +16 -1
- data/sig.json +1 -1
- metadata +34 -4
@@ -0,0 +1,276 @@
|
|
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://developer.fastly.com/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
|
+
class SchemasSnippetResponseCommon
|
16
|
+
# Date and time in ISO 8601 format.
|
17
|
+
attr_accessor :created_at
|
18
|
+
|
19
|
+
# Date and time in ISO 8601 format.
|
20
|
+
attr_accessor :deleted_at
|
21
|
+
|
22
|
+
# Date and time in ISO 8601 format.
|
23
|
+
attr_accessor :updated_at
|
24
|
+
|
25
|
+
attr_accessor :service_id
|
26
|
+
|
27
|
+
# String representing the number identifying a version of the service.
|
28
|
+
attr_accessor :version
|
29
|
+
|
30
|
+
attr_accessor :id
|
31
|
+
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
+
def self.attribute_map
|
34
|
+
{
|
35
|
+
:'created_at' => :'created_at',
|
36
|
+
:'deleted_at' => :'deleted_at',
|
37
|
+
:'updated_at' => :'updated_at',
|
38
|
+
:'service_id' => :'service_id',
|
39
|
+
:'version' => :'version',
|
40
|
+
:'id' => :'id'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns all the JSON keys this model knows about
|
45
|
+
def self.acceptable_attributes
|
46
|
+
attribute_map.values
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.fastly_types
|
51
|
+
{
|
52
|
+
:'created_at' => :'Time',
|
53
|
+
:'deleted_at' => :'Time',
|
54
|
+
:'updated_at' => :'Time',
|
55
|
+
:'service_id' => :'String',
|
56
|
+
:'version' => :'String',
|
57
|
+
:'id' => :'String'
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# List of attributes with nullable: true
|
62
|
+
def self.fastly_nullable
|
63
|
+
Set.new([
|
64
|
+
:'created_at',
|
65
|
+
:'deleted_at',
|
66
|
+
:'updated_at',
|
67
|
+
])
|
68
|
+
end
|
69
|
+
|
70
|
+
# List of class defined in allOf (OpenAPI v3)
|
71
|
+
def self.fastly_all_of
|
72
|
+
[
|
73
|
+
:'SnippetResponseCommonAllOf',
|
74
|
+
:'Timestamps'
|
75
|
+
]
|
76
|
+
end
|
77
|
+
|
78
|
+
# Initializes the object
|
79
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
80
|
+
def initialize(attributes = {})
|
81
|
+
if (!attributes.is_a?(Hash))
|
82
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::SchemasSnippetResponseCommon` initialize method"
|
83
|
+
end
|
84
|
+
|
85
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
86
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
87
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
88
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::SchemasSnippetResponseCommon`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
89
|
+
end
|
90
|
+
h[k.to_sym] = v
|
91
|
+
}
|
92
|
+
|
93
|
+
if attributes.key?(:'created_at')
|
94
|
+
self.created_at = attributes[:'created_at']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'deleted_at')
|
98
|
+
self.deleted_at = attributes[:'deleted_at']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'updated_at')
|
102
|
+
self.updated_at = attributes[:'updated_at']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'service_id')
|
106
|
+
self.service_id = attributes[:'service_id']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'version')
|
110
|
+
self.version = attributes[:'version']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'id')
|
114
|
+
self.id = attributes[:'id']
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
119
|
+
# @return Array for valid properties with the reasons
|
120
|
+
def list_invalid_properties
|
121
|
+
invalid_properties = Array.new
|
122
|
+
invalid_properties
|
123
|
+
end
|
124
|
+
|
125
|
+
# Check to see if the all the properties in the model are valid
|
126
|
+
# @return true if the model is valid
|
127
|
+
def valid?
|
128
|
+
true
|
129
|
+
end
|
130
|
+
|
131
|
+
# Checks equality by comparing each attribute.
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def ==(o)
|
134
|
+
return true if self.equal?(o)
|
135
|
+
self.class == o.class &&
|
136
|
+
created_at == o.created_at &&
|
137
|
+
deleted_at == o.deleted_at &&
|
138
|
+
updated_at == o.updated_at &&
|
139
|
+
service_id == o.service_id &&
|
140
|
+
version == o.version &&
|
141
|
+
id == o.id
|
142
|
+
end
|
143
|
+
|
144
|
+
# @see the `==` method
|
145
|
+
# @param [Object] Object to be compared
|
146
|
+
def eql?(o)
|
147
|
+
self == o
|
148
|
+
end
|
149
|
+
|
150
|
+
# Calculates hash code according to all attributes.
|
151
|
+
# @return [Integer] Hash code
|
152
|
+
def hash
|
153
|
+
[created_at, deleted_at, updated_at, service_id, version, id].hash
|
154
|
+
end
|
155
|
+
|
156
|
+
# Builds the object from hash
|
157
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
158
|
+
# @return [Object] Returns the model itself
|
159
|
+
def self.build_from_hash(attributes)
|
160
|
+
new.build_from_hash(attributes)
|
161
|
+
end
|
162
|
+
|
163
|
+
# Builds the object from hash
|
164
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
165
|
+
# @return [Object] Returns the model itself
|
166
|
+
def build_from_hash(attributes)
|
167
|
+
return nil unless attributes.is_a?(Hash)
|
168
|
+
self.class.fastly_types.each_pair do |key, type|
|
169
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
|
170
|
+
self.send("#{key}=", nil)
|
171
|
+
elsif type =~ /\AArray<(.*)>/i
|
172
|
+
# check to ensure the input is an array given that the attribute
|
173
|
+
# is documented as an array but the input is not
|
174
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
175
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
176
|
+
end
|
177
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
178
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
self
|
183
|
+
end
|
184
|
+
|
185
|
+
# Deserializes the data based on type
|
186
|
+
# @param string type Data type
|
187
|
+
# @param string value Value to be deserialized
|
188
|
+
# @return [Object] Deserialized data
|
189
|
+
def _deserialize(type, value)
|
190
|
+
case type.to_sym
|
191
|
+
when :Time
|
192
|
+
Time.parse(value)
|
193
|
+
when :Date
|
194
|
+
Date.parse(value)
|
195
|
+
when :String
|
196
|
+
value.to_s
|
197
|
+
when :Integer
|
198
|
+
value.to_i
|
199
|
+
when :Float
|
200
|
+
value.to_f
|
201
|
+
when :Boolean
|
202
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
203
|
+
true
|
204
|
+
else
|
205
|
+
false
|
206
|
+
end
|
207
|
+
when :Object
|
208
|
+
# generic object (usually a Hash), return directly
|
209
|
+
value
|
210
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
211
|
+
inner_type = Regexp.last_match[:inner_type]
|
212
|
+
value.map { |v| _deserialize(inner_type, v) }
|
213
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
214
|
+
k_type = Regexp.last_match[:k_type]
|
215
|
+
v_type = Regexp.last_match[:v_type]
|
216
|
+
{}.tap do |hash|
|
217
|
+
value.each do |k, v|
|
218
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
else # model
|
222
|
+
# models (e.g. Pet) or oneOf
|
223
|
+
klass = Fastly.const_get(type)
|
224
|
+
klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# Returns the string representation of the object
|
229
|
+
# @return [String] String presentation of the object
|
230
|
+
def to_s
|
231
|
+
to_hash.to_s
|
232
|
+
end
|
233
|
+
|
234
|
+
# to_body is an alias to to_hash (backward compatibility)
|
235
|
+
# @return [Hash] Returns the object in the form of hash
|
236
|
+
def to_body
|
237
|
+
to_hash
|
238
|
+
end
|
239
|
+
|
240
|
+
# Returns the object in the form of hash
|
241
|
+
# @return [Hash] Returns the object in the form of hash
|
242
|
+
def to_hash
|
243
|
+
hash = {}
|
244
|
+
self.class.attribute_map.each_pair do |attr, param|
|
245
|
+
value = self.send(attr)
|
246
|
+
if value.nil?
|
247
|
+
is_nullable = self.class.fastly_nullable.include?(attr)
|
248
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
249
|
+
end
|
250
|
+
|
251
|
+
hash[param] = _to_hash(value)
|
252
|
+
end
|
253
|
+
hash
|
254
|
+
end
|
255
|
+
|
256
|
+
# Outputs non-array value in the form of hash
|
257
|
+
# For object, use to_hash. Otherwise, just return the value
|
258
|
+
# @param [Object] value Any valid value
|
259
|
+
# @return [Hash] Returns the value in the form of hash
|
260
|
+
def _to_hash(value)
|
261
|
+
if value.is_a?(Array)
|
262
|
+
value.compact.map { |v| _to_hash(v) }
|
263
|
+
elsif value.is_a?(Hash)
|
264
|
+
{}.tap do |hash|
|
265
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
266
|
+
end
|
267
|
+
elsif value.respond_to? :to_hash
|
268
|
+
value.to_hash
|
269
|
+
else
|
270
|
+
value
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
end
|
275
|
+
|
276
|
+
end
|
@@ -16,9 +16,6 @@ module Fastly
|
|
16
16
|
# The name for the snippet.
|
17
17
|
attr_accessor :name
|
18
18
|
|
19
|
-
# Sets the snippet version.
|
20
|
-
attr_accessor :dynamic
|
21
|
-
|
22
19
|
# The location in generated VCL where the snippet should be placed.
|
23
20
|
attr_accessor :type
|
24
21
|
|
@@ -28,6 +25,9 @@ module Fastly
|
|
28
25
|
# Priority determines execution order. Lower numbers execute first.
|
29
26
|
attr_accessor :priority
|
30
27
|
|
28
|
+
# Sets the snippet version.
|
29
|
+
attr_accessor :dynamic
|
30
|
+
|
31
31
|
class EnumAttributeValidator
|
32
32
|
attr_reader :datatype
|
33
33
|
attr_reader :allowable_values
|
@@ -54,10 +54,10 @@ module Fastly
|
|
54
54
|
def self.attribute_map
|
55
55
|
{
|
56
56
|
:'name' => :'name',
|
57
|
-
:'dynamic' => :'dynamic',
|
58
57
|
:'type' => :'type',
|
59
58
|
:'content' => :'content',
|
60
|
-
:'priority' => :'priority'
|
59
|
+
:'priority' => :'priority',
|
60
|
+
:'dynamic' => :'dynamic'
|
61
61
|
}
|
62
62
|
end
|
63
63
|
|
@@ -70,10 +70,10 @@ module Fastly
|
|
70
70
|
def self.fastly_types
|
71
71
|
{
|
72
72
|
:'name' => :'String',
|
73
|
-
:'dynamic' => :'String',
|
74
73
|
:'type' => :'String',
|
75
74
|
:'content' => :'String',
|
76
|
-
:'priority' => :'String'
|
75
|
+
:'priority' => :'String',
|
76
|
+
:'dynamic' => :'String'
|
77
77
|
}
|
78
78
|
end
|
79
79
|
|
@@ -83,6 +83,14 @@ module Fastly
|
|
83
83
|
])
|
84
84
|
end
|
85
85
|
|
86
|
+
# List of class defined in allOf (OpenAPI v3)
|
87
|
+
def self.fastly_all_of
|
88
|
+
[
|
89
|
+
:'SnippetAllOf',
|
90
|
+
:'SnippetCommon'
|
91
|
+
]
|
92
|
+
end
|
93
|
+
|
86
94
|
# Initializes the object
|
87
95
|
# @param [Hash] attributes Model attributes in the form of hash
|
88
96
|
def initialize(attributes = {})
|
@@ -102,10 +110,6 @@ module Fastly
|
|
102
110
|
self.name = attributes[:'name']
|
103
111
|
end
|
104
112
|
|
105
|
-
if attributes.key?(:'dynamic')
|
106
|
-
self.dynamic = attributes[:'dynamic']
|
107
|
-
end
|
108
|
-
|
109
113
|
if attributes.key?(:'type')
|
110
114
|
self.type = attributes[:'type']
|
111
115
|
end
|
@@ -119,6 +123,10 @@ module Fastly
|
|
119
123
|
else
|
120
124
|
self.priority = '100'
|
121
125
|
end
|
126
|
+
|
127
|
+
if attributes.key?(:'dynamic')
|
128
|
+
self.dynamic = attributes[:'dynamic']
|
129
|
+
end
|
122
130
|
end
|
123
131
|
|
124
132
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -131,23 +139,13 @@ module Fastly
|
|
131
139
|
# Check to see if the all the properties in the model are valid
|
132
140
|
# @return true if the model is valid
|
133
141
|
def valid?
|
134
|
-
dynamic_validator = EnumAttributeValidator.new('String', ["0", "1"])
|
135
|
-
return false unless dynamic_validator.valid?(@dynamic)
|
136
142
|
type_validator = EnumAttributeValidator.new('String', ["init", "recv", "hash", "hit", "miss", "pass", "fetch", "error", "deliver", "log", "none"])
|
137
143
|
return false unless type_validator.valid?(@type)
|
144
|
+
dynamic_validator = EnumAttributeValidator.new('String', ["0", "1"])
|
145
|
+
return false unless dynamic_validator.valid?(@dynamic)
|
138
146
|
true
|
139
147
|
end
|
140
148
|
|
141
|
-
# Custom attribute writer method checking allowed values (enum).
|
142
|
-
# @param [Object] dynamic Object to be assigned
|
143
|
-
def dynamic=(dynamic)
|
144
|
-
validator = EnumAttributeValidator.new('String', ["0", "1"])
|
145
|
-
unless validator.valid?(dynamic)
|
146
|
-
fail ArgumentError, "invalid value for \"dynamic\", must be one of #{validator.allowable_values}."
|
147
|
-
end
|
148
|
-
@dynamic = dynamic
|
149
|
-
end
|
150
|
-
|
151
149
|
# Custom attribute writer method checking allowed values (enum).
|
152
150
|
# @param [Object] type Object to be assigned
|
153
151
|
def type=(type)
|
@@ -158,16 +156,26 @@ module Fastly
|
|
158
156
|
@type = type
|
159
157
|
end
|
160
158
|
|
159
|
+
# Custom attribute writer method checking allowed values (enum).
|
160
|
+
# @param [Object] dynamic Object to be assigned
|
161
|
+
def dynamic=(dynamic)
|
162
|
+
validator = EnumAttributeValidator.new('String', ["0", "1"])
|
163
|
+
unless validator.valid?(dynamic)
|
164
|
+
fail ArgumentError, "invalid value for \"dynamic\", must be one of #{validator.allowable_values}."
|
165
|
+
end
|
166
|
+
@dynamic = dynamic
|
167
|
+
end
|
168
|
+
|
161
169
|
# Checks equality by comparing each attribute.
|
162
170
|
# @param [Object] Object to be compared
|
163
171
|
def ==(o)
|
164
172
|
return true if self.equal?(o)
|
165
173
|
self.class == o.class &&
|
166
174
|
name == o.name &&
|
167
|
-
dynamic == o.dynamic &&
|
168
175
|
type == o.type &&
|
169
176
|
content == o.content &&
|
170
|
-
priority == o.priority
|
177
|
+
priority == o.priority &&
|
178
|
+
dynamic == o.dynamic
|
171
179
|
end
|
172
180
|
|
173
181
|
# @see the `==` method
|
@@ -179,7 +187,7 @@ module Fastly
|
|
179
187
|
# Calculates hash code according to all attributes.
|
180
188
|
# @return [Integer] Hash code
|
181
189
|
def hash
|
182
|
-
[name,
|
190
|
+
[name, type, content, priority, dynamic].hash
|
183
191
|
end
|
184
192
|
|
185
193
|
# Builds the object from hash
|
@@ -0,0 +1,251 @@
|
|
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://developer.fastly.com/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
|
+
class SnippetAllOf
|
16
|
+
# Sets the snippet version.
|
17
|
+
attr_accessor :dynamic
|
18
|
+
|
19
|
+
class EnumAttributeValidator
|
20
|
+
attr_reader :datatype
|
21
|
+
attr_reader :allowable_values
|
22
|
+
|
23
|
+
def initialize(datatype, allowable_values)
|
24
|
+
@allowable_values = allowable_values.map do |value|
|
25
|
+
case datatype.to_s
|
26
|
+
when /Integer/i
|
27
|
+
value.to_i
|
28
|
+
when /Float/i
|
29
|
+
value.to_f
|
30
|
+
else
|
31
|
+
value
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def valid?(value)
|
37
|
+
!value || allowable_values.include?(value)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
42
|
+
def self.attribute_map
|
43
|
+
{
|
44
|
+
:'dynamic' => :'dynamic'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns all the JSON keys this model knows about
|
49
|
+
def self.acceptable_attributes
|
50
|
+
attribute_map.values
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.fastly_types
|
55
|
+
{
|
56
|
+
:'dynamic' => :'String'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# List of attributes with nullable: true
|
61
|
+
def self.fastly_nullable
|
62
|
+
Set.new([
|
63
|
+
])
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
if (!attributes.is_a?(Hash))
|
70
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::SnippetAllOf` initialize method"
|
71
|
+
end
|
72
|
+
|
73
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
74
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
75
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
76
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::SnippetAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
77
|
+
end
|
78
|
+
h[k.to_sym] = v
|
79
|
+
}
|
80
|
+
|
81
|
+
if attributes.key?(:'dynamic')
|
82
|
+
self.dynamic = attributes[:'dynamic']
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
87
|
+
# @return Array for valid properties with the reasons
|
88
|
+
def list_invalid_properties
|
89
|
+
invalid_properties = Array.new
|
90
|
+
invalid_properties
|
91
|
+
end
|
92
|
+
|
93
|
+
# Check to see if the all the properties in the model are valid
|
94
|
+
# @return true if the model is valid
|
95
|
+
def valid?
|
96
|
+
dynamic_validator = EnumAttributeValidator.new('String', ["0", "1"])
|
97
|
+
return false unless dynamic_validator.valid?(@dynamic)
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
# Custom attribute writer method checking allowed values (enum).
|
102
|
+
# @param [Object] dynamic Object to be assigned
|
103
|
+
def dynamic=(dynamic)
|
104
|
+
validator = EnumAttributeValidator.new('String', ["0", "1"])
|
105
|
+
unless validator.valid?(dynamic)
|
106
|
+
fail ArgumentError, "invalid value for \"dynamic\", must be one of #{validator.allowable_values}."
|
107
|
+
end
|
108
|
+
@dynamic = dynamic
|
109
|
+
end
|
110
|
+
|
111
|
+
# Checks equality by comparing each attribute.
|
112
|
+
# @param [Object] Object to be compared
|
113
|
+
def ==(o)
|
114
|
+
return true if self.equal?(o)
|
115
|
+
self.class == o.class &&
|
116
|
+
dynamic == o.dynamic
|
117
|
+
end
|
118
|
+
|
119
|
+
# @see the `==` method
|
120
|
+
# @param [Object] Object to be compared
|
121
|
+
def eql?(o)
|
122
|
+
self == o
|
123
|
+
end
|
124
|
+
|
125
|
+
# Calculates hash code according to all attributes.
|
126
|
+
# @return [Integer] Hash code
|
127
|
+
def hash
|
128
|
+
[dynamic].hash
|
129
|
+
end
|
130
|
+
|
131
|
+
# Builds the object from hash
|
132
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
133
|
+
# @return [Object] Returns the model itself
|
134
|
+
def self.build_from_hash(attributes)
|
135
|
+
new.build_from_hash(attributes)
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def build_from_hash(attributes)
|
142
|
+
return nil unless attributes.is_a?(Hash)
|
143
|
+
self.class.fastly_types.each_pair do |key, type|
|
144
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
|
145
|
+
self.send("#{key}=", nil)
|
146
|
+
elsif type =~ /\AArray<(.*)>/i
|
147
|
+
# check to ensure the input is an array given that the attribute
|
148
|
+
# is documented as an array but the input is not
|
149
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
150
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
151
|
+
end
|
152
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
153
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
self
|
158
|
+
end
|
159
|
+
|
160
|
+
# Deserializes the data based on type
|
161
|
+
# @param string type Data type
|
162
|
+
# @param string value Value to be deserialized
|
163
|
+
# @return [Object] Deserialized data
|
164
|
+
def _deserialize(type, value)
|
165
|
+
case type.to_sym
|
166
|
+
when :Time
|
167
|
+
Time.parse(value)
|
168
|
+
when :Date
|
169
|
+
Date.parse(value)
|
170
|
+
when :String
|
171
|
+
value.to_s
|
172
|
+
when :Integer
|
173
|
+
value.to_i
|
174
|
+
when :Float
|
175
|
+
value.to_f
|
176
|
+
when :Boolean
|
177
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
178
|
+
true
|
179
|
+
else
|
180
|
+
false
|
181
|
+
end
|
182
|
+
when :Object
|
183
|
+
# generic object (usually a Hash), return directly
|
184
|
+
value
|
185
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
186
|
+
inner_type = Regexp.last_match[:inner_type]
|
187
|
+
value.map { |v| _deserialize(inner_type, v) }
|
188
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
189
|
+
k_type = Regexp.last_match[:k_type]
|
190
|
+
v_type = Regexp.last_match[:v_type]
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each do |k, v|
|
193
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
else # model
|
197
|
+
# models (e.g. Pet) or oneOf
|
198
|
+
klass = Fastly.const_get(type)
|
199
|
+
klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
# Returns the string representation of the object
|
204
|
+
# @return [String] String presentation of the object
|
205
|
+
def to_s
|
206
|
+
to_hash.to_s
|
207
|
+
end
|
208
|
+
|
209
|
+
# to_body is an alias to to_hash (backward compatibility)
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
211
|
+
def to_body
|
212
|
+
to_hash
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns the object in the form of hash
|
216
|
+
# @return [Hash] Returns the object in the form of hash
|
217
|
+
def to_hash
|
218
|
+
hash = {}
|
219
|
+
self.class.attribute_map.each_pair do |attr, param|
|
220
|
+
value = self.send(attr)
|
221
|
+
if value.nil?
|
222
|
+
is_nullable = self.class.fastly_nullable.include?(attr)
|
223
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
224
|
+
end
|
225
|
+
|
226
|
+
hash[param] = _to_hash(value)
|
227
|
+
end
|
228
|
+
hash
|
229
|
+
end
|
230
|
+
|
231
|
+
# Outputs non-array value in the form of hash
|
232
|
+
# For object, use to_hash. Otherwise, just return the value
|
233
|
+
# @param [Object] value Any valid value
|
234
|
+
# @return [Hash] Returns the value in the form of hash
|
235
|
+
def _to_hash(value)
|
236
|
+
if value.is_a?(Array)
|
237
|
+
value.compact.map { |v| _to_hash(v) }
|
238
|
+
elsif value.is_a?(Hash)
|
239
|
+
{}.tap do |hash|
|
240
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
241
|
+
end
|
242
|
+
elsif value.respond_to? :to_hash
|
243
|
+
value.to_hash
|
244
|
+
else
|
245
|
+
value
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|