datadog_api_client 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.apigentools-info +4 -4
  3. data/.generator/poetry.lock +21 -14
  4. data/.generator/pyproject.toml +1 -1
  5. data/.generator/schemas/v1/openapi.yaml +558 -8
  6. data/.generator/schemas/v2/openapi.yaml +973 -253
  7. data/.generator/src/generator/templates/api_client.j2 +5 -1
  8. data/.generator/src/generator/templates/configuration.j2 +17 -0
  9. data/.github/workflows/test.yml +3 -0
  10. data/.pre-commit-config.yaml +1 -1
  11. data/CHANGELOG.md +26 -0
  12. data/README.md +11 -0
  13. data/examples/v1/dashboards/CreateDashboard_1423904722.rb +38 -0
  14. data/examples/v1/dashboards/CreateDashboard_2652180930.rb +43 -0
  15. data/examples/v1/dashboards/CreateDashboard_2850365602.rb +55 -0
  16. data/examples/v1/dashboards/CreateDashboard_3117424216.rb +33 -0
  17. data/examples/v1/dashboards/CreateDashboard_3669695268.rb +50 -0
  18. data/examples/v1/dashboards/CreateDashboard_858397694.rb +41 -0
  19. data/examples/v1/synthetics/CreateGlobalVariable_1068962881.rb +1 -1
  20. data/examples/v2/incidents/ListIncidentAttachments.rb +8 -0
  21. data/examples/v2/incidents/ListIncidentAttachments_2457735435.rb +11 -0
  22. data/examples/v2/incidents/UpdateIncidentAttachments.rb +38 -0
  23. data/examples/v2/incidents/UpdateIncidentAttachments_3881702075.rb +26 -0
  24. data/examples/v2/metrics/ListActiveMetricConfigurations.rb +5 -0
  25. data/examples/v2/metrics/ListTagConfigurations.rb +1 -1
  26. data/examples/v2/metrics/ListTagConfigurations_265033704.rb +8 -0
  27. data/examples/v2/metrics/{ListTagConfigurations_103226315.rb → ListTagConfigurations_2739018321.rb} +1 -1
  28. data/examples/v2/security-monitoring/CreateSecurityMonitoringRule.rb +3 -2
  29. data/examples/v2/security-monitoring/CreateSecurityMonitoringRule_461183901.rb +2 -2
  30. data/examples/v2/security-monitoring/CreateSecurityMonitoringRule_498211763.rb +2 -2
  31. data/examples/v2/security-monitoring/CreateSecurityMonitoringRule_914562040.rb +50 -0
  32. data/examples/v2/security-monitoring/GetSecurityMonitoringSignal.rb +5 -0
  33. data/examples/v2/security-monitoring/UpdateSecurityMonitoringRule.rb +2 -1
  34. data/examples/v2/usage-metering/GetEstimatedCostByOrg.rb +1 -4
  35. data/examples/v2/usage-metering/GetEstimatedCostByOrg_2734954020.rb +2 -4
  36. data/examples/v2/usage-metering/GetEstimatedCostByOrg_3186693804.rb +2 -4
  37. data/examples/v2/usage-metering/GetHistoricalCostByOrg.rb +8 -0
  38. data/generate.sh +30 -0
  39. data/lib/datadog_api_client/api_client.rb +5 -1
  40. data/lib/datadog_api_client/configuration.rb +20 -1
  41. data/lib/datadog_api_client/inflector.rb +51 -1
  42. data/lib/datadog_api_client/v1/api/service_level_objectives_api.rb +3 -1
  43. data/lib/datadog_api_client/v1/api/usage_metering_api.rb +5 -5
  44. data/lib/datadog_api_client/v1/models/dashboard_template_variable.rb +14 -2
  45. data/lib/datadog_api_client/v1/models/dashboard_template_variable_preset_value.rb +28 -5
  46. data/lib/datadog_api_client/v1/models/formula_and_function_event_query_definition.rb +14 -4
  47. data/lib/datadog_api_client/v1/models/hourly_usage_attribution_usage_type.rb +1 -0
  48. data/lib/datadog_api_client/v1/models/list_stream_query.rb +14 -4
  49. data/lib/datadog_api_client/v1/models/monthly_usage_attribution_supported_metrics.rb +2 -0
  50. data/lib/datadog_api_client/v1/models/monthly_usage_attribution_values.rb +21 -1
  51. data/lib/datadog_api_client/v1/models/search_service_level_objective.rb +111 -0
  52. data/lib/datadog_api_client/v1/models/search_service_level_objective_attributes.rb +286 -0
  53. data/lib/datadog_api_client/v1/models/search_service_level_objective_data.rb +134 -0
  54. data/lib/datadog_api_client/v1/models/search_slo_query.rb +137 -0
  55. data/lib/datadog_api_client/v1/models/search_slo_response_data_attributes.rb +8 -8
  56. data/lib/datadog_api_client/v1/models/search_slo_response_links.rb +2 -0
  57. data/lib/datadog_api_client/v1/models/search_slo_threshold.rb +184 -0
  58. data/lib/datadog_api_client/v1/models/search_slo_timeframe.rb +28 -0
  59. data/lib/datadog_api_client/v1/models/slo_creator.rb +131 -0
  60. data/lib/datadog_api_client/v1/models/slo_list_widget_definition.rb +185 -0
  61. data/lib/datadog_api_client/v1/models/slo_list_widget_definition_type.rb +26 -0
  62. data/lib/datadog_api_client/v1/models/slo_list_widget_query.rb +149 -0
  63. data/lib/datadog_api_client/v1/models/slo_list_widget_request.rb +143 -0
  64. data/lib/datadog_api_client/v1/models/slo_list_widget_request_type.rb +26 -0
  65. data/lib/datadog_api_client/v1/models/slo_overall_statuses.rb +174 -0
  66. data/lib/datadog_api_client/v1/models/slo_raw_error_budget_remaining.rb +121 -0
  67. data/lib/datadog_api_client/v1/models/synthetics_assertion_operator.rb +1 -0
  68. data/lib/datadog_api_client/v1/models/topology_map_widget_definition.rb +193 -0
  69. data/lib/datadog_api_client/v1/models/topology_map_widget_definition_type.rb +26 -0
  70. data/lib/datadog_api_client/v1/models/topology_query.rb +144 -0
  71. data/lib/datadog_api_client/v1/models/topology_query_data_source.rb +27 -0
  72. data/lib/datadog_api_client/v1/models/topology_request.rb +121 -0
  73. data/lib/datadog_api_client/v1/models/topology_request_type.rb +26 -0
  74. data/lib/datadog_api_client/v1/models/usage_attribution_sort.rb +2 -0
  75. data/lib/datadog_api_client/v1/models/usage_attribution_supported_metrics.rb +2 -0
  76. data/lib/datadog_api_client/v1/models/usage_attribution_values.rb +21 -1
  77. data/lib/datadog_api_client/v1/models/usage_fargate_hour.rb +11 -1
  78. data/lib/datadog_api_client/v1/models/usage_summary_date.rb +11 -1
  79. data/lib/datadog_api_client/v1/models/usage_summary_date_org.rb +11 -1
  80. data/lib/datadog_api_client/v1/models/usage_summary_response.rb +11 -1
  81. data/lib/datadog_api_client/v1/models/widget_definition.rb +3 -1
  82. data/lib/datadog_api_client/v2/api/incident_services_api.rb +2 -2
  83. data/lib/datadog_api_client/v2/api/incident_teams_api.rb +2 -2
  84. data/lib/datadog_api_client/v2/api/incidents_api.rb +155 -0
  85. data/lib/datadog_api_client/v2/api/metrics_api.rb +76 -8
  86. data/lib/datadog_api_client/v2/api/security_monitoring_api.rb +65 -0
  87. data/lib/datadog_api_client/v2/api/usage_metering_api.rb +83 -17
  88. data/lib/datadog_api_client/v2/models/incident_attachment_attachment_type.rb +27 -0
  89. data/lib/datadog_api_client/v2/models/incident_attachment_attributes.rb +63 -0
  90. data/lib/datadog_api_client/v2/models/incident_attachment_data.rb +187 -0
  91. data/lib/datadog_api_client/v2/models/incident_attachment_link_attachment_type.rb +26 -0
  92. data/lib/datadog_api_client/v2/models/incident_attachment_link_attributes.rb +145 -0
  93. data/lib/datadog_api_client/v2/models/incident_attachment_link_attributes_attachment_object.rb +143 -0
  94. data/lib/datadog_api_client/v2/models/incident_attachment_postmortem_attachment_type.rb +26 -0
  95. data/lib/datadog_api_client/v2/models/incident_attachment_postmortem_attributes.rb +145 -0
  96. data/lib/datadog_api_client/v2/models/incident_attachment_related_object.rb +26 -0
  97. data/lib/datadog_api_client/v2/models/incident_attachment_relationships.rb +111 -0
  98. data/lib/datadog_api_client/v2/models/incident_attachment_type.rb +26 -0
  99. data/lib/datadog_api_client/v2/models/incident_attachment_update_attributes.rb +63 -0
  100. data/lib/datadog_api_client/v2/models/incident_attachment_update_data.rb +144 -0
  101. data/lib/datadog_api_client/v2/models/incident_attachment_update_request.rb +127 -0
  102. data/lib/datadog_api_client/v2/models/incident_attachment_update_response.rb +137 -0
  103. data/lib/datadog_api_client/v2/models/incident_attachments_postmortem_attributes_attachment_object.rb +143 -0
  104. data/lib/datadog_api_client/v2/models/incident_attachments_response.rb +136 -0
  105. data/lib/datadog_api_client/v2/models/incident_attachments_response_included_item.rb +62 -0
  106. data/lib/datadog_api_client/v2/models/incident_related_object.rb +1 -0
  107. data/lib/datadog_api_client/v2/models/incident_response_attributes.rb +1 -11
  108. data/lib/datadog_api_client/v2/models/incident_response_included_item.rb +2 -1
  109. data/lib/datadog_api_client/v2/models/incident_response_relationships.rb +14 -14
  110. data/lib/datadog_api_client/v2/models/metric_active_configuration_type.rb +26 -0
  111. data/lib/datadog_api_client/v2/models/metric_suggested_tags_and_aggregations.rb +133 -0
  112. data/lib/datadog_api_client/v2/models/metric_suggested_tags_and_aggregations_response.rb +111 -0
  113. data/lib/datadog_api_client/v2/models/metric_suggested_tags_attributes.rb +125 -0
  114. data/lib/datadog_api_client/v2/models/relationship_to_incident_attachment.rb +124 -0
  115. data/lib/datadog_api_client/v2/models/relationship_to_incident_attachment_data.rb +145 -0
  116. data/lib/datadog_api_client/v2/models/security_monitoring_rule_create_payload.rb +36 -248
  117. data/lib/datadog_api_client/v2/models/security_monitoring_rule_query.rb +36 -151
  118. data/lib/datadog_api_client/v2/models/security_monitoring_rule_query_aggregation.rb +1 -0
  119. data/lib/datadog_api_client/v2/models/security_monitoring_rule_response.rb +37 -253
  120. data/lib/datadog_api_client/v2/models/security_monitoring_signal_rule_create_payload.rb +275 -0
  121. data/lib/datadog_api_client/v2/models/security_monitoring_signal_rule_query.rb +187 -0
  122. data/lib/datadog_api_client/v2/models/security_monitoring_signal_rule_response.rb +279 -0
  123. data/lib/datadog_api_client/v2/models/security_monitoring_signal_rule_type.rb +26 -0
  124. data/lib/datadog_api_client/v2/models/security_monitoring_standard_rule_create_payload.rb +275 -0
  125. data/lib/datadog_api_client/v2/models/{security_monitoring_rule_query_create.rb → security_monitoring_standard_rule_query.rb} +3 -3
  126. data/lib/datadog_api_client/v2/models/security_monitoring_standard_rule_response.rb +279 -0
  127. data/lib/datadog_api_client/version.rb +1 -1
  128. metadata +70 -6
  129. data/Makefile +0 -7
  130. data/examples/v2/metrics/ListTagConfigurations_1799362914.rb +0 -8
