fastly 8.9.0 → 9.0.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.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +15 -4
  5. data/docs/AccessKey.md +12 -0
  6. data/docs/AccessKeyResponse.md +15 -0
  7. data/docs/AclsInComputeApi.md +2 -2
  8. data/docs/Backend.md +2 -2
  9. data/docs/BackendApi.md +8 -8
  10. data/docs/BackendResponse.md +2 -2
  11. data/docs/BillingUsageMetricsApi.md +13 -19
  12. data/docs/ComputeAclUpdate.md +10 -0
  13. data/docs/DimensionAttributesCountryStats.md +12 -0
  14. data/docs/DimensionAttributesRate.md +10 -0
  15. data/docs/DimensionBrowser.md +10 -0
  16. data/docs/DimensionContentType.md +10 -0
  17. data/docs/DimensionCountry.md +10 -0
  18. data/docs/DimensionDevice.md +10 -0
  19. data/docs/DimensionOs.md +10 -0
  20. data/docs/DimensionResponse.md +10 -0
  21. data/docs/DimensionStatusCode.md +10 -0
  22. data/docs/DimensionUrl.md +10 -0
  23. data/docs/EnabledProductsApi.md +5 -5
  24. data/docs/FilterFieldItem.md +12 -0
  25. data/docs/GetLogInsightsResponse.md +11 -0
  26. data/docs/GetLogRecordsResponse.md +11 -0
  27. data/docs/GetLogRecordsResponseMeta.md +10 -0
  28. data/docs/GetLogRecordsResponseMetaFilters.md +16 -0
  29. data/docs/InsightsApi.md +69 -0
  30. data/docs/KvStoreItemApi.md +2 -0
  31. data/docs/LogExplorerApi.md +65 -0
  32. data/docs/LogInsights.md +12 -0
  33. data/docs/LogInsightsDimensionAttributes.md +49 -0
  34. data/docs/LogInsightsDimensions.md +61 -0
  35. data/docs/LogInsightsMeta.md +10 -0
  36. data/docs/LogInsightsMetaFilter.md +14 -0
  37. data/docs/LogInsightsValues.md +65 -0
  38. data/docs/LogPropertyServiceId.md +9 -0
  39. data/docs/LogRecord.md +37 -0
  40. data/docs/LoggingGrafanacloudlogsAdditional.md +14 -0
  41. data/docs/LoggingGrafanacloudlogsApi.md +259 -0
  42. data/docs/LoggingGrafanacloudlogsResponse.md +23 -0
  43. data/docs/ObjectStorageAccessKeysApi.md +163 -0
  44. data/docs/RealtimeEntryAggregated.md +3 -7
  45. data/docs/RealtimeMeasurements.md +3 -7
  46. data/docs/Results.md +3 -7
  47. data/docs/SetConfiguration.md +1 -0
  48. data/docs/Usagemetric.md +18 -0
  49. data/docs/Usagemetrics.md +10 -0
  50. data/docs/ValueField.md +59 -0
  51. data/docs/Values503Responses.md +12 -0
  52. data/docs/ValuesBandwidth.md +11 -0
  53. data/docs/ValuesBrowser.md +11 -0
  54. data/docs/ValuesCacheHitRatio.md +10 -0
  55. data/docs/ValuesCountryStats.md +12 -0
  56. data/docs/ValuesDuration.md +12 -0
  57. data/docs/ValuesMisses.md +10 -0
  58. data/docs/ValuesRate.md +10 -0
  59. data/docs/ValuesRequests.md +10 -0
  60. data/docs/ValuesStatusCodes.md +12 -0
  61. data/lib/fastly/api/acls_in_compute_api.rb +3 -3
  62. data/lib/fastly/api/backend_api.rb +8 -8
  63. data/lib/fastly/api/billing_usage_metrics_api.rb +30 -57
  64. data/lib/fastly/api/enabled_products_api.rb +10 -10
  65. data/lib/fastly/api/insights_api.rb +125 -0
  66. data/lib/fastly/api/kv_store_item_api.rb +3 -0
  67. data/lib/fastly/api/log_explorer_api.rb +109 -0
  68. data/lib/fastly/api/logging_grafanacloudlogs_api.rb +471 -0
  69. data/lib/fastly/api/object_storage_access_keys_api.rb +263 -0
  70. data/lib/fastly/configuration.rb +67 -1
  71. data/lib/fastly/models/access_key.rb +248 -0
  72. data/lib/fastly/models/access_key_response.rb +269 -0
  73. data/lib/fastly/models/backend.rb +2 -2
  74. data/lib/fastly/models/backend_response.rb +2 -2
  75. data/lib/fastly/models/compute_acl_list_entries.rb +1 -1
  76. data/lib/fastly/models/compute_acl_lookup.rb +1 -1
  77. data/lib/fastly/models/compute_acl_update.rb +219 -0
  78. data/lib/fastly/models/compute_acl_update_entry.rb +1 -1
  79. data/lib/fastly/models/dimension_attributes_country_stats.rb +237 -0
  80. data/lib/fastly/models/dimension_attributes_rate.rb +217 -0
  81. data/lib/fastly/models/dimension_browser.rb +217 -0
  82. data/lib/fastly/models/dimension_content_type.rb +217 -0
  83. data/lib/fastly/models/dimension_country.rb +217 -0
  84. data/lib/fastly/models/dimension_device.rb +217 -0
  85. data/lib/fastly/models/dimension_os.rb +217 -0
  86. data/lib/fastly/models/dimension_response.rb +217 -0
  87. data/lib/fastly/models/dimension_status_code.rb +217 -0
  88. data/lib/fastly/models/dimension_url.rb +217 -0
  89. data/lib/fastly/models/filter_field_item.rb +271 -0
  90. data/lib/fastly/models/get_log_insights_response.rb +227 -0
  91. data/lib/fastly/models/get_log_records_response.rb +227 -0
  92. data/lib/fastly/models/get_log_records_response_meta.rb +216 -0
  93. data/lib/fastly/models/get_log_records_response_meta_filters.rb +307 -0
  94. data/lib/fastly/models/log_insights.rb +234 -0
  95. data/lib/fastly/models/log_insights_dimension_attributes.rb +103 -0
  96. data/lib/fastly/models/log_insights_dimensions.rb +109 -0
  97. data/lib/fastly/models/log_insights_meta.rb +217 -0
  98. data/lib/fastly/models/log_insights_meta_filter.rb +284 -0
  99. data/lib/fastly/models/log_insights_values.rb +111 -0
  100. data/lib/fastly/models/log_property_service_id.rb +208 -0
  101. data/lib/fastly/models/log_record.rb +486 -0
  102. data/lib/fastly/models/logging_grafanacloudlogs_additional.rb +257 -0
  103. data/lib/fastly/models/logging_grafanacloudlogs_response.rb +408 -0
  104. data/lib/fastly/models/realtime_entry_aggregated.rb +34 -74
  105. data/lib/fastly/models/realtime_measurements.rb +34 -74
  106. data/lib/fastly/models/results.rb +31 -71
  107. data/lib/fastly/models/set_configuration.rb +14 -4
  108. data/lib/fastly/models/usagemetric.rb +297 -0
  109. data/lib/fastly/models/usagemetrics.rb +218 -0
  110. data/lib/fastly/models/value_field.rb +108 -0
  111. data/lib/fastly/models/values503_responses.rb +237 -0
  112. data/lib/fastly/models/values_bandwidth.rb +227 -0
  113. data/lib/fastly/models/values_browser.rb +227 -0
  114. data/lib/fastly/models/values_cache_hit_ratio.rb +217 -0
  115. data/lib/fastly/models/values_country_stats.rb +237 -0
  116. data/lib/fastly/models/values_duration.rb +237 -0
  117. data/lib/fastly/models/values_misses.rb +217 -0
  118. data/lib/fastly/models/values_rate.rb +217 -0
  119. data/lib/fastly/models/values_requests.rb +217 -0
  120. data/lib/fastly/models/values_status_codes.rb +237 -0
  121. data/lib/fastly/version.rb +1 -1
  122. data/lib/fastly.rb +45 -0
  123. data/sig.json +1 -1
  124. metadata +92 -2
