datadog_api_client 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/.apigentools-info +6 -6
  3. data/.github/workflows/scripts/test_integration.js +24 -0
  4. data/.github/workflows/test.yml +4 -0
  5. data/.github/workflows/test_integration.yml +87 -0
  6. data/.openapi-generator/FILES +48 -0
  7. data/CHANGELOG.md +18 -0
  8. data/README.md +1 -1
  9. data/data/v1/openapi.yaml +1133 -99
  10. data/data/v2/openapi.yaml +420 -13
  11. data/docs/v1/Downtime.md +2 -0
  12. data/docs/v1/DowntimeChild.md +48 -0
  13. data/docs/v1/MetricsAPI.md +1 -1
  14. data/docs/v1/Monitor.md +3 -3
  15. data/docs/v1/MonitorGroupSearchResponse.md +22 -0
  16. data/docs/v1/MonitorGroupSearchResponseCounts.md +20 -0
  17. data/docs/v1/MonitorGroupSearchResult.md +30 -0
  18. data/docs/v1/MonitorOptions.md +1 -1
  19. data/docs/v1/MonitorSearchResponse.md +22 -0
  20. data/docs/v1/MonitorSearchResponseCounts.md +24 -0
  21. data/docs/v1/MonitorSearchResponseMetadata.md +24 -0
  22. data/docs/v1/MonitorSearchResult.md +40 -0
  23. data/docs/v1/MonitorSearchResultNotification.md +20 -0
  24. data/docs/v1/MonitorsAPI.md +155 -13
  25. data/docs/v1/NotebookCreateDataAttributes.md +1 -1
  26. data/docs/v1/NotebookResponseDataAttributes.md +3 -3
  27. data/docs/v1/NotebookUpdateDataAttributes.md +1 -1
  28. data/docs/v1/NotebooksResponse.md +1 -1
  29. data/docs/v1/NotebooksResponseData.md +22 -0
  30. data/docs/v1/NotebooksResponseDataAttributes.md +30 -0
  31. data/docs/v1/README.md +25 -4
  32. data/docs/v1/SyntheticsAPI.md +62 -2
  33. data/docs/v1/SyntheticsAPITest.md +2 -2
  34. data/docs/v1/SyntheticsAPITestConfig.md +1 -1
  35. data/docs/v1/SyntheticsBrowserTest.md +2 -2
  36. data/docs/v1/SyntheticsConfigVariable.md +3 -1
  37. data/docs/v1/SyntheticsGlobalVariableValue.md +1 -1
  38. data/docs/v1/SyntheticsListGlobalVariablesResponse.md +18 -0
  39. data/docs/v1/SyntheticsTestConfig.md +1 -1
  40. data/docs/v1/SyntheticsTestDetails.md +2 -2
  41. data/docs/v1/UsageAttributionBody.md +2 -0
  42. data/docs/v1/UsageAttributionPagination.md +3 -7
  43. data/docs/v1/UsageAttributionValues.md +8 -0
  44. data/docs/v1/UsageAuditLogsHour.md +20 -0
  45. data/docs/v1/UsageAuditLogsResponse.md +18 -0
  46. data/docs/v1/UsageCWSHour.md +22 -0
  47. data/docs/v1/UsageCWSResponse.md +18 -0
  48. data/docs/v1/UsageCloudSecurityPostureManagementHour.md +22 -0
  49. data/docs/v1/UsageCloudSecurityPostureManagementResponse.md +18 -0
  50. data/docs/v1/UsageMeteringAPI.md +157 -21
  51. data/docs/v1/UsageSummaryDate.md +12 -4
  52. data/docs/v1/UsageSummaryDateOrg.md +12 -4
  53. data/docs/v1/UsageSummaryResponse.md +12 -4
  54. data/docs/v1/UsageTopAvgMetricsMetadata.md +2 -2
  55. data/docs/v1/WidgetCustomLink.md +7 -3
  56. data/docs/v2/IncidentServicesAPI.md +2 -2
  57. data/docs/v2/IncidentTeamsAPI.md +2 -2
  58. data/docs/v2/IncidentsAPI.md +2 -2
  59. data/docs/v2/IncidentsResponse.md +1 -1
  60. data/docs/v2/KeyManagementAPI.md +6 -6
  61. data/docs/v2/README.md +21 -0
  62. data/docs/v2/RelationshipToIncidentIntegrationMetadataData.md +1 -1
  63. data/docs/v2/RelationshipToIncidentIntegrationMetadatas.md +1 -1
  64. data/docs/v2/RolesAPI.md +4 -4
  65. data/docs/v2/SecurityFilter.md +22 -0
  66. data/docs/v2/SecurityFilterAttributes.md +30 -0
  67. data/docs/v2/SecurityFilterCreateAttributes.md +26 -0
  68. data/docs/v2/SecurityFilterCreateData.md +20 -0
  69. data/docs/v2/SecurityFilterCreateRequest.md +18 -0
  70. data/docs/v2/SecurityFilterDeleteResponse.md +18 -0
  71. data/docs/v2/SecurityFilterExclusionFilter.md +20 -0
  72. data/docs/v2/SecurityFilterExclusionFilterResponse.md +20 -0
  73. data/docs/v2/SecurityFilterFilteredDataType.md +15 -0
  74. data/docs/v2/SecurityFilterMeta.md +18 -0
  75. data/docs/v2/SecurityFilterResponse.md +20 -0
  76. data/docs/v2/SecurityFilterType.md +15 -0
  77. data/docs/v2/SecurityFilterUpdateAttributes.md +28 -0
  78. data/docs/v2/SecurityFilterUpdateData.md +20 -0
  79. data/docs/v2/SecurityFilterUpdateRequest.md +18 -0
  80. data/docs/v2/SecurityFiltersResponse.md +20 -0
  81. data/docs/v2/SecurityMonitoringAPI.md +316 -2
  82. data/docs/v2/UsersAPI.md +10 -10
  83. data/lib/datadog_api_client/v1.rb +18 -2
  84. data/lib/datadog_api_client/v1/api/metrics_api.rb +2 -2
  85. data/lib/datadog_api_client/v1/api/monitors_api.rb +163 -5
  86. data/lib/datadog_api_client/v1/api/synthetics_api.rb +67 -0
  87. data/lib/datadog_api_client/v1/api/usage_metering_api.rb +180 -23
  88. data/lib/datadog_api_client/v1/models/downtime.rb +11 -1
  89. data/lib/datadog_api_client/v1/models/downtime_child.rb +427 -0
  90. data/lib/datadog_api_client/v1/models/monitor.rb +10 -0
  91. data/lib/datadog_api_client/v1/models/monitor_group_search_response.rb +243 -0
  92. data/lib/datadog_api_client/v1/models/monitor_group_search_response_counts.rb +237 -0
  93. data/lib/datadog_api_client/v1/models/monitor_group_search_result.rb +285 -0
  94. data/lib/datadog_api_client/v1/models/monitor_options.rb +1 -1
  95. data/lib/datadog_api_client/v1/models/monitor_search_response.rb +243 -0
  96. data/lib/datadog_api_client/v1/models/monitor_search_response_counts.rb +261 -0
  97. data/lib/datadog_api_client/v1/models/monitor_search_response_metadata.rb +253 -0
  98. data/lib/datadog_api_client/v1/models/monitor_search_result.rb +339 -0
  99. data/lib/datadog_api_client/v1/models/monitor_search_result_notification.rb +233 -0
  100. data/lib/datadog_api_client/v1/models/notebook_create_data_attributes.rb +1 -1
  101. data/lib/datadog_api_client/v1/models/notebook_distribution_cell_attributes.rb +1 -1
  102. data/lib/datadog_api_client/v1/models/notebook_heat_map_cell_attributes.rb +1 -1
  103. data/lib/datadog_api_client/v1/models/notebook_log_stream_cell_attributes.rb +1 -1
  104. data/lib/datadog_api_client/v1/models/notebook_markdown_cell_attributes.rb +1 -1
  105. data/lib/datadog_api_client/v1/models/notebook_response_data_attributes.rb +3 -3
  106. data/lib/datadog_api_client/v1/models/notebook_timeseries_cell_attributes.rb +1 -1
  107. data/lib/datadog_api_client/v1/models/notebook_toplist_cell_attributes.rb +1 -1
  108. data/lib/datadog_api_client/v1/models/notebook_update_data_attributes.rb +1 -1
  109. data/lib/datadog_api_client/v1/models/notebooks_response.rb +1 -1
  110. data/lib/datadog_api_client/v1/models/notebooks_response_data.rb +258 -0
  111. data/lib/datadog_api_client/v1/models/notebooks_response_data_attributes.rb +317 -0
  112. data/lib/datadog_api_client/v1/models/synthetics_api_test_config.rb +0 -5
  113. data/lib/datadog_api_client/v1/models/synthetics_config_variable.rb +11 -6
  114. data/lib/datadog_api_client/v1/models/synthetics_config_variable_type.rb +1 -0
  115. data/lib/datadog_api_client/v1/models/synthetics_global_variable_value.rb +0 -5
  116. data/lib/datadog_api_client/v1/models/synthetics_list_global_variables_response.rb +225 -0
  117. data/lib/datadog_api_client/v1/models/synthetics_test_config.rb +0 -5
  118. data/lib/datadog_api_client/v1/models/usage_attribution_body.rb +11 -1
  119. data/lib/datadog_api_client/v1/models/usage_attribution_pagination.rb +10 -30
  120. data/lib/datadog_api_client/v1/models/usage_attribution_values.rb +41 -1
  121. data/lib/datadog_api_client/v1/models/usage_audit_logs_hour.rb +233 -0
  122. data/lib/datadog_api_client/v1/models/{usage_compliance_response.rb → usage_audit_logs_response.rb} +6 -6
  123. data/lib/datadog_api_client/v1/models/{usage_compliance_hour.rb → usage_cloud_security_posture_management_hour.rb} +19 -19
  124. data/lib/datadog_api_client/v1/models/usage_cloud_security_posture_management_response.rb +225 -0
  125. data/lib/datadog_api_client/v1/models/usage_cws_hour.rb +243 -0
  126. data/lib/datadog_api_client/v1/models/usage_cws_response.rb +225 -0
  127. data/lib/datadog_api_client/v1/models/usage_summary_date.rb +61 -22
  128. data/lib/datadog_api_client/v1/models/usage_summary_date_org.rb +61 -22
  129. data/lib/datadog_api_client/v1/models/usage_summary_response.rb +61 -22
  130. data/lib/datadog_api_client/v1/models/usage_top_avg_metrics_metadata.rb +2 -4
  131. data/lib/datadog_api_client/v1/models/widget_custom_link.rb +24 -14
  132. data/lib/datadog_api_client/v2.rb +16 -0
  133. data/lib/datadog_api_client/v2/api/security_monitoring_api.rb +369 -0
  134. data/lib/datadog_api_client/v2/models/incident_integration_metadata_type.rb +1 -1
  135. data/lib/datadog_api_client/v2/models/relationship_to_incident_integration_metadata_data.rb +1 -1
  136. data/lib/datadog_api_client/v2/models/security_filter.rb +243 -0
  137. data/lib/datadog_api_client/v2/models/security_filter_attributes.rb +299 -0
  138. data/lib/datadog_api_client/v2/models/security_filter_create_attributes.rb +289 -0
  139. data/lib/datadog_api_client/v2/models/security_filter_create_data.rb +243 -0
  140. data/lib/datadog_api_client/v2/models/security_filter_create_request.rb +227 -0
  141. data/lib/datadog_api_client/v2/models/security_filter_delete_response.rb +222 -0
  142. data/lib/datadog_api_client/v2/models/security_filter_exclusion_filter.rb +243 -0
  143. data/lib/datadog_api_client/v2/models/security_filter_exclusion_filter_response.rb +233 -0
  144. data/lib/datadog_api_client/v2/models/security_filter_filtered_data_type.rb +39 -0
  145. data/lib/datadog_api_client/v2/models/security_filter_meta.rb +223 -0
  146. data/lib/datadog_api_client/v2/models/security_filter_response.rb +231 -0
  147. data/lib/datadog_api_client/v2/models/security_filter_type.rb +39 -0
  148. data/lib/datadog_api_client/v2/models/security_filter_update_attributes.rb +289 -0
  149. data/lib/datadog_api_client/v2/models/security_filter_update_data.rb +243 -0
  150. data/lib/datadog_api_client/v2/models/security_filter_update_request.rb +227 -0
  151. data/lib/datadog_api_client/v2/models/security_filters_response.rb +234 -0
  152. data/lib/datadog_api_client/version.rb +1 -1
  153. data/spec/v1/models/downtime_child_spec.rb +127 -0
  154. data/spec/v1/models/monitor_group_search_response_counts_spec.rb +43 -0
  155. data/spec/v1/models/monitor_group_search_response_spec.rb +49 -0
  156. data/spec/v1/models/monitor_group_search_result_spec.rb +73 -0
  157. data/spec/v1/models/monitor_search_response_counts_spec.rb +55 -0
  158. data/spec/v1/models/monitor_search_response_metadata_spec.rb +55 -0
  159. data/spec/v1/models/monitor_search_response_spec.rb +49 -0
  160. data/spec/v1/models/monitor_search_result_notification_spec.rb +43 -0
  161. data/spec/v1/models/monitor_search_result_spec.rb +103 -0
  162. data/spec/v1/models/notebooks_response_data_attributes_spec.rb +73 -0
  163. data/spec/v1/models/notebooks_response_data_spec.rb +49 -0
  164. data/spec/v1/models/synthetics_list_global_variables_response_spec.rb +37 -0
  165. data/spec/v1/models/usage_audit_logs_hour_spec.rb +43 -0
  166. data/spec/v1/models/{usage_compliance_response_spec.rb → usage_audit_logs_response_spec.rb} +6 -6
  167. data/spec/v1/models/usage_cloud_security_posture_management_hour_spec.rb +49 -0
  168. data/spec/v1/models/usage_cloud_security_posture_management_response_spec.rb +37 -0
  169. data/spec/v1/models/{usage_compliance_hour_spec.rb → usage_cws_hour_spec.rb} +8 -8
  170. data/spec/v1/models/usage_cws_response_spec.rb +37 -0
  171. data/spec/v2/models/security_filter_attributes_spec.rb +73 -0
  172. data/spec/v2/models/security_filter_create_attributes_spec.rb +61 -0
  173. data/spec/v2/models/security_filter_create_data_spec.rb +43 -0
  174. data/spec/v2/models/security_filter_create_request_spec.rb +37 -0
  175. data/spec/v2/models/security_filter_delete_response_spec.rb +37 -0
  176. data/spec/v2/models/security_filter_exclusion_filter_response_spec.rb +43 -0
  177. data/spec/v2/models/security_filter_exclusion_filter_spec.rb +43 -0
  178. data/spec/v2/models/security_filter_filtered_data_type_spec.rb +31 -0
  179. data/spec/v2/models/security_filter_meta_spec.rb +37 -0
  180. data/spec/v2/models/security_filter_response_spec.rb +43 -0
  181. data/spec/v2/models/security_filter_spec.rb +49 -0
  182. data/spec/v2/models/security_filter_type_spec.rb +31 -0
  183. data/spec/v2/models/security_filter_update_attributes_spec.rb +67 -0
  184. data/spec/v2/models/security_filter_update_data_spec.rb +43 -0
  185. data/spec/v2/models/security_filter_update_request_spec.rb +37 -0
  186. data/spec/v2/models/security_filters_response_spec.rb +43 -0
  187. metadata +140 -11
  188. data/.azure-pipelines/all.yml +0 -50
  189. data/docs/v1/UsageComplianceHour.md +0 -22
  190. data/docs/v1/UsageComplianceResponse.md +0 -18