@@ -639,6 +639,71 @@ module DatadogAPIClient::V2
639
639
  return data, status_code, headers
640
640
  end
641
641
 
642
+ # Get a signal's details.
643
+ #
644
+ # @see #get_security_monitoring_signal_with_http_info
645
+ def get_security_monitoring_signal(signal_id, opts = {})
646
+ data, _status_code, _headers = get_security_monitoring_signal_with_http_info(signal_id, opts)
647
+ data
648
+ end
649
+
650
+ # Get a signal's details.
651
+ #
652
+ # Get a signal's details.
653
+ #
654
+ # @param signal_id [String] The ID of the signal.
655
+ # @param opts [Hash] the optional parameters
656
+ # @return [Array<(SecurityMonitoringSignal, Integer, Hash)>] SecurityMonitoringSignal data, response status code and response headers
657
+ def get_security_monitoring_signal_with_http_info(signal_id, opts = {})
658
+
659
+ if @api_client.config.debugging
660
+ @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.get_security_monitoring_signal ...'
661
+ end
662
+ # verify the required parameter 'signal_id' is set
663
+ if @api_client.config.client_side_validation && signal_id.nil?
664
+ fail ArgumentError, "Missing the required parameter 'signal_id' when calling SecurityMonitoringAPI.get_security_monitoring_signal"
665
+ end
666
+ # resource path
667
+ local_var_path = '/api/v2/security_monitoring/signals/{signal_id}'.sub('{signal_id}', CGI.escape(signal_id.to_s).gsub('%2F', '/'))
668
+
669
+ # query parameters
670
+ query_params = opts[:query_params] || {}
671
+
672
+ # header parameters
673
+ header_params = opts[:header_params] || {}
674
+ # HTTP header 'Accept' (if needed)
675
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
676
+
677
+ # form parameters
678
+ form_params = opts[:form_params] || {}
679
+
680
+ # http body (model)
681
+ post_body = opts[:debug_body]
682
+
683
+ # return_type
684
+ return_type = opts[:debug_return_type] || 'SecurityMonitoringSignal'
685
+
686
+ # auth_names
687
+ auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]
688
+
689
+ new_options = opts.merge(
690
+ :operation => :get_security_monitoring_signal,
691
+ :header_params => header_params,
692
+ :query_params => query_params,
693
+ :form_params => form_params,
694
+ :body => post_body,
695
+ :auth_names => auth_names,
696
+ :return_type => return_type,
697
+ :api_version => "V2"
698
+ )
699
+
700
+ data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
701
+ if @api_client.config.debugging
702
+ @api_client.config.logger.debug "API called: SecurityMonitoringAPI#get_security_monitoring_signal\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
703
+ end
704
+ return data, status_code, headers
705
+ end
706
+
642
707
  # Get all security filters.