@@ -0,0 +1,109 @@
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
+ module LogInsightsDimensions
16
+ class << self
17
+ # List of class defined in oneOf (OpenAPI v3)
18
+ def fastly_one_of
19
+ [
20
+ :'DimensionBrowser',
21
+ :'DimensionContentType',
22
+ :'DimensionCountry',
23
+ :'DimensionDevice',
24
+ :'DimensionOs',
25
+ :'DimensionResponse',
26
+ :'DimensionStatusCode',
27
+ :'DimensionUrl'
28
+ ]
29
+ end
30
+
31
+ # Builds the object
32
+ # @param [Mixed] Data to be matched against the list of oneOf items
33
+ # @return [Object] Returns the model or the data itself
34
+ def build(data)
35
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
36
+ # Note:
37
+ # - We do not attempt to check whether exactly one item matches.
38
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
39
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
40
+ # - TODO: scalar values are de facto behaving as if they were nullable.
41
+ # - TODO: logging when debugging is set.
42
+ fastly_one_of.each do |klass|
43
+ begin
44
+ next if klass == :AnyType # "nullable: true"
45
+ typed_data = find_and_cast_into_type(klass, data)
46
+ return typed_data if typed_data
47
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
48
+ end
49
+ end
50
+
51
+ fastly_one_of.include?(:AnyType) ? data : nil
52
+ end
53
+
54
+ private
55
+
56
+ SchemaMismatchError = Class.new(StandardError)
57
+
58
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
59
+ def find_and_cast_into_type(klass, data)
60
+ return if data.nil?
61
+
62
+ case klass.to_s
63
+ when 'Boolean'
64
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
65
+ when 'Float'
66
+ return data if data.instance_of?(Float)
67
+ when 'Integer'
68
+ return data if data.instance_of?(Integer)
69
+ when 'Time'
70
+ return Time.parse(data)
71
+ when 'Date'
72
+ return Date.parse(data)
73
+ when 'String'
74
+ return data if data.instance_of?(String)
75
+ when 'Object' # "type: object"
76
+ return data if data.instance_of?(Hash)
77
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
78
+ if data.instance_of?(Array)
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
81
+ end
82
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
83
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
84
+ sub_type = Regexp.last_match[:sub_type]
85
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
86
+ end
87
+ else # model
88
+ const = Fastly.const_get(klass)
89
+ if const
90
+ if const.respond_to?(:fastly_one_of) # nested oneOf model
91
+ model = const.build(data)
92
+ return model if model
93
+ else
94
+ # raise if data contains keys that are not known to the model
95
+ raise unless (data.keys - const.acceptable_attributes).empty?
96
+ model = const.build_from_hash(data)
97
+ return model if model && model.valid?
98
+ end
99
+ end
100
+ end
101
+
102
+ raise # if no match by now, raise
103
+ rescue
104
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
105
+ end
106
+ end
107
+ end
108
+
109
+ end
@@ -0,0 +1,217 @@
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
+ # Echoes the filters that were supplied in the request.
16
+ class LogInsightsMeta
17
+ attr_accessor :filters
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'filters' => :'filters'
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
+ :'filters' => :'LogInsightsMetaFilter'
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::LogInsightsMeta` 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::LogInsightsMeta`. 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?(:'filters')
60
+ self.filters = attributes[:'filters']
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
+ invalid_properties
69
+ end
70
+
71
+ # Check to see if the all the properties in the model are valid
72
+ # @return true if the model is valid
73
+ def valid?
74
+ true
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] Object to be compared
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ filters == o.filters
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Integer] Hash code
93
+ def hash
94
+ [filters].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def self.build_from_hash(attributes)
101
+ new.build_from_hash(attributes)
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.fastly_types.each_pair do |key, type|
110
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
111
+ self.send("#{key}=", nil)
112
+ elsif type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :Time
133
+ Time.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ # models (e.g. Pet) or oneOf
164
+ klass = Fastly.const_get(type)
165
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.fastly_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+
217
+ end
@@ -0,0 +1,284 @@
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 filters that were supplied in the request.
16
+ class LogInsightsMetaFilter
17
+ # Specifies the ID of the service for which data should be returned.
18
+ attr_accessor :service_id
19
+
20
+ # Start time for the query as supplied in the request.
21
+ attr_accessor :start
22
+
23
+ # End time for the query as supplied in the request.
24
+ attr_accessor :_end
25
+
26
+ # Value of the `domain_exact_match` filter as supplied in the request.
27
+ attr_accessor :domain_exact_match
28
+
29
+ # Number of records per page.
30
+ attr_accessor :limit
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'service_id' => :'service_id',
36
+ :'start' => :'start',
37
+ :'_end' => :'end',
38
+ :'domain_exact_match' => :'domain_exact_match',
39
+ :'limit' => :'limit'
40
+ }
41
+ end
42
+
43
+ # Returns all the JSON keys this model knows about
44
+ def self.acceptable_attributes
45
+ attribute_map.values
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.fastly_types
50
+ {
51
+ :'service_id' => :'String',
52
+ :'start' => :'String',
53
+ :'_end' => :'String',
54
+ :'domain_exact_match' => :'Boolean',
55
+ :'limit' => :'Integer'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.fastly_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LogInsightsMetaFilter` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LogInsightsMetaFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'service_id')
81
+ self.service_id = attributes[:'service_id']
82
+ end
83
+
84
+ if attributes.key?(:'start')
85
+ self.start = attributes[:'start']
86
+ end
87
+
88
+ if attributes.key?(:'_end')
89
+ self._end = attributes[:'_end']
90
+ end
91
+
92
+ if attributes.key?(:'domain_exact_match')
93
+ self.domain_exact_match = attributes[:'domain_exact_match']
94
+ end
95
+
96
+ if attributes.key?(:'limit')
97
+ self.limit = attributes[:'limit']
98
+ else
99
+ self.limit = 20
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ if !@limit.nil? && @limit > 100
108
+ invalid_properties.push('invalid value for "limit", must be smaller than or equal to 100.')
109
+ end
110
+
111
+ if !@limit.nil? && @limit < 1
112
+ invalid_properties.push('invalid value for "limit", must be greater than or equal to 1.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ return false if !@limit.nil? && @limit > 100
122
+ return false if !@limit.nil? && @limit < 1
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] limit Value to be assigned
128
+ def limit=(limit)
129
+ if !limit.nil? && limit > 100
130
+ fail ArgumentError, 'invalid value for "limit", must be smaller than or equal to 100.'
131
+ end
132
+
133
+ if !limit.nil? && limit < 1
134
+ fail ArgumentError, 'invalid value for "limit", must be greater than or equal to 1.'
135
+ end
136
+
137
+ @limit = limit
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ service_id == o.service_id &&
146
+ start == o.start &&
147
+ _end == o._end &&
148
+ domain_exact_match == o.domain_exact_match &&
149
+ limit == o.limit
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Integer] Hash code
160
+ def hash
161
+ [service_id, start, _end, domain_exact_match, limit].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def self.build_from_hash(attributes)
168
+ new.build_from_hash(attributes)
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def build_from_hash(attributes)
175
+ return nil unless attributes.is_a?(Hash)
176
+ self.class.fastly_types.each_pair do |key, type|
177
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
178
+ self.send("#{key}=", nil)
179
+ elsif type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
183
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
184
+ end
185
+ elsif !attributes[self.class.attribute_map[key]].nil?
186
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
187
+ end
188
+ end
189
+
190
+ self
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param string type Data type
195
+ # @param string value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def _deserialize(type, value)
198
+ case type.to_sym
199
+ when :Time
200
+ Time.parse(value)
201
+ when :Date
202
+ Date.parse(value)
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :Boolean
210
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ # models (e.g. Pet) or oneOf
231
+ klass = Fastly.const_get(type)
232
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
233
+ end
234
+ end
235
+
236
+ # Returns the string representation of the object
237
+ # @return [String] String presentation of the object
238
+ def to_s
239
+ to_hash.to_s
240
+ end
241
+
242
+ # to_body is an alias to to_hash (backward compatibility)
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_body
245
+ to_hash
246
+ end
247
+
248
+ # Returns the object in the form of hash
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_hash
251
+ hash = {}
252
+ self.class.attribute_map.each_pair do |attr, param|
253
+ value = self.send(attr)
254
+ if value.nil?
255
+ is_nullable = self.class.fastly_nullable.include?(attr)
256
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
257
+ end
258
+
259
+ hash[param] = _to_hash(value)
260
+ end
261
+ hash
262
+ end
263
+
264
+ # Outputs non-array value in the form of hash
265
+ # For object, use to_hash. Otherwise, just return the value
266
+ # @param [Object] value Any valid value
267
+ # @return [Hash] Returns the value in the form of hash
268
+ def _to_hash(value)
269
+ if value.is_a?(Array)
270
+ value.compact.map { |v| _to_hash(v) }
271
+ elsif value.is_a?(Hash)
272
+ {}.tap do |hash|
273
+ value.each { |k, v| hash[k] = _to_hash(v) }
274
+ end
275
+ elsif value.respond_to? :to_hash
276
+ value.to_hash
277
+ else
278
+ value
279
+ end
280
+ end
281
+
282
+ end
283
+
284
+ end