datadog_api_client 2.13.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/.apigentools-info +4 -4
  3. data/.generator/schemas/v1/openapi.yaml +346 -36
  4. data/.generator/schemas/v2/openapi.yaml +436 -174
  5. data/.generator/src/generator/formatter.py +34 -29
  6. data/.generator/src/generator/openapi.py +3 -1
  7. data/.generator/src/generator/templates/api.j2 +8 -2
  8. data/.generator/src/generator/templates/api_client.j2 +81 -53
  9. data/.generator/src/generator/templates/configuration.j2 +21 -0
  10. data/.pre-commit-config.yaml +2 -2
  11. data/CHANGELOG.md +57 -0
  12. data/README.md +23 -0
  13. data/examples/v1/azure-integration/CreateAzureIntegration.rb +3 -0
  14. data/examples/v1/azure-integration/DeleteAzureIntegration.rb +3 -0
  15. data/examples/v1/azure-integration/UpdateAzureHostFilters.rb +3 -0
  16. data/examples/v1/azure-integration/UpdateAzureIntegration.rb +3 -0
  17. data/examples/v1/dashboards/CreateDashboard_252716965.rb +6 -0
  18. data/examples/v1/dashboards/CreateDashboard_2618036642.rb +36 -0
  19. data/examples/v1/dashboards/CreateDashboard_2705593938.rb +3 -0
  20. data/examples/v1/dashboards/CreateDashboard_3777304439.rb +50 -0
  21. data/examples/v1/dashboards/DeletePublicDashboardInvitation.rb +3 -3
  22. data/examples/v1/dashboards/ListDashboards_1062671515.rb +8 -0
  23. data/examples/v1/monitors/ListMonitors_2966492814.rb +8 -0
  24. data/examples/v1/notebooks/ListNotebooks_788665428.rb +8 -0
  25. data/examples/v1/service-level-objective-corrections/ListSLOCorrection_2647266873.rb +8 -0
  26. data/examples/v1/service-level-objectives/ListSLOs_3036942817.rb +8 -0
  27. data/examples/v1/synthetics/CreateSyntheticsAPITest_1487281163.rb +2 -0
  28. data/examples/v1/synthetics/ListTests_1938827783.rb +8 -0
  29. data/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent.rb +3 -0
  30. data/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_129899466.rb +3 -0
  31. data/examples/v2/downtimes/CancelDowntime.rb +0 -3
  32. data/examples/v2/downtimes/CreateDowntime.rb +0 -3
  33. data/examples/v2/downtimes/GetDowntime.rb +0 -3
  34. data/examples/v2/downtimes/ListDowntimes.rb +0 -3
  35. data/examples/v2/downtimes/ListDowntimes_805770330.rb +8 -0
  36. data/examples/v2/downtimes/ListMonitorDowntimes.rb +0 -3
  37. data/examples/v2/downtimes/ListMonitorDowntimes_128979780.rb +0 -3
  38. data/examples/v2/downtimes/UpdateDowntime.rb +0 -3
  39. data/examples/v2/logs/AggregateLogs_2955613758.rb +1 -1
  40. data/examples/v2/security-monitoring/CreateSecurityMonitoringRule_1092490364.rb +1 -1
  41. data/examples/v2/security-monitoring/UpdateSecurityMonitoringRule_428087276.rb +1 -1
  42. data/examples/v2/teams/CreateTeam.rb +2 -2
  43. data/examples/v2/teams/CreateTeam_252121814.rb +24 -0
  44. data/examples/v2/teams/GetUserMemberships.rb +8 -0
  45. data/examples/v2/teams/ListTeams_3592098458.rb +8 -0
  46. data/examples/v2/teams/UpdateTeam.rb +9 -0
  47. data/examples/v2/users/ListUsers_4075885358.rb +8 -0
  48. data/lib/datadog_api_client/api_client.rb +81 -53
  49. data/lib/datadog_api_client/configuration.rb +22 -6
  50. data/lib/datadog_api_client/inflector.rb +11 -1
  51. data/lib/datadog_api_client/v1/api/dashboards_api.rb +25 -0
  52. data/lib/datadog_api_client/v1/api/monitors_api.rb +22 -0
  53. data/lib/datadog_api_client/v1/api/notebooks_api.rb +21 -0
  54. data/lib/datadog_api_client/v1/api/service_level_objective_corrections_api.rb +23 -2
  55. data/lib/datadog_api_client/v1/api/service_level_objectives_api.rb +31 -10
  56. data/lib/datadog_api_client/v1/api/synthetics_api.rb +25 -3
  57. data/lib/datadog_api_client/v1/api/usage_metering_api.rb +3 -3
  58. data/lib/datadog_api_client/v1/models/azure_account.rb +32 -1
  59. data/lib/datadog_api_client/v1/models/distribution_widget_definition.rb +13 -1
  60. data/lib/datadog_api_client/v1/models/heat_map_widget_request.rb +35 -1
  61. data/lib/datadog_api_client/v1/models/hourly_usage_attribution_usage_type.rb +4 -0
  62. data/lib/datadog_api_client/v1/models/list_stream_source.rb +1 -0
  63. data/lib/datadog_api_client/v1/models/monitor.rb +1 -1
  64. data/lib/datadog_api_client/v1/models/monitor_options.rb +1 -1
  65. data/lib/datadog_api_client/v1/models/monthly_usage_attribution_supported_metrics.rb +8 -0
  66. data/lib/datadog_api_client/v1/models/monthly_usage_attribution_values.rb +81 -1
  67. data/lib/datadog_api_client/v1/models/sunburst_widget_request.rb +14 -4
  68. data/lib/datadog_api_client/v1/models/synthetics_assertion_target.rb +11 -1
  69. data/lib/datadog_api_client/v1/models/synthetics_assertion_timings_scope.rb +27 -0
  70. data/lib/datadog_api_client/v1/models/synthetics_test_request.rb +11 -1
  71. data/lib/datadog_api_client/v1/models/usage_ci_visibility_hour.rb +12 -1
  72. data/lib/datadog_api_client/v1/models/usage_profiling_hour.rb +12 -1
  73. data/lib/datadog_api_client/v1/models/usage_summary_date.rb +44 -4
  74. data/lib/datadog_api_client/v1/models/usage_summary_date_org.rb +44 -4
  75. data/lib/datadog_api_client/v1/models/usage_summary_response.rb +44 -4
  76. data/lib/datadog_api_client/v1/models/widget_comparator.rb +1 -0
  77. data/lib/datadog_api_client/v2/api/audit_api.rb +1 -1
  78. data/lib/datadog_api_client/v2/api/ci_visibility_pipelines_api.rb +11 -7
  79. data/lib/datadog_api_client/v2/api/ci_visibility_tests_api.rb +1 -1
  80. data/lib/datadog_api_client/v2/api/downtimes_api.rb +25 -36
  81. data/lib/datadog_api_client/v2/api/events_api.rb +1 -1
  82. data/lib/datadog_api_client/v2/api/ip_allowlist_api.rb +2 -2
  83. data/lib/datadog_api_client/v2/api/logs_api.rb +1 -1
  84. data/lib/datadog_api_client/v2/api/metrics_api.rb +1 -1
  85. data/lib/datadog_api_client/v2/api/processes_api.rb +1 -1
  86. data/lib/datadog_api_client/v2/api/rum_api.rb +1 -1
  87. data/lib/datadog_api_client/v2/api/security_monitoring_api.rb +6 -6
  88. data/lib/datadog_api_client/v2/api/service_definition_api.rb +2 -2
  89. data/lib/datadog_api_client/v2/api/spans_api.rb +1 -1
  90. data/lib/datadog_api_client/v2/api/spans_metrics_api.rb +2 -2
  91. data/lib/datadog_api_client/v2/api/teams_api.rb +87 -0
  92. data/lib/datadog_api_client/v2/api/usage_metering_api.rb +1 -1
  93. data/lib/datadog_api_client/v2/api/users_api.rb +22 -0
  94. data/lib/datadog_api_client/v2/models/application_key_create_attributes.rb +1 -1
  95. data/lib/datadog_api_client/v2/models/application_key_update_attributes.rb +1 -1
  96. data/lib/datadog_api_client/v2/models/audit_logs_event_attributes.rb +11 -1
  97. data/lib/datadog_api_client/v2/models/ci_app_event_attributes.rb +9 -21
  98. data/lib/datadog_api_client/v2/models/ci_app_pipeline_event.rb +1 -1
  99. data/lib/datadog_api_client/v2/models/{team_data.rb → ci_app_pipeline_event_attributes.rb} +24 -62
  100. data/lib/datadog_api_client/v2/models/ci_app_pipeline_level.rb +30 -0
  101. data/lib/datadog_api_client/v2/models/ci_app_pipelines_query_filter.rb +1 -1
  102. data/lib/datadog_api_client/v2/models/ci_app_test_level.rb +29 -0
  103. data/lib/datadog_api_client/v2/models/ci_app_tests_analytics_aggregate_response.rb +1 -1
  104. data/lib/datadog_api_client/v2/models/ci_app_tests_query_filter.rb +1 -1
  105. data/lib/datadog_api_client/v2/models/cloud_configuration_rule_compliance_signal_options.rb +25 -1
  106. data/lib/datadog_api_client/v2/models/dashboard_list_item.rb +25 -1
  107. data/lib/datadog_api_client/v2/models/downtime_relationships_monitor_data.rb +1 -1
  108. data/lib/datadog_api_client/v2/models/downtime_schedule_one_time_response.rb +19 -1
  109. data/lib/datadog_api_client/v2/models/formula_limit.rb +1 -0
  110. data/lib/datadog_api_client/v2/models/full_application_key_attributes.rb +1 -1
  111. data/lib/datadog_api_client/v2/models/logs_aggregate_request.rb +1 -1
  112. data/lib/datadog_api_client/v2/models/logs_aggregate_request_page.rb +1 -1
  113. data/lib/datadog_api_client/v2/models/logs_group_by.rb +3 -2
  114. data/lib/datadog_api_client/v2/models/logs_group_by_histogram.rb +1 -1
  115. data/lib/datadog_api_client/v2/models/logs_list_request.rb +1 -1
  116. data/lib/datadog_api_client/v2/models/logs_query_options.rb +1 -1
  117. data/lib/datadog_api_client/v2/models/logs_response_metadata_page.rb +1 -1
  118. data/lib/datadog_api_client/v2/models/on_demand_concurrency_cap.rb +14 -4
  119. data/lib/datadog_api_client/v2/models/on_demand_concurrency_cap_type.rb +26 -0
  120. data/lib/datadog_api_client/v2/models/partial_application_key_attributes.rb +1 -1
  121. data/lib/datadog_api_client/v2/models/query_formula.rb +1 -0
  122. data/lib/datadog_api_client/v2/models/relationship_to_team_links.rb +14 -4
  123. data/lib/datadog_api_client/v2/models/relationship_to_user_team_permission.rb +14 -4
  124. data/lib/datadog_api_client/v2/models/security_monitoring_signal_metadata_type.rb +26 -0
  125. data/lib/datadog_api_client/v2/models/security_monitoring_signal_response.rb +80 -0
  126. data/lib/datadog_api_client/v2/models/security_monitoring_signal_rule_response_query.rb +26 -2
  127. data/lib/datadog_api_client/v2/models/security_monitoring_signal_state_update_data.rb +24 -4
  128. data/lib/datadog_api_client/v2/models/security_monitoring_signal_triage_update_data.rb +24 -4
  129. data/lib/datadog_api_client/v2/models/security_monitoring_standard_rule_query.rb +1 -19
  130. data/lib/datadog_api_client/v2/models/security_monitoring_triage_user.rb +11 -1
  131. data/lib/datadog_api_client/v2/models/sensitive_data_scanner_get_config_response_data.rb +11 -1
  132. data/lib/datadog_api_client/v2/models/sensitive_data_scanner_meta.rb +11 -1
  133. data/lib/datadog_api_client/v2/models/sensitive_data_scanner_standard_pattern_attributes.rb +11 -1
  134. data/lib/datadog_api_client/v2/models/team_attributes.rb +50 -4
  135. data/lib/datadog_api_client/v2/models/team_create_attributes.rb +57 -4
  136. data/lib/datadog_api_client/v2/models/team_relationships_links.rb +80 -0
  137. data/lib/datadog_api_client/v2/models/team_response.rb +1 -1
  138. data/lib/datadog_api_client/v2/models/team_update_attributes.rb +57 -4
  139. data/lib/datadog_api_client/v2/models/teams_response.rb +24 -4
  140. data/lib/datadog_api_client/v2/models/teams_response_links.rb +129 -0
  141. data/lib/datadog_api_client/v2/models/teams_response_meta.rb +80 -0
  142. data/lib/datadog_api_client/v2/models/teams_response_meta_pagination.rb +150 -0
  143. data/lib/datadog_api_client/v2/models/usage_attributes_object.rb +11 -1
  144. data/lib/datadog_api_client/v2/models/user_teams_response.rb +24 -4
  145. data/lib/datadog_api_client/version.rb +1 -1
  146. data/spec/configuration_spec.rb +17 -0
  147. data/spec/retry_spec.rb +44 -0
  148. metadata +28 -3
