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
@@ -22,6 +22,8 @@ module DatadogAPIClient::V1
22
22
  # If a scheduled downtime currently exists.
23
23
  attr_accessor :active
24
24
 
25
+ attr_accessor :active_child
26
+
25
27
  # If a scheduled downtime is canceled.
26
28
  attr_accessor :canceled
27
29
 
@@ -70,6 +72,7 @@ module DatadogAPIClient::V1
70
72
  def self.attribute_map
71
73
  {
72
74
  :'active' => :'active',
75
+ :'active_child' => :'active_child',
73
76
  :'canceled' => :'canceled',
74
77
  :'creator_id' => :'creator_id',
75
78
  :'disabled' => :'disabled',
@@ -97,6 +100,7 @@ module DatadogAPIClient::V1
97
100
  def self.openapi_types
98
101
  {
99
102
  :'active' => :'Boolean',
103
+ :'active_child' => :'DowntimeChild',
100
104
  :'canceled' => :'Integer',
101
105
  :'creator_id' => :'Integer',
102
106
  :'disabled' => :'Boolean',
@@ -118,6 +122,7 @@ module DatadogAPIClient::V1
118
122
  # List of attributes with nullable: true
119
123
  def self.openapi_nullable
120
124
  Set.new([
125
+ :'active_child',
121
126
  :'canceled',
122
127
  :'_end',
123
128
  :'monitor_id',
@@ -146,6 +151,10 @@ module DatadogAPIClient::V1
146
151
  self.active = attributes[:'active']
147
152
  end
148
153
 
154
+ if attributes.key?(:'active_child')
155
+ self.active_child = attributes[:'active_child']
156
+ end
157
+
149
158
  if attributes.key?(:'canceled')
150
159
  self.canceled = attributes[:'canceled']
151
160
  end
@@ -275,6 +284,7 @@ module DatadogAPIClient::V1
275
284
  return true if self.equal?(o)
276
285
  self.class == o.class &&
277
286
  active == o.active &&
287
+ active_child == o.active_child &&
278
288
  canceled == o.canceled &&
279
289
  creator_id == o.creator_id &&
280
290
  disabled == o.disabled &&
@@ -301,7 +311,7 @@ module DatadogAPIClient::V1
301
311
  # Calculates hash code according to all attributes.
302
312
  # @return [Integer] Hash code
303
313
  def hash
304
- [active, canceled, creator_id, disabled, downtime_type, _end, id, message, monitor_id, monitor_tags, parent_id, recurrence, scope, start, timezone, updater_id].hash
314
+ [active, active_child, canceled, creator_id, disabled, downtime_type, _end, id, message, monitor_id, monitor_tags, parent_id, recurrence, scope, start, timezone, updater_id].hash
305
315
  end
306
316
 
307
317
  # Builds the object from hash
@@ -0,0 +1,427 @@
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 downtime object definition of the active child for the original parent recurring downtime. This field will only exist on recurring downtimes.
21
+ class DowntimeChild
22
+ # If a scheduled downtime currently exists.
23
+ attr_accessor :active
24
+
25
+ # If a scheduled downtime is canceled.
26
+ attr_accessor :canceled
27
+
28
+ # User ID of the downtime creator.
29
+ attr_accessor :creator_id
30
+
31
+ # If a downtime has been disabled.
32
+ attr_accessor :disabled
33
+
34
+ # `0` for a downtime applied on `*` or all, `1` when the downtime is only scoped to hosts, or `2` when the downtime is scoped to anything but hosts.
35
+ attr_accessor :downtime_type
36
+
37
+ # POSIX timestamp to end the downtime. If not provided, the downtime is in effect indefinitely until you cancel it.
38
+ attr_accessor :_end
39
+
40
+ # The downtime ID.
41
+ attr_accessor :id
42
+
43
+ # A message to include with notifications for this downtime. Email notifications can be sent to specific users by using the same `@username` notation as events.
44
+ attr_accessor :message
45
+
46
+ # A single monitor to which the downtime applies. If not provided, the downtime applies to all monitors.
47
+ attr_accessor :monitor_id
48
+
49
+ # A comma-separated list of monitor tags. For example, tags that are applied directly to monitors, not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies. The resulting downtime applies to monitors that match ALL provided monitor tags. For example, `service:postgres` **AND** `team:frontend`.
50
+ attr_accessor :monitor_tags
51
+
52
+ # ID of the parent Downtime.
53
+ attr_accessor :parent_id
54
+
55
+ attr_accessor :recurrence
56
+
57
+ # The scope(s) to which the downtime applies. For example, `host:app2`. Provide multiple scopes as a comma-separated list like `env:dev,env:prod`. The resulting downtime applies to sources that matches ALL provided scopes (`env:dev` **AND** `env:prod`).
58
+ attr_accessor :scope
59
+
60
+ # POSIX timestamp to start the downtime. If not provided, the downtime starts the moment it is created.
61
+ attr_accessor :start
62
+
63
+ # The timezone in which to display the downtime's start and end times in Datadog applications.
64
+ attr_accessor :timezone
65
+
66
+ # ID of the last user that updated the downtime.
67
+ attr_accessor :updater_id
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'active' => :'active',
73
+ :'canceled' => :'canceled',
74
+ :'creator_id' => :'creator_id',
75
+ :'disabled' => :'disabled',
76
+ :'downtime_type' => :'downtime_type',
77
+ :'_end' => :'end',
78
+ :'id' => :'id',
79
+ :'message' => :'message',
80
+ :'monitor_id' => :'monitor_id',
81
+ :'monitor_tags' => :'monitor_tags',
82
+ :'parent_id' => :'parent_id',
83
+ :'recurrence' => :'recurrence',
84
+ :'scope' => :'scope',
85
+ :'start' => :'start',
86
+ :'timezone' => :'timezone',
87
+ :'updater_id' => :'updater_id'
88
+ }
89
+ end
90
+
91
+ # Returns all the JSON keys this model knows about
92
+ def self.acceptable_attributes
93
+ attribute_map.values
94
+ end
95
+
96
+ # Attribute type mapping.
97
+ def self.openapi_types
98
+ {
99
+ :'active' => :'Boolean',
100
+ :'canceled' => :'Integer',
101
+ :'creator_id' => :'Integer',
102
+ :'disabled' => :'Boolean',
103
+ :'downtime_type' => :'Integer',
104
+ :'_end' => :'Integer',
105
+ :'id' => :'Integer',
106
+ :'message' => :'String',
107
+ :'monitor_id' => :'Integer',
108
+ :'monitor_tags' => :'Array<String>',
109
+ :'parent_id' => :'Integer',
110
+ :'recurrence' => :'DowntimeRecurrence',
111
+ :'scope' => :'Array<String>',
112
+ :'start' => :'Integer',
113
+ :'timezone' => :'String',
114
+ :'updater_id' => :'Integer'
115
+ }
116
+ end
117
+
118
+ # List of attributes with nullable: true
119
+ def self.openapi_nullable
120
+ Set.new([
121
+ :'canceled',
122
+ :'_end',
123
+ :'monitor_id',
124
+ :'parent_id',
125
+ :'recurrence',
126
+ :'updater_id'
127
+ ])
128
+ end
129
+
130
+ # Initializes the object
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ def initialize(attributes = {})
133
+ if (!attributes.is_a?(Hash))
134
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::DowntimeChild` initialize method"
135
+ end
136
+
137
+ # check to see if the attribute exists and convert string to symbol for hash key
138
+ attributes = attributes.each_with_object({}) { |(k, v), h|
139
+ if (!self.class.attribute_map.key?(k.to_sym))
140
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::DowntimeChild`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
141
+ end
142
+ h[k.to_sym] = v
143
+ }
144
+
145
+ if attributes.key?(:'active')
146
+ self.active = attributes[:'active']
147
+ end
148
+
149
+ if attributes.key?(:'canceled')
150
+ self.canceled = attributes[:'canceled']
151
+ end
152
+
153
+ if attributes.key?(:'creator_id')
154
+ self.creator_id = attributes[:'creator_id']
155
+ end
156
+
157
+ if attributes.key?(:'disabled')
158
+ self.disabled = attributes[:'disabled']
159
+ end
160
+
161
+ if attributes.key?(:'downtime_type')
162
+ self.downtime_type = attributes[:'downtime_type']
163
+ end
164
+
165
+ if attributes.key?(:'_end')
166
+ self._end = attributes[:'_end']
167
+ end
168
+
169
+ if attributes.key?(:'id')
170
+ self.id = attributes[:'id']
171
+ end
172
+
173
+ if attributes.key?(:'message')
174
+ self.message = attributes[:'message']
175
+ end
176
+
177
+ if attributes.key?(:'monitor_id')
178
+ self.monitor_id = attributes[:'monitor_id']
179
+ end
180
+
181
+ if attributes.key?(:'monitor_tags')
182
+ if (value = attributes[:'monitor_tags']).is_a?(Array)
183
+ self.monitor_tags = value
184
+ end
185
+ end
186
+
187
+ if attributes.key?(:'parent_id')
188
+ self.parent_id = attributes[:'parent_id']
189
+ end
190
+
191
+ if attributes.key?(:'recurrence')
192
+ self.recurrence = attributes[:'recurrence']
193
+ end
194
+
195
+ if attributes.key?(:'scope')
196
+ if (value = attributes[:'scope']).is_a?(Array)
197
+ self.scope = value
198
+ end
199
+ end
200
+
201
+ if attributes.key?(:'start')
202
+ self.start = attributes[:'start']
203
+ end
204
+
205
+ if attributes.key?(:'timezone')
206
+ self.timezone = attributes[:'timezone']
207
+ end
208
+
209
+ if attributes.key?(:'updater_id')
210
+ self.updater_id = attributes[:'updater_id']
211
+ end
212
+ end
213
+
214
+ # Show invalid properties with the reasons. Usually used together with valid?
215
+ # @return Array for valid properties with the reasons
216
+ def list_invalid_properties
217
+ invalid_properties = Array.new
218
+ if !@creator_id.nil? && @creator_id > 2147483647
219
+ invalid_properties.push('invalid value for "creator_id", must be smaller than or equal to 2147483647.')
220
+ end
221
+
222
+ if !@downtime_type.nil? && @downtime_type > 2147483647
223
+ invalid_properties.push('invalid value for "downtime_type", must be smaller than or equal to 2147483647.')
224
+ end
225
+
226
+ if !@updater_id.nil? && @updater_id > 2147483647
227
+ invalid_properties.push('invalid value for "updater_id", must be smaller than or equal to 2147483647.')
228
+ end
229
+
230
+ invalid_properties
231
+ end
232
+
233
+ # Check to see if the all the properties in the model are valid
234
+ # @return true if the model is valid
235
+ def valid?
236
+ return false if !@creator_id.nil? && @creator_id > 2147483647
237
+ return false if !@downtime_type.nil? && @downtime_type > 2147483647
238
+ return false if !@updater_id.nil? && @updater_id > 2147483647
239
+ true
240
+ end
241
+
242
+ # Custom attribute writer method with validation
243
+ # @param [Object] creator_id Value to be assigned
244
+ def creator_id=(creator_id)
245
+ if !creator_id.nil? && creator_id > 2147483647
246
+ fail ArgumentError, 'invalid value for "creator_id", must be smaller than or equal to 2147483647.'
247
+ end
248
+
249
+ @creator_id = creator_id
250
+ end
251
+
252
+ # Custom attribute writer method with validation
253
+ # @param [Object] downtime_type Value to be assigned
254
+ def downtime_type=(downtime_type)
255
+ if !downtime_type.nil? && downtime_type > 2147483647
256
+ fail ArgumentError, 'invalid value for "downtime_type", must be smaller than or equal to 2147483647.'
257
+ end
258
+
259
+ @downtime_type = downtime_type
260
+ end
261
+
262
+ # Custom attribute writer method with validation
263
+ # @param [Object] updater_id Value to be assigned
264
+ def updater_id=(updater_id)
265
+ if !updater_id.nil? && updater_id > 2147483647
266
+ fail ArgumentError, 'invalid value for "updater_id", must be smaller than or equal to 2147483647.'
267
+ end
268
+
269
+ @updater_id = updater_id
270
+ end
271
+
272
+ # Checks equality by comparing each attribute.
273
+ # @param [Object] Object to be compared
274
+ def ==(o)
275
+ return true if self.equal?(o)
276
+ self.class == o.class &&
277
+ active == o.active &&
278
+ canceled == o.canceled &&
279
+ creator_id == o.creator_id &&
280
+ disabled == o.disabled &&
281
+ downtime_type == o.downtime_type &&
282
+ _end == o._end &&
283
+ id == o.id &&
284
+ message == o.message &&
285
+ monitor_id == o.monitor_id &&
286
+ monitor_tags == o.monitor_tags &&
287
+ parent_id == o.parent_id &&
288
+ recurrence == o.recurrence &&
289
+ scope == o.scope &&
290
+ start == o.start &&
291
+ timezone == o.timezone &&
292
+ updater_id == o.updater_id
293
+ end
294
+
295
+ # @see the `==` method
296
+ # @param [Object] Object to be compared
297
+ def eql?(o)
298
+ self == o
299
+ end
300
+
301
+ # Calculates hash code according to all attributes.
302
+ # @return [Integer] Hash code
303
+ def hash
304
+ [active, canceled, creator_id, disabled, downtime_type, _end, id, message, monitor_id, monitor_tags, parent_id, recurrence, scope, start, timezone, updater_id].hash
305
+ end
306
+
307
+ # Builds the object from hash
308
+ # @param [Hash] attributes Model attributes in the form of hash
309
+ # @return [Object] Returns the model itself
310
+ def self.build_from_hash(attributes)
311
+ new.build_from_hash(attributes)
312
+ end
313
+
314
+ # Builds the object from hash
315
+ # @param [Hash] attributes Model attributes in the form of hash
316
+ # @return [Object] Returns the model itself
317
+ def build_from_hash(attributes)
318
+ return nil unless attributes.is_a?(Hash)
319
+ self.class.openapi_types.each_pair do |key, type|
320
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
321
+ self.send("#{key}=", nil)
322
+ elsif type =~ /\AArray<(.*)>/i
323
+ # check to ensure the input is an array given that the attribute
324
+ # is documented as an array but the input is not
325
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
326
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
327
+ end
328
+ elsif !attributes[self.class.attribute_map[key]].nil?
329
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
330
+ end
331
+ end
332
+
333
+ self
334
+ end
335
+
336
+ # Deserializes the data based on type
337
+ # @param string type Data type
338
+ # @param string value Value to be deserialized
339
+ # @return [Object] Deserialized data
340
+ def _deserialize(type, value)
341
+ case type.to_sym
342
+ when :Time
343
+ Time.parse(value)
344
+ when :Date
345
+ Date.parse(value)
346
+ when :String
347
+ value.to_s
348
+ when :Integer
349
+ value.to_i
350
+ when :Float
351
+ value.to_f
352
+ when :Boolean
353
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
354
+ true
355
+ else
356
+ false
357
+ end
358
+ when :Object
359
+ # generic object (usually a Hash), return directly
360
+ value
361
+ when /\AArray<(?<inner_type>.+)>\z/
362
+ inner_type = Regexp.last_match[:inner_type]
363
+ value.map { |v| _deserialize(inner_type, v) }
364
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
365
+ k_type = Regexp.last_match[:k_type]
366
+ v_type = Regexp.last_match[:v_type]
367
+ {}.tap do |hash|
368
+ value.each do |k, v|
369
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
370
+ end
371
+ end
372
+ else # model
373
+ # models (e.g. Pet) or oneOf
374
+ klass = DatadogAPIClient::V1.const_get(type)
375
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
376
+ end
377
+ end
378
+
379
+ # Returns the string representation of the object
380
+ # @return [String] String presentation of the object
381
+ def to_s
382
+ to_hash.to_s
383
+ end
384
+
385
+ # to_body is an alias to to_hash (backward compatibility)
386
+ # @return [Hash] Returns the object in the form of hash
387
+ def to_body
388
+ to_hash
389
+ end
390
+
391
+ # Returns the object in the form of hash
392
+ # @return [Hash] Returns the object in the form of hash
393
+ def to_hash
394
+ hash = {}
395
+ self.class.attribute_map.each_pair do |attr, param|
396
+ value = self.send(attr)
397
+ if value.nil?
398
+ is_nullable = self.class.openapi_nullable.include?(attr)
399
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
400
+ end
401
+
402
+ hash[param] = _to_hash(value)
403
+ end
404
+ hash
405
+ end
406
+
407
+ # Outputs non-array value in the form of hash
408
+ # For object, use to_hash. Otherwise, just return the value
409
+ # @param [Object] value Any valid value
410
+ # @return [Hash] Returns the value in the form of hash
411
+ def _to_hash(value)
412
+ if value.is_a?(Array)
413
+ value.compact.map { |v| _to_hash(v) }
414
+ elsif value.is_a?(Hash)
415
+ {}.tap do |hash|
416
+ value.each { |k, v| hash[k] = _to_hash(v) }
417
+ end
418
+ elsif value.respond_to? :to_hash
419
+ value.to_hash
420
+ else
421
+ value
422
+ end
423
+ end
424
+
425
+ end
426
+
427
+ end