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