@@ -5,11 +5,11 @@ api_instance = DatadogAPIClient::V1::DashboardsAPI.new
5
5
 
6
6
  body = DatadogAPIClient::V1::SharedDashboardInvites.new({
7
7
  data: [
8
- SharedDashboardInvitesDataObject.new({
9
- attributes: SharedDashboardInvitesDataObjectAttributes.new({
8
+ DatadogAPIClient::V1::SharedDashboardInvitesDataObject.new({
9
+ attributes: DatadogAPIClient::V1::SharedDashboardInvitesDataObjectAttributes.new({
10
10
  email: "test@datadoghq.com",
11
11
  }),
12
- type: DashboardInviteType::PUBLIC_DASHBOARD_INVITATION,
12
+ type: DatadogAPIClient::V1::DashboardInviteType::PUBLIC_DASHBOARD_INVITATION,
13
13
  }),
14
14
  ],
15
15
  })
@@ -0,0 +1,8 @@
1
+ # Get all dashboards returns "OK" response with pagination
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::DashboardsAPI.new
5
+ opts = {
6
+ count: 2,
7
+ }
8
+ api_instance.list_dashboards_with_pagination(opts) { |item| puts item }
@@ -0,0 +1,8 @@
1
+ # Get all monitor details returns "OK" response with pagination
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::MonitorsAPI.new
5
+ opts = {
6
+ page_size: 2,
7
+ }
8
+ api_instance.list_monitors_with_pagination(opts) { |item| puts item }
@@ -0,0 +1,8 @@
1
+ # Get all notebooks returns "OK" response with pagination
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::NotebooksAPI.new
5
+ opts = {
6
+ count: 2,
7
+ }
8
+ api_instance.list_notebooks_with_pagination(opts) { |item| puts item }
@@ -0,0 +1,8 @@
1
+ # Get all SLO corrections returns "OK" response with pagination
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
5
+ opts = {
6
+ limit: 2,
7
+ }
8
+ api_instance.list_slo_correction_with_pagination(opts) { |item| puts item }
@@ -0,0 +1,8 @@
1
+ # Get all SLOs returns "OK" response with pagination
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::ServiceLevelObjectivesAPI.new
5
+ opts = {
6
+ limit: 2,
7
+ }
8
+ api_instance.list_slos_with_pagination(opts) { |item| puts item }
@@ -16,6 +16,7 @@ body = DatadogAPIClient::V1::SyntheticsAPITest.new({
16
16
  operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::LESS_THAN,
17
17
  target: 2000,
18
18
  type: DatadogAPIClient::V1::SyntheticsAssertionType::RESPONSE_TIME,
19
+ timings_scope: DatadogAPIClient::V1::SyntheticsAssertionTimingsScope::WITHOUT_DNS,
19
20
  }),
20
21
  DatadogAPIClient::V1::SyntheticsAssertionJSONPathTarget.new({
21
22
  operator: DatadogAPIClient::V1::SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
@@ -77,6 +78,7 @@ body = DatadogAPIClient::V1::SyntheticsAPITest.new({
77
78
  token_api_authentication: DatadogAPIClient::V1::SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
78
79
  type: DatadogAPIClient::V1::SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
79
80
  }),
81
+ persist_cookies: true,
80
82
  }),
81
83
  }),
82
84
  locations: [
@@ -0,0 +1,8 @@
1
+ # Get the list of all Synthetic tests returns "OK - Returns the list of all Synthetic tests." response with pagination
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
5
+ opts = {
6
+ page_size: 2,
7
+ }
8
+ api_instance.list_tests_with_pagination(opts) { |item| puts item }
@@ -1,6 +1,9 @@
1
1
  # Send pipeline event returns "Request accepted for processing" response
2
2
 
3
3
  require "datadog_api_client"
4
+ DatadogAPIClient.configure do |config|
5
+ config.unstable_operations["v2.create_ci_app_pipeline_event".to_sym] = true
6
+ end
4
7
  api_instance = DatadogAPIClient::V2::CIVisibilityPipelinesAPI.new
5
8
 
6
9
  body = DatadogAPIClient::V2::CIAppCreatePipelineEventRequest.new({
@@ -1,6 +1,9 @@
1
1
  # Send pipeline job event returns "Request accepted for processing" response
2
2
 
3
3
  require "datadog_api_client"
4
+ DatadogAPIClient.configure do |config|
5
+ config.unstable_operations["v2.create_ci_app_pipeline_event".to_sym] = true
6
+ end
4
7
  api_instance = DatadogAPIClient::V2::CIVisibilityPipelinesAPI.new
5
8
 
6
9
  body = DatadogAPIClient::V2::CIAppCreatePipelineEventRequest.new({
@@ -1,9 +1,6 @@
1
1
  # Cancel a downtime returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient.configure do |config|
5
- config.unstable_operations["v2.cancel_downtime".to_sym] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V2::DowntimesAPI.new
8
5
 
9
6
  # there is a valid "downtime_v2" in the system
@@ -1,9 +1,6 @@
1
1
  # Schedule a downtime returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient.configure do |config|
5
- config.unstable_operations["v2.create_downtime".to_sym] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V2::DowntimesAPI.new
8
5
 
9
6
  body = DatadogAPIClient::V2::DowntimeCreateRequest.new({
@@ -1,9 +1,6 @@
1
1
  # Get a downtime returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient.configure do |config|
5
- config.unstable_operations["v2.get_downtime".to_sym] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V2::DowntimesAPI.new
8
5
 
9
6
  # there is a valid "downtime_v2" in the system
@@ -1,8 +1,5 @@
1
1
  # Get all downtimes returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient.configure do |config|
5
- config.unstable_operations["v2.list_downtimes".to_sym] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V2::DowntimesAPI.new
8
5
  p api_instance.list_downtimes()
@@ -0,0 +1,8 @@
1
+ # Get all downtimes returns "OK" response with pagination
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V2::DowntimesAPI.new
5
+ opts = {
6
+ page_limit: 2,
7
+ }
8
+ api_instance.list_downtimes_with_pagination(opts) { |item| puts item }
@@ -1,8 +1,5 @@
1
1
  # Get active downtimes for a monitor returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient.configure do |config|
5
- config.unstable_operations["v2.list_monitor_downtimes".to_sym] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V2::DowntimesAPI.new
8
5
  p api_instance.list_monitor_downtimes(9223372036854775807)
@@ -1,8 +1,5 @@
1
1
  # Get all downtimes for a monitor returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient.configure do |config|
5
- config.unstable_operations["v2.list_monitor_downtimes".to_sym] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V2::DowntimesAPI.new
8
5
  p api_instance.list_monitor_downtimes(35534610)
@@ -1,9 +1,6 @@
1
1
  # Update a downtime returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient.configure do |config|
5
- config.unstable_operations["v2.update_downtime".to_sym] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V2::DowntimesAPI.new
8
5
 
9
6
  # there is a valid "downtime_v2" in the system
@@ -29,7 +29,7 @@ body = DatadogAPIClient::V2::LogsAggregateRequest.new({
29
29
  aggregation: DatadogAPIClient::V2::LogsAggregationFunction::PERCENTILE_90,
30
30
  metric: "@duration",
31
31
  }),
32
- total: true,
32
+ total: "recall",
33
33
  }),
34
34
  ],
35
35
  })
@@ -20,7 +20,7 @@ body = DatadogAPIClient::V2::CloudConfigurationRuleCreatePayload.new({
20
20
  resource_type: "gcp_compute_disk",
21
21
  complex_rule: false,
22
22
  rego_rule: DatadogAPIClient::V2::CloudConfigurationRegoRule.new({
23
- policy: 'package datadog\n',
23
+ policy: 'package datadog\n\nimport data.datadog.output as dd_output\n\nimport future.keywords.contains\nimport future.keywords.if\nimport future.keywords.in\n\nmilliseconds_in_a_day := ((1000 * 60) * 60) * 24\n\neval(iam_service_account_key) = "skip" if {\n\tiam_service_account_key.disabled\n} else = "pass" if {\n\t(iam_service_account_key.resource_seen_at / milliseconds_in_a_day) - (iam_service_account_key.valid_after_time / milliseconds_in_a_day) <= 90\n} else = "fail"\n\n# This part remains unchanged for all rules\nresults contains result if {\n\tsome resource in input.resources[input.main_resource_type]\n\tresult := dd_output.format(resource, eval(resource))\n}\n',
24
24
  resource_types: [
25
25
  "gcp_compute_disk",
26
26
  ],
@@ -19,7 +19,7 @@ body = DatadogAPIClient::V2::SecurityMonitoringRuleUpdatePayload.new({
19
19
  compliance_rule_options: DatadogAPIClient::V2::CloudConfigurationComplianceRuleOptions.new({
20
20
  resource_type: "gcp_compute_disk",
21
21
  rego_rule: DatadogAPIClient::V2::CloudConfigurationRegoRule.new({
22
- policy: 'package datadog\n',
22
+ policy: 'package datadog\n\nimport data.datadog.output as dd_output\n\nimport future.keywords.contains\nimport future.keywords.if\nimport future.keywords.in\n\nmilliseconds_in_a_day := ((1000 * 60) * 60) * 24\n\neval(iam_service_account_key) = "skip" if {\n\tiam_service_account_key.disabled\n} else = "pass" if {\n\t(iam_service_account_key.resource_seen_at / milliseconds_in_a_day) - (iam_service_account_key.valid_after_time / milliseconds_in_a_day) <= 90\n} else = "fail"\n\n# This part remains unchanged for all rules\nresults contains result if {\n\tsome resource in input.resources[input.main_resource_type]\n\tresult := dd_output.format(resource, eval(resource))\n}\n',
23
23
  resource_types: [
24
24
  "gcp_compute_disk",
25
25
  ],
@@ -6,8 +6,8 @@ api_instance = DatadogAPIClient::V2::TeamsAPI.new
6
6
  body = DatadogAPIClient::V2::TeamCreateRequest.new({
7
7
  data: DatadogAPIClient::V2::TeamCreate.new({
8
8
  attributes: DatadogAPIClient::V2::TeamCreateAttributes.new({
9
- handle: "handle-a0fc0297eb519635",
10
- name: "name-a0fc0297eb519635",
9
+ handle: "test-handle-a0fc0297eb519635",
10
+ name: "test-name-a0fc0297eb519635",
11
11
  }),
12
12
  relationships: DatadogAPIClient::V2::TeamCreateRelationships.new({
13
13
  users: DatadogAPIClient::V2::RelationshipToUsers.new({
@@ -0,0 +1,24 @@
1
+ # Create a team with V2 fields returns "CREATED" response
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V2::TeamsAPI.new
5
+
6
+ body = DatadogAPIClient::V2::TeamCreateRequest.new({
7
+ data: DatadogAPIClient::V2::TeamCreate.new({
8
+ attributes: DatadogAPIClient::V2::TeamCreateAttributes.new({
9
+ handle: "test-handle-a0fc0297eb519635",
10
+ name: "test-name-a0fc0297eb519635",
11
+ avatar: "🥑",
12
+ banner: 7,
13
+ visible_modules: [
14
+ "m1",
15
+ "m2",
16
+ ],
17
+ hidden_modules: [
18
+ "m3",
19
+ ],
20
+ }),
21
+ type: DatadogAPIClient::V2::TeamType::TEAM,
22
+ }),
23
+ })
24
+ p api_instance.create_team(body)
@@ -0,0 +1,8 @@
1
+ # Get user memberships returns "Represents a user's association to a team" response
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V2::TeamsAPI.new
5
+
6
+ # there is a valid "user" in the system
7
+ USER_DATA_ID = ENV["USER_DATA_ID"]
8
+ p api_instance.get_user_memberships(USER_DATA_ID)
@@ -0,0 +1,8 @@
1
+ # Get all teams returns "OK" response with pagination
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V2::TeamsAPI.new
5
+ opts = {
6
+ page_size: 2,
7
+ }
8
+ api_instance.list_teams_with_pagination(opts) { |item| puts item }
@@ -13,6 +13,15 @@ body = DatadogAPIClient::V2::TeamUpdateRequest.new({
13
13
  attributes: DatadogAPIClient::V2::TeamUpdateAttributes.new({
14
14
  handle: DD_TEAM_DATA_ATTRIBUTES_HANDLE,
15
15
  name: "Example Team updated",
16
+ avatar: "🥑",
17
+ banner: 7,
18
+ hidden_modules: [
19
+ "m3",
20
+ ],
21
+ visible_modules: [
22
+ "m1",
23
+ "m2",
24
+ ],
16
25
  }),
17
26
  type: DatadogAPIClient::V2::TeamType::TEAM,
18
27
  }),
@@ -0,0 +1,8 @@
1
+ # List all users returns "OK" response with pagination
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V2::UsersAPI.new
5
+ opts = {
6
+ page_size: 2,
7
+ }
8
+ api_instance.list_users_with_pagination(opts) { |item| puts item }
@@ -55,71 +55,99 @@ module DatadogAPIClient
55
55
  # the data deserialized from response body (could be nil), response status code and response headers.
56
56
  def call_api(http_method, path, opts = {})
57
57
  request = build_request(http_method, path, opts)
58
- if opts[:stream_body]
59
- tempfile = nil
60
- encoding = nil
61
-
62
- response = request.perform do | chunk |
63
- unless tempfile
64
- content_disposition = chunk.http_response.header['Content-Disposition']
65
- if content_disposition && content_disposition =~ /filename=/i
66
- filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
67
- prefix = sanitize_filename(filename)
68
- else
69
- prefix = 'download-'
70
- end
71
- prefix = prefix + '-' unless prefix.end_with?('-')
72
- unless encoding
73
- encoding = chunk.encoding
58
+ attempt = 0
59
+ loop do
60
+ if opts[:stream_body]
61
+ tempfile = nil
62
+ encoding = nil
63
+
64
+ response = request.perform do | chunk |
65
+ unless tempfile
66
+ content_disposition = chunk.http_response.header['Content-Disposition']
67
+ if content_disposition && content_disposition =~ /filename=/i
68
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
69
+ prefix = sanitize_filename(filename)
70
+ else
71
+ prefix = 'download-'
72
+ end
73
+ prefix = prefix + '-' unless prefix.end_with?('-')
74
+ unless encoding
75
+ encoding = chunk.encoding
76
+ end
77
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
78
+ @tempfile = tempfile
74
79
  end
75
- tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
76
- @tempfile = tempfile
80
+ chunk.force_encoding(encoding)
81
+ tempfile.write(chunk)
82
+ end
83
+ if tempfile
84
+ tempfile.close
85
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
86
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
87
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
88
+ "explicitly with `tempfile.delete`"
77
89
  end
78
- chunk.force_encoding(encoding)
79
- tempfile.write(chunk)
90
+ else
91
+ response = request.perform
80
92
  end
81
- if tempfile
82
- tempfile.close
83
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
84
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
85
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
86
- "explicitly with `tempfile.delete`"
93
+
94
+ if @config.debugging
95
+ @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
87
96
  end
88
- else
89
- response = request.perform
90
- end
91
97
 
92
- if @config.debugging
93
- @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
94
- end
98
+ unless response.success?
99
+ if response.request_timeout?
100
+ fail APIError.new('Connection timed out')
101
+ elsif response.code == 0
102
+ # Errors from libcurl will be made visible here
103
+ fail APIError.new(:code => 0,
104
+ :message => response.return_message)
105
+ else
106
+ body = response.body
107
+ if response.headers['Content-Encoding'].eql?('gzip') && !(body.nil? || body.empty?) then
108
+ gzip = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)
109
+ body = gzip.inflate(body)
110
+ gzip.close
111
+ end
112
+ if should_retry(attempt, @config.max_retries, response.code, @config.enable_retry)
113
+ sleep calculate_retry_interval(response, @config.backoff_base, @config.backoff_multiplier, attempt, @config.timeout)
114
+ attempt = attempt + 1
115
+ next
116
+ else
117
+ fail APIError.new(:code => response.code,
118
+ :response_headers => response.headers,
119
+ :response_body => body),
120
+ response.message
121
+ end
122
+ end
123
+ end
95
124
 
96
- unless response.success?
97
- if response.request_timeout?
98
- fail APIError.new('Connection timed out')
99
- elsif response.code == 0
100
- # Errors from libcurl will be made visible here
101
- fail APIError.new(:code => 0,
102
- :message => response.return_message)
125
+ if opts[:return_type]
126
+ data = deserialize(opts[:api_version], response, opts[:return_type])
103
127
  else
104
- body = response.body
105
- if response.headers['Content-Encoding'].eql?('gzip') && !(body.nil? || body.empty?) then
106
- gzip = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)
107
- body = gzip.inflate(body)
108
- gzip.close
109
- end
110
- fail APIError.new(:code => response.code,
111
- :response_headers => response.headers,
112
- :response_body => body),
113
- response.message
128
+ data = nil
114
129
  end
130
+ return data, response.code, response.headers
115
131
  end
132
+ end
133
+
134
+ # Check if an http request should be retried
135
+ def should_retry(attempt, max_retries, http_code, enable_retry)
136
+ (http_code == 429 || http_code >= 500) && max_retries > attempt && enable_retry
137
+ end
116
138
 
117
- if opts[:return_type]
118
- data = deserialize(opts[:api_version], response, opts[:return_type])
139
+ # Calculate the sleep interval between 2 retry attempts
140
+ def calculate_retry_interval(response, backoff_base, backoff_multiplier, attempt, timeout)
141
+ reset_header = response.headers['X-Ratelimit-Reset']
142
+ if !reset_header.nil? && !reset_header.empty?
143
+ sleep_time = reset_header.to_i
119
144
  else
120
- data = nil
145
+ sleep_time = (backoff_multiplier**attempt) * backoff_base
146
+ if timeout && timeout > 0
147
+ sleep_time = [timeout, sleep_time].min
148
+ end
121
149
  end
122
- return data, response.code, response.headers
150
+ sleep_time
123
151
  end
124
152
 
125
153
  # Build the HTTP request
@@ -149,6 +149,16 @@ module DatadogAPIClient
149
149
  # Password for proxy server authentication
150
150
  attr_accessor :http_proxypass
151
151
 
152
+ # Enable retry when rate limited
153
+ attr_accessor :enable_retry
154
+
155
+ # Retry backoff calculation parameters
156
+ attr_accessor :backoff_base
157
+ attr_accessor :backoff_multiplier
158
+
159
+ # Maximum number of retry attempts allowed
160
+ attr_accessor :max_retries
161
+
152
162
  def initialize
153
163
  @scheme = 'https'
154
164
  @host = 'api.datadoghq.com'
@@ -159,6 +169,10 @@ module DatadogAPIClient
159
169
  @server_operation_variables = {}
160
170
  @api_key = {}
161
171
  @api_key_prefix = {}
172
+ @enable_retry = false
173
+ @backoff_base = 2
174
+ @backoff_multiplier = 2
175
+ @max_retries = 3
162
176
  @timeout = nil
163
177
  @client_side_validation = true
164
178
  @verify_ssl = true
@@ -175,12 +189,7 @@ module DatadogAPIClient
175
189
  @http_proxypass = nil
176
190
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
177
191
  @unstable_operations = {
178
- "v2.cancel_downtime": false,
179
- "v2.create_downtime": false,
180
- "v2.get_downtime": false,
181
- "v2.list_downtimes": false,
182
- "v2.list_monitor_downtimes": false,
183
- "v2.update_downtime": false,
192
+ "v2.create_ci_app_pipeline_event": false,
184
193
  "v2.list_events": false,
185
194
  "v2.search_events": false,
186
195
  "v2.create_incident": false,
@@ -229,6 +238,13 @@ module DatadogAPIClient
229
238
  @@default ||= Configuration.new
230
239
  end
231
240
 
241
+ def backoff_base=(value)
242
+ if value < 2
243
+ raise ArgumentError, 'backoff_base cannot be smaller than 2'
244
+ end
245
+ @backoff_base = value
246
+ end
247
+
232
248
  def configure
233
249
  yield(self) if block_given?
234
250
  end
@@ -517,6 +517,7 @@ module DatadogAPIClient
517
517
  "v1.synthetics_assertion_json_path_target_target" => "SyntheticsAssertionJSONPathTargetTarget",
518
518
  "v1.synthetics_assertion_operator" => "SyntheticsAssertionOperator",
519
519
  "v1.synthetics_assertion_target" => "SyntheticsAssertionTarget",
520
+ "v1.synthetics_assertion_timings_scope" => "SyntheticsAssertionTimingsScope",
520
521
  "v1.synthetics_assertion_type" => "SyntheticsAssertionType",
521
522
  "v1.synthetics_assertion_x_path_operator" => "SyntheticsAssertionXPathOperator",
522
523
  "v1.synthetics_assertion_x_path_target" => "SyntheticsAssertionXPathTarget",
@@ -881,6 +882,7 @@ module DatadogAPIClient
881
882
  "v2.ci_app_group_by_total" => "CIAppGroupByTotal",
882
883
  "v2.ci_app_host_info" => "CIAppHostInfo",
883
884
  "v2.ci_app_pipeline_event" => "CIAppPipelineEvent",
885
+ "v2.ci_app_pipeline_event_attributes" => "CIAppPipelineEventAttributes",
884
886
  "v2.ci_app_pipeline_event_job" => "CIAppPipelineEventJob",
885
887
  "v2.ci_app_pipeline_event_job_level" => "CIAppPipelineEventJobLevel",
886
888
  "v2.ci_app_pipeline_event_job_status" => "CIAppPipelineEventJobStatus",
@@ -898,6 +900,7 @@ module DatadogAPIClient
898
900
  "v2.ci_app_pipeline_event_step_level" => "CIAppPipelineEventStepLevel",
899
901
  "v2.ci_app_pipeline_event_step_status" => "CIAppPipelineEventStepStatus",
900
902
  "v2.ci_app_pipeline_event_type_name" => "CIAppPipelineEventTypeName",
903
+ "v2.ci_app_pipeline_level" => "CIAppPipelineLevel",
901
904
  "v2.ci_app_pipelines_aggregate_request" => "CIAppPipelinesAggregateRequest",
902
905
  "v2.ci_app_pipelines_aggregation_buckets_response" => "CIAppPipelinesAggregationBucketsResponse",
903
906
  "v2.ci_app_pipelines_analytics_aggregate_response" => "CIAppPipelinesAnalyticsAggregateResponse",
@@ -917,6 +920,7 @@ module DatadogAPIClient
917
920
  "v2.ci_app_test_events_request" => "CIAppTestEventsRequest",
918
921
  "v2.ci_app_test_events_response" => "CIAppTestEventsResponse",
919
922
  "v2.ci_app_test_event_type_name" => "CIAppTestEventTypeName",
923
+ "v2.ci_app_test_level" => "CIAppTestLevel",
920
924
  "v2.ci_app_tests_aggregate_request" => "CIAppTestsAggregateRequest",
921
925
  "v2.ci_app_tests_aggregation_buckets_response" => "CIAppTestsAggregationBucketsResponse",
922
926
  "v2.ci_app_tests_analytics_aggregate_response" => "CIAppTestsAnalyticsAggregateResponse",
@@ -1421,6 +1425,7 @@ module DatadogAPIClient
1421
1425
  "v2.on_demand_concurrency_cap" => "OnDemandConcurrencyCap",
1422
1426
  "v2.on_demand_concurrency_cap_attributes" => "OnDemandConcurrencyCapAttributes",
1423
1427
  "v2.on_demand_concurrency_cap_response" => "OnDemandConcurrencyCapResponse",
1428
+ "v2.on_demand_concurrency_cap_type" => "OnDemandConcurrencyCapType",
1424
1429
  "v2.opsgenie_service_create_attributes" => "OpsgenieServiceCreateAttributes",
1425
1430
  "v2.opsgenie_service_create_data" => "OpsgenieServiceCreateData",
1426
1431
  "v2.opsgenie_service_create_request" => "OpsgenieServiceCreateRequest",
@@ -1620,6 +1625,8 @@ module DatadogAPIClient
1620
1625
  "v2.security_monitoring_signal_list_request" => "SecurityMonitoringSignalListRequest",
1621
1626
  "v2.security_monitoring_signal_list_request_filter" => "SecurityMonitoringSignalListRequestFilter",
1622
1627
  "v2.security_monitoring_signal_list_request_page" => "SecurityMonitoringSignalListRequestPage",
1628
+ "v2.security_monitoring_signal_metadata_type" => "SecurityMonitoringSignalMetadataType",
1629
+ "v2.security_monitoring_signal_response" => "SecurityMonitoringSignalResponse",
1623
1630
  "v2.security_monitoring_signal_rule_create_payload" => "SecurityMonitoringSignalRuleCreatePayload",
1624
1631
  "v2.security_monitoring_signal_rule_query" => "SecurityMonitoringSignalRuleQuery",
1625
1632
  "v2.security_monitoring_signal_rule_response" => "SecurityMonitoringSignalRuleResponse",
@@ -1813,7 +1820,6 @@ module DatadogAPIClient
1813
1820
  "v2.team_create_attributes" => "TeamCreateAttributes",
1814
1821
  "v2.team_create_relationships" => "TeamCreateRelationships",
1815
1822
  "v2.team_create_request" => "TeamCreateRequest",
1816
- "v2.team_data" => "TeamData",
1817
1823
  "v2.team_included" => "TeamIncluded",
1818
1824
  "v2.team_link" => "TeamLink",
1819
1825
  "v2.team_link_attributes" => "TeamLinkAttributes",
@@ -1833,8 +1839,12 @@ module DatadogAPIClient
1833
1839
  "v2.team_permission_setting_update_request" => "TeamPermissionSettingUpdateRequest",
1834
1840
  "v2.team_permission_setting_value" => "TeamPermissionSettingValue",
1835
1841
  "v2.team_relationships" => "TeamRelationships",
1842
+ "v2.team_relationships_links" => "TeamRelationshipsLinks",
1836
1843
  "v2.team_response" => "TeamResponse",
1837
1844
  "v2.teams_response" => "TeamsResponse",
1845
+ "v2.teams_response_links" => "TeamsResponseLinks",
1846
+ "v2.teams_response_meta" => "TeamsResponseMeta",
1847
+ "v2.teams_response_meta_pagination" => "TeamsResponseMetaPagination",
1838
1848
  "v2.team_type" => "TeamType",
1839
1849
  "v2.team_update" => "TeamUpdate",
1840
1850
  "v2.team_update_attributes" => "TeamUpdateAttributes",
@@ -644,6 +644,8 @@ module DatadogAPIClient::V1
644
644
  # @param opts [Hash] the optional parameters
645
645
  # @option opts [Boolean] :filter_shared When `true`, this query only returns shared custom created or cloned dashboards.
646
646
  # @option opts [Boolean] :filter_deleted When `true`, this query returns only deleted custom-created or cloned dashboards. This parameter is incompatible with `filter[shared]`.
647
+ # @option opts [Integer] :count The maximum number of dashboards returned in the list.
648
+ # @option opts [Integer] :start The specific offset to use as the beginning of the returned response.
647
649
  # @return [Array<(DashboardSummary, Integer, Hash)>] DashboardSummary data, response status code and response headers
648
650
  def list_dashboards_with_http_info(opts = {})
649
651
 
@@ -657,6 +659,8 @@ module DatadogAPIClient::V1
657
659
  query_params = opts[:query_params] || {}
658
660
  query_params[:'filter[shared]'] = opts[:'filter_shared'] if !opts[:'filter_shared'].nil?
659
661
  query_params[:'filter[deleted]'] = opts[:'filter_deleted'] if !opts[:'filter_deleted'].nil?
662
+ query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
663
+ query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
660
664
 
661
665
  # header parameters
662
666
  header_params = opts[:header_params] || {}
@@ -693,6 +697,27 @@ module DatadogAPIClient::V1
693
697
  return data, status_code, headers
694
698
  end
695
699
 
700
+ # Get all dashboards.
701
+ #
702
+ # Provide a paginated version of {#list_dashboards}, returning all items.
703
+ #
704
+ # To use it you need to use a block: list_dashboards_with_pagination { |item| p item }
705
+ #
706
+ # @yield [DashboardSummaryDefinition] Paginated items
707
+ def list_dashboards_with_pagination(opts = {})
708
+ api_version = "V1"
709
+ page_size = @api_client.get_attribute_from_path(opts, "count", 100)
710
+ @api_client.set_attribute_from_path(api_version, opts, "count", Integer, page_size)
711
+ while true do
712
+ response = list_dashboards(opts)
713
+ @api_client.get_attribute_from_path(response, "dashboards").each { |item| yield(item) }
714
+ if @api_client.get_attribute_from_path(response, "dashboards").length < page_size
715
+ break
716
+ end
717
+ @api_client.set_attribute_from_path(api_version, opts, "start", Integer, @api_client.get_attribute_from_path(opts, "start", 0) + page_size)
718
+ end
719
+ end
720
+
696
721
  # Restore deleted dashboards.
697
722
  #
698
723
  # @see #restore_dashboards_with_http_info