643
708
  #
644
709
  # @see #list_security_filters_with_http_info
@@ -33,7 +33,11 @@ module DatadogAPIClient::V2
33
33
 
34
34
  # Get cost across multi-org account.
35
35
  #
36
- # Get cost across multi-org account. Cost by org data for a given month becomes available no later than the 16th of the following month.
36
+ # Get cost across multi-org account.
37
+ # Cost by org data for a given month becomes available no later than the 16th of the following month.
38
+ # **Note:** This endpoint has been deprecated. Please use the new endpoint
39
+ # [`/historical_cost`](https://docs.datadoghq.com/api/latest/usage-metering/#get-historical-cost-across-your-account)
40
+ # instead.
37
41
  #
38
42
  # @param start_month [Time] Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost beginning this month.
39
43
  # @param opts [Hash] the optional parameters
@@ -94,44 +98,35 @@ module DatadogAPIClient::V2
94
98
  # Get estimated cost across your account.
95
99
  #
96
100
  # @see #get_estimated_cost_by_org_with_http_info
97
- def get_estimated_cost_by_org(view, opts = {})
98
- data, _status_code, _headers = get_estimated_cost_by_org_with_http_info(view, opts)
101
+ def get_estimated_cost_by_org(opts = {})
102
+ data, _status_code, _headers = get_estimated_cost_by_org_with_http_info(opts)
99
103
  data
