diff --git a/.apigentools-info b/.apigentools-info index a34f65973295..89e0fe42a22d 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-28 18:37:35.868660", - "spec_repo_commit": "b4ad1786" + "regenerated": "2024-10-29 10:03:17.643353", + "spec_repo_commit": "a344440c" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-28 18:37:35.886513", - "spec_repo_commit": "b4ad1786" + "regenerated": "2024-10-29 10:03:17.661702", + "spec_repo_commit": "a344440c" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b4665794e534..cf96221c080e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -583,6 +583,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 @@ -18971,6 +18978,310 @@ 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/RumMetricResponseComputeAggregationType' + 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 + RumMetricResponseComputeAggregationType: + description: The type of aggregation to use. + enum: + - count + - distribution + example: distribution + type: string + x-enum-varnames: + - COUNT + - DISTRIBUTION + 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/RumMetricResponseUniquenessWhen' + required: + - when + type: object + RumMetricResponseUniquenessWhen: + 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: + - MATCH + - END + 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: @@ -35972,6 +36283,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. @@ -41571,6 +42007,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..9e7cb5309a10 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:24.345Z \ 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..441afa6a913b --- /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 07:33:24 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..4627ed6777fa --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Conflict-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:24.764Z \ 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..0da3ed5d13bf --- /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 07:33: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-Create_a_rum_based_metric_returns_Conflict_response-1730187204"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Create_a_rum_based_metric_returns_Conflict_response-1730187204","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_1730187204","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-1730187204"},"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 07:33:24 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_1730187204","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_1730187204'' + 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 07:33:24 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_1730187204 + 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..88ba3babce96 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Create-a-rum-based-metric-returns-Created-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:26.042Z \ 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..6727c9c4b16f --- /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 07:33:26 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 07:33:26 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..a8b92ae82c2e --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:26.742Z \ 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..c4f6c0e5d6a9 --- /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 07:33:26 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-1730187206"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Delete_a_rum_based_metric_returns_No_Content_response-1730187206","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_1730187206","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-1730187206"},"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 07:33:26 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_1730187206 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 29 Oct 2024 07:33:26 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_1730187206 + 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_1730187206'' + 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..c2b77dc48acc --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Delete-a-rum-based-metric-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:27.904Z \ 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..4a429ddee7fe --- /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 07:33:27 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-1730187207 + 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-1730187207'' + 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..da7e41597411 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:28.286Z \ 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..ea6071ccf501 --- /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 07:33:28 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-1730187208 + 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-1730187208'' + 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..5f3547d9b2ff --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Get-a-rum-based-metric-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:28.592Z \ 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..9e85deaaa09d --- /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 07:33: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-Get_a_rum_based_metric_returns_OK_response-1730187208"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Get_a_rum_based_metric_returns_OK_response-1730187208","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_1730187208","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-1730187208"},"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 07:33:28 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_1730187208 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"Test_Get_a_rum_based_metric_returns_OK_response_1730187208","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-1730187208"},"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 07:33:28 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_1730187208 + 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..4a2ff7f37d64 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Get-all-rum-based-metrics-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:29.792Z \ 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..5f25d6ad7c43 --- /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 07:33:29 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..d3844f09397f --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:30.098Z \ 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..1233b731c0e4 --- /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 07:33:30 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-1730187210"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Update_a_rum_based_metric_returns_Bad_Request_response-1730187210","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_1730187210","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-1730187210"},"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 07:33:30 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_1730187210 + 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 07:33:30 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_1730187210 + 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..cda057961b61 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Conflict-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:31.415Z \ 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..c571b586b48b --- /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 07:33:31 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-1730187211"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Update_a_rum_based_metric_returns_Conflict_response-1730187211","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_1730187211","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-1730187211"},"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 07:33:31 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_1730187211 + 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 07:33:31 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_1730187211 + 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..e92506557d84 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:32.635Z \ 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..0ede78539785 --- /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 07:33:32 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-1730187212"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Update_a_rum_based_metric_returns_Not_Found_response-1730187212","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_1730187212","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-1730187212"},"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 07:33:32 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 07:33:32 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_1730187212 + 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..efdf4e8eae80 --- /dev/null +++ b/cassettes/features/v2/rum_metrics/Update-a-rum-based-metric-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-10-29T07:33:33.842Z \ 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..5a4ff76325a3 --- /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 07:33:33 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-1730187213"},"group_by":[{"path":"@browser.name","tag_name":"browser_name"}],"uniqueness":{"when":"match"}},"id":"Test-Update_a_rum_based_metric_returns_OK_response-1730187213","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_1730187213","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-1730187213"},"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 07:33:33 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_1730187213","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_1730187213 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"Test_Update_a_rum_based_metric_returns_OK_response_1730187213","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 07:33:33 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_1730187213 + 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 7ebbf68ba166..45cd28a29f46 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1868,6 +1868,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 efc7bed91b5b..970d084b8463 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -459,6 +459,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 62da7c99ef99..a1d78b42a207 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1706,6 +1706,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 40619ea0453c..bca3140fa534 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2079,6 +2079,31 @@ 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_compute_aggregation_type" => "RumMetricResponseComputeAggregationType", + "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_metric_response_uniqueness_when" => "RumMetricResponseUniquenessWhen", + "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", @@ -2596,6 +2621,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..3dbe8d7277f9 --- /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' => :'RumMetricResponseComputeAggregationType', + :'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_compute_aggregation_type.rb b/lib/datadog_api_client/v2/models/rum_metric_response_compute_aggregation_type.rb new file mode 100644 index 000000000000..a689b25428cf --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_response_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 RumMetricResponseComputeAggregationType + include BaseEnumModel + + COUNT = "count".freeze + DISTRIBUTION = "distribution".freeze + 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..da78d087998c --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_response_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 RumMetricResponseUniqueness + 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' => :'RumMetricResponseUniquenessWhen' + } + 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 + + # 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_response_uniqueness_when.rb b/lib/datadog_api_client/v2/models/rum_metric_response_uniqueness_when.rb new file mode 100644 index 000000000000..71ff6885e14e --- /dev/null +++ b/lib/datadog_api_client/v2/models/rum_metric_response_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 RumMetricResponseUniquenessWhen + include BaseEnumModel + + MATCH = "match".freeze + END = "end".freeze + 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