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
@@ -214,6 +214,14 @@ module DatadogAPIClient::V1
214
214
  invalid_properties.push('invalid value for "priority", must be greater than or equal to 1.')
215
215
  end
216
216
 
217
+ if @query.nil?
218
+ invalid_properties.push('invalid value for "query", query cannot be nil.')
219
+ end
220
+
221
+ if @type.nil?
222
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
223
+ end
224
+
217
225
  invalid_properties
218
226
  end
219
227
 
@@ -222,6 +230,8 @@ module DatadogAPIClient::V1
222
230
  def valid?
223
231
  return false if !@priority.nil? && @priority > 5
224
232
  return false if !@priority.nil? && @priority < 1
233
+ return false if @query.nil?
234
+ return false if @type.nil?
225
235
  true
226
236
  end
227
237
 
@@ -0,0 +1,243 @@
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 response of a monitor group search.
21
+ class MonitorGroupSearchResponse
22
+ attr_accessor :counts
23
+
24
+ # The list of found monitor groups.
25
+ attr_accessor :groups
26
+
27
+ attr_accessor :metadata
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'counts' => :'counts',
33
+ :'groups' => :'groups',
34
+ :'metadata' => :'metadata'
35
+ }
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'counts' => :'MonitorGroupSearchResponseCounts',
47
+ :'groups' => :'Array<MonitorGroupSearchResult>',
48
+ :'metadata' => :'MonitorSearchResponseMetadata'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::MonitorGroupSearchResponse` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h|
67
+ if (!self.class.attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::MonitorGroupSearchResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
69
+ end
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:'counts')
74
+ self.counts = attributes[:'counts']
75
+ end
76
+
77
+ if attributes.key?(:'groups')
78
+ if (value = attributes[:'groups']).is_a?(Array)
79
+ self.groups = value
80
+ end
81
+ end
82
+
83
+ if attributes.key?(:'metadata')
84
+ self.metadata = attributes[:'metadata']
85
+ end
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ invalid_properties = Array.new
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ true
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(o)
104
+ return true if self.equal?(o)
105
+ self.class == o.class &&
106
+ counts == o.counts &&
107
+ groups == o.groups &&
108
+ metadata == o.metadata
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [counts, groups, metadata].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ new.build_from_hash(attributes)
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.openapi_types.each_pair do |key, type|
136
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
137
+ self.send("#{key}=", nil)
138
+ elsif type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :Time
159
+ Time.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ # models (e.g. Pet) or oneOf
190
+ klass = DatadogAPIClient::V1.const_get(type)
191
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end
240
+
241
+ end
242
+
243
+ end
@@ -0,0 +1,237 @@
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 monitor groups per different criteria.
21
+ class MonitorGroupSearchResponseCounts
22
+ # Search facets.
23
+ attr_accessor :status
24
+
25
+ # Search facets.
26
+ attr_accessor :type
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'status' => :'status',
32
+ :'type' => :'type'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'status' => :'Array<Object>',
45
+ :'type' => :'Array<Object>'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::MonitorGroupSearchResponseCounts` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::MonitorGroupSearchResponseCounts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'status')
71
+ if (value = attributes[:'status']).is_a?(Array)
72
+ self.status = value
73
+ end
74
+ end
75
+
76
+ if attributes.key?(:'type')
77
+ if (value = attributes[:'type']).is_a?(Array)
78
+ self.type = value
79
+ end
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ status == o.status &&
102
+ type == o.type
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [status, type].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ new.build_from_hash(attributes)
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.openapi_types.each_pair do |key, type|
130
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
131
+ self.send("#{key}=", nil)
132
+ elsif type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
137
+ end
138
+ elsif !attributes[self.class.attribute_map[key]].nil?
139
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
140
+ end
141
+ end
142
+
143
+ self
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :Time
153
+ Time.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ # models (e.g. Pet) or oneOf
184
+ klass = DatadogAPIClient::V1.const_get(type)
185
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end