@@ -0,0 +1,261 @@
1
+ =begin
2
+ #Datadog API V1 Collection
3
+
4
+ #Collection of all Datadog Public endpoints.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@datadoghq.com
8
+ Generated by: https://openapi-generator.tech
9
+
10
+ Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11
+ This product includes software developed at Datadog (https://www.datadoghq.com/).
12
+ Copyright 2020-Present Datadog, Inc.
13
+
14
+ =end
15
+
16
+ require 'date'
17
+ require 'time'
18
+
19
+ module DatadogAPIClient::V1
20
+ # The counts of monitors per different criteria.
21
+ class MonitorSearchResponseCounts
22
+ # Search facets.
23
+ attr_accessor :muted
24
+
25
+ # Search facets.
26
+ attr_accessor :status
27
+
28
+ # Search facets.
29
+ attr_accessor :tag
30
+
31
+ # Search facets.
32
+ attr_accessor :type
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'muted' => :'muted',
38
+ :'status' => :'status',
39
+ :'tag' => :'tag',
40
+ :'type' => :'type'
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.openapi_types
51
+ {
52
+ :'muted' => :'Array<Object>',
53
+ :'status' => :'Array<Object>',
54
+ :'tag' => :'Array<Object>',
55
+ :'type' => :'Array<Object>'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_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 `DatadogAPIClient::V1::MonitorSearchResponseCounts` 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 `DatadogAPIClient::V1::MonitorSearchResponseCounts`. 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?(:'muted')
81
+ if (value = attributes[:'muted']).is_a?(Array)
82
+ self.muted = value
83
+ end
84
+ end
85
+
86
+ if attributes.key?(:'status')
87
+ if (value = attributes[:'status']).is_a?(Array)
88
+ self.status = value
89
+ end
90
+ end
91
+
92
+ if attributes.key?(:'tag')
93
+ if (value = attributes[:'tag']).is_a?(Array)
94
+ self.tag = value
95
+ end
96
+ end
97
+
98
+ if attributes.key?(:'type')
99
+ if (value = attributes[:'type']).is_a?(Array)
100
+ self.type = value
101
+ end
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ invalid_properties = Array.new
109
+ invalid_properties
110
+ end
111
+
112
+ # Check to see if the all the properties in the model are valid
113
+ # @return true if the model is valid
114
+ def valid?
115
+ true
116
+ end
117
+
118
+ # Checks equality by comparing each attribute.
119
+ # @param [Object] Object to be compared
120
+ def ==(o)
121
+ return true if self.equal?(o)
122
+ self.class == o.class &&
123
+ muted == o.muted &&
124
+ status == o.status &&
125
+ tag == o.tag &&
126
+ type == o.type
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Integer] Hash code
137
+ def hash
138
+ [muted, status, tag, type].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def self.build_from_hash(attributes)
145
+ new.build_from_hash(attributes)
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ self.class.openapi_types.each_pair do |key, type|
154
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
155
+ self.send("#{key}=", nil)
156
+ elsif type =~ /\AArray<(.*)>/i
157
+ # check to ensure the input is an array given that the attribute
158
+ # is documented as an array but the input is not
159
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
160
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
161
+ end
162
+ elsif !attributes[self.class.attribute_map[key]].nil?
163
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
164
+ end
165
+ end
166
+
167
+ self
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def _deserialize(type, value)
175
+ case type.to_sym
176
+ when :Time
177
+ Time.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :Boolean
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when :Object
193
+ # generic object (usually a Hash), return directly
194
+ value
195
+ when /\AArray<(?<inner_type>.+)>\z/
196
+ inner_type = Regexp.last_match[:inner_type]
197
+ value.map { |v| _deserialize(inner_type, v) }
198
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
+ k_type = Regexp.last_match[:k_type]
200
+ v_type = Regexp.last_match[:v_type]
201
+ {}.tap do |hash|
202
+ value.each do |k, v|
203
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
+ end
205
+ end
206
+ else # model
207
+ # models (e.g. Pet) or oneOf
208
+ klass = DatadogAPIClient::V1.const_get(type)
209
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+
259
+ end
260
+
261
+ end
@@ -0,0 +1,253 @@
1
+ =begin
2
+ #Datadog API V1 Collection
3
+
4
+ #Collection of all Datadog Public endpoints.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@datadoghq.com
8
+ Generated by: https://openapi-generator.tech
9
+
10
+ Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11
+ This product includes software developed at Datadog (https://www.datadoghq.com/).
12
+ Copyright 2020-Present Datadog, Inc.
13
+
14
+ =end
15
+
16
+ require 'date'
17
+ require 'time'
18
+
19
+ module DatadogAPIClient::V1
20
+ # Metadata about the response.
21
+ class MonitorSearchResponseMetadata
22
+ # The page to start paginating from.
23
+ attr_accessor :page
24
+
25
+ # The number of pages.
26
+ attr_accessor :page_count
27
+
28
+ # The number of monitors to return per page.
29
+ attr_accessor :per_page
30
+
31
+ # The total number of monitors.
32
+ attr_accessor :total_count
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'page' => :'page',
38
+ :'page_count' => :'page_count',
39
+ :'per_page' => :'per_page',
40
+ :'total_count' => :'total_count'
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.openapi_types
51
+ {
52
+ :'page' => :'Integer',
53
+ :'page_count' => :'Integer',
54
+ :'per_page' => :'Integer',
55
+ :'total_count' => :'Integer'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_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 `DatadogAPIClient::V1::MonitorSearchResponseMetadata` 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 `DatadogAPIClient::V1::MonitorSearchResponseMetadata`. 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?(:'page')
81
+ self.page = attributes[:'page']
82
+ end
83
+
84
+ if attributes.key?(:'page_count')
85
+ self.page_count = attributes[:'page_count']
86
+ end
87
+
88
+ if attributes.key?(:'per_page')
89
+ self.per_page = attributes[:'per_page']
90
+ end
91
+
92
+ if attributes.key?(:'total_count')
93
+ self.total_count = attributes[:'total_count']
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ page == o.page &&
116
+ page_count == o.page_count &&
117
+ per_page == o.per_page &&
118
+ total_count == o.total_count
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Integer] Hash code
129
+ def hash
130
+ [page, page_count, per_page, total_count].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def self.build_from_hash(attributes)
137
+ new.build_from_hash(attributes)
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ self.class.openapi_types.each_pair do |key, type|
146
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
147
+ self.send("#{key}=", nil)
148
+ elsif type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ end
157
+ end
158
+
159
+ self
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def _deserialize(type, value)
167
+ case type.to_sym
168
+ when :Time
169
+ Time.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :Boolean
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ # models (e.g. Pet) or oneOf
200
+ klass = DatadogAPIClient::V1.const_get(type)
201
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ if value.nil?
224
+ is_nullable = self.class.openapi_nullable.include?(attr)
225
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
226
+ end
227
+
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+
251
+ end
252
+
253
+ end