datadog_api_client 1.0.0.beta.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/.apigentools-info +4 -4
  3. data/.azure-pipelines/all.yml +0 -1
  4. data/.rubocop.yml +1 -1
  5. data/CHANGELOG.md +23 -0
  6. data/Gemfile +1 -1
  7. data/LICENSE-3rdparty.csv +0 -1
  8. data/check-examples.sh +7 -2
  9. data/data/v1/openapi.yaml +1963 -245
  10. data/data/v2/openapi.yaml +67 -13
  11. data/docs/v1/DashboardsAPI.md +10 -5
  12. data/docs/v1/DistributionWidgetDefinition.md +9 -3
  13. data/docs/v1/DistributionWidgetXAxis.md +24 -0
  14. data/docs/v1/DistributionWidgetYAxis.md +26 -0
  15. data/docs/v1/EventsAPI.md +7 -3
  16. data/docs/v1/GroupWidgetDefinition.md +8 -0
  17. data/docs/v1/ImageWidgetDefinition.md +11 -1
  18. data/docs/v1/LogsByRetention.md +22 -0
  19. data/docs/v1/LogsByRetentionMonthlyUsage.md +20 -0
  20. data/docs/v1/LogsByRetentionOrgUsage.md +18 -0
  21. data/docs/v1/LogsByRetentionOrgs.md +18 -0
  22. data/docs/v1/LogsRetentionAggSumUsage.md +24 -0
  23. data/docs/v1/LogsRetentionSumUsage.md +24 -0
  24. data/docs/v1/MonitorsAPI.md +1 -1
  25. data/docs/v1/NoteWidgetDefinition.md +5 -1
  26. data/docs/v1/NotebookAbsoluteTime.md +22 -0
  27. data/docs/v1/NotebookAuthor.md +34 -0
  28. data/docs/v1/NotebookCellCreateRequest.md +20 -0
  29. data/docs/v1/NotebookCellCreateRequestAttributes.md +57 -0
  30. data/docs/v1/NotebookCellResourceType.md +15 -0
  31. data/docs/v1/NotebookCellResponse.md +22 -0
  32. data/docs/v1/NotebookCellResponseAttributes.md +57 -0
  33. data/docs/v1/NotebookCellTime.md +49 -0
  34. data/docs/v1/NotebookCellUpdateRequest.md +22 -0
  35. data/docs/v1/NotebookCellUpdateRequestAttributes.md +57 -0
  36. data/docs/v1/NotebookCreateData.md +20 -0
  37. data/docs/v1/NotebookCreateDataAttributes.md +24 -0
  38. data/docs/v1/NotebookCreateRequest.md +18 -0
  39. data/docs/v1/NotebookDistributionCellAttributes.md +24 -0
  40. data/docs/v1/NotebookGlobalTime.md +49 -0
  41. data/docs/v1/NotebookGraphSize.md +15 -0
  42. data/docs/v1/NotebookHeatMapCellAttributes.md +24 -0
  43. data/docs/v1/NotebookLogStreamCellAttributes.md +22 -0
  44. data/docs/v1/NotebookMarkdownCellAttributes.md +18 -0
  45. data/docs/v1/NotebookMarkdownCellDefinition.md +21 -0
  46. data/docs/v1/NotebookMarkdownCellDefinitionType.md +15 -0
  47. data/docs/v1/NotebookRelativeTime.md +18 -0
  48. data/docs/v1/NotebookResourceType.md +15 -0
  49. data/docs/v1/NotebookResponse.md +18 -0
  50. data/docs/v1/NotebookResponseData.md +22 -0
  51. data/docs/v1/NotebookResponseDataAttributes.md +30 -0
  52. data/docs/v1/NotebookSplitBy.md +20 -0
  53. data/docs/v1/NotebookStatus.md +15 -0
  54. data/docs/v1/NotebookTimeseriesCellAttributes.md +24 -0
  55. data/docs/v1/NotebookToplistCellAttributes.md +24 -0
  56. data/docs/v1/NotebookUpdateCell.md +49 -0
  57. data/docs/v1/NotebookUpdateData.md +20 -0
  58. data/docs/v1/NotebookUpdateDataAttributes.md +24 -0
  59. data/docs/v1/NotebookUpdateRequest.md +18 -0
  60. data/docs/v1/NotebooksAPI.md +339 -0
  61. data/docs/v1/NotebooksResponse.md +20 -0
  62. data/docs/v1/NotebooksResponseMeta.md +18 -0
  63. data/docs/v1/NotebooksResponsePage.md +20 -0
  64. data/docs/v1/README.md +66 -9
  65. data/docs/v1/SLOListResponse.md +3 -1
  66. data/docs/v1/SLOListResponseMetadata.md +18 -0
  67. data/docs/v1/SLOListResponseMetadataPage.md +20 -0
  68. data/docs/v1/SLOResponse.md +1 -1
  69. data/docs/v1/SLOResponseData.md +44 -0
  70. data/docs/v1/ServiceLevelObjectivesAPI.md +8 -4
  71. data/docs/v1/SyntheticsAPI.md +28 -156
  72. data/docs/v1/SyntheticsAPIStep.md +4 -0
  73. data/docs/v1/SyntheticsBrowserTestConfig.md +2 -0
  74. data/docs/v1/SyntheticsTestConfig.md +1 -1
  75. data/docs/v1/SyntheticsTestOptions.md +1 -1
  76. data/docs/v1/SyntheticsTestRequest.md +6 -0
  77. data/docs/v1/UsageAttributionSupportedMetrics.md +15 -0
  78. data/docs/v1/UsageAttributionValues.md +8 -0
  79. data/docs/v1/UsageHostHour.md +3 -1
  80. data/docs/v1/UsageIoTHour.md +1 -1
  81. data/docs/v1/UsageLogsByRetentionHour.md +24 -0
  82. data/docs/v1/UsageLogsByRetentionResponse.md +18 -0
  83. data/docs/v1/UsageMeteringAPI.md +69 -2
  84. data/docs/v1/UsageSummaryDate.md +11 -9
  85. data/docs/v1/UsageSummaryDateOrg.md +3 -1
  86. data/docs/v1/UsageSummaryResponse.md +5 -1
  87. data/docs/v1/WidgetHorizontalAlign.md +15 -0
  88. data/docs/v1/WidgetLayout.md +2 -0
  89. data/docs/v1/WidgetMarker.md +1 -1
  90. data/docs/v1/WidgetVerticalAlign.md +15 -0
  91. data/docs/v2/IncidentServiceUpdateData.md +1 -1
  92. data/docs/v2/IncidentServicesAPI.md +1 -1
  93. data/docs/v2/IncidentTeamUpdateData.md +1 -1
  94. data/docs/v2/IncidentTeamsAPI.md +1 -1
  95. data/docs/v2/MetricsAPI.md +1 -11
  96. data/extract-code-blocks.sh +6 -2
  97. data/lib/datadog_api_client/v1.rb +54 -0
  98. data/lib/datadog_api_client/v1/api/dashboards_api.rb +3 -0
  99. data/lib/datadog_api_client/v1/api/events_api.rb +14 -4
  100. data/lib/datadog_api_client/v1/api/monitors_api.rb +2 -2
  101. data/lib/datadog_api_client/v1/api/notebooks_api.rb +418 -0
  102. data/lib/datadog_api_client/v1/api/service_level_objectives_api.rb +3 -0
  103. data/lib/datadog_api_client/v1/api/synthetics_api.rb +14 -170
  104. data/lib/datadog_api_client/v1/api/usage_metering_api.rb +79 -2
  105. data/lib/datadog_api_client/v1/models/distribution_widget_definition.rb +36 -6
  106. data/lib/datadog_api_client/v1/models/distribution_widget_x_axis.rb +259 -0
  107. data/lib/datadog_api_client/v1/models/distribution_widget_y_axis.rb +269 -0
  108. data/lib/datadog_api_client/v1/models/group_widget_definition.rb +42 -1
  109. data/lib/datadog_api_client/v1/models/image_widget_definition.rb +56 -4
  110. data/lib/datadog_api_client/v1/models/logs_by_retention.rb +243 -0
  111. data/lib/datadog_api_client/v1/models/logs_by_retention_monthly_usage.rb +235 -0
  112. data/lib/datadog_api_client/v1/models/logs_by_retention_org_usage.rb +225 -0
  113. data/lib/datadog_api_client/v1/models/logs_by_retention_orgs.rb +225 -0
  114. data/lib/datadog_api_client/v1/models/logs_retention_agg_sum_usage.rb +253 -0
  115. data/lib/datadog_api_client/v1/models/logs_retention_sum_usage.rb +253 -0
  116. data/lib/datadog_api_client/v1/models/note_widget_definition.rb +25 -4
  117. data/lib/datadog_api_client/v1/models/notebook_absolute_time.rb +253 -0
  118. data/lib/datadog_api_client/v1/models/notebook_author.rb +303 -0
  119. data/lib/datadog_api_client/v1/models/notebook_cell_create_request.rb +243 -0
  120. data/lib/datadog_api_client/v1/models/notebook_cell_create_request_attributes.rb +113 -0
  121. data/lib/datadog_api_client/v1/models/notebook_cell_resource_type.rb +39 -0
  122. data/lib/datadog_api_client/v1/models/notebook_cell_response.rb +258 -0
  123. data/lib/datadog_api_client/v1/models/notebook_cell_response_attributes.rb +113 -0
  124. data/lib/datadog_api_client/v1/models/notebook_cell_time.rb +109 -0
  125. data/lib/datadog_api_client/v1/models/notebook_cell_update_request.rb +258 -0
  126. data/lib/datadog_api_client/v1/models/notebook_cell_update_request_attributes.rb +113 -0
  127. data/lib/datadog_api_client/v1/models/notebook_create_data.rb +243 -0
  128. data/lib/datadog_api_client/v1/models/notebook_create_data_attributes.rb +298 -0
  129. data/lib/datadog_api_client/v1/models/notebook_create_request.rb +227 -0
  130. data/lib/datadog_api_client/v1/models/notebook_distribution_cell_attributes.rb +255 -0
  131. data/lib/datadog_api_client/v1/models/notebook_global_time.rb +109 -0
  132. data/lib/datadog_api_client/v1/models/notebook_graph_size.rb +43 -0
  133. data/lib/datadog_api_client/v1/models/notebook_heat_map_cell_attributes.rb +255 -0
  134. data/lib/datadog_api_client/v1/models/notebook_log_stream_cell_attributes.rb +246 -0
  135. data/lib/datadog_api_client/v1/models/notebook_markdown_cell_attributes.rb +227 -0
  136. data/lib/datadog_api_client/v1/models/notebook_markdown_cell_definition.rb +244 -0
  137. data/lib/datadog_api_client/v1/models/notebook_markdown_cell_definition_type.rb +39 -0
  138. data/lib/datadog_api_client/v1/models/notebook_relative_time.rb +227 -0
  139. data/lib/datadog_api_client/v1/models/notebook_resource_type.rb +39 -0
  140. data/lib/datadog_api_client/v1/models/notebook_response.rb +222 -0
  141. data/lib/datadog_api_client/v1/models/notebook_response_data.rb +258 -0
  142. data/lib/datadog_api_client/v1/models/notebook_response_data_attributes.rb +327 -0
  143. data/lib/datadog_api_client/v1/models/notebook_split_by.rb +247 -0
  144. data/lib/datadog_api_client/v1/models/notebook_status.rb +39 -0
  145. data/lib/datadog_api_client/v1/models/notebook_timeseries_cell_attributes.rb +255 -0
  146. data/lib/datadog_api_client/v1/models/notebook_toplist_cell_attributes.rb +255 -0
  147. data/lib/datadog_api_client/v1/models/notebook_update_cell.rb +109 -0
  148. data/lib/datadog_api_client/v1/models/notebook_update_data.rb +243 -0
  149. data/lib/datadog_api_client/v1/models/notebook_update_data_attributes.rb +298 -0
  150. data/lib/datadog_api_client/v1/models/notebook_update_request.rb +227 -0
  151. data/lib/datadog_api_client/v1/models/notebooks_response.rb +234 -0
  152. data/lib/datadog_api_client/v1/models/notebooks_response_meta.rb +222 -0
  153. data/lib/datadog_api_client/v1/models/notebooks_response_page.rb +233 -0
  154. data/lib/datadog_api_client/v1/models/slo_list_response.rb +13 -4
  155. data/lib/datadog_api_client/v1/models/slo_list_response_metadata.rb +222 -0
  156. data/lib/datadog_api_client/v1/models/slo_list_response_metadata_page.rb +233 -0
  157. data/lib/datadog_api_client/v1/models/slo_response.rb +1 -1
  158. data/lib/datadog_api_client/v1/models/slo_response_data.rb +363 -0
  159. data/lib/datadog_api_client/v1/models/synthetics_api_step.rb +21 -1
  160. data/lib/datadog_api_client/v1/models/synthetics_assertion_type.rb +4 -0
  161. data/lib/datadog_api_client/v1/models/synthetics_browser_test_config.rb +11 -1
  162. data/lib/datadog_api_client/v1/models/synthetics_test_config.rb +0 -5
  163. data/lib/datadog_api_client/v1/models/synthetics_test_details_sub_type.rb +1 -0
  164. data/lib/datadog_api_client/v1/models/synthetics_test_options.rb +1 -1
  165. data/lib/datadog_api_client/v1/models/synthetics_test_request.rb +79 -1
  166. data/lib/datadog_api_client/v1/models/synthetics_tick_interval.rb +1 -0
  167. data/lib/datadog_api_client/v1/models/usage_attribution_supported_metrics.rb +67 -0
  168. data/lib/datadog_api_client/v1/models/usage_attribution_values.rb +41 -1
  169. data/lib/datadog_api_client/v1/models/usage_host_hour.rb +14 -4
  170. data/lib/datadog_api_client/v1/models/usage_io_t_hour.rb +1 -1
  171. data/lib/datadog_api_client/v1/models/usage_logs_by_retention_hour.rb +253 -0
  172. data/lib/datadog_api_client/v1/models/usage_logs_by_retention_response.rb +225 -0
  173. data/lib/datadog_api_client/v1/models/usage_summary_date.rb +38 -28
  174. data/lib/datadog_api_client/v1/models/usage_summary_date_org.rb +14 -4
  175. data/lib/datadog_api_client/v1/models/usage_summary_response.rb +23 -4
  176. data/lib/datadog_api_client/v1/models/widget.rb +1 -1
  177. data/lib/datadog_api_client/v1/models/widget_horizontal_align.rb +41 -0
  178. data/lib/datadog_api_client/v1/models/widget_image_sizing.rb +5 -0
  179. data/lib/datadog_api_client/v1/models/widget_layout.rb +12 -2
  180. data/lib/datadog_api_client/v1/models/widget_margin.rb +3 -0
  181. data/lib/datadog_api_client/v1/models/widget_marker.rb +1 -1
  182. data/lib/datadog_api_client/v1/models/widget_vertical_align.rb +41 -0
  183. data/lib/datadog_api_client/v2/api/metrics_api.rb +2 -2
  184. data/lib/datadog_api_client/v2/configuration.rb +0 -2
  185. data/lib/datadog_api_client/v2/models/incident_service_update_data.rb +0 -5
  186. data/lib/datadog_api_client/v2/models/incident_team_update_data.rb +0 -5
  187. data/lib/datadog_api_client/v2/models/metric_tag_configuration_metric_types.rb +1 -0
  188. data/lib/datadog_api_client/v2/models/security_monitoring_rule_detection_method.rb +1 -0
  189. data/lib/datadog_api_client/version.rb +1 -1
  190. data/run-tests.sh +0 -6
  191. data/spec/v1/api/notebooks_api_spec.rb +106 -0
  192. data/spec/v1/models/distribution_widget_x_axis_spec.rb +55 -0
  193. data/spec/v1/models/distribution_widget_y_axis_spec.rb +61 -0
  194. data/spec/v1/models/logs_by_retention_monthly_usage_spec.rb +43 -0
  195. data/spec/v1/models/logs_by_retention_org_usage_spec.rb +37 -0
  196. data/spec/v1/models/logs_by_retention_orgs_spec.rb +37 -0
  197. data/spec/v1/models/logs_by_retention_spec.rb +49 -0
  198. data/spec/v1/models/logs_retention_agg_sum_usage_spec.rb +55 -0
  199. data/spec/v1/models/logs_retention_sum_usage_spec.rb +55 -0
  200. data/spec/v1/models/notebook_absolute_time_spec.rb +49 -0
  201. data/spec/v1/models/notebook_author_spec.rb +85 -0
  202. data/spec/v1/models/notebook_cell_create_request_attributes_spec.rb +34 -0
  203. data/spec/v1/models/notebook_cell_create_request_spec.rb +43 -0
  204. data/spec/v1/models/notebook_cell_resource_type_spec.rb +31 -0
  205. data/spec/v1/models/notebook_cell_response_attributes_spec.rb +34 -0
  206. data/spec/v1/models/notebook_cell_response_spec.rb +49 -0
  207. data/spec/v1/models/notebook_cell_time_spec.rb +34 -0
  208. data/spec/v1/models/notebook_cell_update_request_attributes_spec.rb +34 -0
  209. data/spec/v1/models/notebook_cell_update_request_spec.rb +49 -0
  210. data/spec/v1/models/notebook_create_data_attributes_spec.rb +55 -0
  211. data/spec/v1/models/notebook_create_data_spec.rb +43 -0
  212. data/spec/v1/models/notebook_create_request_spec.rb +37 -0
  213. data/spec/v1/models/notebook_distribution_cell_attributes_spec.rb +55 -0
  214. data/spec/v1/models/notebook_global_time_spec.rb +34 -0
  215. data/spec/v1/models/notebook_graph_size_spec.rb +31 -0
  216. data/spec/v1/models/notebook_heat_map_cell_attributes_spec.rb +55 -0
  217. data/spec/v1/models/notebook_log_stream_cell_attributes_spec.rb +49 -0
  218. data/spec/v1/models/notebook_markdown_cell_attributes_spec.rb +37 -0
  219. data/spec/v1/models/notebook_markdown_cell_definition_spec.rb +43 -0
  220. data/spec/v1/models/notebook_markdown_cell_definition_type_spec.rb +31 -0
  221. data/spec/v1/models/notebook_relative_time_spec.rb +37 -0
  222. data/spec/v1/models/notebook_resource_type_spec.rb +31 -0
  223. data/spec/v1/models/notebook_response_data_attributes_spec.rb +73 -0
  224. data/spec/v1/models/notebook_response_data_spec.rb +49 -0
  225. data/spec/v1/models/notebook_response_spec.rb +37 -0
  226. data/spec/v1/models/notebook_split_by_spec.rb +43 -0
  227. data/spec/v1/models/notebook_status_spec.rb +31 -0
  228. data/spec/v1/models/notebook_timeseries_cell_attributes_spec.rb +55 -0
  229. data/spec/v1/models/notebook_toplist_cell_attributes_spec.rb +55 -0
  230. data/spec/v1/models/notebook_update_cell_spec.rb +34 -0
  231. data/spec/v1/models/notebook_update_data_attributes_spec.rb +55 -0
  232. data/spec/v1/models/notebook_update_data_spec.rb +43 -0
  233. data/spec/v1/models/notebook_update_request_spec.rb +37 -0
  234. data/spec/v1/models/notebooks_response_meta_spec.rb +37 -0
  235. data/spec/v1/models/notebooks_response_page_spec.rb +43 -0
  236. data/spec/v1/models/notebooks_response_spec.rb +43 -0
  237. data/spec/v1/models/slo_list_response_metadata_page_spec.rb +43 -0
  238. data/spec/v1/models/slo_list_response_metadata_spec.rb +37 -0
  239. data/spec/v1/models/slo_response_data_spec.rb +115 -0
  240. data/spec/v1/models/usage_attribution_supported_metrics_spec.rb +31 -0
  241. data/spec/v1/models/usage_logs_by_retention_hour_spec.rb +55 -0
  242. data/spec/v1/models/usage_logs_by_retention_response_spec.rb +37 -0
  243. data/spec/v1/models/widget_horizontal_align_spec.rb +31 -0
  244. data/spec/v1/models/widget_vertical_align_spec.rb +31 -0
  245. metadata +220 -4