100
104
  end
101
105
 
102
106
  # Get estimated cost across your account.
103
107
  #
104
108
  # Get estimated cost across multi-org and single root-org accounts.
105
- # Estimated cost data is only available for the current month and previous month. To access historical costs prior to this, use the /cost_by_org endpoint.
109
+ # Estimated cost data is only available for the current month and previous month.
110
+ # To access historical costs prior to this, use the `/historical_cost` endpoint.
106
111
  #
107
- # @param view [String] String to specify whether cost is broken down at a parent-org level or at the sub-org level. Currently, only the 'sub-org' view is supported.
108
112
  # @param opts [Hash] the optional parameters
113
+ # @option opts [String] :view String to specify whether cost is broken down at a parent-org level or at the sub-org level. Available views are `summary` and `sub-org`. Defaults to `summary`.
109
114
  # @option opts [Time] :start_month Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost beginning this month. Either start_month or start_date should be specified, but not both. (start_month cannot go beyond two months in the past)
110
115
  # @option opts [Time] :end_month Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost ending this month.
111
116
  # @option opts [Time] :start_date Datetime in ISO-8601 format, UTC, precise to day: `[YYYY-MM-DD]` for cost beginning this day. Either start_month or start_date should be specified, but not both. (start_date cannot go beyond two months in the past)
