datadog_api_client 2.12.0 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.apigentools-info +6 -6
- data/.generator/conftest.py +7 -0
- data/.generator/poetry.lock +45 -75
- data/.generator/pyproject.toml +7 -7
- data/.generator/schemas/v1/openapi.yaml +257 -19
- data/.generator/schemas/v2/openapi.yaml +3020 -911
- data/.generator/src/generator/formatter.py +43 -32
- data/.generator/src/generator/openapi.py +4 -2
- data/.generator/src/generator/templates/api_client.j2 +81 -53
- data/.generator/src/generator/templates/configuration.j2 +21 -0
- data/.github/workflows/test_integration.yml +7 -1
- data/.pre-commit-config.yaml +4 -4
- data/CHANGELOG.md +62 -0
- data/README.md +23 -0
- data/examples/v1/azure-integration/CreateAzureIntegration.rb +3 -0
- data/examples/v1/azure-integration/DeleteAzureIntegration.rb +3 -0
- data/examples/v1/azure-integration/UpdateAzureHostFilters.rb +3 -0
- data/examples/v1/azure-integration/UpdateAzureIntegration.rb +3 -0
- data/examples/v1/dashboards/CreateDashboard_1284514532.rb +43 -0
- data/examples/v1/dashboards/CreateDashboard_2261785072.rb +47 -0
- data/examples/v1/dashboards/CreateDashboard_252716965.rb +6 -0
- data/examples/v1/dashboards/CreateDashboard_3513586382.rb +74 -0
- data/examples/v1/dashboards/CreateDashboard_3562282606.rb +1 -0
- data/examples/v1/dashboards/DeletePublicDashboardInvitation.rb +3 -3
- data/examples/v1/organizations/UpdateOrg.rb +1 -1
- data/examples/v1/synthetics/CreateSyntheticsAPITest_1487281163.rb +1 -0
- data/examples/v1/users/CreateUser.rb +1 -1
- data/examples/v1/users/CreateUser_266604071.rb +13 -0
- data/examples/v1/users/UpdateUser.rb +1 -1
- data/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent.rb +3 -0
- data/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_129899466.rb +3 -0
- data/examples/v2/confluent-cloud/CreateConfluentAccount.rb +1 -0
- data/examples/v2/confluent-cloud/CreateConfluentResource.rb +1 -0
- data/examples/v2/confluent-cloud/UpdateConfluentResource.rb +1 -0
- data/examples/v2/downtimes/CancelDowntime.rb +11 -0
- data/examples/v2/downtimes/CreateDowntime.rb +26 -0
- data/examples/v2/downtimes/GetDowntime.rb +11 -0
- data/examples/v2/downtimes/ListDowntimes.rb +8 -0
- data/examples/v2/downtimes/ListMonitorDowntimes.rb +8 -0
- data/examples/v2/downtimes/ListMonitorDowntimes_128979780.rb +8 -0
- data/examples/v2/downtimes/UpdateDowntime.rb +21 -0
- data/examples/v2/logs/AggregateLogs_2955613758.rb +1 -1
- data/examples/v2/logs/ListLogsGet_2034110533.rb +3 -1
- data/examples/v2/security-monitoring/CreateSecurityMonitoringRule_1092490364.rb +10 -0
- data/examples/v2/spans/AggregateSpans.rb +25 -0
- data/examples/v2/spans/ListSpans.rb +25 -0
- data/examples/v2/spans/ListSpansGet.rb +5 -0
- data/examples/v2/spans/ListSpansGet_1130763422.rb +8 -0
- data/examples/v2/spans/ListSpans_3495563906.rb +25 -0
- data/examples/v2/teams/CreateTeam.rb +2 -2
- data/examples/v2/teams/CreateTeam_252121814.rb +24 -0
- data/examples/v2/teams/GetUserMemberships.rb +8 -0
- data/examples/v2/teams/UpdateTeam.rb +9 -0
- data/lib/datadog_api_client/api_client.rb +81 -53
- data/lib/datadog_api_client/configuration.rb +28 -0
- data/lib/datadog_api_client/inflector.rb +97 -1
- data/lib/datadog_api_client/v1/api/service_level_objective_corrections_api.rb +2 -2
- data/lib/datadog_api_client/v1/api/service_level_objectives_api.rb +10 -10
- data/lib/datadog_api_client/v1/api/usage_metering_api.rb +3 -3
- data/lib/datadog_api_client/v1/models/azure_account.rb +32 -1
- data/lib/datadog_api_client/v1/models/change_widget_request.rb +1 -1
- data/lib/datadog_api_client/v1/models/distribution_widget_definition.rb +13 -1
- data/lib/datadog_api_client/v1/models/formula_and_function_cloud_cost_data_source.rb +26 -0
- data/lib/datadog_api_client/v1/models/formula_and_function_cloud_cost_query_definition.rb +150 -0
- data/lib/datadog_api_client/v1/models/formula_and_function_query_definition.rb +2 -1
- data/lib/datadog_api_client/v1/models/formula_and_function_response_format.rb +2 -1
- data/lib/datadog_api_client/v1/models/formula_and_function_slo_query_definition.rb +11 -1
- data/lib/datadog_api_client/v1/models/geomap_widget_request.rb +24 -2
- data/lib/datadog_api_client/v1/models/hourly_usage_attribution_usage_type.rb +3 -0
- data/lib/datadog_api_client/v1/models/ip_prefixes_remote_configuration.rb +94 -0
- data/lib/datadog_api_client/v1/models/ip_ranges.rb +11 -1
- data/lib/datadog_api_client/v1/models/monthly_usage_attribution_supported_metrics.rb +6 -0
- data/lib/datadog_api_client/v1/models/monthly_usage_attribution_values.rb +61 -1
- data/lib/datadog_api_client/v1/models/organization_settings.rb +8 -0
- data/lib/datadog_api_client/v1/models/query_value_widget_request.rb +1 -1
- data/lib/datadog_api_client/v1/models/scatterplot_table_request.rb +1 -1
- data/lib/datadog_api_client/v1/models/sunburst_widget_request.rb +1 -1
- data/lib/datadog_api_client/v1/models/synthetics_test_request.rb +11 -1
- data/lib/datadog_api_client/v1/models/table_widget_request.rb +1 -1
- data/lib/datadog_api_client/v1/models/timeseries_widget_request.rb +1 -1
- data/lib/datadog_api_client/v1/models/toplist_widget_request.rb +1 -1
- data/lib/datadog_api_client/v1/models/tree_map_widget_request.rb +1 -1
- data/lib/datadog_api_client/v1/models/usage_ci_visibility_hour.rb +12 -1
- data/lib/datadog_api_client/v1/models/usage_summary_date.rb +24 -4
- data/lib/datadog_api_client/v1/models/usage_summary_date_org.rb +24 -4
- data/lib/datadog_api_client/v1/models/usage_summary_response.rb +24 -4
- data/lib/datadog_api_client/v1/models/user.rb +8 -0
- data/lib/datadog_api_client/v1/models/widget_comparator.rb +1 -0
- data/lib/datadog_api_client/v1/models/widget_display_type.rb +1 -0
- data/lib/datadog_api_client/v2/api/ci_visibility_pipelines_api.rb +11 -5
- data/lib/datadog_api_client/v2/api/downtimes_api.rb +462 -0
- data/lib/datadog_api_client/v2/api/ip_allowlist_api.rb +2 -2
- data/lib/datadog_api_client/v2/api/logs_api.rb +2 -2
- data/lib/datadog_api_client/v2/api/metrics_api.rb +2 -2
- data/lib/datadog_api_client/v2/api/rum_api.rb +2 -2
- data/lib/datadog_api_client/v2/api/security_monitoring_api.rb +3 -3
- data/lib/datadog_api_client/v2/api/spans_api.rb +294 -0
- data/lib/datadog_api_client/v2/api/spans_metrics_api.rb +2 -2
- data/lib/datadog_api_client/v2/api/teams_api.rb +65 -0
- data/lib/datadog_api_client/v2/models/application_key_create_attributes.rb +1 -1
- data/lib/datadog_api_client/v2/models/application_key_update_attributes.rb +1 -1
- data/lib/datadog_api_client/v2/models/audit_logs_event_attributes.rb +11 -1
- data/lib/datadog_api_client/v2/models/ci_app_event_attributes.rb +9 -21
- data/lib/datadog_api_client/v2/models/ci_app_pipeline_event.rb +1 -1
- data/lib/datadog_api_client/v2/models/ci_app_pipeline_event_attributes.rb +102 -0
- data/lib/datadog_api_client/v2/models/ci_app_pipeline_event_pipeline.rb +1 -1
- data/lib/datadog_api_client/v2/models/ci_app_pipeline_level.rb +30 -0
- data/lib/datadog_api_client/v2/models/ci_app_pipelines_query_filter.rb +1 -1
- data/lib/datadog_api_client/v2/models/ci_app_test_level.rb +29 -0
- data/lib/datadog_api_client/v2/models/ci_app_tests_analytics_aggregate_response.rb +1 -1
- data/lib/datadog_api_client/v2/models/ci_app_tests_query_filter.rb +1 -1
- data/lib/datadog_api_client/v2/models/cloud_configuration_rule_compliance_signal_options.rb +25 -1
- data/lib/datadog_api_client/v2/models/cloud_configuration_rule_create_payload.rb +13 -1
- data/lib/datadog_api_client/v2/models/cloud_workload_security_agent_rule_attributes.rb +41 -1
- data/lib/datadog_api_client/v2/models/confluent_account_resource_attributes.rb +11 -1
- data/lib/datadog_api_client/v2/models/confluent_resource_request_attributes.rb +11 -1
- data/lib/datadog_api_client/v2/models/confluent_resource_response_attributes.rb +21 -1
- data/lib/datadog_api_client/v2/models/dashboard_list_item.rb +36 -1
- data/lib/datadog_api_client/v2/models/downtime_create_request.rb +98 -0
- data/lib/datadog_api_client/v2/models/downtime_create_request_attributes.rb +194 -0
- data/lib/datadog_api_client/v2/models/downtime_create_request_data.rb +119 -0
- data/lib/datadog_api_client/v2/models/downtime_included_monitor_type.rb +26 -0
- data/lib/datadog_api_client/v2/models/downtime_meta.rb +80 -0
- data/lib/datadog_api_client/v2/models/downtime_meta_page.rb +80 -0
- data/lib/datadog_api_client/v2/models/downtime_monitor_identifier.rb +63 -0
- data/lib/datadog_api_client/v2/models/downtime_monitor_identifier_id.rb +98 -0
- data/lib/datadog_api_client/v2/models/downtime_monitor_identifier_tags.rb +107 -0
- data/lib/datadog_api_client/v2/models/downtime_monitor_included_attributes.rb +80 -0
- data/lib/datadog_api_client/v2/models/downtime_monitor_included_item.rb +100 -0
- data/lib/datadog_api_client/v2/models/downtime_notify_end_state_actions.rb +27 -0
- data/lib/datadog_api_client/v2/models/downtime_notify_end_state_types.rb +28 -0
- data/lib/datadog_api_client/v2/models/downtime_relationships.rb +90 -0
- data/lib/datadog_api_client/v2/models/downtime_relationships_created_by.rb +88 -0
- data/lib/datadog_api_client/v2/models/downtime_relationships_created_by_data.rb +90 -0
- data/lib/datadog_api_client/v2/models/downtime_relationships_monitor.rb +88 -0
- data/lib/datadog_api_client/v2/models/downtime_relationships_monitor_data.rb +90 -0
- data/lib/datadog_api_client/v2/models/downtime_resource_type.rb +26 -0
- data/lib/datadog_api_client/v2/models/downtime_response.rb +95 -0
- data/lib/datadog_api_client/v2/models/downtime_response_attributes.rb +208 -0
- data/lib/datadog_api_client/v2/models/downtime_response_data.rb +110 -0
- data/lib/datadog_api_client/v2/models/downtime_response_included_item.rb +63 -0
- data/lib/datadog_api_client/v2/models/downtime_schedule_create_request.rb +63 -0
- data/lib/datadog_api_client/v2/models/downtime_schedule_current_downtime_response.rb +100 -0
- data/lib/datadog_api_client/v2/models/downtime_schedule_one_time_create_update_request.rb +101 -0
- data/lib/datadog_api_client/v2/models/downtime_schedule_one_time_response.rb +116 -0
- data/lib/datadog_api_client/v2/models/downtime_schedule_recurrence_create_update_request.rb +143 -0
- data/lib/datadog_api_client/v2/models/downtime_schedule_recurrence_response.rb +106 -0
- data/lib/datadog_api_client/v2/models/downtime_schedule_recurrences_create_request.rb +110 -0
- data/lib/datadog_api_client/v2/models/downtime_schedule_recurrences_response.rb +131 -0
- data/lib/datadog_api_client/v2/models/downtime_schedule_recurrences_update_request.rb +92 -0
- data/lib/datadog_api_client/v2/models/downtime_schedule_response.rb +65 -0
- data/lib/datadog_api_client/v2/models/downtime_schedule_update_request.rb +63 -0
- data/lib/datadog_api_client/v2/models/downtime_status.rb +29 -0
- data/lib/datadog_api_client/v2/models/downtime_update_request.rb +98 -0
- data/lib/datadog_api_client/v2/models/downtime_update_request_attributes.rb +165 -0
- data/lib/datadog_api_client/v2/models/{team_data.rb → downtime_update_request_data.rb} +9 -9
- data/lib/datadog_api_client/v2/models/event_response_attributes.rb +11 -1
- data/lib/datadog_api_client/v2/models/events_group_by_sort.rb +1 -1
- data/lib/datadog_api_client/v2/models/events_response_metadata.rb +11 -1
- data/lib/datadog_api_client/v2/models/formula_limit.rb +1 -0
- data/lib/datadog_api_client/v2/models/full_application_key_attributes.rb +1 -1
- data/lib/datadog_api_client/v2/models/list_downtimes_response.rb +104 -0
- data/lib/datadog_api_client/v2/models/logs_aggregate_request.rb +1 -1
- data/lib/datadog_api_client/v2/models/logs_aggregate_request_page.rb +1 -1
- data/lib/datadog_api_client/v2/models/logs_group_by.rb +3 -2
- data/lib/datadog_api_client/v2/models/logs_group_by_histogram.rb +1 -1
- data/lib/datadog_api_client/v2/models/logs_list_request.rb +1 -1
- data/lib/datadog_api_client/v2/models/logs_query_options.rb +1 -1
- data/lib/datadog_api_client/v2/models/logs_response_metadata_page.rb +1 -1
- data/lib/datadog_api_client/v2/models/metrics_aggregator.rb +1 -1
- data/lib/datadog_api_client/v2/models/metrics_scalar_query.rb +1 -1
- data/lib/datadog_api_client/v2/models/monitor_downtime_match_resource_type.rb +26 -0
- data/lib/datadog_api_client/v2/models/monitor_downtime_match_response.rb +92 -0
- data/lib/datadog_api_client/v2/models/monitor_downtime_match_response_attributes.rb +120 -0
- data/lib/datadog_api_client/v2/models/monitor_downtime_match_response_data.rb +108 -0
- data/lib/datadog_api_client/v2/models/on_demand_concurrency_cap.rb +14 -4
- data/lib/datadog_api_client/v2/models/on_demand_concurrency_cap_type.rb +26 -0
- data/lib/datadog_api_client/v2/models/partial_application_key_attributes.rb +1 -1
- data/lib/datadog_api_client/v2/models/query_formula.rb +1 -0
- data/lib/datadog_api_client/v2/models/relationship_to_team_links.rb +14 -4
- data/lib/datadog_api_client/v2/models/relationship_to_user_team_permission.rb +14 -4
- data/lib/datadog_api_client/v2/models/restriction_policy_binding.rb +2 -1
- data/lib/datadog_api_client/v2/models/rum_application_list.rb +11 -1
- data/lib/datadog_api_client/v2/models/security_monitoring_signal_metadata_type.rb +26 -0
- data/lib/datadog_api_client/v2/models/security_monitoring_signal_response.rb +80 -0
- data/lib/datadog_api_client/v2/models/security_monitoring_signal_rule_response_query.rb +26 -2
- data/lib/datadog_api_client/v2/models/security_monitoring_signal_state_update_data.rb +24 -4
- data/lib/datadog_api_client/v2/models/security_monitoring_signal_triage_update_data.rb +24 -4
- data/lib/datadog_api_client/v2/models/security_monitoring_standard_rule_query.rb +1 -19
- data/lib/datadog_api_client/v2/models/security_monitoring_triage_user.rb +11 -1
- data/lib/datadog_api_client/v2/models/sensitive_data_scanner_get_config_response_data.rb +11 -1
- data/lib/datadog_api_client/v2/models/sensitive_data_scanner_meta.rb +11 -1
- data/lib/datadog_api_client/v2/models/sensitive_data_scanner_standard_pattern_attributes.rb +11 -1
- data/lib/datadog_api_client/v2/models/service_definition_data.rb +11 -1
- data/lib/datadog_api_client/v2/models/service_definition_meta.rb +36 -4
- data/lib/datadog_api_client/v2/models/service_definition_meta_warnings.rb +100 -0
- data/lib/datadog_api_client/v2/models/span.rb +100 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_bucket.rb +100 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_bucket_attributes.rb +100 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_bucket_type.rb +26 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_bucket_value.rb +64 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_bucket_value_timeseries_point.rb +90 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_data.rb +90 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_request.rb +80 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_request_attributes.rb +115 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_request_type.rb +26 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_response.rb +92 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_response_metadata.rb +113 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_response_status.rb +27 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_sort.rb +110 -0
- data/lib/datadog_api_client/v2/models/spans_aggregate_sort_type.rb +27 -0
- data/lib/datadog_api_client/v2/models/spans_aggregation_function.rb +37 -0
- data/lib/datadog_api_client/v2/models/spans_attributes.rb +244 -0
- data/lib/datadog_api_client/v2/models/spans_compute.rb +129 -0
- data/lib/datadog_api_client/v2/models/spans_compute_type.rb +27 -0
- data/lib/datadog_api_client/v2/models/spans_group_by.rb +149 -0
- data/lib/datadog_api_client/v2/models/spans_group_by_histogram.rb +143 -0
- data/lib/datadog_api_client/v2/models/spans_group_by_missing.rb +63 -0
- data/lib/datadog_api_client/v2/models/spans_group_by_total.rb +64 -0
- data/lib/datadog_api_client/v2/models/spans_list_request.rb +80 -0
- data/lib/datadog_api_client/v2/models/spans_list_request_attributes.rb +111 -0
- data/lib/datadog_api_client/v2/models/spans_list_request_data.rb +90 -0
- data/lib/datadog_api_client/v2/models/spans_list_request_page.rb +108 -0
- data/lib/datadog_api_client/v2/models/spans_list_request_type.rb +26 -0
- data/lib/datadog_api_client/v2/models/spans_list_response.rb +102 -0
- data/lib/datadog_api_client/v2/models/spans_list_response_links.rb +81 -0
- data/lib/datadog_api_client/v2/models/spans_list_response_metadata.rb +123 -0
- data/lib/datadog_api_client/v2/models/spans_query_filter.rb +100 -0
- data/lib/datadog_api_client/v2/models/spans_query_options.rb +91 -0
- data/lib/datadog_api_client/v2/models/spans_response_metadata_page.rb +81 -0
- data/lib/datadog_api_client/v2/models/spans_sort.rb +27 -0
- data/lib/datadog_api_client/v2/models/spans_sort_order.rb +27 -0
- data/lib/datadog_api_client/v2/models/spans_type.rb +26 -0
- data/lib/datadog_api_client/v2/models/spans_warning.rb +100 -0
- data/lib/datadog_api_client/v2/models/team_attributes.rb +50 -4
- data/lib/datadog_api_client/v2/models/team_create_attributes.rb +57 -4
- data/lib/datadog_api_client/v2/models/team_relationships_links.rb +80 -0
- data/lib/datadog_api_client/v2/models/team_response.rb +1 -1
- data/lib/datadog_api_client/v2/models/team_update_attributes.rb +57 -4
- data/lib/datadog_api_client/v2/models/teams_response.rb +24 -4
- data/lib/datadog_api_client/v2/models/teams_response_links.rb +129 -0
- data/lib/datadog_api_client/v2/models/teams_response_meta.rb +80 -0
- data/lib/datadog_api_client/v2/models/teams_response_meta_pagination.rb +150 -0
- data/lib/datadog_api_client/v2/models/usage_attributes_object.rb +11 -1
- data/lib/datadog_api_client/v2/models/user_invitation_response_data.rb +11 -1
- data/lib/datadog_api_client/v2/models/user_teams_response.rb +24 -4
- data/lib/datadog_api_client/version.rb +1 -1
- data/spec/configuration_spec.rb +17 -0
- data/spec/retry_spec.rb +44 -0
- metadata +119 -3
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import pathlib
|
|
3
3
|
import json
|
|
4
4
|
import re
|
|
5
|
-
import warnings
|
|
6
5
|
from functools import singledispatch
|
|
7
6
|
|
|
8
7
|
|
|
@@ -185,6 +184,8 @@ def _format_oneof(data, schema, name_prefix=None, replace_values=None):
|
|
|
185
184
|
matched = 0
|
|
186
185
|
for sub_schema in schema["oneOf"]:
|
|
187
186
|
try:
|
|
187
|
+
if "items" in sub_schema and not isinstance(data, list):
|
|
188
|
+
continue
|
|
188
189
|
formatted = format_data_with_schema(
|
|
189
190
|
data,
|
|
190
191
|
sub_schema,
|
|
@@ -196,13 +197,11 @@ def _format_oneof(data, schema, name_prefix=None, replace_values=None):
|
|
|
196
197
|
# parameters += formatted
|
|
197
198
|
parameters = formatted
|
|
198
199
|
matched += 1
|
|
199
|
-
except (KeyError, ValueError):
|
|
200
|
+
except (KeyError, ValueError, TypeError):
|
|
200
201
|
pass
|
|
201
202
|
|
|
202
|
-
if matched
|
|
203
|
+
if matched != 1:
|
|
203
204
|
raise ValueError(f"[{matched}] {data} is not valid for schema")
|
|
204
|
-
elif matched > 1:
|
|
205
|
-
warnings.warn(f"[{matched}] {data} is not valid for schema")
|
|
206
205
|
|
|
207
206
|
return parameters
|
|
208
207
|
|
|
@@ -216,9 +215,13 @@ def format_data_with_schema(
|
|
|
216
215
|
default_name=None,
|
|
217
216
|
):
|
|
218
217
|
name = get_name(schema)
|
|
218
|
+
nullable = schema.get("nullable", False)
|
|
219
219
|
|
|
220
|
-
if "enum" in schema
|
|
221
|
-
|
|
220
|
+
if "enum" in schema:
|
|
221
|
+
if nullable and data is None:
|
|
222
|
+
pass
|
|
223
|
+
elif data not in schema["enum"]:
|
|
224
|
+
raise ValueError(f"{data} is not valid enum value {schema['enum']}")
|
|
222
225
|
|
|
223
226
|
if replace_values and data in replace_values:
|
|
224
227
|
parameters = replace_values[data]
|
|
@@ -227,9 +230,11 @@ def format_data_with_schema(
|
|
|
227
230
|
elif schema.get("type") == "number":
|
|
228
231
|
parameters = f"{parameters}.to_f"
|
|
229
232
|
elif "enum" in schema:
|
|
233
|
+
if nullable and data is None:
|
|
234
|
+
return "nil"
|
|
230
235
|
parameters = schema["x-enum-varnames"][schema["enum"].index(data)]
|
|
231
236
|
else:
|
|
232
|
-
if
|
|
237
|
+
if nullable and data is None:
|
|
233
238
|
return "nil"
|
|
234
239
|
else:
|
|
235
240
|
if "oneOf" in schema:
|
|
@@ -240,11 +245,28 @@ def format_data_with_schema(
|
|
|
240
245
|
def open_file(x):
|
|
241
246
|
return f"File.open({repr(x)}, 'r')"
|
|
242
247
|
|
|
248
|
+
def format_number(x):
|
|
249
|
+
if isinstance(x, (bool, str)):
|
|
250
|
+
raise TypeError(f"{x} is not supported type {schema}")
|
|
251
|
+
return str(x)
|
|
252
|
+
|
|
253
|
+
def format_string(x):
|
|
254
|
+
if isinstance(x, bool):
|
|
255
|
+
raise TypeError(f"{x} is not supported type {schema}")
|
|
256
|
+
if schema.get("format") == "binary":
|
|
257
|
+
return open_file(x)
|
|
258
|
+
return repr(x)
|
|
259
|
+
|
|
260
|
+
def format_boolean(x):
|
|
261
|
+
if not isinstance(x, bool):
|
|
262
|
+
raise TypeError(f"{x} is not supported type {schema}")
|
|
263
|
+
return "true" if x else "false"
|
|
264
|
+
|
|
243
265
|
formatter = {
|
|
244
|
-
"number":
|
|
245
|
-
"integer":
|
|
246
|
-
"boolean":
|
|
247
|
-
"string":
|
|
266
|
+
"number": format_number,
|
|
267
|
+
"integer": format_number,
|
|
268
|
+
"boolean": format_boolean,
|
|
269
|
+
"string": format_string,
|
|
248
270
|
None: repr,
|
|
249
271
|
}[schema.get("type")]
|
|
250
272
|
|
|
@@ -275,18 +297,7 @@ def format_data_with_schema_list(
|
|
|
275
297
|
name = get_name(schema)
|
|
276
298
|
|
|
277
299
|
if "oneOf" in schema:
|
|
278
|
-
|
|
279
|
-
try:
|
|
280
|
-
value = format_data_with_schema(
|
|
281
|
-
data,
|
|
282
|
-
sub_schema,
|
|
283
|
-
replace_values=replace_values,
|
|
284
|
-
default_name=name,
|
|
285
|
-
)
|
|
286
|
-
except (KeyError, ValueError):
|
|
287
|
-
continue
|
|
288
|
-
return value
|
|
289
|
-
raise ValueError(f"{data} is not valid oneOf {schema}")
|
|
300
|
+
return _format_oneof(data, schema, name_prefix=name_prefix, replace_values=replace_values)
|
|
290
301
|
|
|
291
302
|
parameters = ""
|
|
292
303
|
for d in data:
|
|
@@ -318,7 +329,7 @@ def format_data_with_schema_dict(
|
|
|
318
329
|
missing = required_properties - set(data.keys())
|
|
319
330
|
if missing:
|
|
320
331
|
raise ValueError(f"missing required properties: {missing}")
|
|
321
|
-
|
|
332
|
+
|
|
322
333
|
for k, v in data.items():
|
|
323
334
|
if k not in schema["properties"]:
|
|
324
335
|
continue
|
|
@@ -349,18 +360,18 @@ def format_data_with_schema_dict(
|
|
|
349
360
|
if default_name and not schema.get("additionalProperties") and schema.get("properties"):
|
|
350
361
|
name = default_name
|
|
351
362
|
else:
|
|
352
|
-
|
|
353
|
-
|
|
363
|
+
if not parameters and data:
|
|
364
|
+
parameters = ", ".join(f"\"{k}\": \"{v}\"" for k, v in data.items())
|
|
365
|
+
return f"{{\n{parameters}}}"
|
|
354
366
|
|
|
355
367
|
if "oneOf" in schema:
|
|
356
368
|
name = None
|
|
357
369
|
parameters = _format_oneof(data, schema, name_prefix=name_prefix, replace_values=replace_values)
|
|
358
370
|
|
|
359
|
-
if
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
elif name:
|
|
371
|
+
if parameters == "" and schema.get("type") == "string":
|
|
372
|
+
raise ValueError(f"No schema matched for {data}")
|
|
373
|
+
|
|
374
|
+
if name:
|
|
364
375
|
return f"{name_prefix}{name}.new({{\n{parameters}}})"
|
|
365
376
|
|
|
366
377
|
return parameters
|
|
@@ -461,8 +461,10 @@ def get_default(operation, attribute_path):
|
|
|
461
461
|
|
|
462
462
|
|
|
463
463
|
def get_container(operation, attribute_path, with_type=False):
|
|
464
|
-
def get_type(parameter):
|
|
464
|
+
def get_type(parameter, attribute=None):
|
|
465
465
|
if with_type:
|
|
466
|
+
if attribute:
|
|
467
|
+
return ", {}".format(type_to_ruby(parameter_schema(parameter)["properties"][attribute]))
|
|
466
468
|
return f", {get_type_for_parameter(parameter)}"
|
|
467
469
|
return ""
|
|
468
470
|
|
|
@@ -473,7 +475,7 @@ def get_container(operation, attribute_path, with_type=False):
|
|
|
473
475
|
return '{}, "{}"{}'.format(
|
|
474
476
|
name,
|
|
475
477
|
".".join(formatter.attribute_name(a) for a in attribute_path.split(".")[1:]),
|
|
476
|
-
get_type(parameter),
|
|
478
|
+
get_type(parameter, attribute_path.split(".")[1]),
|
|
477
479
|
)
|
|
478
480
|
return f'opts, "{formatter.attribute_path(attribute_path)}"{get_type(parameter)}'
|
|
479
481
|
|
|
@@ -44,71 +44,99 @@ module {{ module_name }}
|
|
|
44
44
|
# the data deserialized from response body (could be nil), response status code and response headers.
|
|
45
45
|
def call_api(http_method, path, opts = {})
|
|
46
46
|
request = build_request(http_method, path, opts)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
47
|
+
attempt = 0
|
|
48
|
+
loop do
|
|
49
|
+
if opts[:stream_body]
|
|
50
|
+
tempfile = nil
|
|
51
|
+
encoding = nil
|
|
52
|
+
|
|
53
|
+
response = request.perform do | chunk |
|
|
54
|
+
unless tempfile
|
|
55
|
+
content_disposition = chunk.http_response.header['Content-Disposition']
|
|
56
|
+
if content_disposition && content_disposition =~ /filename=/i
|
|
57
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
|
58
|
+
prefix = sanitize_filename(filename)
|
|
59
|
+
else
|
|
60
|
+
prefix = 'download-'
|
|
61
|
+
end
|
|
62
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
|
63
|
+
unless encoding
|
|
64
|
+
encoding = chunk.encoding
|
|
65
|
+
end
|
|
66
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
|
67
|
+
@tempfile = tempfile
|
|
63
68
|
end
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
chunk.force_encoding(encoding)
|
|
70
|
+
tempfile.write(chunk)
|
|
71
|
+
end
|
|
72
|
+
if tempfile
|
|
73
|
+
tempfile.close
|
|
74
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
|
75
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
|
76
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
|
77
|
+
"explicitly with `tempfile.delete`"
|
|
66
78
|
end
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
else
|
|
80
|
+
response = request.perform
|
|
69
81
|
end
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
@config.logger.
|
|
73
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
|
74
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
|
75
|
-
"explicitly with `tempfile.delete`"
|
|
82
|
+
|
|
83
|
+
if @config.debugging
|
|
84
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
|
76
85
|
end
|
|
77
|
-
else
|
|
78
|
-
response = request.perform
|
|
79
|
-
end
|
|
80
86
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
unless response.success?
|
|
88
|
+
if response.request_timeout?
|
|
89
|
+
fail APIError.new('Connection timed out')
|
|
90
|
+
elsif response.code == 0
|
|
91
|
+
# Errors from libcurl will be made visible here
|
|
92
|
+
fail APIError.new(:code => 0,
|
|
93
|
+
:message => response.return_message)
|
|
94
|
+
else
|
|
95
|
+
body = response.body
|
|
96
|
+
if response.headers['Content-Encoding'].eql?('gzip') && !(body.nil? || body.empty?) then
|
|
97
|
+
gzip = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)
|
|
98
|
+
body = gzip.inflate(body)
|
|
99
|
+
gzip.close
|
|
100
|
+
end
|
|
101
|
+
if should_retry(attempt, @config.max_retries, response.code, @config.enable_retry)
|
|
102
|
+
sleep calculate_retry_interval(response, @config.backoff_base, @config.backoff_multiplier, attempt, @config.timeout)
|
|
103
|
+
attempt = attempt + 1
|
|
104
|
+
next
|
|
105
|
+
else
|
|
106
|
+
fail APIError.new(:code => response.code,
|
|
107
|
+
:response_headers => response.headers,
|
|
108
|
+
:response_body => body),
|
|
109
|
+
response.message
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
84
113
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
fail APIError.new('Connection timed out')
|
|
88
|
-
elsif response.code == 0
|
|
89
|
-
# Errors from libcurl will be made visible here
|
|
90
|
-
fail APIError.new(:code => 0,
|
|
91
|
-
:message => response.return_message)
|
|
114
|
+
if opts[:return_type]
|
|
115
|
+
data = deserialize(opts[:api_version], response, opts[:return_type])
|
|
92
116
|
else
|
|
93
|
-
|
|
94
|
-
if response.headers['Content-Encoding'].eql?('gzip') && !(body.nil? || body.empty?) then
|
|
95
|
-
gzip = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)
|
|
96
|
-
body = gzip.inflate(body)
|
|
97
|
-
gzip.close
|
|
98
|
-
end
|
|
99
|
-
fail APIError.new(:code => response.code,
|
|
100
|
-
:response_headers => response.headers,
|
|
101
|
-
:response_body => body),
|
|
102
|
-
response.message
|
|
117
|
+
data = nil
|
|
103
118
|
end
|
|
119
|
+
return data, response.code, response.headers
|
|
104
120
|
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Check if an http request should be retried
|
|
124
|
+
def should_retry(attempt, max_retries, http_code, enable_retry)
|
|
125
|
+
(http_code == 429 || http_code >= 500) && max_retries > attempt && enable_retry
|
|
126
|
+
end
|
|
105
127
|
|
|
106
|
-
|
|
107
|
-
|
|
128
|
+
# Calculate the sleep interval between 2 retry attempts
|
|
129
|
+
def calculate_retry_interval(response, backoff_base, backoff_multiplier, attempt, timeout)
|
|
130
|
+
reset_header = response.headers['X-Ratelimit-Reset']
|
|
131
|
+
if !reset_header.nil? && !reset_header.empty?
|
|
132
|
+
sleep_time = reset_header.to_i
|
|
108
133
|
else
|
|
109
|
-
|
|
134
|
+
sleep_time = (backoff_multiplier**attempt) * backoff_base
|
|
135
|
+
if timeout && timeout > 0
|
|
136
|
+
sleep_time = [timeout, sleep_time].min
|
|
137
|
+
end
|
|
110
138
|
end
|
|
111
|
-
|
|
139
|
+
sleep_time
|
|
112
140
|
end
|
|
113
141
|
|
|
114
142
|
# Build the HTTP request
|
|
@@ -138,6 +138,16 @@ module {{ module_name }}
|
|
|
138
138
|
# Password for proxy server authentication
|
|
139
139
|
attr_accessor :http_proxypass
|
|
140
140
|
|
|
141
|
+
# Enable retry when rate limited
|
|
142
|
+
attr_accessor :enable_retry
|
|
143
|
+
|
|
144
|
+
# Retry backoff calculation parameters
|
|
145
|
+
attr_accessor :backoff_base
|
|
146
|
+
attr_accessor :backoff_multiplier
|
|
147
|
+
|
|
148
|
+
# Maximum number of retry attempts allowed
|
|
149
|
+
attr_accessor :max_retries
|
|
150
|
+
|
|
141
151
|
def initialize
|
|
142
152
|
{%- set default_server = openapi.servers[0]|format_server %}
|
|
143
153
|
@scheme = '{{ default_server.scheme }}'
|
|
@@ -149,6 +159,10 @@ module {{ module_name }}
|
|
|
149
159
|
@server_operation_variables = {}
|
|
150
160
|
@api_key = {}
|
|
151
161
|
@api_key_prefix = {}
|
|
162
|
+
@enable_retry = false
|
|
163
|
+
@backoff_base = 2
|
|
164
|
+
@backoff_multiplier = 2
|
|
165
|
+
@max_retries = 3
|
|
152
166
|
@timeout = nil
|
|
153
167
|
@client_side_validation = true
|
|
154
168
|
@verify_ssl = true
|
|
@@ -188,6 +202,13 @@ module {{ module_name }}
|
|
|
188
202
|
@@default ||= Configuration.new
|
|
189
203
|
end
|
|
190
204
|
|
|
205
|
+
def backoff_base=(value)
|
|
206
|
+
if value < 2
|
|
207
|
+
raise ArgumentError, 'backoff_base cannot be smaller than 2'
|
|
208
|
+
end
|
|
209
|
+
@backoff_base = value
|
|
210
|
+
end
|
|
211
|
+
|
|
191
212
|
def configure
|
|
192
213
|
yield(self) if block_given?
|
|
193
214
|
end
|
data/.pre-commit-config.yaml
CHANGED
|
@@ -19,7 +19,7 @@ repos:
|
|
|
19
19
|
name: Format documentation
|
|
20
20
|
stages: [manual]
|
|
21
21
|
language: node
|
|
22
|
-
language_version:
|
|
22
|
+
language_version: 20.5.0
|
|
23
23
|
entry: prettier --write --list-different --ignore-unknown README.md
|
|
24
24
|
"types": [text]
|
|
25
25
|
files: 'README.md'
|
|
@@ -27,11 +27,11 @@ repos:
|
|
|
27
27
|
additional_dependencies:
|
|
28
28
|
# When updating the version of prettier, make sure to check the pre-commit file
|
|
29
29
|
# And keep the `entry` here up to date https://github.com/pre-commit/mirrors-prettier/blob/master/.pre-commit-hooks.yaml
|
|
30
|
-
- prettier@
|
|
30
|
+
- prettier@3.0.0
|
|
31
31
|
- id: generator
|
|
32
32
|
name: generator
|
|
33
33
|
language: python
|
|
34
|
-
entry: bash -c "
|
|
34
|
+
entry: bash -c "cd .generator && poetry install && poetry run python -m generator ./schemas/v1/openapi.yaml ./schemas/v2/openapi.yaml -o ../lib/"
|
|
35
35
|
files: "^.generator/(config|schemas/v1|src|poetry.lock|pyproject.toml)"
|
|
36
36
|
stages: [manual]
|
|
37
37
|
pass_filenames: false
|
|
@@ -40,7 +40,7 @@ repos:
|
|
|
40
40
|
- id: examples
|
|
41
41
|
name: examples
|
|
42
42
|
language: python
|
|
43
|
-
entry: bash -c "
|
|
43
|
+
entry: bash -c "cd .generator && poetry install && poetry run pytest"
|
|
44
44
|
files: "^.generator/"
|
|
45
45
|
stages: [manual]
|
|
46
46
|
pass_filenames: false
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,67 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 2.14.0 / 2023-08-23
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
* Update team schemas by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1470
|
|
7
|
+
* Mark downtime v2 start response as required by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1482
|
|
8
|
+
* Document new properties and fix security monitoring schemas by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1469
|
|
9
|
+
* Add missing CI App fields `page` and `test_level` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1448
|
|
10
|
+
### Added
|
|
11
|
+
* Update stated limit for api/v2/metrics from 14 days to 30 days by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1476
|
|
12
|
+
* Add missing sensitive data scanner fields by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1466
|
|
13
|
+
* Add Workflow Executions to usage metering API by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1478
|
|
14
|
+
* Add missing `type` field for OnDemandConcurrencyCap response by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1468
|
|
15
|
+
* Add CI Visibility Intelligent Test Runner to usage metering API by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1477
|
|
16
|
+
* Add custom_links to distribution widget schema by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1485
|
|
17
|
+
* Add usage field `region` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1486
|
|
18
|
+
* Add `message` field to audit logs response by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1488
|
|
19
|
+
* Add `tags` field to dashboard list response by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1487
|
|
20
|
+
* API specs for user team memberships by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1495
|
|
21
|
+
* Document `EQUAL` comparator by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1498
|
|
22
|
+
* Add persistCookies option synthetics test request by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1497
|
|
23
|
+
* Expose sds_scanned_bytes_usage in usage attribution API by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1501
|
|
24
|
+
* Add support in azure integration endpoint for app service plan filters/cspm/custom metrics by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1496
|
|
25
|
+
* Add APM and USM usage attribution type by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1494
|
|
26
|
+
* Document new attributes for team models by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1492
|
|
27
|
+
* Add retry support by @HantingZhang2 in https://github.com/DataDog/datadog-api-client-ruby/pull/1502
|
|
28
|
+
|
|
29
|
+
## New Contributors
|
|
30
|
+
* @HantingZhang2 made their first contribution in https://github.com/DataDog/datadog-api-client-ruby/pull/1502
|
|
31
|
+
|
|
32
|
+
**Full Changelog**: https://github.com/DataDog/datadog-api-client-ruby/compare/v2.13.0...v2.14.0
|
|
33
|
+
|
|
34
|
+
## 2.13.0 / 2023-07-20
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
* Set the right object creation in pagination by @therve in https://github.com/DataDog/datadog-api-client-ruby/pull/1437
|
|
38
|
+
* Spans API docs update by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1442
|
|
39
|
+
* Fix filter indexes parameter in logs search by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1447
|
|
40
|
+
* Fix Spans endpoint schemas by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1462
|
|
41
|
+
### Added
|
|
42
|
+
* Add support for geomap widget using response_type `event_list` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1427
|
|
43
|
+
* Add support for the spans API endpoints by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1431
|
|
44
|
+
* Add a new field additional_query_filters to formula and function slo query by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1443
|
|
45
|
+
* Add support for `enable_custom_metrics` in Confluent Account by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1440
|
|
46
|
+
* Add missing `id` attribute for Confluent Account Response by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1446
|
|
47
|
+
* Fix downtimes v2 schema and add missing field `canceled` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1451
|
|
48
|
+
* Add cloud_cost data source and query definition to dashboards by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1452
|
|
49
|
+
* Add missing cloud workload security fields by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1457
|
|
50
|
+
* Add `integration_id` field for dashboard list item by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1461
|
|
51
|
+
* Add events response fields `message` and `status` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1459
|
|
52
|
+
* Add missing `GetRUMApplications` response field `id` by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1458
|
|
53
|
+
* Add missing service definition fields by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1460
|
|
54
|
+
* Add overlay type to Dashboards WidgetDisplayType by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1463
|
|
55
|
+
* Update IP ranges with remote configuration section by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1465
|
|
56
|
+
* Add missing `relationships` to UsersInvitations response by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1467
|
|
57
|
+
* Added optional field filters when creating a cloud configuration rule by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1471
|
|
58
|
+
### Changed
|
|
59
|
+
* Add downtime v2 API in private beta by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1388
|
|
60
|
+
* Mark `access_role` as nullable by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/1449
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
**Full Changelog**: https://github.com/DataDog/datadog-api-client-ruby/compare/v2.12.0...v2.13.0
|
|
64
|
+
|
|
3
65
|
## 2.12.0 / 2023-06-27
|
|
4
66
|
|
|
5
67
|
### Fixed
|
data/README.md
CHANGED
|
@@ -165,6 +165,29 @@ api_instance.list_incidents_with_pagination() do |incident|
|
|
|
165
165
|
end
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
+
### Retry
|
|
169
|
+
|
|
170
|
+
To enable the client to retry when rate limited (status 429) or status 500 and above:
|
|
171
|
+
|
|
172
|
+
```ruby
|
|
173
|
+
config = DatadogAPIClient::Configuration.new
|
|
174
|
+
config.enable_retry = true
|
|
175
|
+
client = DatadogAPIClient::APIClient.new(config)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The interval between 2 retry attempts will be the value of the `x-ratelimit-reset` response header when available.
|
|
179
|
+
If not, it will be :
|
|
180
|
+
|
|
181
|
+
```ruby
|
|
182
|
+
(config.backoffMultiplier ** current_retry_count) * config.backoffBase
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
The maximum number of retry attempts is `3` by default and can be modified with
|
|
186
|
+
|
|
187
|
+
```ruby
|
|
188
|
+
config.maxRetries
|
|
189
|
+
```
|
|
190
|
+
|
|
168
191
|
## Documentation
|
|
169
192
|
|
|
170
193
|
If you are interested in general documentation for all public Datadog API endpoints, checkout the [general documentation site][api docs].
|
|
@@ -4,9 +4,12 @@ require "datadog_api_client"
|
|
|
4
4
|
api_instance = DatadogAPIClient::V1::AzureIntegrationAPI.new
|
|
5
5
|
|
|
6
6
|
body = DatadogAPIClient::V1::AzureAccount.new({
|
|
7
|
+
app_service_plan_filters: "key:value,filter:example",
|
|
7
8
|
automute: true,
|
|
8
9
|
client_id: "testc7f6-1234-5678-9101-3fcbf464test",
|
|
9
10
|
client_secret: "testingx./Sw*g/Y33t..R1cH+hScMDt",
|
|
11
|
+
cspm_enabled: true,
|
|
12
|
+
custom_metrics_enabled: true,
|
|
10
13
|
errors: [
|
|
11
14
|
"*",
|
|
12
15
|
],
|
|
@@ -4,9 +4,12 @@ require "datadog_api_client"
|
|
|
4
4
|
api_instance = DatadogAPIClient::V1::AzureIntegrationAPI.new
|
|
5
5
|
|
|
6
6
|
body = DatadogAPIClient::V1::AzureAccount.new({
|
|
7
|
+
app_service_plan_filters: "key:value,filter:example",
|
|
7
8
|
automute: true,
|
|
8
9
|
client_id: "testc7f6-1234-5678-9101-3fcbf464test",
|
|
9
10
|
client_secret: "testingx./Sw*g/Y33t..R1cH+hScMDt",
|
|
11
|
+
cspm_enabled: true,
|
|
12
|
+
custom_metrics_enabled: true,
|
|
10
13
|
errors: [
|
|
11
14
|
"*",
|
|
12
15
|
],
|
|
@@ -4,9 +4,12 @@ require "datadog_api_client"
|
|
|
4
4
|
api_instance = DatadogAPIClient::V1::AzureIntegrationAPI.new
|
|
5
5
|
|
|
6
6
|
body = DatadogAPIClient::V1::AzureAccount.new({
|
|
7
|
+
app_service_plan_filters: "key:value,filter:example",
|
|
7
8
|
automute: true,
|
|
8
9
|
client_id: "testc7f6-1234-5678-9101-3fcbf464test",
|
|
9
10
|
client_secret: "testingx./Sw*g/Y33t..R1cH+hScMDt",
|
|
11
|
+
cspm_enabled: true,
|
|
12
|
+
custom_metrics_enabled: true,
|
|
10
13
|
errors: [
|
|
11
14
|
"*",
|
|
12
15
|
],
|
|
@@ -4,9 +4,12 @@ require "datadog_api_client"
|
|
|
4
4
|
api_instance = DatadogAPIClient::V1::AzureIntegrationAPI.new
|
|
5
5
|
|
|
6
6
|
body = DatadogAPIClient::V1::AzureAccount.new({
|
|
7
|
+
app_service_plan_filters: "key:value,filter:example",
|
|
7
8
|
automute: true,
|
|
8
9
|
client_id: "testc7f6-1234-5678-9101-3fcbf464test",
|
|
9
10
|
client_secret: "testingx./Sw*g/Y33t..R1cH+hScMDt",
|
|
11
|
+
cspm_enabled: true,
|
|
12
|
+
custom_metrics_enabled: true,
|
|
10
13
|
errors: [
|
|
11
14
|
"*",
|
|
12
15
|
],
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Create a new dashboard with a timeseries widget using formulas and functions cloud cost query
|
|
2
|
+
|
|
3
|
+
require "datadog_api_client"
|
|
4
|
+
api_instance = DatadogAPIClient::V1::DashboardsAPI.new
|
|
5
|
+
|
|
6
|
+
body = DatadogAPIClient::V1::Dashboard.new({
|
|
7
|
+
title: "Example-Dashboard",
|
|
8
|
+
widgets: [
|
|
9
|
+
DatadogAPIClient::V1::Widget.new({
|
|
10
|
+
definition: DatadogAPIClient::V1::TimeseriesWidgetDefinition.new({
|
|
11
|
+
title: "Example Cloud Cost Query",
|
|
12
|
+
title_size: "16",
|
|
13
|
+
title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT,
|
|
14
|
+
type: DatadogAPIClient::V1::TimeseriesWidgetDefinitionType::TIMESERIES,
|
|
15
|
+
requests: [
|
|
16
|
+
DatadogAPIClient::V1::TimeseriesWidgetRequest.new({
|
|
17
|
+
formulas: [
|
|
18
|
+
DatadogAPIClient::V1::WidgetFormula.new({
|
|
19
|
+
formula: "query1",
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
queries: [
|
|
23
|
+
DatadogAPIClient::V1::FormulaAndFunctionCloudCostQueryDefinition.new({
|
|
24
|
+
data_source: DatadogAPIClient::V1::FormulaAndFunctionCloudCostDataSource::CLOUD_COST,
|
|
25
|
+
name: "query1",
|
|
26
|
+
query: "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)",
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
29
|
+
response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::TIMESERIES,
|
|
30
|
+
style: DatadogAPIClient::V1::WidgetRequestStyle.new({
|
|
31
|
+
palette: "dog_classic",
|
|
32
|
+
line_type: DatadogAPIClient::V1::WidgetLineType::SOLID,
|
|
33
|
+
line_width: DatadogAPIClient::V1::WidgetLineWidth::NORMAL,
|
|
34
|
+
}),
|
|
35
|
+
display_type: DatadogAPIClient::V1::WidgetDisplayType::BARS,
|
|
36
|
+
}),
|
|
37
|
+
],
|
|
38
|
+
}),
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
|
|
42
|
+
})
|
|
43
|
+
p api_instance.create_dashboard(body)
|