datadog_api_client 1.9.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/.apigentools-info +4 -4
  3. data/.generator/schemas/v1/openapi.yaml +489 -124
  4. data/.generator/schemas/v2/openapi.yaml +701 -28
  5. data/.generator/src/generator/formatter.py +6 -1
  6. data/.generator/src/generator/openapi.py +5 -5
  7. data/.generator/src/generator/templates/api_client.j2 +1 -4
  8. data/.generator/src/generator/templates/model_generic.j2 +42 -3
  9. data/.github/workflows/prepare_release.yml +15 -3
  10. data/CHANGELOG.md +32 -0
  11. data/Makefile +1 -1
  12. data/README.md +16 -0
  13. data/check-examples.sh +0 -2
  14. data/examples/v1/aws-integration/UpdateAWSAccount.rb +8 -4
  15. data/examples/v1/downtimes/CreateDowntime_2908359488.rb +1 -0
  16. data/examples/v1/downtimes/CreateDowntime_3059354445.rb +1 -0
  17. data/examples/v1/downtimes/UpdateDowntime.rb +1 -0
  18. data/examples/v1/monitors/CreateMonitor_1969035628.rb +52 -0
  19. data/examples/v1/monitors/CreateMonitor_2520912138.rb +22 -0
  20. data/examples/v1/security-monitoring/AddSecurityMonitoringSignalToIncident.rb +9 -0
  21. data/examples/v1/security-monitoring/EditSecurityMonitoringSignalAssignee.rb +9 -0
  22. data/examples/v1/security-monitoring/EditSecurityMonitoringSignalState.rb +10 -0
  23. data/examples/v1/service-level-objective-corrections/CreateSLOCorrection.rb +0 -3
  24. data/examples/v1/service-level-objective-corrections/CreateSLOCorrection_1326388368.rb +0 -3
  25. data/examples/v1/service-level-objective-corrections/DeleteSLOCorrection.rb +0 -3
  26. data/examples/v1/service-level-objective-corrections/GetSLOCorrection.rb +0 -3
  27. data/examples/v1/service-level-objective-corrections/ListSLOCorrection.rb +0 -3
  28. data/examples/v1/service-level-objective-corrections/UpdateSLOCorrection.rb +0 -3
  29. data/examples/v1/service-level-objectives/GetSLOCorrections.rb +0 -3
  30. data/examples/v1/synthetics/CreateSyntheticsAPITest.rb +5 -0
  31. data/examples/v1/synthetics/CreateSyntheticsAPITest_1402674167.rb +44 -0
  32. data/examples/v1/synthetics/CreateSyntheticsBrowserTest_2932742688.rb +64 -0
  33. data/examples/v1/synthetics/UpdateBrowserTest.rb +5 -0
  34. data/examples/v1/usage-metering/GetHourlyUsageAttribution.rb +1 -1
  35. data/examples/v1/usage-metering/GetMonthlyUsageAttribution.rb +1 -1
  36. data/examples/v1/usage-metering/{GetMonthlyUsageAttribution_3738504447.rb → GetMonthlyUsageAttribution_3849653599.rb} +1 -1
  37. data/examples/v1/usage-metering/GetUsageAttribution.rb +1 -1
  38. data/examples/v1/usage-metering/GetUsageRumSessions_3271366243.rb +9 -0
  39. data/examples/v2/logs/SubmitLog.rb +1 -0
  40. data/examples/v2/logs-archives/CreateLogsArchive.rb +1 -0
  41. data/examples/v2/logs-archives/UpdateLogsArchive.rb +1 -0
  42. data/examples/v2/metrics/EstimateMetricsOutputSeries.rb +9 -0
  43. data/examples/v2/metrics/SubmitMetrics.rb +20 -0
  44. data/examples/v2/security-monitoring/UpdateSecurityMonitoringRule.rb +1 -0
  45. data/examples/v2/usage-metering/GetCostByOrg.rb +5 -0
  46. data/examples/v2/usage-metering/GetUsageApplicationSecurityMonitoring.rb +8 -0
  47. data/examples/v2/usage-metering/GetUsageLambdaTracedInvocations.rb +8 -0
  48. data/lib/datadog_api_client/v1/api/metrics_api.rb +1 -1
  49. data/lib/datadog_api_client/v1/api/monitors_api.rb +69 -56
  50. data/lib/datadog_api_client/v1/api/security_monitoring_api.rb +266 -0
  51. data/lib/datadog_api_client/v1/api/service_level_objective_corrections_api.rb +1 -1
  52. data/lib/datadog_api_client/v1/api/usage_metering_api.rb +10 -10
  53. data/lib/datadog_api_client/v1/api_client.rb +1 -4
  54. data/lib/datadog_api_client/v1/configuration.rb +0 -6
  55. data/lib/datadog_api_client/v1/models/add_signal_to_incident_request.rb +142 -0
  56. data/lib/datadog_api_client/v1/models/downtime.rb +11 -1
  57. data/lib/datadog_api_client/v1/models/downtime_child.rb +11 -1
  58. data/lib/datadog_api_client/v1/models/event.rb +1 -1
  59. data/lib/datadog_api_client/v1/models/http_log_item.rb +29 -4
  60. data/lib/datadog_api_client/v1/models/logs_category_processor.rb +1 -1
  61. data/lib/datadog_api_client/v1/models/logs_list_request.rb +1 -1
  62. data/lib/datadog_api_client/v1/models/logs_sort.rb +1 -1
  63. data/lib/datadog_api_client/v1/models/monitor_formula_and_function_events_data_source.rb +1 -0
  64. data/lib/datadog_api_client/v1/models/monitor_group_search_response_counts.rb +2 -2
  65. data/lib/datadog_api_client/v1/models/{monitor_search_response_counts_tag_item.rb → monitor_search_count_item.rb} +3 -3
  66. data/lib/datadog_api_client/v1/models/monitor_search_response_counts.rb +4 -4
  67. data/lib/datadog_api_client/v1/models/monitor_type.rb +1 -0
  68. data/lib/datadog_api_client/v1/models/monthly_usage_attribution_response.rb +1 -1
  69. data/lib/datadog_api_client/v1/models/notebook_cell_create_request.rb +146 -0
  70. data/lib/datadog_api_client/v1/models/notebook_cell_create_request_attributes.rb +68 -0
  71. data/lib/datadog_api_client/v1/models/series.rb +2 -2
  72. data/lib/datadog_api_client/v1/models/signal_archive_reason.rb +29 -0
  73. data/lib/datadog_api_client/v1/models/signal_assignee_update_request.rb +132 -0
  74. data/lib/datadog_api_client/v1/models/signal_state_update_request.rb +152 -0
  75. data/lib/datadog_api_client/v1/models/signal_triage_state.rb +28 -0
  76. data/lib/datadog_api_client/v1/models/slo_correction_create_request_attributes.rb +1 -1
  77. data/lib/datadog_api_client/v1/models/slo_correction_response_attributes.rb +4 -4
  78. data/lib/datadog_api_client/v1/models/slo_correction_update_request_attributes.rb +1 -1
  79. data/lib/datadog_api_client/v1/models/{monitor_search_response_counts_status_item.rb → successful_signal_update_response.rb} +12 -22
  80. data/lib/datadog_api_client/v1/models/synthetics_api_test.rb +1 -1
  81. data/lib/datadog_api_client/v1/models/synthetics_assertion_type.rb +2 -0
  82. data/lib/datadog_api_client/v1/models/synthetics_browser_test_rum_settings.rb +152 -0
  83. data/lib/datadog_api_client/v1/models/synthetics_test_details.rb +1 -1
  84. data/lib/datadog_api_client/v1/models/synthetics_test_details_sub_type.rb +2 -1
  85. data/lib/datadog_api_client/v1/models/synthetics_test_options.rb +21 -1
  86. data/lib/datadog_api_client/v1/models/synthetics_test_request.rb +21 -1
  87. data/lib/datadog_api_client/v1/models/usage_attribution_response.rb +1 -1
  88. data/lib/datadog_api_client/v1/models/usage_rum_sessions_hour.rb +18 -4
  89. data/lib/datadog_api_client/v1/models/usage_summary_date.rb +11 -1
  90. data/lib/datadog_api_client/v1/models/usage_summary_date_org.rb +11 -1
  91. data/lib/datadog_api_client/v1/models/usage_summary_response.rb +11 -1
  92. data/lib/datadog_api_client/v1.rb +11 -6
  93. data/lib/datadog_api_client/v2/api/authn_mappings_api.rb +0 -2
  94. data/lib/datadog_api_client/v2/api/metrics_api.rb +173 -0
  95. data/lib/datadog_api_client/v2/api/usage_metering_api.rb +228 -0
  96. data/lib/datadog_api_client/v2/api_client.rb +1 -4
  97. data/lib/datadog_api_client/v2/models/authn_mapping.rb +1 -13
  98. data/lib/datadog_api_client/v2/models/authn_mapping_attributes.rb +1 -12
  99. data/lib/datadog_api_client/v2/models/authn_mapping_response.rb +16 -4
  100. data/lib/datadog_api_client/v2/models/authn_mappings_response.rb +13 -1
  101. data/lib/datadog_api_client/v2/models/chargeback_breakdown.rb +131 -0
  102. data/lib/datadog_api_client/v2/models/cost_by_org.rb +133 -0
  103. data/lib/datadog_api_client/v2/models/cost_by_org_attributes.rb +153 -0
  104. data/lib/datadog_api_client/v2/models/cost_by_org_response.rb +113 -0
  105. data/lib/datadog_api_client/v2/models/cost_by_org_type.rb +26 -0
  106. data/lib/datadog_api_client/v2/models/hourly_usage_type.rb +2 -0
  107. data/lib/datadog_api_client/v2/models/http_log_item.rb +40 -4
  108. data/lib/datadog_api_client/v2/models/intake_payload_accepted.rb +111 -0
  109. data/lib/datadog_api_client/v2/models/logs_archive_attributes.rb +12 -1
  110. data/lib/datadog_api_client/v2/models/logs_archive_create_request_attributes.rb +12 -1
  111. data/lib/datadog_api_client/v2/models/metric_content_encoding.rb +26 -0
  112. data/lib/datadog_api_client/v2/models/metric_estimate.rb +133 -0
  113. data/lib/datadog_api_client/v2/models/metric_estimate_attributes.rb +133 -0
  114. data/lib/datadog_api_client/v2/models/metric_estimate_resource_type.rb +26 -0
  115. data/lib/datadog_api_client/v2/models/metric_estimate_response.rb +111 -0
  116. data/lib/datadog_api_client/v2/models/metric_estimate_type.rb +28 -0
  117. data/lib/datadog_api_client/v2/models/metric_intake_type.rb +30 -0
  118. data/lib/datadog_api_client/v2/models/metric_metadata.rb +111 -0
  119. data/lib/datadog_api_client/v2/models/metric_origin.rb +170 -0
  120. data/lib/datadog_api_client/{v1/models/monitor_group_search_response_counts_type_item.rb → v2/models/metric_payload.rb} +27 -24
  121. data/lib/datadog_api_client/v2/models/metric_point.rb +122 -0
  122. data/lib/datadog_api_client/{v1/models/monitor_search_response_counts_type_item.rb → v2/models/metric_resource.rb} +21 -21
  123. data/lib/datadog_api_client/v2/models/metric_series.rb +220 -0
  124. data/lib/datadog_api_client/v2/models/relationship_to_saml_assertion_attribute_data.rb +1 -5
  125. data/lib/datadog_api_client/v2/models/saml_assertion_attribute.rb +1 -5
  126. data/lib/datadog_api_client/v2/models/security_monitoring_rule_detection_method.rb +1 -0
  127. data/lib/datadog_api_client/v2/models/security_monitoring_rule_hardcoded_evaluator_type.rb +26 -0
  128. data/lib/datadog_api_client/v2/models/security_monitoring_rule_options.rb +11 -1
  129. data/lib/datadog_api_client/{v1/models/monitor_group_search_response_counts_status_item.rb → v2/models/usage_application_security_monitoring_response.rb} +16 -24
  130. data/lib/datadog_api_client/{v1/models/monitor_search_response_counts_muted_item.rb → v2/models/usage_lambda_traced_invocations_response.rb} +16 -24
  131. data/lib/datadog_api_client/v2.rb +22 -0
  132. data/lib/datadog_api_client/version.rb +1 -1
  133. data/spec/v1/api_client_spec.rb +3 -3
  134. data/spec/v2/api_client_spec.rb +3 -3
  135. metadata +49 -11
  136. data/extract-code-blocks.awk +0 -81
  137. data/extract-code-blocks.sh +0 -3
