From 38c3d84ad12df83d8c6d39346aba5e98bbeb5595 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 3 Dec 2024 10:17:55 +0000 Subject: [PATCH] Regenerate client from commit 3f8bbb67 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 397 ++++++++++++++++++ ...equest-returns-Bad-Request-response.frozen | 1 + ...n-request-returns-Bad-Request-response.yml | 21 + ...eletion-request-returns-OK-response.frozen | 1 + ...a-deletion-request-returns-OK-response.yml | 63 +++ ...-Precondition-failed-error-response.frozen | 1 + ...rns-Precondition-failed-error-response.yml | 20 + ...eletion-request-returns-OK-response.frozen | 1 + ...a-deletion-request-returns-OK-response.yml | 44 ++ ...-Precondition-failed-error-response.frozen | 1 + ...rns-Precondition-failed-error-response.yml | 24 ++ ...letion-requests-returns-OK-response.frozen | 1 + ...-deletion-requests-returns-OK-response.yml | 91 ++++ .../CancelDataDeletionRequest.rb | 8 + .../CreateDataDeletionRequest.rb | 21 + .../data-deletion/GetDataDeletionRequests.rb | 5 + features/scenarios_model_mapping.rb | 14 + features/v2/data_deletion.feature | 76 ++++ features/v2/given.json | 16 + features/v2/undo.json | 25 ++ lib/datadog_api_client/inflector.rb | 10 + .../v2/api/data_deletion_api.rb | 239 +++++++++++ .../cancel_data_deletion_response_body.rb | 115 +++++ .../create_data_deletion_request_body.rb | 123 ++++++ ...e_data_deletion_request_body_attributes.rb | 177 ++++++++ .../create_data_deletion_request_body_data.rb | 123 ++++++ .../create_data_deletion_response_body.rb | 115 +++++ .../v2/models/data_deletion_response_item.rb | 165 ++++++++ .../data_deletion_response_item_attributes.rb | 366 ++++++++++++++++ .../v2/models/data_deletion_response_meta.rb | 145 +++++++ .../get_data_deletions_response_body.rb | 117 ++++++ 32 files changed, 2530 insertions(+), 4 deletions(-) create mode 100644 cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-OK-response.frozen create mode 100644 cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-OK-response.yml create mode 100644 cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Precondition-failed-error-response.frozen create mode 100644 cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Precondition-failed-error-response.yml create mode 100644 cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-OK-response.frozen create mode 100644 cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-OK-response.yml create mode 100644 cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-Precondition-failed-error-response.frozen create mode 100644 cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-Precondition-failed-error-response.yml create mode 100644 cassettes/features/v2/data_deletion/Gets-a-list-of-data-deletion-requests-returns-OK-response.frozen create mode 100644 cassettes/features/v2/data_deletion/Gets-a-list-of-data-deletion-requests-returns-OK-response.yml create mode 100644 examples/v2/data-deletion/CancelDataDeletionRequest.rb create mode 100644 examples/v2/data-deletion/CreateDataDeletionRequest.rb create mode 100644 examples/v2/data-deletion/GetDataDeletionRequests.rb create mode 100644 features/v2/data_deletion.feature create mode 100644 lib/datadog_api_client/v2/api/data_deletion_api.rb create mode 100644 lib/datadog_api_client/v2/models/cancel_data_deletion_response_body.rb create mode 100644 lib/datadog_api_client/v2/models/create_data_deletion_request_body.rb create mode 100644 lib/datadog_api_client/v2/models/create_data_deletion_request_body_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/create_data_deletion_request_body_data.rb create mode 100644 lib/datadog_api_client/v2/models/create_data_deletion_response_body.rb create mode 100644 lib/datadog_api_client/v2/models/data_deletion_response_item.rb create mode 100644 lib/datadog_api_client/v2/models/data_deletion_response_item_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/data_deletion_response_meta.rb create mode 100644 lib/datadog_api_client/v2/models/get_data_deletions_response_body.rb diff --git a/.apigentools-info b/.apigentools-info index 5d4598a9bfee..baa7bd577254 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-02 19:29:44.370178", - "spec_repo_commit": "7511c5f0" + "regenerated": "2024-12-03 10:17:28.049947", + "spec_repo_commit": "3f8bbb67" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-02 19:29:44.389400", - "spec_repo_commit": "7511c5f0" + "regenerated": "2024-12-03 10:17:28.068735", + "spec_repo_commit": "3f8bbb67" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 66bdf713cec8..ed720de0d077 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -566,6 +566,13 @@ components: example: 10 format: int64 type: integer + ProductName: + description: Name of the product to be deleted, either `logs` or `rum`. + in: path + name: product + required: true + schema: + type: string ProjectIDPathParameter: description: Project UUID example: e555e290-ed65-49bd-ae18-8acbfcf18db7 @@ -581,6 +588,13 @@ components: required: true schema: type: string + RequestId: + description: ID of the deletion request. + in: path + name: id + required: true + schema: + type: string ResourceID: description: 'Identifier, formatted as `type:id`. Supported types: `connection`, `dashboard`, `notebook`, `security-rule`, `slo`.' @@ -4197,6 +4211,14 @@ components: - name - expression type: object + CancelDataDeletionResponseBody: + description: The response from the cancel data deletion request endpoint. + properties: + data: + $ref: '#/components/schemas/DataDeletionResponseItem' + meta: + $ref: '#/components/schemas/DataDeletionResponseMeta' + type: object Case: description: A case properties: @@ -6372,6 +6394,66 @@ components: type: string x-enum-varnames: - COST_BY_ORG + CreateDataDeletionRequestBody: + description: Object needed to create a data deletion request. + properties: + data: + $ref: '#/components/schemas/CreateDataDeletionRequestBodyData' + required: + - data + type: object + CreateDataDeletionRequestBodyAttributes: + description: Attributes for creating a data deletion request. + properties: + from: + description: Start of requested time window, milliseconds since Unix epoch. + example: 1672527600000 + format: int64 + type: integer + indexes: + description: List of indexes for the search. If not provided, the search + is performed in all indexes. + example: + - index-1 + - index-2 + items: + description: Individual index. + type: string + type: array + query: + additionalProperties: + type: string + description: Query for creating a data deletion request. + example: + host: abc + service: xyz + type: object + to: + description: End of requested time window, milliseconds since Unix epoch. + example: 1704063600000 + format: int64 + type: integer + required: + - query + - from + - to + type: object + CreateDataDeletionRequestBodyData: + description: Data needed to create a data deletion request. + properties: + attributes: + $ref: '#/components/schemas/CreateDataDeletionRequestBodyAttributes' + required: + - attributes + type: object + CreateDataDeletionResponseBody: + description: The response from the create data deletion request endpoint. + properties: + data: + $ref: '#/components/schemas/DataDeletionResponseItem' + meta: + $ref: '#/components/schemas/DataDeletionResponseMeta' + type: object CreateOpenAPIResponse: description: Response for `CreateOpenAPI` operation. properties: @@ -7663,6 +7745,140 @@ components: - INTEGRATION_SCREENBOARD - INTEGRATION_TIMEBOARD - HOST_TIMEBOARD + DataDeletionResponseItem: + description: The created data deletion request information. + properties: + attributes: + $ref: '#/components/schemas/DataDeletionResponseItemAttributes' + id: + description: The ID of the created data deletion request. + example: '1' + type: string + type: + description: The type of the request created. + example: deletion_request + type: string + required: + - id + - type + - attributes + type: object + DataDeletionResponseItemAttributes: + description: Deletion attribute for data deletion response. + properties: + created_at: + description: Creation time of the deletion request. + example: '2024-01-01T00:00:00.000000Z' + type: string + created_by: + description: User who created the deletion request. + example: test.user@datadoghq.com + type: string + from_time: + description: Start of requested time window, milliseconds since Unix epoch. + example: 1672527600000 + format: int64 + type: integer + indexes: + description: List of indexes for the search. If not provided, the search + is performed in all indexes. + example: + - index-1 + - index-2 + items: + description: Individual index. + type: string + type: array + is_created: + description: Whether the deletion request is fully created or not. + example: true + type: boolean + org_id: + description: Organization ID. + example: 321813 + format: int64 + type: integer + product: + description: Product name. + example: logs + type: string + query: + description: Query for creating a data deletion request. + example: service:xyz host:abc + type: string + starting_at: + description: Starting time of the process to delete the requested data. + example: '2024-01-01T02:00:00.000000Z' + type: string + status: + description: Status of the deletion request. + example: pending + type: string + to_time: + description: End of requested time window, milliseconds since Unix epoch. + example: 1704063600000 + format: int64 + type: integer + total_unrestricted: + description: Total number of elements to be deleted. Only the data accessible + to the current user that matches the query and timeframe provided will + be deleted. + example: 100 + format: int64 + type: integer + updated_at: + description: Update time of the deletion request. + example: '2024-01-01T00:00:00.000000Z' + type: string + required: + - created_at + - created_by + - from_time + - is_created + - org_id + - product + - query + - starting_at + - status + - to_time + - total_unrestricted + - updated_at + type: object + DataDeletionResponseMeta: + description: The metadata of the data deletion response. + properties: + count_product: + additionalProperties: + format: int64 + type: integer + description: The total deletion requests created by product. + example: + logs: 8 + rum: 7 + type: object + count_status: + additionalProperties: + format: int64 + type: integer + description: The total deletion requests created by status. + example: + completed: 10 + pending: 5 + type: object + next_page: + description: The next page when searching deletion requests created in the + current organization. + example: cGFnZTI= + type: string + product: + description: The product of the deletion request. + example: logs + type: string + request_status: + description: The status of the executed request. + example: canceled + type: string + type: object DataScalarColumn: description: A column containing the numerical results for a formula or query. properties: @@ -10649,6 +10865,17 @@ components: type: string x-enum-varnames: - GCP_SERVICE_ACCOUNT + GetDataDeletionsResponseBody: + description: The response from the get data deletion requests endpoint. + properties: + data: + description: The list of data deletion requests that matches the query. + items: + $ref: '#/components/schemas/DataDeletionResponseItem' + type: array + meta: + $ref: '#/components/schemas/DataDeletionResponseMeta' + type: object GetDeviceAttributes: description: The device attributes properties: @@ -30912,6 +31139,172 @@ paths: tags: - Dashboard Lists x-codegen-request-body-name: body + /api/v2/deletion/data/{product}: + post: + description: Creates a data deletion request by providing a query and a time + frame targeting the proper data. + operationId: CreateDataDeletionRequest + parameters: + - $ref: '#/components/parameters/ProductName' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateDataDeletionRequestBody' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CreateDataDeletionResponseBody' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '412': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Precondition failed error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Internal server error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Creates a data deletion request + tags: + - Data Deletion + x-permission: + operator: OR + permissions: + - rum_delete_data + - logs_delete_data + /api/v2/deletion/requests: + get: + description: Gets a list of data deletion requests based on several filter parameters. + operationId: GetDataDeletionRequests + parameters: + - description: The next page of the previous search. If the next_page parameter + is included, the rest of the query elements are ignored. + example: cGFnZTI= + in: query + name: next_page + required: false + schema: + type: string + - description: Retrieve only the requests related to the given product. + example: logs + in: query + name: product + required: false + schema: + type: string + - description: Retrieve only the requests that matches the given query. + example: service:xyz host:abc + in: query + name: query + required: false + schema: + type: string + - description: Retrieve only the requests with the given status. + example: pending + in: query + name: status + required: false + schema: + type: string + - description: Sets the page size of the search. + example: '50' + in: query + name: page_size + required: false + schema: + default: 50 + format: int64 + maximum: 50 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GetDataDeletionsResponseBody' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Internal server error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Gets a list of data deletion requests + tags: + - Data Deletion + x-permission: + operator: OR + permissions: + - rum_delete_data + - logs_delete_data + /api/v2/deletion/requests/{id}/cancel: + put: + description: Cancels a data deletion request by providing its ID. + operationId: CancelDataDeletionRequest + parameters: + - $ref: '#/components/parameters/RequestId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CancelDataDeletionResponseBody' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '412': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Precondition failed error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Internal server error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Cancels a data deletion request + tags: + - Data Deletion + x-permission: + operator: OR + permissions: + - rum_delete_data + - logs_delete_data /api/v2/domain_allowlist: get: description: Get the domain allowlist for an organization. @@ -44061,6 +44454,10 @@ tags: organization.' name: Dashboard Lists +- description: The Data Deletion API allows the user to target and delete data from + the allowed products. It's currently enabled for Logs and RUM and depends on `logs_delete_data` + and `rum_delete_data` permissions respectively. + name: Data Deletion - description: 'Configure your Datadog Email Domain Allowlist directly through the Datadog API. diff --git a/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Bad-Request-response.frozen b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..4390af5977db --- /dev/null +++ b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-11-15T08:56:51.182Z \ No newline at end of file diff --git a/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Bad-Request-response.yml b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..b905747067d9 --- /dev/null +++ b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Bad-Request-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Fri, 15 Nov 2024 08:56:51 GMT + request: + body: null + headers: + Accept: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/deletion/requests/id-1/cancel + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"400","title":"Invalid Parameter","detail":"invalid + parameter \"id\" in \"path\"; expected type \"int\""}]}' + 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/data_deletion/Cancels-a-data-deletion-request-returns-OK-response.frozen b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-OK-response.frozen new file mode 100644 index 000000000000..04ac8a541df1 --- /dev/null +++ b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-11-15T08:57:02.769Z \ No newline at end of file diff --git a/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-OK-response.yml b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-OK-response.yml new file mode 100644 index 000000000000..483f91a572c4 --- /dev/null +++ b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-OK-response.yml @@ -0,0 +1,63 @@ +http_interactions: +- recorded_at: Fri, 15 Nov 2024 08:57:02 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"from":1672527600000,"indexes":["index-1","index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000}}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deletion/data/logs + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"303","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:57:03.242841331Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:57:03.242841331Z"}},"meta":{"product":"logs"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Fri, 15 Nov 2024 08:57:02 GMT + request: + body: null + headers: + Accept: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/deletion/requests/303/cancel + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"303","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:57:03.242841Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:57:03.638067Z"}},"meta":{"product":"logs","request_status":"canceled"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Fri, 15 Nov 2024 08:57:02 GMT + request: + body: null + headers: + Accept: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/deletion/requests/303/cancel + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"303","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:57:03.242841Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:57:03.936325Z"}},"meta":{"product":"logs","request_status":"canceled"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Precondition-failed-error-response.frozen b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Precondition-failed-error-response.frozen new file mode 100644 index 000000000000..3bb79b73d33f --- /dev/null +++ b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Precondition-failed-error-response.frozen @@ -0,0 +1 @@ +2024-11-15T08:57:14.890Z \ No newline at end of file diff --git a/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Precondition-failed-error-response.yml b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Precondition-failed-error-response.yml new file mode 100644 index 000000000000..61e9fb51a475 --- /dev/null +++ b/cassettes/features/v2/data_deletion/Cancels-a-data-deletion-request-returns-Precondition-failed-error-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Fri, 15 Nov 2024 08:57:14 GMT + request: + body: null + headers: + Accept: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/deletion/requests/-1/cancel + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"412","code":"INVALID_ID","title":"INVALID_ID","detail":"INVALID_ID"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 412 + message: Precondition Failed +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-OK-response.frozen b/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-OK-response.frozen new file mode 100644 index 000000000000..b74c2983af0b --- /dev/null +++ b/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-11-15T08:59:09.810Z \ No newline at end of file diff --git a/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-OK-response.yml b/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-OK-response.yml new file mode 100644 index 000000000000..0aab555a641b --- /dev/null +++ b/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-OK-response.yml @@ -0,0 +1,44 @@ +http_interactions: +- recorded_at: Fri, 15 Nov 2024 08:59:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"from":1672527600000,"indexes":["index-1","index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000}}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deletion/data/logs + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"305","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:59:10.304195172Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:59:10.304195172Z"}},"meta":{"product":"logs"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Fri, 15 Nov 2024 08:59:09 GMT + request: + body: null + headers: + Accept: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/deletion/requests/305/cancel + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"305","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:59:10.304195Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:59:10.681676Z"}},"meta":{"product":"logs","request_status":"canceled"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-Precondition-failed-error-response.frozen b/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-Precondition-failed-error-response.frozen new file mode 100644 index 000000000000..74ecbd427cf7 --- /dev/null +++ b/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-Precondition-failed-error-response.frozen @@ -0,0 +1 @@ +2024-11-15T08:59:22.532Z \ No newline at end of file diff --git a/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-Precondition-failed-error-response.yml b/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-Precondition-failed-error-response.yml new file mode 100644 index 000000000000..3988c817a274 --- /dev/null +++ b/cassettes/features/v2/data_deletion/Creates-a-data-deletion-request-returns-Precondition-failed-error-response.yml @@ -0,0 +1,24 @@ +http_interactions: +- recorded_at: Fri, 15 Nov 2024 08:59:22 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"from":1672527600000,"indexes":["index-1","index-2"],"query":{},"to":1704063600000}}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deletion/data/logs + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"412","code":"INVALID_BODY","title":"INVALID_BODY","detail":"INVALID_BODY"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 412 + message: Precondition Failed +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/data_deletion/Gets-a-list-of-data-deletion-requests-returns-OK-response.frozen b/cassettes/features/v2/data_deletion/Gets-a-list-of-data-deletion-requests-returns-OK-response.frozen new file mode 100644 index 000000000000..108d0eae3637 --- /dev/null +++ b/cassettes/features/v2/data_deletion/Gets-a-list-of-data-deletion-requests-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-11-15T08:57:26.678Z \ No newline at end of file diff --git a/cassettes/features/v2/data_deletion/Gets-a-list-of-data-deletion-requests-returns-OK-response.yml b/cassettes/features/v2/data_deletion/Gets-a-list-of-data-deletion-requests-returns-OK-response.yml new file mode 100644 index 000000000000..f2516059718a --- /dev/null +++ b/cassettes/features/v2/data_deletion/Gets-a-list-of-data-deletion-requests-returns-OK-response.yml @@ -0,0 +1,91 @@ +http_interactions: +- recorded_at: Fri, 15 Nov 2024 08:57:26 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"from":1672527600000,"indexes":["index-1","index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000}}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deletion/data/logs + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"304","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:57:27.161919269Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:57:27.161919269Z"}},"meta":{"product":"logs"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Fri, 15 Nov 2024 08:57:26 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/deletion/requests + response: + body: + encoding: UTF-8 + string: '{"data":[{"id":"304","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:57:27.161919Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:57:27.161919Z"}},{"id":"303","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:57:03.242841Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:57:03.936325Z"}},{"id":"302","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:44:51.953197Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:44:54.901861Z"}},{"id":"301","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:44:12.92412Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:44:44.846759Z"}},{"id":"300","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:20:26.053712Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:20:34.545658Z"}},{"id":"299","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:12:17.70049Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:12:50.271468Z"}},{"id":"298","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:09:41.997486Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:09:45.322668Z"}},{"id":"297","type":"deletion_request","attributes":{"created_at":"2024-11-15T07:51:10.059846Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T07:51:27.637588Z"}},{"id":"296","type":"deletion_request","attributes":{"created_at":"2024-11-15T07:49:26.502631Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T07:49:28.431587Z"}},{"id":"295","type":"deletion_request","attributes":{"created_at":"2024-11-14T17:57:14.713251Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T17:57:16.874262Z"}},{"id":"294","type":"deletion_request","attributes":{"created_at":"2024-11-14T17:56:38.672296Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T17:56:39.220134Z"}},{"id":"293","type":"deletion_request","attributes":{"created_at":"2024-11-14T17:56:21.931549Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T17:56:22.653515Z"}},{"id":"292","type":"deletion_request","attributes":{"created_at":"2024-11-14T17:52:37.230638Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T17:52:41.82939Z"}},{"id":"291","type":"deletion_request","attributes":{"created_at":"2024-11-14T17:51:34.464818Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T17:51:35.662615Z"}},{"id":"290","type":"deletion_request","attributes":{"created_at":"2024-11-14T17:34:51.13924Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T17:34:52.585803Z"}},{"id":"289","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:54:28.587048Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:54:30.222141Z"}},{"id":"288","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:52:52.567007Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:52:54.810859Z"}},{"id":"287","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:49:54.011076Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:49:55.255357Z"}},{"id":"286","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:35:25.381857Z","created_by":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:35:30.570834Z"}},{"id":"285","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:32:52.425512Z","created_by":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:33:25.559245Z"}},{"id":"284","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:27:22.412357Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:27:28.763719Z"}},{"id":"283","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:26:56.006849Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:26:57.682661Z"}},{"id":"282","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:26:02.447468Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:26:05.009146Z"}},{"id":"281","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:24:58.627741Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:25:02.852354Z"}},{"id":"280","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:23:10.220638Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:23:42.451575Z"}},{"id":"279","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:22:34.323711Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:23:06.006296Z"}},{"id":"278","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:21:42.323606Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:21:49.622015Z"}},{"id":"277","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:19:07.723768Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:19:11.463512Z"}},{"id":"276","type":"deletion_request","attributes":{"created_at":"2024-11-14T16:16:47.047428Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-14T16:17:18.723041Z"}}],"meta":{"count_status":{"canceled":28,"pending":1},"count_product":{"logs":29}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Fri, 15 Nov 2024 08:57:26 GMT + request: + body: null + headers: + Accept: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/deletion/requests/304/cancel + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"304","type":"deletion_request","attributes":{"created_at":"2024-11-15T08:57:27.161919Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["index-1","index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc + service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-11-15T08:57:27.931008Z"}},"meta":{"product":"logs","request_status":"canceled"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v2/data-deletion/CancelDataDeletionRequest.rb b/examples/v2/data-deletion/CancelDataDeletionRequest.rb new file mode 100644 index 000000000000..ca4fafbffdd1 --- /dev/null +++ b/examples/v2/data-deletion/CancelDataDeletionRequest.rb @@ -0,0 +1,8 @@ +# Cancels a data deletion request returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::DataDeletionAPI.new + +# there is a valid "deletion_request" in the system +DELETION_REQUEST_DATA_ID = ENV["DELETION_REQUEST_DATA_ID"] +p api_instance.cancel_data_deletion_request(DELETION_REQUEST_DATA_ID) diff --git a/examples/v2/data-deletion/CreateDataDeletionRequest.rb b/examples/v2/data-deletion/CreateDataDeletionRequest.rb new file mode 100644 index 000000000000..77be5aa36c63 --- /dev/null +++ b/examples/v2/data-deletion/CreateDataDeletionRequest.rb @@ -0,0 +1,21 @@ +# Creates a data deletion request returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::DataDeletionAPI.new + +body = DatadogAPIClient::V2::CreateDataDeletionRequestBody.new({ + data: DatadogAPIClient::V2::CreateDataDeletionRequestBodyData.new({ + attributes: DatadogAPIClient::V2::CreateDataDeletionRequestBodyAttributes.new({ + from: 1672527600000, + indexes: [ + "index-1", + "index-2", + ], + query: { + host: "abc", service: "xyz", + }, + to: 1704063600000, + }), + }), +}) +p api_instance.create_data_deletion_request("logs", body) diff --git a/examples/v2/data-deletion/GetDataDeletionRequests.rb b/examples/v2/data-deletion/GetDataDeletionRequests.rb new file mode 100644 index 000000000000..8f703aff8828 --- /dev/null +++ b/examples/v2/data-deletion/GetDataDeletionRequests.rb @@ -0,0 +1,5 @@ +# Gets a list of data deletion requests returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::DataDeletionAPI.new +p api_instance.get_data_deletion_requests() diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 4aeffbe730fe..52e7dc71b28a 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1186,6 +1186,20 @@ "dashboard_list_id" => "Integer", "body" => "DashboardListUpdateItemsRequest", }, + "v2.CreateDataDeletionRequest" => { + "product" => "String", + "body" => "CreateDataDeletionRequestBody", + }, + "v2.GetDataDeletionRequests" => { + "next_page" => "String", + "product" => "String", + "query" => "String", + "status" => "String", + "page_size" => "Integer", + }, + "v2.CancelDataDeletionRequest" => { + "id" => "String", + }, "v2.PatchDomainAllowlist" => { "body" => "DomainAllowlistRequest", }, diff --git a/features/v2/data_deletion.feature b/features/v2/data_deletion.feature new file mode 100644 index 000000000000..84c5830ead3a --- /dev/null +++ b/features/v2/data_deletion.feature @@ -0,0 +1,76 @@ +@endpoint(data-deletion) @endpoint(data-deletion-v2) +Feature: Data Deletion + The Data Deletion API allows the user to target and delete data from the + allowed products. It's currently enabled for Logs and RUM and depends on + `logs_delete_data` and `rum_delete_data` permissions respectively. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "DataDeletion" API + + @team:DataDog/supportability-engineering + Scenario: Cancels a data deletion request returns "Bad Request" response + Given new "CancelDataDeletionRequest" request + And request contains "id" parameter with value "id-1" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/supportability-engineering + Scenario: Cancels a data deletion request returns "OK" response + Given there is a valid "deletion_request" in the system + And new "CancelDataDeletionRequest" request + And request contains "id" parameter from "deletion_request.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" is equal to "{{ deletion_request.data.id }}" + And the response "data.type" is equal to "{{ deletion_request.data.type }}" + And the response "data.attributes.product" is equal to "{{ deletion_request.data.attributes.product }}" + And the response "data.attributes.status" is equal to "canceled" + + @team:DataDog/supportability-engineering + Scenario: Cancels a data deletion request returns "Precondition failed error" response + Given new "CancelDataDeletionRequest" request + And request contains "id" parameter with value "-1" + When the request is sent + Then the response status is 412 Precondition failed error + + @generated @skip @team:DataDog/supportability-engineering + Scenario: Creates a data deletion request returns "Bad Request" response + Given new "CreateDataDeletionRequest" request + And request contains "product" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"from": 1672527600000, "indexes": ["index-1", "index-2"], "query": {"host": "abc", "service": "xyz"}, "to": 1704063600000}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/supportability-engineering + Scenario: Creates a data deletion request returns "OK" response + Given new "CreateDataDeletionRequest" request + And request contains "product" parameter with value "logs" + And body with value {"data": {"attributes": {"from": 1672527600000, "indexes": ["index-1", "index-2"], "query": {"host": "abc", "service": "xyz"}, "to": 1704063600000}}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "deletion_request" + And the response "data.attributes.product" is equal to "logs" + And the response "data.attributes.status" is equal to "pending" + + @team:DataDog/supportability-engineering + Scenario: Creates a data deletion request returns "Precondition failed error" response + Given new "CreateDataDeletionRequest" request + And request contains "product" parameter with value "logs" + And body with value {"data": {"attributes": {"from": 1672527600000, "indexes": ["index-1", "index-2"], "query": {}, "to": 1704063600000}}} + When the request is sent + Then the response status is 412 Precondition failed error + + @generated @skip @team:DataDog/supportability-engineering + Scenario: Gets a list of data deletion requests returns "Bad Request" response + Given new "GetDataDeletionRequests" request + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/supportability-engineering + Scenario: Gets a list of data deletion requests returns "OK" response + Given there is a valid "deletion_request" in the system + And new "GetDataDeletionRequests" request + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/given.json b/features/v2/given.json index 41cd8e0f22a3..62f11ecc9502 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -128,6 +128,22 @@ "tag": "Dashboard Lists", "operationId": "CreateDashboardListItems" }, + { + "parameters": [ + { + "name": "product", + "value": "\"logs\"" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"from\": 1672527600000,\n \"to\": 1704063600000,\n \"indexes\": [\"index-1\", \"index-2\"],\n \"query\": {\"host\": \"abc\", \"service\": \"xyz\"}\n }\n }\n}" + } + ], + "step": "there is a valid \"deletion_request\" in the system", + "key": "deletion_request", + "tag": "Data Deletion", + "operationId": "CreateDataDeletionRequest" + }, { "parameters": [ { diff --git a/features/v2/undo.json b/features/v2/undo.json index 91f554953bdf..608035022755 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -541,6 +541,31 @@ "type": "safe" } }, + "CreateDataDeletionRequest": { + "tag": "Data Deletion", + "undo": { + "operationId": "CancelDataDeletionRequest", + "parameters": [ + { + "name": "id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "GetDataDeletionRequests": { + "tag": "Data Deletion", + "undo": { + "type": "safe" + } + }, + "CancelDataDeletionRequest": { + "tag": "Data Deletion", + "undo": { + "type": "idempotent" + } + }, "GetDomainAllowlist": { "tag": "Domain Allowlist", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index fc6d8c19e15a..cac40f02cd92 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1055,6 +1055,7 @@ def overrides "v2.bulk_mute_findings_response" => "BulkMuteFindingsResponse", "v2.bulk_mute_findings_response_data" => "BulkMuteFindingsResponseData", "v2.calculated_field" => "CalculatedField", + "v2.cancel_data_deletion_response_body" => "CancelDataDeletionResponseBody", "v2.case" => "Case", "v2.case3rd_party_ticket_status" => "Case3rdPartyTicketStatus", "v2.case_assign" => "CaseAssign", @@ -1259,6 +1260,10 @@ def overrides "v2.cost_by_org_attributes" => "CostByOrgAttributes", "v2.cost_by_org_response" => "CostByOrgResponse", "v2.cost_by_org_type" => "CostByOrgType", + "v2.create_data_deletion_request_body" => "CreateDataDeletionRequestBody", + "v2.create_data_deletion_request_body_attributes" => "CreateDataDeletionRequestBodyAttributes", + "v2.create_data_deletion_request_body_data" => "CreateDataDeletionRequestBodyData", + "v2.create_data_deletion_response_body" => "CreateDataDeletionResponseBody", "v2.create_open_api_response" => "CreateOpenAPIResponse", "v2.create_open_api_response_attributes" => "CreateOpenAPIResponseAttributes", "v2.create_open_api_response_data" => "CreateOpenAPIResponseData", @@ -1328,6 +1333,9 @@ def overrides "v2.dashboard_list_update_items_request" => "DashboardListUpdateItemsRequest", "v2.dashboard_list_update_items_response" => "DashboardListUpdateItemsResponse", "v2.dashboard_type" => "DashboardType", + "v2.data_deletion_response_item" => "DataDeletionResponseItem", + "v2.data_deletion_response_item_attributes" => "DataDeletionResponseItemAttributes", + "v2.data_deletion_response_meta" => "DataDeletionResponseMeta", "v2.data_scalar_column" => "DataScalarColumn", "v2.detailed_finding" => "DetailedFinding", "v2.detailed_finding_attributes" => "DetailedFindingAttributes", @@ -1530,6 +1538,7 @@ def overrides "v2.gcpsts_service_accounts_response" => "GCPSTSServiceAccountsResponse", "v2.gcpsts_service_account_update_request" => "GCPSTSServiceAccountUpdateRequest", "v2.gcpsts_service_account_update_request_data" => "GCPSTSServiceAccountUpdateRequestData", + "v2.get_data_deletions_response_body" => "GetDataDeletionsResponseBody", "v2.get_device_attributes" => "GetDeviceAttributes", "v2.get_device_data" => "GetDeviceData", "v2.get_device_response" => "GetDeviceResponse", @@ -2693,6 +2702,7 @@ def overrides "v2.containers_api" => "ContainersAPI", "v2.csm_threats_api" => "CSMThreatsAPI", "v2.dashboard_lists_api" => "DashboardListsAPI", + "v2.data_deletion_api" => "DataDeletionAPI", "v2.domain_allowlist_api" => "DomainAllowlistAPI", "v2.dora_metrics_api" => "DORAMetricsAPI", "v2.downtimes_api" => "DowntimesAPI", diff --git a/lib/datadog_api_client/v2/api/data_deletion_api.rb b/lib/datadog_api_client/v2/api/data_deletion_api.rb new file mode 100644 index 000000000000..613d10060038 --- /dev/null +++ b/lib/datadog_api_client/v2/api/data_deletion_api.rb @@ -0,0 +1,239 @@ +=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 DataDeletionAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Cancels a data deletion request. + # + # @see #cancel_data_deletion_request_with_http_info + def cancel_data_deletion_request(id, opts = {}) + data, _status_code, _headers = cancel_data_deletion_request_with_http_info(id, opts) + data + end + + # Cancels a data deletion request. + # + # Cancels a data deletion request by providing its ID. + # + # @param id [String] ID of the deletion request. + # @param opts [Hash] the optional parameters + # @return [Array<(CancelDataDeletionResponseBody, Integer, Hash)>] CancelDataDeletionResponseBody data, response status code and response headers + def cancel_data_deletion_request_with_http_info(id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DataDeletionAPI.cancel_data_deletion_request ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling DataDeletionAPI.cancel_data_deletion_request" + end + # resource path + local_var_path = '/api/v2/deletion/requests/{id}/cancel'.sub('{id}', CGI.escape(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] || 'CancelDataDeletionResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :cancel_data_deletion_request, + :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::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DataDeletionAPI#cancel_data_deletion_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Creates a data deletion request. + # + # @see #create_data_deletion_request_with_http_info + def create_data_deletion_request(product, body, opts = {}) + data, _status_code, _headers = create_data_deletion_request_with_http_info(product, body, opts) + data + end + + # Creates a data deletion request. + # + # Creates a data deletion request by providing a query and a time frame targeting the proper data. + # + # @param product [String] Name of the product to be deleted, either `logs` or `rum`. + # @param body [CreateDataDeletionRequestBody] + # @param opts [Hash] the optional parameters + # @return [Array<(CreateDataDeletionResponseBody, Integer, Hash)>] CreateDataDeletionResponseBody data, response status code and response headers + def create_data_deletion_request_with_http_info(product, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DataDeletionAPI.create_data_deletion_request ...' + end + # verify the required parameter 'product' is set + if @api_client.config.client_side_validation && product.nil? + fail ArgumentError, "Missing the required parameter 'product' when calling DataDeletionAPI.create_data_deletion_request" + 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 DataDeletionAPI.create_data_deletion_request" + end + # resource path + local_var_path = '/api/v2/deletion/data/{product}'.sub('{product}', CGI.escape(product.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] || 'CreateDataDeletionResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_data_deletion_request, + :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: DataDeletionAPI#create_data_deletion_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Gets a list of data deletion requests. + # + # @see #get_data_deletion_requests_with_http_info + def get_data_deletion_requests(opts = {}) + data, _status_code, _headers = get_data_deletion_requests_with_http_info(opts) + data + end + + # Gets a list of data deletion requests. + # + # Gets a list of data deletion requests based on several filter parameters. + # + # @param opts [Hash] the optional parameters + # @option opts [String] :next_page The next page of the previous search. If the next_page parameter is included, the rest of the query elements are ignored. + # @option opts [String] :product Retrieve only the requests related to the given product. + # @option opts [String] :query Retrieve only the requests that matches the given query. + # @option opts [String] :status Retrieve only the requests with the given status. + # @option opts [Integer] :page_size Sets the page size of the search. + # @return [Array<(GetDataDeletionsResponseBody, Integer, Hash)>] GetDataDeletionsResponseBody data, response status code and response headers + def get_data_deletion_requests_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DataDeletionAPI.get_data_deletion_requests ...' + end + if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 50 + fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling DataDeletionAPI.get_data_deletion_requests, must be smaller than or equal to 50.' + end + if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 + fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling DataDeletionAPI.get_data_deletion_requests, must be greater than or equal to 1.' + end + # resource path + local_var_path = '/api/v2/deletion/requests' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].nil? + query_params[:'product'] = opts[:'product'] if !opts[:'product'].nil? + query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil? + query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? + query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? + + # 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] || 'GetDataDeletionsResponseBody' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_data_deletion_requests, + :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: DataDeletionAPI#get_data_deletion_requests\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/cancel_data_deletion_response_body.rb b/lib/datadog_api_client/v2/models/cancel_data_deletion_response_body.rb new file mode 100644 index 000000000000..3dfba05d1d31 --- /dev/null +++ b/lib/datadog_api_client/v2/models/cancel_data_deletion_response_body.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 + # The response from the cancel data deletion request endpoint. + class CancelDataDeletionResponseBody + include BaseGenericModel + + # The created data deletion request information. + attr_accessor :data + + # The metadata of the data deletion response. + attr_accessor :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'DataDeletionResponseItem', + :'meta' => :'DataDeletionResponseMeta' + } + 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::CancelDataDeletionResponseBody` 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 + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + 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 && + meta == o.meta + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_data_deletion_request_body.rb b/lib/datadog_api_client/v2/models/create_data_deletion_request_body.rb new file mode 100644 index 000000000000..e06f789b8695 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_data_deletion_request_body.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 + # Object needed to create a data deletion request. + class CreateDataDeletionRequestBody + include BaseGenericModel + + # Data needed to create a data deletion request. + 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' => :'CreateDataDeletionRequestBodyData' + } + 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::CreateDataDeletionRequestBody` 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/create_data_deletion_request_body_attributes.rb b/lib/datadog_api_client/v2/models/create_data_deletion_request_body_attributes.rb new file mode 100644 index 000000000000..8fd44083d2cc --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_data_deletion_request_body_attributes.rb @@ -0,0 +1,177 @@ +=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 + # Attributes for creating a data deletion request. + class CreateDataDeletionRequestBodyAttributes + include BaseGenericModel + + # Start of requested time window, milliseconds since Unix epoch. + attr_reader :from + + # List of indexes for the search. If not provided, the search is performed in all indexes. + attr_accessor :indexes + + # Query for creating a data deletion request. + attr_reader :query + + # End of requested time window, milliseconds since Unix epoch. + attr_reader :to + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'from' => :'from', + :'indexes' => :'indexes', + :'query' => :'query', + :'to' => :'to' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'from' => :'Integer', + :'indexes' => :'Array', + :'query' => :'Hash', + :'to' => :'Integer' + } + 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::CreateDataDeletionRequestBodyAttributes` 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?(:'from') + self.from = attributes[:'from'] + end + + if attributes.key?(:'indexes') + if (value = attributes[:'indexes']).is_a?(Array) + self.indexes = value + end + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'to') + self.to = attributes[:'to'] + 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 @from.nil? + return false if @query.nil? + return false if @to.nil? + true + end + + # Custom attribute writer method with validation + # @param from [Object] Object to be assigned + # @!visibility private + def from=(from) + if from.nil? + fail ArgumentError, 'invalid value for "from", from cannot be nil.' + end + @from = from + 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 + + # Custom attribute writer method with validation + # @param to [Object] Object to be assigned + # @!visibility private + def to=(to) + if to.nil? + fail ArgumentError, 'invalid value for "to", to cannot be nil.' + end + @to = to + 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 && + from == o.from && + indexes == o.indexes && + query == o.query && + to == o.to + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [from, indexes, query, to].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_data_deletion_request_body_data.rb b/lib/datadog_api_client/v2/models/create_data_deletion_request_body_data.rb new file mode 100644 index 000000000000..e818c1b85ac0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_data_deletion_request_body_data.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 + # Data needed to create a data deletion request. + class CreateDataDeletionRequestBodyData + include BaseGenericModel + + # Attributes for creating a data deletion request. + attr_reader :attributes + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CreateDataDeletionRequestBodyAttributes' + } + 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::CreateDataDeletionRequestBodyData` 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 + 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? + 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 + + # 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 + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_data_deletion_response_body.rb b/lib/datadog_api_client/v2/models/create_data_deletion_response_body.rb new file mode 100644 index 000000000000..291c56a50649 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_data_deletion_response_body.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 + # The response from the create data deletion request endpoint. + class CreateDataDeletionResponseBody + include BaseGenericModel + + # The created data deletion request information. + attr_accessor :data + + # The metadata of the data deletion response. + attr_accessor :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'DataDeletionResponseItem', + :'meta' => :'DataDeletionResponseMeta' + } + 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::CreateDataDeletionResponseBody` 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 + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + 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 && + meta == o.meta + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/data_deletion_response_item.rb b/lib/datadog_api_client/v2/models/data_deletion_response_item.rb new file mode 100644 index 000000000000..e9e49e867989 --- /dev/null +++ b/lib/datadog_api_client/v2/models/data_deletion_response_item.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 created data deletion request information. + class DataDeletionResponseItem + include BaseGenericModel + + # Deletion attribute for data deletion response. + attr_reader :attributes + + # The ID of the created data deletion request. + attr_reader :id + + # The type of the request created. + 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' => :'DataDeletionResponseItemAttributes', + :'id' => :'String', + :'type' => :'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::DataDeletionResponseItem` 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/data_deletion_response_item_attributes.rb b/lib/datadog_api_client/v2/models/data_deletion_response_item_attributes.rb new file mode 100644 index 000000000000..402bf24b264d --- /dev/null +++ b/lib/datadog_api_client/v2/models/data_deletion_response_item_attributes.rb @@ -0,0 +1,366 @@ +=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 + # Deletion attribute for data deletion response. + class DataDeletionResponseItemAttributes + include BaseGenericModel + + # Creation time of the deletion request. + attr_reader :created_at + + # User who created the deletion request. + attr_reader :created_by + + # Start of requested time window, milliseconds since Unix epoch. + attr_reader :from_time + + # List of indexes for the search. If not provided, the search is performed in all indexes. + attr_accessor :indexes + + # Whether the deletion request is fully created or not. + attr_reader :is_created + + # Organization ID. + attr_reader :org_id + + # Product name. + attr_reader :product + + # Query for creating a data deletion request. + attr_reader :query + + # Starting time of the process to delete the requested data. + attr_reader :starting_at + + # Status of the deletion request. + attr_reader :status + + # End of requested time window, milliseconds since Unix epoch. + attr_reader :to_time + + # Total number of elements to be deleted. Only the data accessible to the current user that matches the query and timeframe provided will be deleted. + attr_reader :total_unrestricted + + # Update time of the deletion request. + attr_reader :updated_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'created_by' => :'created_by', + :'from_time' => :'from_time', + :'indexes' => :'indexes', + :'is_created' => :'is_created', + :'org_id' => :'org_id', + :'product' => :'product', + :'query' => :'query', + :'starting_at' => :'starting_at', + :'status' => :'status', + :'to_time' => :'to_time', + :'total_unrestricted' => :'total_unrestricted', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'String', + :'created_by' => :'String', + :'from_time' => :'Integer', + :'indexes' => :'Array', + :'is_created' => :'Boolean', + :'org_id' => :'Integer', + :'product' => :'String', + :'query' => :'String', + :'starting_at' => :'String', + :'status' => :'String', + :'to_time' => :'Integer', + :'total_unrestricted' => :'Integer', + :'updated_at' => :'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::DataDeletionResponseItemAttributes` 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?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'created_by') + self.created_by = attributes[:'created_by'] + end + + if attributes.key?(:'from_time') + self.from_time = attributes[:'from_time'] + end + + if attributes.key?(:'indexes') + if (value = attributes[:'indexes']).is_a?(Array) + self.indexes = value + end + end + + if attributes.key?(:'is_created') + self.is_created = attributes[:'is_created'] + end + + if attributes.key?(:'org_id') + self.org_id = attributes[:'org_id'] + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'starting_at') + self.starting_at = attributes[:'starting_at'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'to_time') + self.to_time = attributes[:'to_time'] + end + + if attributes.key?(:'total_unrestricted') + self.total_unrestricted = attributes[:'total_unrestricted'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 @created_at.nil? + return false if @created_by.nil? + return false if @from_time.nil? + return false if @is_created.nil? + return false if @org_id.nil? + return false if @product.nil? + return false if @query.nil? + return false if @starting_at.nil? + return false if @status.nil? + return false if @to_time.nil? + return false if @total_unrestricted.nil? + return false if @updated_at.nil? + true + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param created_by [Object] Object to be assigned + # @!visibility private + def created_by=(created_by) + if created_by.nil? + fail ArgumentError, 'invalid value for "created_by", created_by cannot be nil.' + end + @created_by = created_by + end + + # Custom attribute writer method with validation + # @param from_time [Object] Object to be assigned + # @!visibility private + def from_time=(from_time) + if from_time.nil? + fail ArgumentError, 'invalid value for "from_time", from_time cannot be nil.' + end + @from_time = from_time + end + + # Custom attribute writer method with validation + # @param is_created [Object] Object to be assigned + # @!visibility private + def is_created=(is_created) + if is_created.nil? + fail ArgumentError, 'invalid value for "is_created", is_created cannot be nil.' + end + @is_created = is_created + end + + # Custom attribute writer method with validation + # @param org_id [Object] Object to be assigned + # @!visibility private + def org_id=(org_id) + if org_id.nil? + fail ArgumentError, 'invalid value for "org_id", org_id cannot be nil.' + end + @org_id = org_id + end + + # Custom attribute writer method with validation + # @param product [Object] Object to be assigned + # @!visibility private + def product=(product) + if product.nil? + fail ArgumentError, 'invalid value for "product", product cannot be nil.' + end + @product = product + 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 + + # Custom attribute writer method with validation + # @param starting_at [Object] Object to be assigned + # @!visibility private + def starting_at=(starting_at) + if starting_at.nil? + fail ArgumentError, 'invalid value for "starting_at", starting_at cannot be nil.' + end + @starting_at = starting_at + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Custom attribute writer method with validation + # @param to_time [Object] Object to be assigned + # @!visibility private + def to_time=(to_time) + if to_time.nil? + fail ArgumentError, 'invalid value for "to_time", to_time cannot be nil.' + end + @to_time = to_time + end + + # Custom attribute writer method with validation + # @param total_unrestricted [Object] Object to be assigned + # @!visibility private + def total_unrestricted=(total_unrestricted) + if total_unrestricted.nil? + fail ArgumentError, 'invalid value for "total_unrestricted", total_unrestricted cannot be nil.' + end + @total_unrestricted = total_unrestricted + end + + # Custom attribute writer method with validation + # @param updated_at [Object] Object to be assigned + # @!visibility private + def updated_at=(updated_at) + if updated_at.nil? + fail ArgumentError, 'invalid value for "updated_at", updated_at cannot be nil.' + end + @updated_at = updated_at + 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 && + created_at == o.created_at && + created_by == o.created_by && + from_time == o.from_time && + indexes == o.indexes && + is_created == o.is_created && + org_id == o.org_id && + product == o.product && + query == o.query && + starting_at == o.starting_at && + status == o.status && + to_time == o.to_time && + total_unrestricted == o.total_unrestricted && + updated_at == o.updated_at + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, created_by, from_time, indexes, is_created, org_id, product, query, starting_at, status, to_time, total_unrestricted, updated_at].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/data_deletion_response_meta.rb b/lib/datadog_api_client/v2/models/data_deletion_response_meta.rb new file mode 100644 index 000000000000..b6449aa1dd43 --- /dev/null +++ b/lib/datadog_api_client/v2/models/data_deletion_response_meta.rb @@ -0,0 +1,145 @@ +=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 metadata of the data deletion response. + class DataDeletionResponseMeta + include BaseGenericModel + + # The total deletion requests created by product. + attr_accessor :count_product + + # The total deletion requests created by status. + attr_accessor :count_status + + # The next page when searching deletion requests created in the current organization. + attr_accessor :next_page + + # The product of the deletion request. + attr_accessor :product + + # The status of the executed request. + attr_accessor :request_status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'count_product' => :'count_product', + :'count_status' => :'count_status', + :'next_page' => :'next_page', + :'product' => :'product', + :'request_status' => :'request_status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'count_product' => :'Hash', + :'count_status' => :'Hash', + :'next_page' => :'String', + :'product' => :'String', + :'request_status' => :'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::DataDeletionResponseMeta` 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?(:'count_product') + self.count_product = attributes[:'count_product'] + end + + if attributes.key?(:'count_status') + self.count_status = attributes[:'count_status'] + end + + if attributes.key?(:'next_page') + self.next_page = attributes[:'next_page'] + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + + if attributes.key?(:'request_status') + self.request_status = attributes[:'request_status'] + 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 && + count_product == o.count_product && + count_status == o.count_status && + next_page == o.next_page && + product == o.product && + request_status == o.request_status + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [count_product, count_status, next_page, product, request_status].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/get_data_deletions_response_body.rb b/lib/datadog_api_client/v2/models/get_data_deletions_response_body.rb new file mode 100644 index 000000000000..23623c796d54 --- /dev/null +++ b/lib/datadog_api_client/v2/models/get_data_deletions_response_body.rb @@ -0,0 +1,117 @@ +=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 response from the get data deletion requests endpoint. + class GetDataDeletionsResponseBody + include BaseGenericModel + + # The list of data deletion requests that matches the query. + attr_accessor :data + + # The metadata of the data deletion response. + attr_accessor :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'meta' => :'DataDeletionResponseMeta' + } + 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::GetDataDeletionsResponseBody` 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 + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + 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 && + meta == o.meta + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta].hash + end + end +end