112
117
  # @option opts [Time] :end_date Datetime in ISO-8601 format, UTC, precise to day: `[YYYY-MM-DD]` for cost ending this day.
113
118
  # @return [Array<(CostByOrgResponse, Integer, Hash)>] CostByOrgResponse data, response status code and response headers
114
- def get_estimated_cost_by_org_with_http_info(view, opts = {})
115
- unstable_enabled = @api_client.config.unstable_operations["v2.get_estimated_cost_by_org".to_sym]
116
- if unstable_enabled
117
- @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_estimated_cost_by_org")
118
- else
119
- raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_estimated_cost_by_org"))
120
- end
119
+ def get_estimated_cost_by_org_with_http_info(opts = {})
121
120
 
122
121
  if @api_client.config.debugging
123
122
  @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_estimated_cost_by_org ...'
124
123
  end
125
- # verify the required parameter 'view' is set
126
- if @api_client.config.client_side_validation && view.nil?
127
- fail ArgumentError, "Missing the required parameter 'view' when calling UsageMeteringAPI.get_estimated_cost_by_org"
128
- end
129
124
  # resource path
130
125
  local_var_path = '/api/v2/usage/estimated_cost'
131
126
 
132
127
  # query parameters
133
128
  query_params = opts[:query_params] || {}
134
- query_params[:'view'] = view
129
+ query_params[:'view'] = opts[:'view'] if !opts[:'view'].nil?
135
130
  query_params[:'start_month'] = opts[:'start_month'] if !opts[:'start_month'].nil?
136
131
  query_params[:'end_month'] = opts[:'end_month'] if !opts[:'end_month'].nil?
137
132
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
@@ -172,6 +167,77 @@ module DatadogAPIClient::V2
172
167
  return data, status_code, headers
173
168
  end
174
169
 