@@ -297,8 +297,11 @@ def format_data_with_schema_dict(
297
297
  name = get_name(schema)
298
298
 
299
299
  parameters = ""
300
- if "properties" in schema:
300
+ has_properties = schema.get("properties")
301
+ if has_properties:
301
302
  for k, v in data.items():
303
+ if k not in schema["properties"]:
304
+ continue
302
305
  value = format_data_with_schema(
303
306
  v,
304
307
  schema["properties"][k],
@@ -310,6 +313,8 @@ def format_data_with_schema_dict(
310
313
 
311
314
  if schema.get("additionalProperties"):
312
315
  for k, v in data.items():
316
+ if has_properties and k in schema["properties"]:
317
+ continue
313
318
  value = format_data_with_schema(
314
319
  v,
315
320
  schema["additionalProperties"],
@@ -32,7 +32,7 @@ def type_to_ruby(schema, alternative_name=None):
32
32
  if name:
33
33
  if "enum" in schema:
34
34
  return name
35
- if not schema.get("additionalProperties") and schema.get("type", "object") == "object":
35
+ if not (schema.get("additionalProperties") and not schema.get("properties")) and schema.get("type", "object") == "object":
36
36
  return name
37
37
 
38
38
  type_ = schema.get("type")
@@ -59,9 +59,9 @@ def type_to_ruby(schema, alternative_name=None):
59
59
  elif type_ == "boolean":
60
60
  return "Boolean"
61
61
  elif type_ == "array":
62
- return "Array<{}>".format(type_to_ruby(schema["items"]))
62
+ return "Array<{}>".format(type_to_ruby(schema["items"], name + "Item" if name else None))
63
63
  elif type_ == "object":
64
- if "additionalProperties" in schema:
64
+ if "additionalProperties" in schema and not schema.get("properties"):
65
65
  return "Hash<String, {}>".format(type_to_ruby(schema["additionalProperties"]))
66
66
  return (
67
67
  alternative_name
@@ -113,13 +113,13 @@ def child_models(schema, alternative_name=None, seen=None):
113
113
  if "items" in schema:
114
114
  yield from child_models(
115
115
  schema["items"],
116
- alternative_name=alternative_name + "Item" if alternative_name is not None else None,
116
+ alternative_name=name + "Item" if name is not None else None,
117
117
  seen=seen,
118
118
  )
119
119
 
120
120
  if (
121
121
  schema.get("type") == "object" or "properties" in schema or has_sub_models
122
- ) and "additionalProperties" not in schema:
122
+ ) and not ("additionalProperties" in schema and "properties" not in schema):
123
123
  if not has_sub_models and name is None:
124
124
  # this is a basic map object so we don't need a type
125
125
  return
@@ -25,7 +25,6 @@ module {{ module_name }}::{{ version|upper }}
25
25
  @config = config
26
26
  @user_agent = "#{{ '{' }}{{ module_name }}::USER_AGENT}"
27
27
  @default_headers = {
28
- 'Content-Type' => 'application/json',
29
28
  'User-Agent' => @user_agent
30
29
  }
31
30
  @default_headers['Accept-Encoding'] = 'gzip' if @config.compress
@@ -330,9 +329,7 @@ module {{ module_name }}::{{ version|upper }}
330
329
  # @return [String] the Accept header (e.g. application/json)
331
330
  def select_header_accept(accepts)
332
331
  return nil if accepts.nil? || accepts.empty?
333
- # use JSON when present, otherwise use all of the provided
334
- json_accept = accepts.find { |s| json_mime?(s) }
335
- json_accept || accepts.join(',')
332
+ accepts.join(', ')
336
333
  end
337
334
 
338
335
  # Return Content-Type header based on an array of content types provided.
@@ -9,6 +9,10 @@
9
9
  {{ definition.description|block_comment|indent(4) }}
10
10
  attr_accessor :{{ attr|attribute_name }}
11
11
  {%- endfor %}
12
+ {%- if model.get("additionalProperties") %}
13
+
14
+ attr_accessor :additional_properties
15
+ {%- endif %}
12
16
 
13
17
  # Attribute mapping from ruby-style variable name to JSON key.
14
18
  # @!visibility private
@@ -53,13 +57,23 @@
53
57
  if (!attributes.is_a?(Hash))
54
58
  fail ArgumentError, "The input argument (attributes) must be a hash in `{{ module_name }}::{{ version|upper }}::{{ name }}` initialize method"
55
59
  end
56
-
60
+ {# preserve blank line #}
61
+ {%- if model.get("additionalProperties") %}
62
+ self.additional_properties = {}
63
+ {%- endif %}
57
64
  # check to see if the attribute exists and convert string to symbol for hash key
58
65
  attributes = attributes.each_with_object({}) { |(k, v), h|
59
66
  if (!self.class.attribute_map.key?(k.to_sym))
67
+ {%- if model.get("additionalProperties") %}
68
+ self.additional_properties[k.to_sym] = v
69
+ else
70
+ h[k.to_sym] = v
71
+ end
72
+ {%- else %}
60
73
  fail ArgumentError, "`#{k}` is not a valid attribute in `{{ module_name }}::{{ version|upper }}::{{ name }}`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
74
  end
62
75
  h[k.to_sym] = v
76
+ {%- endif %}
63
77
  }
64
78
  {%- for attr, definition in model.get("properties", {}).items() %}
65
79
 
@@ -185,6 +199,28 @@
185
199
  end
186
200
  {%- endif %}
187
201
  {%- endfor %}
202
+ {%- if model.get("additionalProperties") %}
203
+
204
+ # Returns the object in the form of hash, with additionalProperties support.
205
+ # @return [Hash] Returns the object in the form of hash
206
+ # @!visibility private
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ self.additional_properties.each_pair do |attr, value|
219
+ hash[attr] = value
220
+ end
221
+ hash
222
+ end
223
+ {%- endif %}
188
224
 
189
225
  # Checks equality by comparing each attribute.
190
226
  # @param o [Object] Object to be compared
@@ -193,8 +229,11 @@
193
229
  return true if self.equal?(o)
194
230
  self.class == o.class &&
195
231
  {%- for attr in model.properties %}
196
- {{ attr|attribute_name }} == o.{{ attr|attribute_name }}{% if not loop.last %} &&{% endif %}
232
+ {{ attr|attribute_name }} == o.{{ attr|attribute_name }}{% if not loop.last or model.get("additionalProperties") %} &&{% endif %}
197
233
  {%- endfor %}
234
+ {%- if model.get("additionalProperties") %}
235
+ additional_properties == o.additional_properties
236
+ {%- endif %}
198
237
  end
199
238
 
200
239
  # @see the `==` method
@@ -208,6 +247,6 @@
208
247
  # @return [Integer] Hash code
209
248
  # @!visibility private
210
249
  def hash
211
- [{% for attr in model.properties %}{{ attr|attribute_name }}{% if not loop.last %}, {% endif %}{% endfor %}].hash
250
+ [{% for attr in model.properties %}{{ attr|attribute_name }}{% if not loop.last or model.get("additionalProperties") %}, {% endif %}{% endfor %}{% if model.get("additionalProperties") %}additional_properties{% endif %}].hash
212
251
  end
213
252
  end
@@ -9,7 +9,6 @@ on:
9
9
  inputs:
10
10
  version:
11
11
  description: New version number (e.g. '1.2.3' without the 'v' prefix)
12
- required: true
13
12
 
14
13
  jobs:
15
14
  prepare_release:
@@ -37,6 +36,19 @@ jobs:
37
36
  with:
38
37
  ruby-version: 2.6
39
38
 
39
+ - name: Calculate version
40
+ id: get_version
41
+ run: |
42
+ if [ "${VERSION}" = "" ] ; then
43
+ LATEST_TAG=$(git describe --tags --abbrev=0)
44
+ NEXT_TAG=$(echo ${LATEST_TAG#v} | awk '{split($0, a, "."); print a[1] "." a[2] + 1 "." a[3]}')
45
+ echo ::set-output name=version::$NEXT_TAG
46
+ else
47
+ echo ::set-output name=version::$VERSION
48
+ fi
49
+ env:
50
+ VERSION: ${{ github.event.inputs.version }}
51
+
40
52
  - name: Bump version
41
53
  run: |
42
54
  git switch -c "release/${RELEASE_VERSION}"
@@ -44,12 +56,12 @@ jobs:
44
56
  bundle exec gem bump -v "${RELEASE_VERSION}"
45
57
  git push -f --set-upstream origin "release/${RELEASE_VERSION}"
46
58
  env:
47
- RELEASE_VERSION: ${{ github.event.inputs.version }}
59
+ RELEASE_VERSION: ${{ steps.get_version.outputs.version }}
48
60
 
49
61
  - name: Create PR
50
62
  uses: actions/github-script@v5
51
63
  env:
52
- RELEASE_VERSION: ${{ github.event.inputs.version }}
64
+ RELEASE_VERSION: ${{ steps.get_version.outputs.version }}
53
65
  BASE: ${{ github.event.ref }}
54
66
  with:
55
67
  github-token: ${{ steps.get_token.outputs.token }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.10.0 / 2022-05-30
4
+
5
+ ### Fixed
6
+ * Add support for nested additionalProperties by @therve in https://github.com/DataDog/datadog-api-client-ruby/pull/873
7
+ * Fix monitor search count generation by @therve in https://github.com/DataDog/datadog-api-client-ruby/pull/888
8
+ * Remove unused pararameter from authn mapping by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/891
9
+ * AuthN Mapping spec cleanup to match implementation by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/908
10
+ * Enable header matching in tests by @therve in https://github.com/DataDog/datadog-api-client-ruby/pull/920
11
+ ### Added
12
+ * Add Historical Chargeback Summary endpoint by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/870
13
+ * Expose v2 usage endpoint for application security monitoring by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/883
14
+ * Add `rehydration_max_scan_size_in_gb` field to Logs Archives by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/879
15
+ * Add `mute_first_recovery_notification` option to downtime by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/850
16
+ * Add lambda traced invocations usage endpoint by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/889
17
+ * Expose new usage field for react sessions by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/892
18
+ * Add missing option and enum value for SecurityMonitoringRule by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/898
19
+ * Adds docs for metric estimate endpoint by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/880
20
+ * Allow additional log attributes by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/869
21
+ * Add v2 endpoint for submitting series by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/824
22
+ * Add `ci-tests` monitor type by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/897
23
+ * Add RUM settings schema to synthetics tests by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/906
24
+ * Add v1 signal triage endpoints by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/902
25
+ * Add connection to synthetics assertion type enum by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/911
26
+ * Add grpc subtype to synthetics tests by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/890
27
+ ### Changed
28
+ * Remove unstable marker from SLO corrections API by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/917
29
+ ### Deprecated
30
+ * Deprecate old usage apis by @api-clients-generation-pipeline in https://github.com/DataDog/datadog-api-client-ruby/pull/894
31
+
32
+
33
+ **Full Changelog**: https://github.com/DataDog/datadog-api-client-ruby/compare/v1.9.0...v1.10.0
34
+
3
35
  ## 1.9.0 / 2022-04-26
4
36
 
5
37
  ### Fixed
data/Makefile CHANGED
@@ -1,6 +1,6 @@
1
1
  .PHONY: all
2
2
  all:
3
- @rm -rf ./lib/datadog_api_client/v1 ./lib/datadog_api_client/v2
3
+ @rm -rf ./lib/datadog_api_client/v1 ./lib/datadog_api_client/v2 examples/*
4
4
  @pre-commit run --all-files --hook-stage=manual generator-v1 || true
5
5
  @pre-commit run --all-files --hook-stage=manual generator-v2 || true
6
6
  @pre-commit run --all-files --hook-stage=manual examples || true
data/README.md CHANGED
@@ -138,6 +138,22 @@ config.debugging = true
138
138
  client = DatadogAPIClient::V1::APIClient.new(config)
139
139
  ```
140
140
 
141
+ ### Pagination
142
+
143
+ Several listing operations have a pagination method to help consume all the items available.
144
+ For example, to retrieve all your incidents:
145
+
146
+ ```ruby
147
+ require "datadog_api_client"
148
+ DatadogAPIClient::V2.configure do |config|
149
+ config.unstable_operations[:list_incidents] = true
150
+ end
151
+ api_instance = DatadogAPIClient::V2::IncidentsAPI.new
152
+ api_instance.list_incidents_with_pagination() do |incident|
153
+ p incident.id
154
+ end
155
+ ```
156
+
141
157
  ## Documentation
142
158
 
143
159
  If you are interested in general documentation for all public Datadog API endpoints, checkout the [general documentation site][api docs].
data/check-examples.sh CHANGED
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- ./extract-code-blocks.sh examples
4
-
5
3
  bundle install
6
4
  ls examples/*/*/*.rb | xargs -P $(($(nproc)*2)) -n 1 bundle exec ruby -cw && bundle exec rubocop examples/*/*/*.rb
7
5
  if [ $? -ne 0 ]; then
@@ -4,9 +4,9 @@ require "datadog_api_client"
4
4
  api_instance = DatadogAPIClient::V1::AWSIntegrationAPI.new
5
5
 
6
6
  body = DatadogAPIClient::V1::AWSAccount.new({
7
- account_id: "1234567",
7
+ account_id: "123456789012",
8
8
  account_specific_namespace_rules: {
9
- auto_scaling: false, opswork: false,
9
+ auto_scaling: false,
10
10
  },
11
11
  cspm_resource_collection_enabled: true,
12
12
  excluded_regions: [
@@ -21,6 +21,10 @@ body = DatadogAPIClient::V1::AWSAccount.new({
21
21
  ],
22
22
  metrics_collection_enabled: false,
23
23
  resource_collection_enabled: true,
24
- role_name: "DatadogAWSIntegrationRole",
24
+ role_name: "datadog-role",
25
25
  })
26
- p api_instance.update_aws_account(body)
26
+ opts = {
27
+ account_id: "123456789012",
28
+ role_name: "datadog-role",
29
+ }
30
+ p api_instance.update_aws_account(body, opts)
@@ -23,5 +23,6 @@ body = DatadogAPIClient::V1::Downtime.new({
23
23
  start: Time.now.to_i,
24
24
  _end: (Time.now + 1 * 3600).to_i,
25
25
  timezone: "Etc/UTC",
26
+ mute_first_recovery_notification: true,
26
27
  })
27
28
  p api_instance.create_downtime(body)
@@ -15,5 +15,6 @@ body = DatadogAPIClient::V1::Downtime.new({
15
15
  start: Time.now.to_i,
16
16
  _end: (Time.now + 1 * 3600).to_i,
17
17
  timezone: "Etc/UTC",
18
+ mute_first_recovery_notification: true,
18
19
  })
19
20
  p api_instance.create_downtime(body)
@@ -8,5 +8,6 @@ DOWNTIME_ID = ENV["DOWNTIME_ID"]
8
8
 
9
9
  body = DatadogAPIClient::V1::Downtime.new({
10
10
  message: "Example-Update_a_downtime_returns_OK_response-updated",
11
+ mute_first_recovery_notification: true,
11
12
  })
12
13
  p api_instance.update_downtime(DOWNTIME_ID.to_i, body)
@@ -0,0 +1,52 @@
1
+ # Create a ci-tests formula and functions monitor returns "OK" response
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::MonitorsAPI.new
5
+
6
+ body = DatadogAPIClient::V1::Monitor.new({
7
+ name: "Example-Create_a_ci_tests_formula_and_functions_monitor_returns_OK_response",
8
+ type: DatadogAPIClient::V1::MonitorType::CI_TESTS_ALERT,
9
+ query: 'formula("query1 / query2 * 100").last("15m") >= 0.8',
10
+ message: "some message Notify: @hipchat-channel",
11
+ tags: [
12
+ "test:examplecreateacitestsformulaandfunctionsmonitorreturnsokresponse",
13
+ "env:ci",
14
+ ],
15
+ priority: 3,
16
+ options: DatadogAPIClient::V1::MonitorOptions.new({
17
+ thresholds: DatadogAPIClient::V1::MonitorThresholds.new({
18
+ critical: 0.8,
19
+ }),
20
+ variables: [
21
+ DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinition.new({
22
+ data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventsDataSource::CI_TESTS,
23
+ name: "query1",
24
+ search: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionSearch.new({
25
+ query: "@test.status:fail",
26
+ }),
27
+ indexes: [
28
+ "*",
29
+ ],
30
+ compute: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionCompute.new({
31
+ aggregation: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventAggregation::COUNT,
32
+ }),
33
+ group_by: [],
34
+ }),
35
+ DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinition.new({
36
+ data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventsDataSource::CI_TESTS,
37
+ name: "query2",
38
+ search: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionSearch.new({
39
+ query: "",
40
+ }),
41
+ indexes: [
42
+ "*",
43
+ ],
44
+ compute: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionCompute.new({
45
+ aggregation: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventAggregation::COUNT,
46
+ }),
47
+ group_by: [],
48
+ }),
49
+ ],
50
+ }),
51
+ })
52
+ p api_instance.create_monitor(body)
@@ -0,0 +1,22 @@
1
+ # Create a ci-tests monitor returns "OK" response
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::MonitorsAPI.new
5
+
6
+ body = DatadogAPIClient::V1::Monitor.new({
7
+ name: "Example-Create_a_ci_tests_monitor_returns_OK_response",
8
+ type: DatadogAPIClient::V1::MonitorType::CI_TESTS_ALERT,
9
+ query: 'ci-tests("type:test @git.branch:staging* @test.status:fail").rollup("count").by("@test.name").last("5m") >= 1',
10
+ message: "some message Notify: @hipchat-channel",
11
+ tags: [
12
+ "test:examplecreateacitestsmonitorreturnsokresponse",
13
+ "env:ci",
14
+ ],
15
+ priority: 3,
16
+ options: DatadogAPIClient::V1::MonitorOptions.new({
17
+ thresholds: DatadogAPIClient::V1::MonitorThresholds.new({
18
+ critical: 1,
19
+ }),
20
+ }),
21
+ })
22
+ p api_instance.create_monitor(body)
@@ -0,0 +1,9 @@
1
+ # Add a security signal to an incident returns "OK" response
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::SecurityMonitoringAPI.new
5
+
6
+ body = DatadogAPIClient::V1::AddSignalToIncidentRequest.new({
7
+ incident_id: 2609,
8
+ })
9
+ p api_instance.add_security_monitoring_signal_to_incident("AQAAAYDiB_Ol8PbzFAAAAABBWURpQl9PbEFBQU0yeXhGTG9ZV2JnQUE", body)
@@ -0,0 +1,9 @@
1
+ # Modify the triage assignee of a security signal returns "OK" response
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::SecurityMonitoringAPI.new
5
+
6
+ body = DatadogAPIClient::V1::SignalAssigneeUpdateRequest.new({
7
+ assignee: "773b045d-ccf8-4808-bd3b-955ef6a8c940",
8
+ })
9
+ p api_instance.edit_security_monitoring_signal_assignee("AQAAAYDiB_Ol8PbzFAAAAABBWURpQl9PbEFBQU0yeXhGTG9ZV2JnQUE", body)
@@ -0,0 +1,10 @@
1
+ # Change the triage state of a security signal returns "OK" response
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::SecurityMonitoringAPI.new
5
+
6
+ body = DatadogAPIClient::V1::SignalStateUpdateRequest.new({
7
+ archive_reason: DatadogAPIClient::V1::SignalArchiveReason::NONE,
8
+ state: DatadogAPIClient::V1::SignalTriageState::OPEN,
9
+ })
10
+ p api_instance.edit_security_monitoring_signal_state("AQAAAYDiB_Ol8PbzFAAAAABBWURpQl9PbEFBQU0yeXhGTG9ZV2JnQUE", body)
@@ -1,9 +1,6 @@
1
1
  # Create an SLO correction returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient::V2.configure do |config|
5
- config.unstable_operations[:create_slo_correction] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
8
5
 
9
6
  # there is a valid "slo" in the system
@@ -1,9 +1,6 @@
1
1
  # Create an SLO correction with rrule returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient::V2.configure do |config|
5
- config.unstable_operations[:create_slo_correction] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
8
5
 
9
6
  # there is a valid "slo" in the system
@@ -1,8 +1,5 @@
1
1
  # Delete an SLO correction returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient::V2.configure do |config|
5
- config.unstable_operations[:delete_slo_correction] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
8
5
  api_instance.delete_slo_correction("slo_correction_id")
@@ -1,9 +1,6 @@
1
1
  # Get an SLO correction for an SLO returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient::V2.configure do |config|
5
- config.unstable_operations[:get_slo_correction] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
8
5
 
9
6
  # there is a valid "correction" for "slo"
@@ -1,8 +1,5 @@
1
1
  # Get all SLO corrections returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient::V2.configure do |config|
5
- config.unstable_operations[:list_slo_correction] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
8
5
  p api_instance.list_slo_correction()
@@ -1,9 +1,6 @@
1
1
  # Update an SLO correction returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient::V2.configure do |config|
5
- config.unstable_operations[:update_slo_correction] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
8
5
 
9
6
  # there is a valid "correction" for "slo"
@@ -1,9 +1,6 @@
1
1
  # Get Corrections For an SLO returns "OK" response
2
2
 
3
3
  require "datadog_api_client"
4
- DatadogAPIClient::V2.configure do |config|
5
- config.unstable_operations[:get_slo_corrections] = true
6
- end
7
4
  api_instance = DatadogAPIClient::V1::ServiceLevelObjectivesAPI.new
8
5
 
9
6
  # there is a valid "slo" in the system
@@ -31,6 +31,11 @@ body = DatadogAPIClient::V1::SyntheticsAPITest.new({
31
31
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
32
32
  ],
33
33
  _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({}),
34
+ rum_settings: DatadogAPIClient::V1::SyntheticsBrowserTestRumSettings.new({
35
+ application_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
36
+ client_token_id: 12345,
37
+ is_enabled: true,
38
+ }),
34
39
  }),
35
40
  status: DatadogAPIClient::V1::SyntheticsTestPauseStatus::LIVE,
36
41
  subtype: DatadogAPIClient::V1::SyntheticsTestDetailsSubType::HTTP,
@@ -0,0 +1,44 @@
1
+ # Create an API GRPC test returns "OK - Returns the created test details." response
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
5
+
6
+ body = DatadogAPIClient::V1::SyntheticsAPITest.new({
7
+ config: DatadogAPIClient::V1::SyntheticsAPITestConfig.new({
8
+ assertions: [
9
+ DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
10
+ operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::IS,
11
+ target: 1,
12
+ type: DatadogAPIClient::V1::SyntheticsAssertionType::GRPC_HEALTHCHECK_STATUS,
13
+ }),
14
+ ],
15
+ request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
16
+ host: "localhost",
17
+ port: 50051,
18
+ service: "Hello",
19
+ method: DatadogAPIClient::V1::HTTPMethod::GET,
20
+ message: "",
21
+ metadata: DatadogAPIClient::V1::SyntheticsTestMetadata.new({}),
22
+ }),
23
+ }),
24
+ locations: [
25
+ "aws:us-east-2",
26
+ ],
27
+ message: "BDD test payload: synthetics_api_grpc_test_payload.json",
28
+ name: "Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response",
29
+ options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
30
+ min_failure_duration: 0,
31
+ min_location_failed: 1,
32
+ monitor_options: DatadogAPIClient::V1::SyntheticsTestOptionsMonitorOptions.new({
33
+ renotify_interval: 0,
34
+ }),
35
+ monitor_name: "Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response",
36
+ tick_every: 60,
37
+ }),
38
+ subtype: DatadogAPIClient::V1::SyntheticsTestDetailsSubType::GRPC,
39
+ tags: [
40
+ "testing:api",
41
+ ],
42
+ type: DatadogAPIClient::V1::SyntheticsAPITestType::API,
43
+ })
44
+ p api_instance.create_synthetics_api_test(body)
@@ -0,0 +1,64 @@
1
+ # Create a browser test returns "OK - Returns saved rumSettings." response
2
+
3
+ require "datadog_api_client"
4
+ api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
5
+
6
+ body = DatadogAPIClient::V1::SyntheticsBrowserTest.new({
7
+ config: DatadogAPIClient::V1::SyntheticsBrowserTestConfig.new({
8
+ assertions: [],
9
+ config_variables: [
10
+ DatadogAPIClient::V1::SyntheticsConfigVariable.new({
11
+ example: "content-type",
12
+ name: "PROPERTY",
13
+ pattern: "content-type",
14
+ type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
15
+ }),
16
+ ],
17
+ request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
18
+ method: DatadogAPIClient::V1::HTTPMethod::GET,
19
+ url: "https://datadoghq.com",
20
+ }),
21
+ set_cookie: "name:test",
22
+ }),
23
+ locations: [
24
+ "aws:us-east-2",
25
+ ],
26
+ message: "Test message",
27
+ name: "Example-Create_a_browser_test_returns_OK_Returns_saved_rumSettings_response",
28
+ options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
29
+ accept_self_signed: false,
30
+ allow_insecure: true,
31
+ device_ids: [
32
+ DatadogAPIClient::V1::SyntheticsDeviceID::TABLET,
33
+ ],
34
+ disable_cors: true,
35
+ follow_redirects: true,
36
+ min_failure_duration: 10,
37
+ min_location_failed: 1,
38
+ no_screenshot: true,
39
+ _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
40
+ count: 3,
41
+ interval: 10,
42
+ }),
43
+ rum_settings: DatadogAPIClient::V1::SyntheticsBrowserTestRumSettings.new({
44
+ is_enabled: true,
45
+ application_id: "mockApplicationId",
46
+ client_token_id: 123456,
47
+ }),
48
+ tick_every: 300,
49
+ }),
50
+ tags: [
51
+ "testing:browser",
52
+ ],
53
+ type: DatadogAPIClient::V1::SyntheticsBrowserTestType::BROWSER,
54
+ steps: [
55
+ DatadogAPIClient::V1::SyntheticsStep.new({
56
+ allow_failure: false,
57
+ is_critical: true,
58
+ name: "Refresh page",
59
+ params: {},
60
+ type: DatadogAPIClient::V1::SyntheticsStepType::REFRESH,
61
+ }),
62
+ ],
63
+ })
64
+ p api_instance.create_synthetics_browser_test(body)
@@ -49,6 +49,11 @@ body = DatadogAPIClient::V1::SyntheticsBrowserTest.new({
49
49
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
50
50
  ],
51
51
  _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({}),
52
+ rum_settings: DatadogAPIClient::V1::SyntheticsBrowserTestRumSettings.new({
53
+ application_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
54
+ client_token_id: 12345,
55
+ is_enabled: true,
56
+ }),
52
57
  }),
53
58
  status: DatadogAPIClient::V1::SyntheticsTestPauseStatus::LIVE,
54
59
  steps: [