@@ -0,0 +1,255 @@
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 attributes of a notebook toplist cell.
21
+ class NotebookToplistCellAttributes
22
+ attr_accessor :definition
23
+
24
+ attr_accessor :graph_size
25
+
26
+ attr_accessor :split_by
27
+
28
+ attr_accessor :time
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'definition' => :'definition',
34
+ :'graph_size' => :'graph_size',
35
+ :'split_by' => :'split_by',
36
+ :'time' => :'time'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'definition' => :'ToplistWidgetDefinition',
49
+ :'graph_size' => :'NotebookGraphSize',
50
+ :'split_by' => :'NotebookSplitBy',
51
+ :'time' => :'NotebookCellTime'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ :'time'
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::NotebookToplistCellAttributes` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::NotebookToplistCellAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'definition')
78
+ self.definition = attributes[:'definition']
79
+ end
80
+
81
+ if attributes.key?(:'graph_size')
82
+ self.graph_size = attributes[:'graph_size']
83
+ end
84
+
85
+ if attributes.key?(:'split_by')
86
+ self.split_by = attributes[:'split_by']
87
+ end
88
+
89
+ if attributes.key?(:'time')
90
+ self.time = attributes[:'time']
91
+ end
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ invalid_properties = Array.new
98
+ if @definition.nil?
99
+ invalid_properties.push('invalid value for "definition", definition cannot be nil.')
100
+ end
101
+
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ return false if @definition.nil?
109
+ true
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ definition == o.definition &&
118
+ graph_size == o.graph_size &&
119
+ split_by == o.split_by &&
120
+ time == o.time
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [definition, graph_size, split_by, time].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ new.build_from_hash(attributes)
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ self.class.openapi_types.each_pair do |key, type|
148
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
149
+ self.send("#{key}=", nil)
150
+ elsif type =~ /\AArray<(.*)>/i
151
+ # check to ensure the input is an array given that the attribute
152
+ # is documented as an array but the input is not
153
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
154
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
155
+ end
156
+ elsif !attributes[self.class.attribute_map[key]].nil?
157
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
158
+ end
159
+ end
160
+
161
+ self
162
+ end
163
+
164
+ # Deserializes the data based on type
165
+ # @param string type Data type
166
+ # @param string value Value to be deserialized
167
+ # @return [Object] Deserialized data
168
+ def _deserialize(type, value)
169
+ case type.to_sym
170
+ when :Time
171
+ Time.parse(value)
172
+ when :Date
173
+ Date.parse(value)
174
+ when :String
175
+ value.to_s
176
+ when :Integer
177
+ value.to_i
178
+ when :Float
179
+ value.to_f
180
+ when :Boolean
181
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
182
+ true
183
+ else
184
+ false
185
+ end
186
+ when :Object
187
+ # generic object (usually a Hash), return directly
188
+ value
189
+ when /\AArray<(?<inner_type>.+)>\z/
190
+ inner_type = Regexp.last_match[:inner_type]
191
+ value.map { |v| _deserialize(inner_type, v) }
192
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
193
+ k_type = Regexp.last_match[:k_type]
194
+ v_type = Regexp.last_match[:v_type]
195
+ {}.tap do |hash|
196
+ value.each do |k, v|
197
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
+ end
199
+ end
200
+ else # model
201
+ # models (e.g. Pet) or oneOf
202
+ klass = DatadogAPIClient::V1.const_get(type)
203
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ if value.nil?
226
+ is_nullable = self.class.openapi_nullable.include?(attr)
227
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
228
+ end
229
+
230
+ hash[param] = _to_hash(value)
231
+ end
232
+ hash
233
+ end
234
+
235
+ # Outputs non-array value in the form of hash
236
+ # For object, use to_hash. Otherwise, just return the value
237
+ # @param [Object] value Any valid value
238
+ # @return [Hash] Returns the value in the form of hash
239
+ def _to_hash(value)
240
+ if value.is_a?(Array)
241
+ value.compact.map { |v| _to_hash(v) }
242
+ elsif value.is_a?(Hash)
243
+ {}.tap do |hash|
244
+ value.each { |k, v| hash[k] = _to_hash(v) }
245
+ end
246
+ elsif value.respond_to? :to_hash
247
+ value.to_hash
248
+ else
249
+ value
250
+ end
251
+ end
252
+
253
+ end
254
+
255
+ end
@@ -0,0 +1,109 @@
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
+ # Updating a notebook can either insert new cell(s) or update existing cell(s) by including the cell `id`. To delete existing cell(s), simply omit it from the list of cells.
21
+ module NotebookUpdateCell
22
+ class << self
23
+ # List of class defined in oneOf (OpenAPI v3)
24
+ def openapi_one_of
25
+ [
26
+ :'NotebookCellCreateRequest',
27
+ :'NotebookCellUpdateRequest'
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 defacto behaving as if they were nullable.
41
+ # - TODO: logging when debugging is set.
42
+ openapi_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
+ openapi_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 = DatadogAPIClient::V1.const_get(klass)
89
+ if const
90
+ if const.respond_to?(:openapi_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,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 data for a notebook update request.
21
+ class NotebookUpdateData
22
+ attr_accessor :attributes
23
+
24
+ attr_accessor :type
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'attributes' => :'attributes',
30
+ :'type' => :'type'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'attributes' => :'NotebookUpdateDataAttributes',
43
+ :'type' => :'NotebookResourceType'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::NotebookUpdateData` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::NotebookUpdateData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'attributes')
69
+ self.attributes = attributes[:'attributes']
70
+ end
71
+
72
+ if attributes.key?(:'type')
73
+ self.type = attributes[:'type']
74
+ else
75
+ self.type = 'notebooks'
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ if @attributes.nil?
84
+ invalid_properties.push('invalid value for "attributes", attributes cannot be nil.')
85
+ end
86
+
87
+ if @type.nil?
88
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if @attributes.nil?
98
+ return false if @type.nil?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ attributes == o.attributes &&
108
+ type == o.type
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
+ [attributes, type].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