170
+ # Get historical cost across your account.
171
+ #
172
+ # @see #get_historical_cost_by_org_with_http_info
173
+ def get_historical_cost_by_org(start_month, opts = {})
174
+ data, _status_code, _headers = get_historical_cost_by_org_with_http_info(start_month, opts)
175
+ data
176
+ end
177
+
178
+ # Get historical cost across your account.
179
+ #
180
+ # Get historical cost across multi-org and single root-org accounts.
181
+ # Cost data for a given month becomes available no later than the 16th of the following month.
182
+ #
183
+ # @param start_month [Time] Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost beginning this month.
184
+ # @param opts [Hash] the optional parameters
185
+ # @option opts [String] :view String to specify whether cost is broken down at a parent-org level or at the sub-org level. Available views are `summary` and `sub-org`. Defaults to `summary`.
186
+ # @option opts [Time] :end_month Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost ending this month.
187
+ # @return [Array<(CostByOrgResponse, Integer, Hash)>] CostByOrgResponse data, response status code and response headers
188
+ def get_historical_cost_by_org_with_http_info(start_month, opts = {})
189
+
190
+ if @api_client.config.debugging
191
+ @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_historical_cost_by_org ...'
192
+ end
193
+ # verify the required parameter 'start_month' is set
194
+ if @api_client.config.client_side_validation && start_month.nil?
195
+ fail ArgumentError, "Missing the required parameter 'start_month' when calling UsageMeteringAPI.get_historical_cost_by_org"
196
+ end
197
+ # resource path
198
+ local_var_path = '/api/v2/usage/historical_cost'
199
+
200
+ # query parameters
201
+ query_params = opts[:query_params] || {}
202
+ query_params[:'start_month'] = start_month
203
+ query_params[:'view'] = opts[:'view'] if !opts[:'view'].nil?
204
+ query_params[:'end_month'] = opts[:'end_month'] if !opts[:'end_month'].nil?
205
+
206
+ # header parameters
207
+ header_params = opts[:header_params] || {}
208
+ # HTTP header 'Accept' (if needed)
209
+ header_params['Accept'] = @api_client.select_header_accept(['application/json;datetime-format=rfc3339'])
210
+
211
+ # form parameters
212
+ form_params = opts[:form_params] || {}
213
+
214
+ # http body (model)
215
+ post_body = opts[:debug_body]
216
+
217
+ # return_type
218
+ return_type = opts[:debug_return_type] || 'CostByOrgResponse'
219
+
220
+ # auth_names
221
+ auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]
222
+
223
+ new_options = opts.merge(
224
+ :operation => :get_historical_cost_by_org,
225
+ :header_params => header_params,
226
+ :query_params => query_params,
227
+ :form_params => form_params,
228
+ :body => post_body,
229
+ :auth_names => auth_names,
230
+ :return_type => return_type,
231
+ :api_version => "V2"
232
+ )
233
+
234
+ data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
235
+ if @api_client.config.debugging
236
+ @api_client.config.logger.debug "API called: UsageMeteringAPI#get_historical_cost_by_org\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
237
+ end
238
+ return data, status_code, headers
239
+ end
240
+
175
241
  # Get hourly usage by product family.
176
242
  #
177
243
  # @see #get_hourly_usage_with_http_info
