From e67f16f0989e02b68cfd2a2b1f2e448a37eb338b Mon Sep 17 00:00:00 2001 From: Sherzod Karimov Date: Tue, 29 Oct 2024 10:27:42 -0400 Subject: [PATCH 1/2] fix tests --- .generator/conftest.py | 3 -- .generator/src/generator/formatter.py | 45 ++------------------------ .generator/src/generator/keywords.json | 43 ++++++++++++++++++++++++ features/support/templating.rb | 5 ++- 4 files changed, 49 insertions(+), 47 deletions(-) create mode 100644 .generator/src/generator/keywords.json diff --git a/.generator/conftest.py b/.generator/conftest.py index 633c9d944fa4..cba05beb302a 100644 --- a/.generator/conftest.py +++ b/.generator/conftest.py @@ -20,10 +20,7 @@ MODIFIED_FEATURES = {pathlib.Path(p).resolve() for p in os.getenv("BDD_MODIFIED_FEATURES", "").split(" ") if p} - ROOT_PATH = pathlib.Path(__file__).parent.parent - - PATTERN_ALPHANUM = re.compile(r"[^A-Za-z0-9]+") diff --git a/.generator/src/generator/formatter.py b/.generator/src/generator/formatter.py index 6aafbd507fb4..776bfd706200 100644 --- a/.generator/src/generator/formatter.py +++ b/.generator/src/generator/formatter.py @@ -5,49 +5,8 @@ from functools import singledispatch -KEYWORDS = { - "__FILE__", - "and", - "def", - "end", - "in", - "or", - "self", - "unless", - "__LINE__", - "begin", - "defined?", - "ensure", - "module", - "redo", - "super", - "until", - "BEGIN", - "break", - "do", - "false", - "next", - "rescue", - "then", - "when", - "END", - "case", - "else", - "for", - "nil", - "retry", - "true", - "while", - "alias", - "class", - "elsif", - "if", - "not", - "return", - "undef", - "yield", - "hash", -} +with (pathlib.Path(__file__).parent / "keywords.json").open() as f: + KEYWORDS = json.load(f) with (pathlib.Path(__file__).parent / "replacement.json").open() as f: EDGE_CASES = json.load(f) diff --git a/.generator/src/generator/keywords.json b/.generator/src/generator/keywords.json new file mode 100644 index 000000000000..dc319cd8e401 --- /dev/null +++ b/.generator/src/generator/keywords.json @@ -0,0 +1,43 @@ +[ + "__FILE__", + "and", + "def", + "end", + "in", + "or", + "self", + "unless", + "__LINE__", + "begin", + "defined?", + "ensure", + "module", + "redo", + "super", + "until", + "BEGIN", + "break", + "do", + "false", + "next", + "rescue", + "then", + "when", + "END", + "case", + "else", + "for", + "nil", + "retry", + "true", + "while", + "alias", + "class", + "elsif", + "if", + "not", + "return", + "undef", + "yield", + "hash" +] \ No newline at end of file diff --git a/features/support/templating.rb b/features/support/templating.rb index dff18dcddc6e..9ad428438cda 100644 --- a/features/support/templating.rb +++ b/features/support/templating.rb @@ -1,5 +1,6 @@ require 'json' +KEYWORDS = JSON.parse(File.read(File.join(__dir__, "..", "..", ".generator", "src", "generator", "keywords.json"))) EDGE_CASES = JSON.parse(File.read(File.join(__dir__, "..", "..", ".generator", "src", "generator", "replacement.json"))) REPLACED_KEYS = EDGE_CASES.keys.map { |k| Regexp.quote(k) }.join("|") @@ -20,7 +21,9 @@ def lookup(dotted_path) when Hash result = result.include?(part.to_sym) ? result[part.to_sym] : result[part] else - result = result.send(part.snakecase) + s = part.snakecase + s = "_#{s}" if KEYWORDS.include? s + result = result.send(s) end end end From aaf13c1b0eebbec9b44b0dca11fbe9ee00b11e49 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 31 Oct 2024 14:20:21 +0000 Subject: [PATCH 2/2] Regenerate client from commit 47da2e01 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 419 ++++++++++++++++++ ...metric-returns-Bad-Request-response.frozen | 1 + ...ed-metric-returns-Bad-Request-response.yml | 25 ++ ...ed-metric-returns-Conflict-response.frozen | 1 + ...based-metric-returns-Conflict-response.yml | 64 +++ ...sed-metric-returns-Created-response.frozen | 1 + ...-based-metric-returns-Created-response.yml | 40 ++ ...-metric-returns-No-Content-response.frozen | 1 + ...sed-metric-returns-No-Content-response.yml | 60 +++ ...d-metric-returns-Not-Found-response.frozen | 1 + ...ased-metric-returns-Not-Found-response.yml | 22 + ...d-metric-returns-Not-Found-response.frozen | 1 + ...ased-metric-returns-Not-Found-response.yml | 22 + ...um-based-metric-returns-OK-response.frozen | 1 + ...a-rum-based-metric-returns-OK-response.yml | 58 +++ ...m-based-metrics-returns-OK-response.frozen | 1 + ...-rum-based-metrics-returns-OK-response.yml | 20 + ...metric-returns-Bad-Request-response.frozen | 1 + ...ed-metric-returns-Bad-Request-response.yml | 63 +++ ...ed-metric-returns-Conflict-response.frozen | 1 + ...based-metric-returns-Conflict-response.yml | 63 +++ ...d-metric-returns-Not-Found-response.frozen | 1 + ...ased-metric-returns-Not-Found-response.yml | 63 +++ ...um-based-metric-returns-OK-response.frozen | 1 + ...a-rum-based-metric-returns-OK-response.yml | 62 +++ examples/v2/rum-metrics/CreateRumMetric.rb | 32 ++ examples/v2/rum-metrics/DeleteRumMetric.rb | 8 + examples/v2/rum-metrics/GetRumMetric.rb | 8 + examples/v2/rum-metrics/ListRumMetrics.rb | 5 + examples/v2/rum-metrics/UpdateRumMetric.rb | 29 ++ features/scenarios_model_mapping.rb | 13 + features/v2/given.json | 12 + features/v2/rum_metrics.feature | 134 ++++++ features/v2/undo.json | 37 ++ lib/datadog_api_client/inflector.rb | 24 + .../v2/api/rum_metrics_api.rb | 357 +++++++++++++++ .../v2/models/rum_metric_compute.rb | 144 ++++++ .../rum_metric_compute_aggregation_type.rb | 27 ++ .../v2/models/rum_metric_create_attributes.rb | 176 ++++++++ .../v2/models/rum_metric_create_data.rb | 165 +++++++ .../v2/models/rum_metric_create_request.rb | 123 +++++ .../v2/models/rum_metric_event_type.rb | 32 ++ .../v2/models/rum_metric_filter.rb | 123 +++++ .../v2/models/rum_metric_group_by.rb | 133 ++++++ .../v2/models/rum_metric_response.rb | 105 +++++ .../models/rum_metric_response_attributes.rb | 147 ++++++ .../v2/models/rum_metric_response_compute.rb | 126 ++++++ .../v2/models/rum_metric_response_data.rb | 125 ++++++ .../v2/models/rum_metric_response_filter.rb | 105 +++++ .../v2/models/rum_metric_response_group_by.rb | 115 +++++ .../models/rum_metric_response_uniqueness.rb | 105 +++++ .../v2/models/rum_metric_type.rb | 26 ++ .../v2/models/rum_metric_uniqueness.rb | 123 +++++ .../v2/models/rum_metric_uniqueness_when.rb | 27 ++ .../v2/models/rum_metric_update_attributes.rb | 127 ++++++ .../v2/models/rum_metric_update_compute.rb | 106 +++++ .../v2/models/rum_metric_update_data.rb | 154 +++++++ .../v2/models/rum_metric_update_request.rb | 123 +++++ .../v2/models/rum_metrics_response.rb | 107 +++++ 60 files changed, 4200 insertions(+), 4 deletions(-) create mode 100644 cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Conflict-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Conflict-response.yml create mode 100644 cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Created-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Created-response.yml create mode 100644 cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-No-Content-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-No-Content-response.yml create mode 100644 cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-OK-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-OK-response.yml create mode 100644 cassettes/features/v2/rum_metrics/Get-all-rum-based-metrics-returns-OK-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Get-all-rum-based-metrics-returns-OK-response.yml create mode 100644 cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Conflict-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Conflict-response.yml create mode 100644 cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-OK-response.frozen create mode 100644 cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-OK-response.yml create mode 100644 examples/v2/rum-metrics/CreateRumMetric.rb create mode 100644 examples/v2/rum-metrics/DeleteRumMetric.rb create mode 100644 examples/v2/rum-metrics/GetRumMetric.rb create mode 100644 examples/v2/rum-metrics/ListRumMetrics.rb create mode 100644 examples/v2/rum-metrics/UpdateRumMetric.rb create mode 100644 features/v2/rum_metrics.feature create mode 100644 lib/datadog_api_client/v2/api/rum_metrics_api.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_compute.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_compute_aggregation_type.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_create_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_create_data.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_event_type.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_filter.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_group_by.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_response.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_response_compute.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_response_filter.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_response_group_by.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_response_uniqueness.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_type.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_uniqueness.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_uniqueness_when.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_update_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_update_compute.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_update_data.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metric_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/rum_metrics_response.rb diff --git a/.apigentools-info b/.apigentools-info index 9aa4d69452bb..3127a51d3ddc 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-30 18:58:10.241853", - "spec_repo_commit": "755120dd" + "regenerated": "2024-10-31 14:19:55.243697", + "spec_repo_commit": "47da2e01" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-30 18:58:10.260831", - "spec_repo_commit": "755120dd" + "regenerated": "2024-10-31 14:19:55.263009", + "spec_repo_commit": "47da2e01" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 38238fba6cc1..32377c157b09 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -597,6 +597,13 @@ components: required: true schema: type: string + RumMetricIDParameter: + description: The name of the rum-based metric. + in: path + name: metric_id + required: true + schema: + type: string SchemaVersion: description: The schema version desired in the response. in: query @@ -19253,6 +19260,287 @@ components: type: string x-enum-varnames: - RULE + RumMetricCompute: + description: The compute rule to compute the rum-based metric. + properties: + aggregation_type: + $ref: '#/components/schemas/RumMetricComputeAggregationType' + include_percentiles: + $ref: '#/components/schemas/RumMetricComputeIncludePercentiles' + path: + description: The path to the value the rum-based metric will aggregate on + (only used if the aggregation type is a "distribution"). + example: '@duration' + type: string + required: + - aggregation_type + type: object + RumMetricComputeAggregationType: + description: The type of aggregation to use. + enum: + - count + - distribution + example: distribution + type: string + x-enum-varnames: + - COUNT + - DISTRIBUTION + RumMetricComputeIncludePercentiles: + description: 'Toggle to include or exclude percentile aggregations for distribution + metrics. + + Only present when the `aggregation_type` is `distribution`.' + example: true + type: boolean + RumMetricCreateAttributes: + description: The object describing the Datadog rum-based metric to create. + properties: + compute: + $ref: '#/components/schemas/RumMetricCompute' + event_type: + $ref: '#/components/schemas/RumMetricEventType' + filter: + $ref: '#/components/schemas/RumMetricFilter' + group_by: + description: The rules for the group by. + items: + $ref: '#/components/schemas/RumMetricGroupBy' + type: array + uniqueness: + $ref: '#/components/schemas/RumMetricUniqueness' + required: + - event_type + - compute + type: object + RumMetricCreateData: + description: The new rum-based metric properties. + properties: + attributes: + $ref: '#/components/schemas/RumMetricCreateAttributes' + id: + $ref: '#/components/schemas/RumMetricID' + type: + $ref: '#/components/schemas/RumMetricType' + required: + - id + - type + - attributes + type: object + RumMetricCreateRequest: + description: The new rum-based metric body. + properties: + data: + $ref: '#/components/schemas/RumMetricCreateData' + required: + - data + type: object + RumMetricEventType: + description: The type of RUM events to filter on. + enum: + - session + - view + - action + - error + - resource + - long_task + - vital + example: session + type: string + x-enum-varnames: + - SESSION + - VIEW + - ACTION + - ERROR + - RESOURCE + - LONG_TASK + - VITAL + RumMetricFilter: + description: The rum-based metric filter. Events matching this filter will be + aggregated in this metric. + properties: + query: + default: '*' + description: The search query - following the RUM search syntax. Must include + an @type facet query. + example: '@service:web-ui: ' + type: string + required: + - query + type: object + RumMetricGroupBy: + description: A group by rule. + properties: + path: + description: The path to the value the rum-based metric will be aggregated + over. + example: '@browser.name' + type: string + tag_name: + description: Eventual name of the tag that gets created. By default, the + path attribute is used as the tag name. + example: browser_name + type: string + required: + - path + type: object + RumMetricID: + description: The name of the rum-based metric. + example: rum.sessions.webui.count + type: string + RumMetricResponse: + description: The rum-based metric object. + properties: + data: + $ref: '#/components/schemas/RumMetricResponseData' + type: object + RumMetricResponseAttributes: + description: The object describing a Datadog rum-based metric. + properties: + compute: + $ref: '#/components/schemas/RumMetricResponseCompute' + event_type: + $ref: '#/components/schemas/RumMetricEventType' + filter: + $ref: '#/components/schemas/RumMetricResponseFilter' + group_by: + description: The rules for the group by. + items: + $ref: '#/components/schemas/RumMetricResponseGroupBy' + type: array + uniqueness: + $ref: '#/components/schemas/RumMetricResponseUniqueness' + type: object + RumMetricResponseCompute: + description: The compute rule to compute the rum-based metric. + properties: + aggregation_type: + $ref: '#/components/schemas/RumMetricComputeAggregationType' + include_percentiles: + $ref: '#/components/schemas/RumMetricComputeIncludePercentiles' + path: + description: The path to the value the rum-based metric will aggregate on + (only used if the aggregation type is a "distribution"). + example: '@duration' + type: string + type: object + RumMetricResponseData: + description: The rum-based metric properties. + properties: + attributes: + $ref: '#/components/schemas/RumMetricResponseAttributes' + id: + $ref: '#/components/schemas/RumMetricID' + type: + $ref: '#/components/schemas/RumMetricType' + type: object + RumMetricResponseFilter: + description: The rum-based metric filter. RUM events matching this filter will + be aggregated in this metric. + properties: + query: + description: The search query - following the RUM search syntax. + example: service:web* AND @http.status_code:[200 TO 299] + type: string + type: object + RumMetricResponseGroupBy: + description: A group by rule. + properties: + path: + description: The path to the value the rum-based metric will be aggregated + over. + example: '@http.status_code' + type: string + tag_name: + description: Eventual name of the tag that gets created. By default, the + path attribute is used as the tag name. + example: status_code + type: string + type: object + RumMetricResponseUniqueness: + description: The rule to count updatable events. Is only set if "event_type" + is "sessions" or "views". + properties: + when: + $ref: '#/components/schemas/RumMetricUniquenessWhen' + type: object + RumMetricType: + default: rum_metrics + description: The type of the resource. The value should always be rum_metrics. + enum: + - rum_metrics + example: rum_metrics + type: string + x-enum-varnames: + - RUM_METRICS + RumMetricUniqueness: + description: The rule to count updatable events. Is only set if "event_type" + is "sessions" or "views". + properties: + when: + $ref: '#/components/schemas/RumMetricUniquenessWhen' + required: + - when + type: object + RumMetricUniquenessWhen: + description: When to count updatable events. "match" when the event is first + seen, or "end" when the event is complete. + enum: + - match + - end + example: match + type: string + x-enum-varnames: + - WHEN_MATCH + - WHEN_END + RumMetricUpdateAttributes: + description: The rum-based metric properties that will be updated. + properties: + compute: + $ref: '#/components/schemas/RumMetricUpdateCompute' + filter: + $ref: '#/components/schemas/RumMetricFilter' + group_by: + description: The rules for the group by. + items: + $ref: '#/components/schemas/RumMetricGroupBy' + type: array + type: object + RumMetricUpdateCompute: + description: The compute rule to compute the rum-based metric. + properties: + include_percentiles: + $ref: '#/components/schemas/RumMetricComputeIncludePercentiles' + type: object + RumMetricUpdateData: + description: The new rum-based metric properties. + properties: + attributes: + $ref: '#/components/schemas/RumMetricUpdateAttributes' + id: + $ref: '#/components/schemas/RumMetricID' + type: + $ref: '#/components/schemas/RumMetricType' + required: + - type + - attributes + type: object + RumMetricUpdateRequest: + description: The new rum-based metric body. + properties: + data: + $ref: '#/components/schemas/RumMetricUpdateData' + required: + - data + type: object + RumMetricsResponse: + description: All the available rum-based metric objects. + properties: + data: + description: A list of rum-based metric objects. + items: + $ref: '#/components/schemas/RumMetricResponseData' + type: array + type: object SAMLAssertionAttribute: description: SAML assertion attribute. properties: @@ -36517,6 +36805,131 @@ paths: operator: OR permissions: - rum_apps_write + /api/v2/rum/config/metrics: + get: + description: Get the list of configured rum-based metrics with their definitions. + operationId: ListRumMetrics + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RumMetricsResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get all rum-based metrics + tags: + - Rum Metrics + post: + description: 'Create a metric based on your organization''s RUM data. + + Returns the rum-based metric object from the request body when the request + is successful.' + operationId: CreateRumMetric + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RumMetricCreateRequest' + description: The definition of the new rum-based metric. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/RumMetricResponse' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a rum-based metric + tags: + - Rum Metrics + x-codegen-request-body-name: body + /api/v2/rum/config/metrics/{metric_id}: + delete: + description: Delete a specific rum-based metric from your organization. + operationId: DeleteRumMetric + parameters: + - $ref: '#/components/parameters/RumMetricIDParameter' + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete a rum-based metric + tags: + - Rum Metrics + get: + description: Get a specific rum-based metric from your organization. + operationId: GetRumMetric + parameters: + - $ref: '#/components/parameters/RumMetricIDParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RumMetricResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get a rum-based metric + tags: + - Rum Metrics + patch: + description: 'Update a specific rum-based metric from your organization. + + Returns the rum-based metric object from the request body when the request + is successful.' + operationId: UpdateRumMetric + parameters: + - $ref: '#/components/parameters/RumMetricIDParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RumMetricUpdateRequest' + description: New definition of the rum-based metric. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RumMetricResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update a rum-based metric + tags: + - Rum Metrics + x-codegen-request-body-name: body /api/v2/rum/events: get: description: 'List endpoint returns events that match a RUM search query. @@ -42124,6 +42537,12 @@ tags: [Pipelines page](https://app.datadoghq.com/logs/pipelines).' name: Roles +- description: Manage configuration of [rum-based metrics](https://app.datadoghq.com/rum/generate-metrics) + for your organization. + externalDocs: + description: Find out more at + url: https://docs.datadoghq.com/real_user_monitoring/platform/generate_metrics/ + name: Rum Metrics - description: Create and manage your security rules, signals, filters, and more. See the [Datadog Security page](https://docs.datadoghq.com/security/) for more information. diff --git a/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Bad-Request-response.frozen b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..aeb6d494b5c4 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:19.714Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Bad-Request-response.yml b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..76211e9f357b --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Bad-Request-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:19 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"aggregation_type":"count"},"event_type":"action","uniqueness":{"when":"match"}},"id":"rum.actions.invalid","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/rum/config/metrics + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"uniqueness\" failed excluded_if validation"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Conflict-response.frozen b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Conflict-response.frozen new file mode 100644 index 000000000000..7ab47461a53b --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Conflict-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:20.162Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Conflict-response.yml b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Conflict-response.yml new file mode 100644 index 000000000000..96f478ada007 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Conflict-response.yml @@ -0,0 +1,64 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:20 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Create_a_rum_based_metric_returns_Conflict_response-1730203160"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Create_a_rum_based_metric_returns_Conflict_response-1730203160","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/rum/config/metrics + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"Test_Create_a_rum_based_metric_returns_Conflict_response_1730203160","type":"rum_metrics","attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Create_a_rum_based_metric_returns_Conflict_response-1730203160"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 29 Oct 2024 11:59:20 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"aggregation_type":"count"},"event_type":"action"},"id":"Test_Create_a_rum_based_metric_returns_Conflict_response_1730203160","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/rum/config/metrics + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"409","title":"Conflict","detail":"conflict(Field + ''data.id'' is invalid: ''Test_Create_a_rum_based_metric_returns_Conflict_response_1730203160'' + cannot be used as metric name, a metric already exists with that name)"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 409 + message: Conflict +- recorded_at: Tue, 29 Oct 2024 11:59:20 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Create_a_rum_based_metric_returns_Conflict_response_1730203160 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Created-response.frozen b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Created-response.frozen new file mode 100644 index 000000000000..904b31816c10 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Created-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:21.453Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Created-response.yml b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Created-response.yml new file mode 100644 index 000000000000..cd4e66e0447c --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Created-response.yml @@ -0,0 +1,40 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:21 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"@service:web-ui"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"rum.sessions.webui.count","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/rum/config/metrics + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"rum.sessions.webui.count","type":"rum_metrics","attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"@service:web-ui"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 29 Oct 2024 11:59:21 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/rum.sessions.webui.count + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-No-Content-response.frozen b/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-No-Content-response.frozen new file mode 100644 index 000000000000..6cfba31aca35 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:22.291Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-No-Content-response.yml b/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-No-Content-response.yml new file mode 100644 index 000000000000..4b51f1b6e18f --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-No-Content-response.yml @@ -0,0 +1,60 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:22 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Delete_a_rum_based_metric_returns_No_Content_response-1730203162"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Delete_a_rum_based_metric_returns_No_Content_response-1730203162","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/rum/config/metrics + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"Test_Delete_a_rum_based_metric_returns_No_Content_response_1730203162","type":"rum_metrics","attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Delete_a_rum_based_metric_returns_No_Content_response-1730203162"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 29 Oct 2024 11:59:22 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Delete_a_rum_based_metric_returns_No_Content_response_1730203162 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 29 Oct 2024 11:59:22 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Delete_a_rum_based_metric_returns_No_Content_response_1730203162 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Not Found","detail":"not_found(Metric + with name ''Test_Delete_a_rum_based_metric_returns_No_Content_response_1730203162'' + not found)"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-Not-Found-response.frozen b/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..2d4669c70d38 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:23.441Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-Not-Found-response.yml b/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-Not-Found-response.yml new file mode 100644 index 000000000000..045c9b4be1e8 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-Not-Found-response.yml @@ -0,0 +1,22 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:23 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test-Delete_a_rum_based_metric_returns_Not_Found_response-1730203163 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Not Found","detail":"not_found(Metric + with name ''Test-Delete_a_rum_based_metric_returns_Not_Found_response-1730203163'' + not found)"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-Not-Found-response.frozen b/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..bf0fe79db01f --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:23.838Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-Not-Found-response.yml b/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-Not-Found-response.yml new file mode 100644 index 000000000000..0148ea92039b --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-Not-Found-response.yml @@ -0,0 +1,22 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:23 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test-Get_a_rum_based_metric_returns_Not_Found_response-1730203163 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Not Found","detail":"not_found(Metric + with name ''Test-Get_a_rum_based_metric_returns_Not_Found_response-1730203163'' + not found)"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-OK-response.frozen b/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-OK-response.frozen new file mode 100644 index 000000000000..166f9b69cbe1 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:24.146Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-OK-response.yml b/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-OK-response.yml new file mode 100644 index 000000000000..e74806a0dace --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-OK-response.yml @@ -0,0 +1,58 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:24 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Get_a_rum_based_metric_returns_OK_response-1730203164"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Get_a_rum_based_metric_returns_OK_response-1730203164","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/rum/config/metrics + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"Test_Get_a_rum_based_metric_returns_OK_response_1730203164","type":"rum_metrics","attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Get_a_rum_based_metric_returns_OK_response-1730203164"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 29 Oct 2024 11:59:24 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Get_a_rum_based_metric_returns_OK_response_1730203164 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"Test_Get_a_rum_based_metric_returns_OK_response_1730203164","type":"rum_metrics","attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Get_a_rum_based_metric_returns_OK_response-1730203164"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 29 Oct 2024 11:59:24 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Get_a_rum_based_metric_returns_OK_response_1730203164 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/rum_metrics/Get-all-rum-based-metrics-returns-OK-response.frozen b/cassettes/features/v2/rum_metrics/Get-all-rum-based-metrics-returns-OK-response.frozen new file mode 100644 index 000000000000..b61a6a3553ce --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Get-all-rum-based-metrics-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:25.250Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Get-all-rum-based-metrics-returns-OK-response.yml b/cassettes/features/v2/rum_metrics/Get-all-rum-based-metrics-returns-OK-response.yml new file mode 100644 index 000000000000..6414ae85b12c --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Get-all-rum-based-metrics-returns-OK-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:25 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/rum/config/metrics + response: + body: + encoding: UTF-8 + string: '{"data":[]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Bad-Request-response.frozen b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..311aa3beb93a --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:25.568Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Bad-Request-response.yml b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..3a8f948e0adf --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Bad-Request-response.yml @@ -0,0 +1,63 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:25 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Update_a_rum_based_metric_returns_Bad_Request_response-1730203165"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Update_a_rum_based_metric_returns_Bad_Request_response-1730203165","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/rum/config/metrics + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"Test_Update_a_rum_based_metric_returns_Bad_Request_response_1730203165","type":"rum_metrics","attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Update_a_rum_based_metric_returns_Bad_Request_response-1730203165"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 29 Oct 2024 11:59:25 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"include_percentiles":true}},"id":"rum.sessions.webui.count","type":"unknown_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Update_a_rum_based_metric_returns_Bad_Request_response_1730203165 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"got type + \"unknown_metrics\" expected one of \"rum_metrics\""}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +- recorded_at: Tue, 29 Oct 2024 11:59:25 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Update_a_rum_based_metric_returns_Bad_Request_response_1730203165 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Conflict-response.frozen b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Conflict-response.frozen new file mode 100644 index 000000000000..85af2dc5c80b --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Conflict-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:27.027Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Conflict-response.yml b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Conflict-response.yml new file mode 100644 index 000000000000..d2440c4b5fe6 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Conflict-response.yml @@ -0,0 +1,63 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:27 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Update_a_rum_based_metric_returns_Conflict_response-1730203167"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Update_a_rum_based_metric_returns_Conflict_response-1730203167","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/rum/config/metrics + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"Test_Update_a_rum_based_metric_returns_Conflict_response_1730203167","type":"rum_metrics","attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Update_a_rum_based_metric_returns_Conflict_response-1730203167"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 29 Oct 2024 11:59:27 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"include_percentiles":true}},"id":"conflicting.id","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Update_a_rum_based_metric_returns_Conflict_response_1730203167 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"409","title":"Conflict","detail":"ID provided + in the payload does not match the url parameter"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 409 + message: Conflict +- recorded_at: Tue, 29 Oct 2024 11:59:27 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Update_a_rum_based_metric_returns_Conflict_response_1730203167 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Not-Found-response.frozen b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..d0605146d53a --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:28.193Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Not-Found-response.yml b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Not-Found-response.yml new file mode 100644 index 000000000000..34fa9e0fcbbe --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Not-Found-response.yml @@ -0,0 +1,63 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:28 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Update_a_rum_based_metric_returns_Not_Found_response-1730203168"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Update_a_rum_based_metric_returns_Not_Found_response-1730203168","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/rum/config/metrics + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"Test_Update_a_rum_based_metric_returns_Not_Found_response_1730203168","type":"rum_metrics","attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Update_a_rum_based_metric_returns_Not_Found_response-1730203168"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 29 Oct 2024 11:59:28 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"include_percentiles":true}},"id":"8fc991bf-967e-4652-8a5b-0711a985abe3","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/8fc991bf-967e-4652-8a5b-0711a985abe3 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Not Found","detail":"not_found(Metric + with name ''8fc991bf-967e-4652-8a5b-0711a985abe3'' not found)"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +- recorded_at: Tue, 29 Oct 2024 11:59:28 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Update_a_rum_based_metric_returns_Not_Found_response_1730203168 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-OK-response.frozen b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-OK-response.frozen new file mode 100644 index 000000000000..79f1ec749e7b --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-10-29T11:59:29.233Z \ No newline at end of file diff --git a/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-OK-response.yml b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-OK-response.yml new file mode 100644 index 000000000000..785e7408f7c4 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-OK-response.yml @@ -0,0 +1,62 @@ +http_interactions: +- recorded_at: Tue, 29 Oct 2024 11:59:29 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Update_a_rum_based_metric_returns_OK_response-1730203169"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Update_a_rum_based_metric_returns_OK_response-1730203169","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/rum/config/metrics + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"Test_Update_a_rum_based_metric_returns_OK_response_1730203169","type":"rum_metrics","attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"},"event_type":"session","filter":{"query":"source:Test-Update_a_rum_based_metric_returns_OK_response-1730203169"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 29 Oct 2024 11:59:29 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"compute":{"include_percentiles":false},"filter":{"query":"@service:rum-config"},"group_by":[{"path":"@browser.version","tag_name":"browser_version"}]},"id":"Test_Update_a_rum_based_metric_returns_OK_response_1730203169","type":"rum_metrics"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Update_a_rum_based_metric_returns_OK_response_1730203169 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"Test_Update_a_rum_based_metric_returns_OK_response_1730203169","type":"rum_metrics","attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":false,"path":"@duration"},"event_type":"session","filter":{"query":"@service:rum-config"},"group_by":[{"path":"@browser.version","tag_name":"browser_version"}],"uniqueness":{"when":"match"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 29 Oct 2024 11:59:29 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/rum/config/metrics/Test_Update_a_rum_based_metric_returns_OK_response_1730203169 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/rum-metrics/CreateRumMetric.rb b/examples/v2/rum-metrics/CreateRumMetric.rb new file mode 100644 index 000000000000..13e9f42ab56b --- /dev/null +++ b/examples/v2/rum-metrics/CreateRumMetric.rb @@ -0,0 +1,32 @@ +# Create a rum-based metric returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::RumMetricsAPI.new + +body = DatadogAPIClient::V2::RumMetricCreateRequest.new({ + data: DatadogAPIClient::V2::RumMetricCreateData.new({ + attributes: DatadogAPIClient::V2::RumMetricCreateAttributes.new({ + compute: DatadogAPIClient::V2::RumMetricCompute.new({ + aggregation_type: DatadogAPIClient::V2::RumMetricComputeAggregationType::DISTRIBUTION, + include_percentiles: true, + path: "@duration", + }), + event_type: DatadogAPIClient::V2::RumMetricEventType::SESSION, + filter: DatadogAPIClient::V2::RumMetricFilter.new({ + query: "@service:web-ui", + }), + group_by: [ + DatadogAPIClient::V2::RumMetricGroupBy.new({ + path: "@browser.name", + tag_name: "browser_name", + }), + ], + uniqueness: DatadogAPIClient::V2::RumMetricUniqueness.new({ + _when: DatadogAPIClient::V2::RumMetricUniquenessWhen::WHEN_MATCH, + }), + }), + id: "rum.sessions.webui.count", + type: DatadogAPIClient::V2::RumMetricType::RUM_METRICS, + }), +}) +p api_instance.create_rum_metric(body) diff --git a/examples/v2/rum-metrics/DeleteRumMetric.rb b/examples/v2/rum-metrics/DeleteRumMetric.rb new file mode 100644 index 000000000000..a426bd84ae5c --- /dev/null +++ b/examples/v2/rum-metrics/DeleteRumMetric.rb @@ -0,0 +1,8 @@ +# Delete a rum-based metric returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::RumMetricsAPI.new + +# there is a valid "rum_metric" in the system +RUM_METRIC_DATA_ID = ENV["RUM_METRIC_DATA_ID"] +api_instance.delete_rum_metric(RUM_METRIC_DATA_ID) diff --git a/examples/v2/rum-metrics/GetRumMetric.rb b/examples/v2/rum-metrics/GetRumMetric.rb new file mode 100644 index 000000000000..f751e27dd455 --- /dev/null +++ b/examples/v2/rum-metrics/GetRumMetric.rb @@ -0,0 +1,8 @@ +# Get a rum-based metric returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::RumMetricsAPI.new + +# there is a valid "rum_metric" in the system +RUM_METRIC_DATA_ID = ENV["RUM_METRIC_DATA_ID"] +p api_instance.get_rum_metric(RUM_METRIC_DATA_ID) diff --git a/examples/v2/rum-metrics/ListRumMetrics.rb b/examples/v2/rum-metrics/ListRumMetrics.rb new file mode 100644 index 000000000000..71f244b36667 --- /dev/null +++ b/examples/v2/rum-metrics/ListRumMetrics.rb @@ -0,0 +1,5 @@ +# Get all rum-based metrics returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::RumMetricsAPI.new +p api_instance.list_rum_metrics() diff --git a/examples/v2/rum-metrics/UpdateRumMetric.rb b/examples/v2/rum-metrics/UpdateRumMetric.rb new file mode 100644 index 000000000000..daa74fbd7afe --- /dev/null +++ b/examples/v2/rum-metrics/UpdateRumMetric.rb @@ -0,0 +1,29 @@ +# Update a rum-based metric returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::RumMetricsAPI.new + +# there is a valid "rum_metric" in the system +RUM_METRIC_DATA_ID = ENV["RUM_METRIC_DATA_ID"] + +body = DatadogAPIClient::V2::RumMetricUpdateRequest.new({ + data: DatadogAPIClient::V2::RumMetricUpdateData.new({ + id: RUM_METRIC_DATA_ID, + type: DatadogAPIClient::V2::RumMetricType::RUM_METRICS, + attributes: DatadogAPIClient::V2::RumMetricUpdateAttributes.new({ + compute: DatadogAPIClient::V2::RumMetricUpdateCompute.new({ + include_percentiles: false, + }), + filter: DatadogAPIClient::V2::RumMetricFilter.new({ + query: "@service:rum-config", + }), + group_by: [ + DatadogAPIClient::V2::RumMetricGroupBy.new({ + path: "@browser.version", + tag_name: "browser_version", + }), + ], + }), + }), +}) +p api_instance.update_rum_metric(RUM_METRIC_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 53c581b2a648..e23e20d789e5 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1887,6 +1887,19 @@ "v2.SearchRUMEvents" => { "body" => "RUMSearchEventsRequest", }, + "v2.CreateRumMetric" => { + "body" => "RumMetricCreateRequest", + }, + "v2.DeleteRumMetric" => { + "metric_id" => "String", + }, + "v2.GetRumMetric" => { + "metric_id" => "String", + }, + "v2.UpdateRumMetric" => { + "metric_id" => "String", + "body" => "RumMetricUpdateRequest", + }, "v2.ListScorecardOutcomes" => { "page_size" => "Integer", "page_offset" => "Integer", diff --git a/features/v2/given.json b/features/v2/given.json index 9370b4fc5fc6..76246b3199db 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -471,6 +471,18 @@ "tag": "RUM", "operationId": "CreateRUMApplication" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"id\": \"{{ unique }}\",\n \"type\": \"rum_metrics\",\n \"attributes\": {\n \"event_type\": \"session\",\n \"compute\": {\n \"aggregation_type\": \"distribution\",\n \"include_percentiles\": true,\n \"path\": \"@duration\"\n },\n \"filter\": {\n \"query\": \"source:{{ unique }}\"\n },\n \"group_by\": [{\n \"path\": \"@browser.name\",\n \"tag_name\": \"browser_name\"\n }],\n \"uniqueness\": {\n \"when\": \"match\"\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"rum_metric\" in the system", + "key": "rum_metric", + "tag": "Rum Metrics", + "operationId": "CreateRumMetric" + }, { "parameters": [ { diff --git a/features/v2/rum_metrics.feature b/features/v2/rum_metrics.feature new file mode 100644 index 000000000000..cf13d41e9515 --- /dev/null +++ b/features/v2/rum_metrics.feature @@ -0,0 +1,134 @@ +@endpoint(rum-metrics) @endpoint(rum-metrics-v2) +Feature: Rum Metrics + Manage configuration of [rum-based + metrics](https://app.datadoghq.com/rum/generate-metrics) for your + organization. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "RumMetrics" API + + @team:DataDog/rum-backend + Scenario: Create a rum-based metric returns "Bad Request" response + Given new "CreateRumMetric" request + And body with value {"data": {"id": "rum.actions.invalid", "type": "rum_metrics", "attributes": {"event_type": "action", "compute": {"aggregation_type": "count"}, "uniqueness":{"when": "match"}}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/rum-backend + Scenario: Create a rum-based metric returns "Conflict" response + Given there is a valid "rum_metric" in the system + And new "CreateRumMetric" request + And body with value {"data": {"id": "{{ rum_metric.data.id }}", "type": "rum_metrics", "attributes": {"compute": {"aggregation_type": "count"}, "event_type": "action"}}} + When the request is sent + Then the response status is 409 Conflict + + @team:DataDog/rum-backend + Scenario: Create a rum-based metric returns "Created" response + Given new "CreateRumMetric" request + And body with value {"data": {"attributes": {"compute": {"aggregation_type": "distribution", "include_percentiles": true, "path": "@duration"}, "event_type": "session", "filter": {"query": "@service:web-ui"}, "group_by": [{"path": "@browser.name", "tag_name": "browser_name"}], "uniqueness": {"when": "match"}}, "id": "rum.sessions.webui.count", "type": "rum_metrics"}} + When the request is sent + Then the response status is 201 Created + And the response "data.id" is equal to "rum.sessions.webui.count" + And the response "data.type" is equal to "rum_metrics" + And the response "data.attributes.event_type" is equal to "session" + And the response "data.attributes.compute.aggregation_type" is equal to "distribution" + And the response "data.attributes.compute.include_percentiles" is equal to true + And the response "data.attributes.compute.path" is equal to "@duration" + And the response "data.attributes.filter.query" is equal to "@service:web-ui" + And the response "data.attributes.group_by[0].path" is equal to "@browser.name" + And the response "data.attributes.group_by[0].tag_name" is equal to "browser_name" + And the response "data.attributes.uniqueness.when" is equal to "match" + + @team:DataDog/rum-backend + Scenario: Delete a rum-based metric returns "No Content" response + Given there is a valid "rum_metric" in the system + And new "DeleteRumMetric" request + And request contains "metric_id" parameter from "rum_metric.data.id" + When the request is sent + Then the response status is 204 No Content + + @team:DataDog/rum-backend + Scenario: Delete a rum-based metric returns "Not Found" response + Given new "DeleteRumMetric" request + And request contains "metric_id" parameter with value "{{ unique }}" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/rum-backend + Scenario: Get a rum-based metric returns "Not Found" response + Given new "GetRumMetric" request + And request contains "metric_id" parameter with value "{{ unique }}" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/rum-backend + Scenario: Get a rum-based metric returns "OK" response + Given there is a valid "rum_metric" in the system + And new "GetRumMetric" request + And request contains "metric_id" parameter from "rum_metric.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "rum_metric.data.id" + And the response "data.type" has the same value as "rum_metric.data.type" + And the response "data.attributes.event_type" has the same value as "rum_metric.data.attributes.event_type" + And the response "data.attributes.compute.aggregation_type" has the same value as "rum_metric.data.attributes.compute.aggregation_type" + And the response "data.attributes.compute.include_percentiles" has the same value as "rum_metric.data.attributes.compute.include_percentiles" + And the response "data.attributes.compute.path" has the same value as "rum_metric.data.attributes.compute.path" + And the response "data.attributes.filter.query" has the same value as "rum_metric.data.attributes.filter.query" + And the response "data.attributes.group_by[0].path" has the same value as "rum_metric.data.attributes.group_by[0].path" + And the response "data.attributes.group_by[0].tag_name" has the same value as "rum_metric.data.attributes.group_by[0].tag_name" + And the response "data.attributes.uniqueness.when" has the same value as "rum_metric.data.attributes.uniqueness.when" + + @team:DataDog/rum-backend + Scenario: Get all rum-based metrics returns "OK" response + Given new "ListRumMetrics" request + When the request is sent + Then the response status is 200 OK + + @team:DataDog/rum-backend + Scenario: Update a rum-based metric returns "Bad Request" response + Given there is a valid "rum_metric" in the system + And new "UpdateRumMetric" request + And request contains "metric_id" parameter from "rum_metric.data.id" + And body with value {"data": {"id": "rum.sessions.webui.count", "type": "unknown_metrics", "attributes": {"compute": {"include_percentiles": true}}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/rum-backend + Scenario: Update a rum-based metric returns "Conflict" response + Given there is a valid "rum_metric" in the system + And new "UpdateRumMetric" request + And request contains "metric_id" parameter from "rum_metric.data.id" + And body with value {"data": {"id": "conflicting.id", "type": "rum_metrics", "attributes": {"compute": {"include_percentiles": true}}}} + When the request is sent + Then the response status is 409 Conflict + + @team:DataDog/rum-backend + Scenario: Update a rum-based metric returns "Not Found" response + Given there is a valid "rum_metric" in the system + And new "UpdateRumMetric" request + And request contains "metric_id" parameter with value "8fc991bf-967e-4652-8a5b-0711a985abe3" + And body with value {"data": {"id": "8fc991bf-967e-4652-8a5b-0711a985abe3", "type": "rum_metrics", "attributes": {"compute": {"include_percentiles": true}}}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/rum-backend + Scenario: Update a rum-based metric returns "OK" response + Given there is a valid "rum_metric" in the system + And new "UpdateRumMetric" request + And request contains "metric_id" parameter from "rum_metric.data.id" + And body with value {"data": {"id": "{{ rum_metric.data.id }}", "type": "rum_metrics", "attributes": {"compute": {"include_percentiles": false}, "filter": {"query": "@service:rum-config"}, "group_by": [{"path": "@browser.version", "tag_name": "browser_version"}]}}} + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "rum_metric.data.id" + And the response "data.type" has the same value as "rum_metric.data.type" + And the response "data.attributes.event_type" has the same value as "rum_metric.data.attributes.event_type" + And the response "data.attributes.compute.aggregation_type" has the same value as "rum_metric.data.attributes.compute.aggregation_type" + And the response "data.attributes.compute.include_percentiles" is equal to false + And the response "data.attributes.compute.path" has the same value as "rum_metric.data.attributes.compute.path" + And the response "data.attributes.filter.query" is equal to "@service:rum-config" + And the response "data.attributes.group_by[0].path" is equal to "@browser.version" + And the response "data.attributes.group_by[0].tag_name" is equal to "browser_version" + And the response "data.attributes.uniqueness.when" has the same value as "rum_metric.data.attributes.uniqueness.when" diff --git a/features/v2/undo.json b/features/v2/undo.json index 5516102f8ffd..62b494c8dc11 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1755,6 +1755,43 @@ "type": "idempotent" } }, + "ListRumMetrics": { + "tag": "Rum Metrics", + "undo": { + "type": "safe" + } + }, + "CreateRumMetric": { + "tag": "Rum Metrics", + "undo": { + "operationId": "DeleteRumMetric", + "parameters": [ + { + "name": "metric_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteRumMetric": { + "tag": "Rum Metrics", + "undo": { + "type": "idempotent" + } + }, + "GetRumMetric": { + "tag": "Rum Metrics", + "undo": { + "type": "safe" + } + }, + "UpdateRumMetric": { + "tag": "Rum Metrics", + "undo": { + "type": "idempotent" + } + }, "ListRUMEvents": { "tag": "RUM", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 624b9ea59c10..02718c5d8d9c 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2096,6 +2096,29 @@ def overrides "v2.rum_group_by_histogram" => "RUMGroupByHistogram", "v2.rum_group_by_missing" => "RUMGroupByMissing", "v2.rum_group_by_total" => "RUMGroupByTotal", + "v2.rum_metric_compute" => "RumMetricCompute", + "v2.rum_metric_compute_aggregation_type" => "RumMetricComputeAggregationType", + "v2.rum_metric_create_attributes" => "RumMetricCreateAttributes", + "v2.rum_metric_create_data" => "RumMetricCreateData", + "v2.rum_metric_create_request" => "RumMetricCreateRequest", + "v2.rum_metric_event_type" => "RumMetricEventType", + "v2.rum_metric_filter" => "RumMetricFilter", + "v2.rum_metric_group_by" => "RumMetricGroupBy", + "v2.rum_metric_response" => "RumMetricResponse", + "v2.rum_metric_response_attributes" => "RumMetricResponseAttributes", + "v2.rum_metric_response_compute" => "RumMetricResponseCompute", + "v2.rum_metric_response_data" => "RumMetricResponseData", + "v2.rum_metric_response_filter" => "RumMetricResponseFilter", + "v2.rum_metric_response_group_by" => "RumMetricResponseGroupBy", + "v2.rum_metric_response_uniqueness" => "RumMetricResponseUniqueness", + "v2.rum_metrics_response" => "RumMetricsResponse", + "v2.rum_metric_type" => "RumMetricType", + "v2.rum_metric_uniqueness" => "RumMetricUniqueness", + "v2.rum_metric_uniqueness_when" => "RumMetricUniquenessWhen", + "v2.rum_metric_update_attributes" => "RumMetricUpdateAttributes", + "v2.rum_metric_update_compute" => "RumMetricUpdateCompute", + "v2.rum_metric_update_data" => "RumMetricUpdateData", + "v2.rum_metric_update_request" => "RumMetricUpdateRequest", "v2.rum_query_filter" => "RUMQueryFilter", "v2.rum_query_options" => "RUMQueryOptions", "v2.rum_query_page_options" => "RUMQueryPageOptions", @@ -2614,6 +2637,7 @@ def overrides "v2.restriction_policies_api" => "RestrictionPoliciesAPI", "v2.roles_api" => "RolesAPI", "v2.rum_api" => "RUMAPI", + "v2.rum_metrics_api" => "RumMetricsAPI", "v2.security_monitoring_api" => "SecurityMonitoringAPI", "v2.sensitive_data_scanner_api" => "SensitiveDataScannerAPI", "v2.service_accounts_api" => "ServiceAccountsAPI", diff --git a/lib/datadog_api_client/v2/api/rum_metrics_api.rb b/lib/datadog_api_client/v2/api/rum_metrics_api.rb new file mode 100644 index 000000000000..c18d53b362d4 --- /dev/null +++ b/lib/datadog_api_client/v2/api/rum_metrics_api.rb @@ -0,0 +1,357 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class RumMetricsAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create a rum-based metric. + # + # @see #create_rum_metric_with_http_info + def create_rum_metric(body, opts = {}) + data, _status_code, _headers = create_rum_metric_with_http_info(body, opts) + data + end + + # Create a rum-based metric. + # + # Create a metric based on your organization's RUM data. + # Returns the rum-based metric object from the request body when the request is successful. + # + # @param body [RumMetricCreateRequest] The definition of the new rum-based metric. + # @param opts [Hash] the optional parameters + # @return [Array<(RumMetricResponse, Integer, Hash)>] RumMetricResponse data, response status code and response headers + def create_rum_metric_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RumMetricsAPI.create_rum_metric ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling RumMetricsAPI.create_rum_metric" + end + # resource path + local_var_path = '/api/v2/rum/config/metrics' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'RumMetricResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_rum_metric, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RumMetricsAPI#create_rum_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a rum-based metric. + # + # @see #delete_rum_metric_with_http_info + def delete_rum_metric(metric_id, opts = {}) + delete_rum_metric_with_http_info(metric_id, opts) + nil + end + + # Delete a rum-based metric. + # + # Delete a specific rum-based metric from your organization. + # + # @param metric_id [String] The name of the rum-based metric. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_rum_metric_with_http_info(metric_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RumMetricsAPI.delete_rum_metric ...' + end + # verify the required parameter 'metric_id' is set + if @api_client.config.client_side_validation && metric_id.nil? + fail ArgumentError, "Missing the required parameter 'metric_id' when calling RumMetricsAPI.delete_rum_metric" + end + # resource path + local_var_path = '/api/v2/rum/config/metrics/{metric_id}'.sub('{metric_id}', CGI.escape(metric_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_rum_metric, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RumMetricsAPI#delete_rum_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a rum-based metric. + # + # @see #get_rum_metric_with_http_info + def get_rum_metric(metric_id, opts = {}) + data, _status_code, _headers = get_rum_metric_with_http_info(metric_id, opts) + data + end + + # Get a rum-based metric. + # + # Get a specific rum-based metric from your organization. + # + # @param metric_id [String] The name of the rum-based metric. + # @param opts [Hash] the optional parameters + # @return [Array<(RumMetricResponse, Integer, Hash)>] RumMetricResponse data, response status code and response headers + def get_rum_metric_with_http_info(metric_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RumMetricsAPI.get_rum_metric ...' + end + # verify the required parameter 'metric_id' is set + if @api_client.config.client_side_validation && metric_id.nil? + fail ArgumentError, "Missing the required parameter 'metric_id' when calling RumMetricsAPI.get_rum_metric" + end + # resource path + local_var_path = '/api/v2/rum/config/metrics/{metric_id}'.sub('{metric_id}', CGI.escape(metric_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RumMetricResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_rum_metric, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RumMetricsAPI#get_rum_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get all rum-based metrics. + # + # @see #list_rum_metrics_with_http_info + def list_rum_metrics(opts = {}) + data, _status_code, _headers = list_rum_metrics_with_http_info(opts) + data + end + + # Get all rum-based metrics. + # + # Get the list of configured rum-based metrics with their definitions. + # + # @param opts [Hash] the optional parameters + # @return [Array<(RumMetricsResponse, Integer, Hash)>] RumMetricsResponse data, response status code and response headers + def list_rum_metrics_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RumMetricsAPI.list_rum_metrics ...' + end + # resource path + local_var_path = '/api/v2/rum/config/metrics' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RumMetricsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_rum_metrics, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RumMetricsAPI#list_rum_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a rum-based metric. + # + # @see #update_rum_metric_with_http_info + def update_rum_metric(metric_id, body, opts = {}) + data, _status_code, _headers = update_rum_metric_with_http_info(metric_id, body, opts) + data + end + + # Update a rum-based metric. + # + # Update a specific rum-based metric from your organization. + # Returns the rum-based metric object from the request body when the request is successful. + # + # @param metric_id [String] The name of the rum-based metric. + # @param body [RumMetricUpdateRequest] New definition of the rum-based metric. + # @param opts [Hash] the optional parameters + # @return [Array<(RumMetricResponse, Integer, Hash)>] RumMetricResponse data, response status code and response headers + def update_rum_metric_with_http_info(metric_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RumMetricsAPI.update_rum_metric ...' + end + # verify the required parameter 'metric_id' is set + if @api_client.config.client_side_validation && metric_id.nil? + fail ArgumentError, "Missing the required parameter 'metric_id' when calling RumMetricsAPI.update_rum_metric" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling RumMetricsAPI.update_rum_metric" + end + # resource path + local_var_path = '/api/v2/rum/config/metrics/{metric_id}'.sub('{metric_id}', CGI.escape(metric_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'RumMetricResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_rum_metric, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RumMetricsAPI#update_rum_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_compute.rb b/lib/datadog_api_client/v2/models/rum_metric_compute.rb new file mode 100644 index 000000000000..18beae3992cd --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_compute.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The compute rule to compute the rum-based metric. + class RumMetricCompute + include BaseGenericModel + + # The type of aggregation to use. + attr_reader :aggregation_type + + # Toggle to include or exclude percentile aggregations for distribution metrics. + # Only present when the `aggregation_type` is `distribution`. + attr_accessor :include_percentiles + + # The path to the value the rum-based metric will aggregate on (only used if the aggregation type is a "distribution"). + attr_accessor :path + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'aggregation_type' => :'aggregation_type', + :'include_percentiles' => :'include_percentiles', + :'path' => :'path' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'aggregation_type' => :'RumMetricComputeAggregationType', + :'include_percentiles' => :'Boolean', + :'path' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricCompute` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'aggregation_type') + self.aggregation_type = attributes[:'aggregation_type'] + end + + if attributes.key?(:'include_percentiles') + self.include_percentiles = attributes[:'include_percentiles'] + end + + if attributes.key?(:'path') + self.path = attributes[:'path'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @aggregation_type.nil? + true + end + + # Custom attribute writer method with validation + # @param aggregation_type [Object] Object to be assigned + # @!visibility private + def aggregation_type=(aggregation_type) + if aggregation_type.nil? + fail ArgumentError, 'invalid value for "aggregation_type", aggregation_type cannot be nil.' + end + @aggregation_type = aggregation_type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + aggregation_type == o.aggregation_type && + include_percentiles == o.include_percentiles && + path == o.path + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [aggregation_type, include_percentiles, path].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_compute_aggregation_type.rb b/lib/datadog_api_client/v2/models/rum_metric_compute_aggregation_type.rb new file mode 100644 index 000000000000..ee29805eb52c --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_compute_aggregation_type.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of aggregation to use. + class RumMetricComputeAggregationType + include BaseEnumModel + + COUNT = "count".freeze + DISTRIBUTION = "distribution".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_create_attributes.rb b/lib/datadog_api_client/v2/models/rum_metric_create_attributes.rb new file mode 100644 index 000000000000..0c6a770921e7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_create_attributes.rb @@ -0,0 +1,176 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The object describing the Datadog rum-based metric to create. + class RumMetricCreateAttributes + include BaseGenericModel + + # The compute rule to compute the rum-based metric. + attr_reader :compute + + # The type of RUM events to filter on. + attr_reader :event_type + + # The rum-based metric filter. Events matching this filter will be aggregated in this metric. + attr_accessor :filter + + # The rules for the group by. + attr_accessor :group_by + + # The rule to count updatable events. Is only set if "event_type" is "sessions" or "views". + attr_accessor :uniqueness + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'compute' => :'compute', + :'event_type' => :'event_type', + :'filter' => :'filter', + :'group_by' => :'group_by', + :'uniqueness' => :'uniqueness' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'compute' => :'RumMetricCompute', + :'event_type' => :'RumMetricEventType', + :'filter' => :'RumMetricFilter', + :'group_by' => :'Array', + :'uniqueness' => :'RumMetricUniqueness' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'compute') + self.compute = attributes[:'compute'] + end + + if attributes.key?(:'event_type') + self.event_type = attributes[:'event_type'] + end + + if attributes.key?(:'filter') + self.filter = attributes[:'filter'] + end + + if attributes.key?(:'group_by') + if (value = attributes[:'group_by']).is_a?(Array) + self.group_by = value + end + end + + if attributes.key?(:'uniqueness') + self.uniqueness = attributes[:'uniqueness'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @compute.nil? + return false if @event_type.nil? + true + end + + # Custom attribute writer method with validation + # @param compute [Object] Object to be assigned + # @!visibility private + def compute=(compute) + if compute.nil? + fail ArgumentError, 'invalid value for "compute", compute cannot be nil.' + end + @compute = compute + end + + # Custom attribute writer method with validation + # @param event_type [Object] Object to be assigned + # @!visibility private + def event_type=(event_type) + if event_type.nil? + fail ArgumentError, 'invalid value for "event_type", event_type cannot be nil.' + end + @event_type = event_type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + compute == o.compute && + event_type == o.event_type && + filter == o.filter && + group_by == o.group_by && + uniqueness == o.uniqueness + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [compute, event_type, filter, group_by, uniqueness].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_create_data.rb b/lib/datadog_api_client/v2/models/rum_metric_create_data.rb new file mode 100644 index 000000000000..ffba8007c338 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_create_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The new rum-based metric properties. + class RumMetricCreateData + include BaseGenericModel + + # The object describing the Datadog rum-based metric to create. + attr_reader :attributes + + # The name of the rum-based metric. + attr_reader :id + + # The type of the resource. The value should always be rum_metrics. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'RumMetricCreateAttributes', + :'id' => :'String', + :'type' => :'RumMetricType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricCreateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_create_request.rb b/lib/datadog_api_client/v2/models/rum_metric_create_request.rb new file mode 100644 index 000000000000..b1e8180bc410 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The new rum-based metric body. + class RumMetricCreateRequest + include BaseGenericModel + + # The new rum-based metric properties. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'RumMetricCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_event_type.rb b/lib/datadog_api_client/v2/models/rum_metric_event_type.rb new file mode 100644 index 000000000000..06e09943aff3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_event_type.rb @@ -0,0 +1,32 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of RUM events to filter on. + class RumMetricEventType + include BaseEnumModel + + SESSION = "session".freeze + VIEW = "view".freeze + ACTION = "action".freeze + ERROR = "error".freeze + RESOURCE = "resource".freeze + LONG_TASK = "long_task".freeze + VITAL = "vital".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_filter.rb b/lib/datadog_api_client/v2/models/rum_metric_filter.rb new file mode 100644 index 000000000000..551ac58cd98f --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_filter.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The rum-based metric filter. Events matching this filter will be aggregated in this metric. + class RumMetricFilter + include BaseGenericModel + + # The search query - following the RUM search syntax. Must include an @type facet query. + attr_reader :query + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'query' => :'query' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'query' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricFilter` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @query.nil? + true + end + + # Custom attribute writer method with validation + # @param query [Object] Object to be assigned + # @!visibility private + def query=(query) + if query.nil? + fail ArgumentError, 'invalid value for "query", query cannot be nil.' + end + @query = query + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + query == o.query + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [query].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_group_by.rb b/lib/datadog_api_client/v2/models/rum_metric_group_by.rb new file mode 100644 index 000000000000..15540c081de8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_group_by.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A group by rule. + class RumMetricGroupBy + include BaseGenericModel + + # The path to the value the rum-based metric will be aggregated over. + attr_reader :path + + # Eventual name of the tag that gets created. By default, the path attribute is used as the tag name. + attr_accessor :tag_name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'path' => :'path', + :'tag_name' => :'tag_name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'path' => :'String', + :'tag_name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricGroupBy` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'path') + self.path = attributes[:'path'] + end + + if attributes.key?(:'tag_name') + self.tag_name = attributes[:'tag_name'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @path.nil? + true + end + + # Custom attribute writer method with validation + # @param path [Object] Object to be assigned + # @!visibility private + def path=(path) + if path.nil? + fail ArgumentError, 'invalid value for "path", path cannot be nil.' + end + @path = path + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + path == o.path && + tag_name == o.tag_name + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [path, tag_name].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_response.rb b/lib/datadog_api_client/v2/models/rum_metric_response.rb new file mode 100644 index 000000000000..88b5b42f449c --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_response.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The rum-based metric object. + class RumMetricResponse + include BaseGenericModel + + # The rum-based metric properties. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'RumMetricResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_response_attributes.rb b/lib/datadog_api_client/v2/models/rum_metric_response_attributes.rb new file mode 100644 index 000000000000..f2167ba1dd6a --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_response_attributes.rb @@ -0,0 +1,147 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The object describing a Datadog rum-based metric. + class RumMetricResponseAttributes + include BaseGenericModel + + # The compute rule to compute the rum-based metric. + attr_accessor :compute + + # The type of RUM events to filter on. + attr_accessor :event_type + + # The rum-based metric filter. RUM events matching this filter will be aggregated in this metric. + attr_accessor :filter + + # The rules for the group by. + attr_accessor :group_by + + # The rule to count updatable events. Is only set if "event_type" is "sessions" or "views". + attr_accessor :uniqueness + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'compute' => :'compute', + :'event_type' => :'event_type', + :'filter' => :'filter', + :'group_by' => :'group_by', + :'uniqueness' => :'uniqueness' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'compute' => :'RumMetricResponseCompute', + :'event_type' => :'RumMetricEventType', + :'filter' => :'RumMetricResponseFilter', + :'group_by' => :'Array', + :'uniqueness' => :'RumMetricResponseUniqueness' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'compute') + self.compute = attributes[:'compute'] + end + + if attributes.key?(:'event_type') + self.event_type = attributes[:'event_type'] + end + + if attributes.key?(:'filter') + self.filter = attributes[:'filter'] + end + + if attributes.key?(:'group_by') + if (value = attributes[:'group_by']).is_a?(Array) + self.group_by = value + end + end + + if attributes.key?(:'uniqueness') + self.uniqueness = attributes[:'uniqueness'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + compute == o.compute && + event_type == o.event_type && + filter == o.filter && + group_by == o.group_by && + uniqueness == o.uniqueness + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [compute, event_type, filter, group_by, uniqueness].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_response_compute.rb b/lib/datadog_api_client/v2/models/rum_metric_response_compute.rb new file mode 100644 index 000000000000..1414a79bf1f7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_response_compute.rb @@ -0,0 +1,126 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The compute rule to compute the rum-based metric. + class RumMetricResponseCompute + include BaseGenericModel + + # The type of aggregation to use. + attr_accessor :aggregation_type + + # Toggle to include or exclude percentile aggregations for distribution metrics. + # Only present when the `aggregation_type` is `distribution`. + attr_accessor :include_percentiles + + # The path to the value the rum-based metric will aggregate on (only used if the aggregation type is a "distribution"). + attr_accessor :path + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'aggregation_type' => :'aggregation_type', + :'include_percentiles' => :'include_percentiles', + :'path' => :'path' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'aggregation_type' => :'RumMetricComputeAggregationType', + :'include_percentiles' => :'Boolean', + :'path' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricResponseCompute` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'aggregation_type') + self.aggregation_type = attributes[:'aggregation_type'] + end + + if attributes.key?(:'include_percentiles') + self.include_percentiles = attributes[:'include_percentiles'] + end + + if attributes.key?(:'path') + self.path = attributes[:'path'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + aggregation_type == o.aggregation_type && + include_percentiles == o.include_percentiles && + path == o.path + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [aggregation_type, include_percentiles, path].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_response_data.rb b/lib/datadog_api_client/v2/models/rum_metric_response_data.rb new file mode 100644 index 000000000000..c7c8d8764690 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_response_data.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The rum-based metric properties. + class RumMetricResponseData + include BaseGenericModel + + # The object describing a Datadog rum-based metric. + attr_accessor :attributes + + # The name of the rum-based metric. + attr_accessor :id + + # The type of the resource. The value should always be rum_metrics. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'RumMetricResponseAttributes', + :'id' => :'String', + :'type' => :'RumMetricType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_response_filter.rb b/lib/datadog_api_client/v2/models/rum_metric_response_filter.rb new file mode 100644 index 000000000000..c544a1755aef --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_response_filter.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The rum-based metric filter. RUM events matching this filter will be aggregated in this metric. + class RumMetricResponseFilter + include BaseGenericModel + + # The search query - following the RUM search syntax. + attr_accessor :query + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'query' => :'query' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'query' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricResponseFilter` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + query == o.query + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [query].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_response_group_by.rb b/lib/datadog_api_client/v2/models/rum_metric_response_group_by.rb new file mode 100644 index 000000000000..9a8c16c4fff2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_response_group_by.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A group by rule. + class RumMetricResponseGroupBy + include BaseGenericModel + + # The path to the value the rum-based metric will be aggregated over. + attr_accessor :path + + # Eventual name of the tag that gets created. By default, the path attribute is used as the tag name. + attr_accessor :tag_name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'path' => :'path', + :'tag_name' => :'tag_name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'path' => :'String', + :'tag_name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricResponseGroupBy` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'path') + self.path = attributes[:'path'] + end + + if attributes.key?(:'tag_name') + self.tag_name = attributes[:'tag_name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + path == o.path && + tag_name == o.tag_name + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [path, tag_name].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_response_uniqueness.rb b/lib/datadog_api_client/v2/models/rum_metric_response_uniqueness.rb new file mode 100644 index 000000000000..6eb9d4fcdd05 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_response_uniqueness.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The rule to count updatable events. Is only set if "event_type" is "sessions" or "views". + class RumMetricResponseUniqueness + include BaseGenericModel + + # When to count updatable events. "match" when the event is first seen, or "end" when the event is complete. + attr_accessor :_when + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'_when' => :'when' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'_when' => :'RumMetricUniquenessWhen' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricResponseUniqueness` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'_when') + self._when = attributes[:'_when'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _when == o._when + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [_when].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_type.rb b/lib/datadog_api_client/v2/models/rum_metric_type.rb new file mode 100644 index 000000000000..3768ba67009c --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the resource. The value should always be rum_metrics. + class RumMetricType + include BaseEnumModel + + RUM_METRICS = "rum_metrics".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_uniqueness.rb b/lib/datadog_api_client/v2/models/rum_metric_uniqueness.rb new file mode 100644 index 000000000000..d129066457d3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_uniqueness.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The rule to count updatable events. Is only set if "event_type" is "sessions" or "views". + class RumMetricUniqueness + include BaseGenericModel + + # When to count updatable events. "match" when the event is first seen, or "end" when the event is complete. + attr_reader :_when + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'_when' => :'when' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'_when' => :'RumMetricUniquenessWhen' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricUniqueness` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'_when') + self._when = attributes[:'_when'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @_when.nil? + true + end + + # Custom attribute writer method with validation + # @param _when [Object] Object to be assigned + # @!visibility private + def _when=(_when) + if _when.nil? + fail ArgumentError, 'invalid value for "_when", _when cannot be nil.' + end + @_when = _when + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _when == o._when + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [_when].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_uniqueness_when.rb b/lib/datadog_api_client/v2/models/rum_metric_uniqueness_when.rb new file mode 100644 index 000000000000..7dd895f4a52e --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_uniqueness_when.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # When to count updatable events. "match" when the event is first seen, or "end" when the event is complete. + class RumMetricUniquenessWhen + include BaseEnumModel + + WHEN_MATCH = "match".freeze + WHEN_END = "end".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_update_attributes.rb b/lib/datadog_api_client/v2/models/rum_metric_update_attributes.rb new file mode 100644 index 000000000000..7c9d028e0577 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_update_attributes.rb @@ -0,0 +1,127 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The rum-based metric properties that will be updated. + class RumMetricUpdateAttributes + include BaseGenericModel + + # The compute rule to compute the rum-based metric. + attr_accessor :compute + + # The rum-based metric filter. Events matching this filter will be aggregated in this metric. + attr_accessor :filter + + # The rules for the group by. + attr_accessor :group_by + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'compute' => :'compute', + :'filter' => :'filter', + :'group_by' => :'group_by' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'compute' => :'RumMetricUpdateCompute', + :'filter' => :'RumMetricFilter', + :'group_by' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricUpdateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'compute') + self.compute = attributes[:'compute'] + end + + if attributes.key?(:'filter') + self.filter = attributes[:'filter'] + end + + if attributes.key?(:'group_by') + if (value = attributes[:'group_by']).is_a?(Array) + self.group_by = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + compute == o.compute && + filter == o.filter && + group_by == o.group_by + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [compute, filter, group_by].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_update_compute.rb b/lib/datadog_api_client/v2/models/rum_metric_update_compute.rb new file mode 100644 index 000000000000..507e0b59a792 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_update_compute.rb @@ -0,0 +1,106 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The compute rule to compute the rum-based metric. + class RumMetricUpdateCompute + include BaseGenericModel + + # Toggle to include or exclude percentile aggregations for distribution metrics. + # Only present when the `aggregation_type` is `distribution`. + attr_accessor :include_percentiles + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'include_percentiles' => :'include_percentiles' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'include_percentiles' => :'Boolean' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricUpdateCompute` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'include_percentiles') + self.include_percentiles = attributes[:'include_percentiles'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + include_percentiles == o.include_percentiles + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [include_percentiles].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_update_data.rb b/lib/datadog_api_client/v2/models/rum_metric_update_data.rb new file mode 100644 index 000000000000..994d25fe3845 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_update_data.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The new rum-based metric properties. + class RumMetricUpdateData + include BaseGenericModel + + # The rum-based metric properties that will be updated. + attr_reader :attributes + + # The name of the rum-based metric. + attr_accessor :id + + # The type of the resource. The value should always be rum_metrics. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'RumMetricUpdateAttributes', + :'id' => :'String', + :'type' => :'RumMetricType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricUpdateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metric_update_request.rb b/lib/datadog_api_client/v2/models/rum_metric_update_request.rb new file mode 100644 index 000000000000..ed6a9b0d00e2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The new rum-based metric body. + class RumMetricUpdateRequest + include BaseGenericModel + + # The new rum-based metric properties. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'RumMetricUpdateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rum_metrics_response.rb b/lib/datadog_api_client/v2/models/rum_metrics_response.rb new file mode 100644 index 000000000000..c60369cd84d3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metrics_response.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # All the available rum-based metric objects. + class RumMetricsResponse + include BaseGenericModel + + # A list of rum-based metric objects. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RumMetricsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end