@@ -0,0 +1,27 @@
1
+ =begin
2
+ #Datadog API V2 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://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
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::V2
20
+ # The type of the incident attachment attributes.
21
+ class IncidentAttachmentAttachmentType
22
+ include BaseEnumModel
23
+
24
+ LINK = "link".freeze
25
+ POSTMORTEM = "postmortem".freeze
26
+ end
27
+ end
@@ -0,0 +1,63 @@
1
+ =begin
2
+ #Datadog API V2 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://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
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::V2
20
+ # The attributes object for an attachment.
21
+ module IncidentAttachmentAttributes
22
+ class << self
23
+ include BaseOneOfModel
24
+ include BaseOneOfModelNoDiscriminator
25
+
26
+ # List of class defined in oneOf (OpenAPI v3)
27
+ def openapi_one_of
28
+ [
29
+ :'IncidentAttachmentPostmortemAttributes',
30
+ :'IncidentAttachmentLinkAttributes'
31
+ ]
32
+ end
33
+ # Builds the object
34
+ # @param [Mixed] Data to be matched against the list of oneOf items
35
+ # @return [Object] Returns the model or the data itself
36
+ def build(data)
37
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
38
+ # Note:
39
+ # - We do not attempt to check whether exactly one item matches.
40
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
41
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
42
+ # - TODO: scalar values are de facto behaving as if they were nullable.
43
+ # - TODO: logging when debugging is set.
44
+ openapi_one_of.each do |klass|
45
+ begin
46
+ next if klass == :AnyType # "nullable: true"
47
+ typed_data = find_and_cast_into_type(klass, data)
48
+ next if typed_data._unparsed
49
+ return typed_data if typed_data
50
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
51
+ end
52
+ end
53
+
54
+ if openapi_one_of.include?(:AnyType)
55
+ data
56
+ else
57
+ self._unparsed = true
58
+ DatadogAPIClient::UnparsedObject.new(data)
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,187 @@
1
+ =begin
2
+ #Datadog API V2 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://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
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::V2
20
+ # A single incident attachment.
21
+ class IncidentAttachmentData
22
+ include BaseGenericModel
23
+
24
+ # Whether the object has unparsed attributes
25
+ # @!visibility private
26
+ attr_accessor :_unparsed
27
+
28
+ # The attributes object for an attachment.
29
+ attr_accessor :attributes
30
+
31
+ # A unique identifier that represents the incident attachment.
32
+ attr_accessor :id
33
+
34
+ # The incident attachment's relationships.
35
+ attr_accessor :relationships
36
+
37
+ # The incident attachment resource type.
38
+ attr_accessor :type
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ # @!visibility private
42
+ def self.attribute_map
43
+ {
44
+ :'attributes' => :'attributes',
45
+ :'id' => :'id',
46
+ :'relationships' => :'relationships',
47
+ :'type' => :'type'
48
+ }
49
+ end
50
+
51
+ # Returns all the JSON keys this model knows about
52
+ # @!visibility private
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ # @!visibility private
59
+ def self.openapi_types
60
+ {
61
+ :'attributes' => :'IncidentAttachmentAttributes',
62
+ :'id' => :'String',
63
+ :'relationships' => :'IncidentAttachmentRelationships',
64
+ :'type' => :'IncidentAttachmentType'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ # @!visibility private
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param attributes [Hash] Model attributes in the form of hash
77
+ # @!visibility private
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentData` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h|
85
+ if (!self.class.attribute_map.key?(k.to_sym))
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::IncidentAttachmentData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ end
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+ if attributes.key?(:'attributes')
92
+ self.attributes = attributes[:'attributes']
93
+ end
94
+
95
+ if attributes.key?(:'id')
96
+ self.id = attributes[:'id']
97
+ end
98
+
99
+ if attributes.key?(:'relationships')
100
+ self.relationships = attributes[:'relationships']
101
+ end
102
+
103
+ if attributes.key?(:'type')
104
+ self.type = attributes[:'type']
105
+ else
106
+ self.type = 'incident_attachments'
107
+ end
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ # @!visibility private
113
+ def valid?
114
+ return false if @attributes.nil?
115
+ return false if @id.nil?
116
+ return false if @relationships.nil?
117
+ return false if @type.nil?
118
+ true
119
+ end
120
+
121
+ # Custom attribute writer method with validation
122
+ # @param attributes [Object] Object to be assigned
123
+ # @!visibility private
124
+ def attributes=(attributes)
125
+ if attributes.nil?
126
+ fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.'
127
+ end
128
+ @attributes = attributes
129
+ end
130
+
131
+ # Custom attribute writer method with validation
132
+ # @param id [Object] Object to be assigned
133
+ # @!visibility private
134
+ def id=(id)
135
+ if id.nil?
136
+ fail ArgumentError, 'invalid value for "id", id cannot be nil.'
137
+ end
138
+ @id = id
139
+ end
140
+
141
+ # Custom attribute writer method with validation
142
+ # @param relationships [Object] Object to be assigned
143
+ # @!visibility private
144
+ def relationships=(relationships)
145
+ if relationships.nil?
146
+ fail ArgumentError, 'invalid value for "relationships", relationships cannot be nil.'
147
+ end
148
+ @relationships = relationships
149
+ end
150
+
151
+ # Custom attribute writer method with validation
152
+ # @param type [Object] Object to be assigned
153
+ # @!visibility private
154
+ def type=(type)
155
+ if type.nil?
156
+ fail ArgumentError, 'invalid value for "type", type cannot be nil.'
157
+ end
158
+ @type = type
159
+ end
160
+
161
+ # Checks equality by comparing each attribute.
162
+ # @param o [Object] Object to be compared
163
+ # @!visibility private
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ attributes == o.attributes &&
168
+ id == o.id &&
169
+ relationships == o.relationships &&
170
+ type == o.type
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param o [Object] Object to be compared
175
+ # @!visibility private
176
+ def eql?(o)
177
+ self == o
178
+ end
179
+
180
+ # Calculates hash code according to all attributes.
181
+ # @return [Integer] Hash code
182
+ # @!visibility private
183
+ def hash
184
+ [attributes, id, relationships, type].hash
185
+ end
186
+ end
187
+ end
@@ -0,0 +1,26 @@
1
+ =begin
2
+ #Datadog API V2 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://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
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::V2
20
+ # The type of link attachment attributes.
21
+ class IncidentAttachmentLinkAttachmentType
22
+ include BaseEnumModel
23
+
24
+ LINK = "link".freeze
25
+ end
26
+ end
@@ -0,0 +1,145 @@
1
+ =begin
2
+ #Datadog API V2 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://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
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::V2
20
+ # The attributes object for a link attachment.
21
+ class IncidentAttachmentLinkAttributes
22
+ include BaseGenericModel
23
+
24
+ # Whether the object has unparsed attributes
25
+ # @!visibility private
26
+ attr_accessor :_unparsed
27
+
28
+ # The link attachment.
29
+ attr_accessor :attachment
30
+
31
+ # The type of link attachment attributes.
32
+ attr_accessor :attachment_type
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ # @!visibility private
36
+ def self.attribute_map
37
+ {
38
+ :'attachment' => :'attachment',
39
+ :'attachment_type' => :'attachment_type'
40
+ }
41
+ end
42
+
43
+ # Returns all the JSON keys this model knows about
44
+ # @!visibility private
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ # @!visibility private
51
+ def self.openapi_types
52
+ {
53
+ :'attachment' => :'IncidentAttachmentLinkAttributesAttachmentObject',
54
+ :'attachment_type' => :'IncidentAttachmentLinkAttachmentType'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ # @!visibility private
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param attributes [Hash] Model attributes in the form of hash
67
+ # @!visibility private
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentLinkAttributes` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::IncidentAttachmentLinkAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'attachment')
82
+ self.attachment = attributes[:'attachment']
83
+ end
84
+
85
+ if attributes.key?(:'attachment_type')
86
+ self.attachment_type = attributes[:'attachment_type']
87
+ else
88
+ self.attachment_type = 'link'
89
+ end
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ # @!visibility private
95
+ def valid?
96
+ return false if @attachment.nil?
97
+ return false if @attachment_type.nil?
98
+ true
99
+ end
100
+
101
+ # Custom attribute writer method with validation
102
+ # @param attachment [Object] Object to be assigned
103
+ # @!visibility private
104
+ def attachment=(attachment)
105
+ if attachment.nil?
106
+ fail ArgumentError, 'invalid value for "attachment", attachment cannot be nil.'
107
+ end
108
+ @attachment = attachment
109
+ end
110
+
111
+ # Custom attribute writer method with validation
112
+ # @param attachment_type [Object] Object to be assigned
113
+ # @!visibility private
114
+ def attachment_type=(attachment_type)
115
+ if attachment_type.nil?
116
+ fail ArgumentError, 'invalid value for "attachment_type", attachment_type cannot be nil.'
117
+ end
118
+ @attachment_type = attachment_type
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param o [Object] Object to be compared
123
+ # @!visibility private
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ attachment == o.attachment &&
128
+ attachment_type == o.attachment_type
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param o [Object] Object to be compared
133
+ # @!visibility private
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ # @!visibility private
141
+ def hash
142
+ [attachment, attachment_type].hash
143
+ end
144
+ end
145
+ end