diff --git a/.apigentools-info b/.apigentools-info index 8600692cffc..25cbaa53428 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-15 19:35:10.684002", - "spec_repo_commit": "ad80112e" + "regenerated": "2024-11-15 21:56:54.413435", + "spec_repo_commit": "bca33096" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-15 19:35:10.703150", - "spec_repo_commit": "ad80112e" + "regenerated": "2024-11-15 21:56:54.432495", + "spec_repo_commit": "bca33096" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4f1a562ac59..8dddab6b10a 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`.' @@ -4217,6 +4231,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: @@ -6271,6 +6293,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: @@ -7562,6 +7644,138 @@ 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: Start time of the data to be deleted. + 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. + 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 requests. + 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: @@ -10429,6 +10643,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: @@ -30687,6 +30912,169 @@ 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 in 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: + format: int64 + 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. @@ -43730,6 +44118,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/api/datadogV2/api_data_deletion.go b/api/datadogV2/api_data_deletion.go new file mode 100644 index 00000000000..0e6727b1250 --- /dev/null +++ b/api/datadogV2/api_data_deletion.go @@ -0,0 +1,307 @@ +// 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 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + _context "context" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DataDeletionApi service type +type DataDeletionApi datadog.Service + +// CancelDataDeletionRequest Cancels a data deletion request. +// Cancels a data deletion request by providing its ID. +func (a *DataDeletionApi) CancelDataDeletionRequest(ctx _context.Context, id string) (CancelDataDeletionResponseBody, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue CancelDataDeletionResponseBody + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DataDeletionApi.CancelDataDeletionRequest") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/deletion/requests/{id}/cancel" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", _neturl.PathEscape(datadog.ParameterToString(id, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 412 || localVarHTTPResponse.StatusCode == 429 || localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// CreateDataDeletionRequest Creates a data deletion request. +// Creates a data deletion request by providing a query and a time frame targeting the proper data. +func (a *DataDeletionApi) CreateDataDeletionRequest(ctx _context.Context, product string, body CreateDataDeletionRequestBody) (CreateDataDeletionResponseBody, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue CreateDataDeletionResponseBody + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DataDeletionApi.CreateDataDeletionRequest") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/deletion/data/{product}" + localVarPath = strings.Replace(localVarPath, "{"+"product"+"}", _neturl.PathEscape(datadog.ParameterToString(product, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 412 || localVarHTTPResponse.StatusCode == 429 || localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetDataDeletionRequestsOptionalParameters holds optional parameters for GetDataDeletionRequests. +type GetDataDeletionRequestsOptionalParameters struct { + NextPage *string + Product *string + Query *string + Status *string + PageSize *int64 +} + +// NewGetDataDeletionRequestsOptionalParameters creates an empty struct for parameters. +func NewGetDataDeletionRequestsOptionalParameters() *GetDataDeletionRequestsOptionalParameters { + this := GetDataDeletionRequestsOptionalParameters{} + return &this +} + +// WithNextPage sets the corresponding parameter name and returns the struct. +func (r *GetDataDeletionRequestsOptionalParameters) WithNextPage(nextPage string) *GetDataDeletionRequestsOptionalParameters { + r.NextPage = &nextPage + return r +} + +// WithProduct sets the corresponding parameter name and returns the struct. +func (r *GetDataDeletionRequestsOptionalParameters) WithProduct(product string) *GetDataDeletionRequestsOptionalParameters { + r.Product = &product + return r +} + +// WithQuery sets the corresponding parameter name and returns the struct. +func (r *GetDataDeletionRequestsOptionalParameters) WithQuery(query string) *GetDataDeletionRequestsOptionalParameters { + r.Query = &query + return r +} + +// WithStatus sets the corresponding parameter name and returns the struct. +func (r *GetDataDeletionRequestsOptionalParameters) WithStatus(status string) *GetDataDeletionRequestsOptionalParameters { + r.Status = &status + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *GetDataDeletionRequestsOptionalParameters) WithPageSize(pageSize int64) *GetDataDeletionRequestsOptionalParameters { + r.PageSize = &pageSize + return r +} + +// GetDataDeletionRequests Gets a list of data deletion requests. +// Gets a list of data deletion requests based on several filter parameters. +func (a *DataDeletionApi) GetDataDeletionRequests(ctx _context.Context, o ...GetDataDeletionRequestsOptionalParameters) (GetDataDeletionsResponseBody, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue GetDataDeletionsResponseBody + optionalParams GetDataDeletionRequestsOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetDataDeletionRequestsOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DataDeletionApi.GetDataDeletionRequests") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/deletion/requests" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.NextPage != nil { + localVarQueryParams.Add("next_page", datadog.ParameterToString(*optionalParams.NextPage, "")) + } + if optionalParams.Product != nil { + localVarQueryParams.Add("product", datadog.ParameterToString(*optionalParams.Product, "")) + } + if optionalParams.Query != nil { + localVarQueryParams.Add("query", datadog.ParameterToString(*optionalParams.Query, "")) + } + if optionalParams.Status != nil { + localVarQueryParams.Add("status", datadog.ParameterToString(*optionalParams.Status, "")) + } + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page_size", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 || localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewDataDeletionApi Returns NewDataDeletionApi. +func NewDataDeletionApi(client *datadog.APIClient) *DataDeletionApi { + return &DataDeletionApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 3e9b8009b93..271dbc5cda3 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -97,6 +97,9 @@ // - [DashboardListsApi.DeleteDashboardListItems] // - [DashboardListsApi.GetDashboardListItems] // - [DashboardListsApi.UpdateDashboardListItems] +// - [DataDeletionApi.CancelDataDeletionRequest] +// - [DataDeletionApi.CreateDataDeletionRequest] +// - [DataDeletionApi.GetDataDeletionRequests] // - [DomainAllowlistApi.GetDomainAllowlist] // - [DomainAllowlistApi.PatchDomainAllowlist] // - [DowntimesApi.CancelDowntime] diff --git a/api/datadogV2/model_cancel_data_deletion_response_body.go b/api/datadogV2/model_cancel_data_deletion_response_body.go new file mode 100644 index 00000000000..f007cbd972e --- /dev/null +++ b/api/datadogV2/model_cancel_data_deletion_response_body.go @@ -0,0 +1,149 @@ +// 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 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CancelDataDeletionResponseBody The response from the cancel data deletion request endpoint. +type CancelDataDeletionResponseBody struct { + // The created data deletion request information. + Data *DataDeletionResponseItem `json:"data,omitempty"` + // The metadata of the data deletion requests. + Meta *DataDeletionResponseMeta `json:"meta,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCancelDataDeletionResponseBody instantiates a new CancelDataDeletionResponseBody object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCancelDataDeletionResponseBody() *CancelDataDeletionResponseBody { + this := CancelDataDeletionResponseBody{} + return &this +} + +// NewCancelDataDeletionResponseBodyWithDefaults instantiates a new CancelDataDeletionResponseBody object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCancelDataDeletionResponseBodyWithDefaults() *CancelDataDeletionResponseBody { + this := CancelDataDeletionResponseBody{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CancelDataDeletionResponseBody) GetData() DataDeletionResponseItem { + if o == nil || o.Data == nil { + var ret DataDeletionResponseItem + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CancelDataDeletionResponseBody) GetDataOk() (*DataDeletionResponseItem, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CancelDataDeletionResponseBody) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given DataDeletionResponseItem and assigns it to the Data field. +func (o *CancelDataDeletionResponseBody) SetData(v DataDeletionResponseItem) { + o.Data = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *CancelDataDeletionResponseBody) GetMeta() DataDeletionResponseMeta { + if o == nil || o.Meta == nil { + var ret DataDeletionResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CancelDataDeletionResponseBody) GetMetaOk() (*DataDeletionResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *CancelDataDeletionResponseBody) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given DataDeletionResponseMeta and assigns it to the Meta field. +func (o *CancelDataDeletionResponseBody) SetMeta(v DataDeletionResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CancelDataDeletionResponseBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CancelDataDeletionResponseBody) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *DataDeletionResponseItem `json:"data,omitempty"` + Meta *DataDeletionResponseMeta `json:"meta,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_data_deletion_request_body.go b/api/datadogV2/model_create_data_deletion_request_body.go new file mode 100644 index 00000000000..1711d6caa1a --- /dev/null +++ b/api/datadogV2/model_create_data_deletion_request_body.go @@ -0,0 +1,110 @@ +// 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 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateDataDeletionRequestBody Object needed to create a data deletion request. +type CreateDataDeletionRequestBody struct { + // Data needed to create a data deletion request. + Data CreateDataDeletionRequestBodyData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateDataDeletionRequestBody instantiates a new CreateDataDeletionRequestBody object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateDataDeletionRequestBody(data CreateDataDeletionRequestBodyData) *CreateDataDeletionRequestBody { + this := CreateDataDeletionRequestBody{} + this.Data = data + return &this +} + +// NewCreateDataDeletionRequestBodyWithDefaults instantiates a new CreateDataDeletionRequestBody object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateDataDeletionRequestBodyWithDefaults() *CreateDataDeletionRequestBody { + this := CreateDataDeletionRequestBody{} + return &this +} + +// GetData returns the Data field value. +func (o *CreateDataDeletionRequestBody) GetData() CreateDataDeletionRequestBodyData { + if o == nil { + var ret CreateDataDeletionRequestBodyData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *CreateDataDeletionRequestBody) GetDataOk() (*CreateDataDeletionRequestBodyData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CreateDataDeletionRequestBody) SetData(v CreateDataDeletionRequestBodyData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateDataDeletionRequestBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateDataDeletionRequestBody) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CreateDataDeletionRequestBodyData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_data_deletion_request_body_attributes.go b/api/datadogV2/model_create_data_deletion_request_body_attributes.go new file mode 100644 index 00000000000..892ef413321 --- /dev/null +++ b/api/datadogV2/model_create_data_deletion_request_body_attributes.go @@ -0,0 +1,200 @@ +// 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 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateDataDeletionRequestBodyAttributes Attributes for creating a data deletion request. +type CreateDataDeletionRequestBodyAttributes struct { + // Start of requested time window, milliseconds since Unix epoch. + From int64 `json:"from"` + // List of indexes for the search. If not provided, the search is performed in all indexes. + Indexes []string `json:"indexes,omitempty"` + // Query for creating a data deletion request. + Query map[string]string `json:"query"` + // End of requested time window, milliseconds since Unix epoch. + To int64 `json:"to"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateDataDeletionRequestBodyAttributes instantiates a new CreateDataDeletionRequestBodyAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateDataDeletionRequestBodyAttributes(from int64, query map[string]string, to int64) *CreateDataDeletionRequestBodyAttributes { + this := CreateDataDeletionRequestBodyAttributes{} + this.From = from + this.Query = query + this.To = to + return &this +} + +// NewCreateDataDeletionRequestBodyAttributesWithDefaults instantiates a new CreateDataDeletionRequestBodyAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateDataDeletionRequestBodyAttributesWithDefaults() *CreateDataDeletionRequestBodyAttributes { + this := CreateDataDeletionRequestBodyAttributes{} + return &this +} + +// GetFrom returns the From field value. +func (o *CreateDataDeletionRequestBodyAttributes) GetFrom() int64 { + if o == nil { + var ret int64 + return ret + } + return o.From +} + +// GetFromOk returns a tuple with the From field value +// and a boolean to check if the value has been set. +func (o *CreateDataDeletionRequestBodyAttributes) GetFromOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.From, true +} + +// SetFrom sets field value. +func (o *CreateDataDeletionRequestBodyAttributes) SetFrom(v int64) { + o.From = v +} + +// GetIndexes returns the Indexes field value if set, zero value otherwise. +func (o *CreateDataDeletionRequestBodyAttributes) GetIndexes() []string { + if o == nil || o.Indexes == nil { + var ret []string + return ret + } + return o.Indexes +} + +// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDataDeletionRequestBodyAttributes) GetIndexesOk() (*[]string, bool) { + if o == nil || o.Indexes == nil { + return nil, false + } + return &o.Indexes, true +} + +// HasIndexes returns a boolean if a field has been set. +func (o *CreateDataDeletionRequestBodyAttributes) HasIndexes() bool { + return o != nil && o.Indexes != nil +} + +// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. +func (o *CreateDataDeletionRequestBodyAttributes) SetIndexes(v []string) { + o.Indexes = v +} + +// GetQuery returns the Query field value. +func (o *CreateDataDeletionRequestBodyAttributes) GetQuery() map[string]string { + if o == nil { + var ret map[string]string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *CreateDataDeletionRequestBodyAttributes) GetQueryOk() (*map[string]string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *CreateDataDeletionRequestBodyAttributes) SetQuery(v map[string]string) { + o.Query = v +} + +// GetTo returns the To field value. +func (o *CreateDataDeletionRequestBodyAttributes) GetTo() int64 { + if o == nil { + var ret int64 + return ret + } + return o.To +} + +// GetToOk returns a tuple with the To field value +// and a boolean to check if the value has been set. +func (o *CreateDataDeletionRequestBodyAttributes) GetToOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.To, true +} + +// SetTo sets field value. +func (o *CreateDataDeletionRequestBodyAttributes) SetTo(v int64) { + o.To = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateDataDeletionRequestBodyAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["from"] = o.From + if o.Indexes != nil { + toSerialize["indexes"] = o.Indexes + } + toSerialize["query"] = o.Query + toSerialize["to"] = o.To + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateDataDeletionRequestBodyAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + From *int64 `json:"from"` + Indexes []string `json:"indexes,omitempty"` + Query *map[string]string `json:"query"` + To *int64 `json:"to"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.From == nil { + return fmt.Errorf("required field from missing") + } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } + if all.To == nil { + return fmt.Errorf("required field to missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"from", "indexes", "query", "to"}) + } else { + return err + } + o.From = *all.From + o.Indexes = all.Indexes + o.Query = *all.Query + o.To = *all.To + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_create_data_deletion_request_body_data.go b/api/datadogV2/model_create_data_deletion_request_body_data.go new file mode 100644 index 00000000000..a66ad4d8c27 --- /dev/null +++ b/api/datadogV2/model_create_data_deletion_request_body_data.go @@ -0,0 +1,110 @@ +// 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 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateDataDeletionRequestBodyData Data needed to create a data deletion request. +type CreateDataDeletionRequestBodyData struct { + // Attributes for creating a data deletion request. + Attributes CreateDataDeletionRequestBodyAttributes `json:"attributes"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateDataDeletionRequestBodyData instantiates a new CreateDataDeletionRequestBodyData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateDataDeletionRequestBodyData(attributes CreateDataDeletionRequestBodyAttributes) *CreateDataDeletionRequestBodyData { + this := CreateDataDeletionRequestBodyData{} + this.Attributes = attributes + return &this +} + +// NewCreateDataDeletionRequestBodyDataWithDefaults instantiates a new CreateDataDeletionRequestBodyData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateDataDeletionRequestBodyDataWithDefaults() *CreateDataDeletionRequestBodyData { + this := CreateDataDeletionRequestBodyData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *CreateDataDeletionRequestBodyData) GetAttributes() CreateDataDeletionRequestBodyAttributes { + if o == nil { + var ret CreateDataDeletionRequestBodyAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *CreateDataDeletionRequestBodyData) GetAttributesOk() (*CreateDataDeletionRequestBodyAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *CreateDataDeletionRequestBodyData) SetAttributes(v CreateDataDeletionRequestBodyAttributes) { + o.Attributes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateDataDeletionRequestBodyData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateDataDeletionRequestBodyData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CreateDataDeletionRequestBodyAttributes `json:"attributes"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_data_deletion_response_body.go b/api/datadogV2/model_create_data_deletion_response_body.go new file mode 100644 index 00000000000..ee45de36ab3 --- /dev/null +++ b/api/datadogV2/model_create_data_deletion_response_body.go @@ -0,0 +1,149 @@ +// 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 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateDataDeletionResponseBody The response from the create data deletion request endpoint. +type CreateDataDeletionResponseBody struct { + // The created data deletion request information. + Data *DataDeletionResponseItem `json:"data,omitempty"` + // The metadata of the data deletion requests. + Meta *DataDeletionResponseMeta `json:"meta,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateDataDeletionResponseBody instantiates a new CreateDataDeletionResponseBody object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateDataDeletionResponseBody() *CreateDataDeletionResponseBody { + this := CreateDataDeletionResponseBody{} + return &this +} + +// NewCreateDataDeletionResponseBodyWithDefaults instantiates a new CreateDataDeletionResponseBody object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateDataDeletionResponseBodyWithDefaults() *CreateDataDeletionResponseBody { + this := CreateDataDeletionResponseBody{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CreateDataDeletionResponseBody) GetData() DataDeletionResponseItem { + if o == nil || o.Data == nil { + var ret DataDeletionResponseItem + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDataDeletionResponseBody) GetDataOk() (*DataDeletionResponseItem, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CreateDataDeletionResponseBody) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given DataDeletionResponseItem and assigns it to the Data field. +func (o *CreateDataDeletionResponseBody) SetData(v DataDeletionResponseItem) { + o.Data = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *CreateDataDeletionResponseBody) GetMeta() DataDeletionResponseMeta { + if o == nil || o.Meta == nil { + var ret DataDeletionResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDataDeletionResponseBody) GetMetaOk() (*DataDeletionResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *CreateDataDeletionResponseBody) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given DataDeletionResponseMeta and assigns it to the Meta field. +func (o *CreateDataDeletionResponseBody) SetMeta(v DataDeletionResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateDataDeletionResponseBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateDataDeletionResponseBody) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *DataDeletionResponseItem `json:"data,omitempty"` + Meta *DataDeletionResponseMeta `json:"meta,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_data_deletion_response_item.go b/api/datadogV2/model_data_deletion_response_item.go new file mode 100644 index 00000000000..0da7912fb4d --- /dev/null +++ b/api/datadogV2/model_data_deletion_response_item.go @@ -0,0 +1,174 @@ +// 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 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DataDeletionResponseItem The created data deletion request information. +type DataDeletionResponseItem struct { + // Deletion attribute for data deletion response. + Attributes DataDeletionResponseItemAttributes `json:"attributes"` + // The ID of the created data deletion request. + Id string `json:"id"` + // The type of the request created. + Type string `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewDataDeletionResponseItem instantiates a new DataDeletionResponseItem object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewDataDeletionResponseItem(attributes DataDeletionResponseItemAttributes, id string, typeVar string) *DataDeletionResponseItem { + this := DataDeletionResponseItem{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewDataDeletionResponseItemWithDefaults instantiates a new DataDeletionResponseItem object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewDataDeletionResponseItemWithDefaults() *DataDeletionResponseItem { + this := DataDeletionResponseItem{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *DataDeletionResponseItem) GetAttributes() DataDeletionResponseItemAttributes { + if o == nil { + var ret DataDeletionResponseItemAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItem) GetAttributesOk() (*DataDeletionResponseItemAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *DataDeletionResponseItem) SetAttributes(v DataDeletionResponseItemAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *DataDeletionResponseItem) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItem) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *DataDeletionResponseItem) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *DataDeletionResponseItem) GetType() string { + if o == nil { + var ret string + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItem) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DataDeletionResponseItem) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DataDeletionResponseItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DataDeletionResponseItem) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *DataDeletionResponseItemAttributes `json:"attributes"` + Id *string `json:"id"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_data_deletion_response_item_attributes.go b/api/datadogV2/model_data_deletion_response_item_attributes.go new file mode 100644 index 00000000000..a9ead5a9f2a --- /dev/null +++ b/api/datadogV2/model_data_deletion_response_item_attributes.go @@ -0,0 +1,488 @@ +// 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 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DataDeletionResponseItemAttributes Deletion attribute for data deletion response. +type DataDeletionResponseItemAttributes struct { + // Creation time of the deletion request. + CreatedAt string `json:"created_at"` + // User who created the deletion request. + CreatedBy string `json:"created_by"` + // Start of requested time window, milliseconds since Unix epoch. + FromTime int64 `json:"from_time"` + // List of indexes for the search. If not provided, the search is performed in all indexes. + Indexes []string `json:"indexes,omitempty"` + // Whether the deletion request is fully created or not. + IsCreated bool `json:"is_created"` + // Organization ID. + OrgId int64 `json:"org_id"` + // Product name. + Product string `json:"product"` + // Query for creating a data deletion request. + Query string `json:"query"` + // Start time of the data to be deleted. + StartingAt string `json:"starting_at"` + // Status of the deletion request. + Status string `json:"status"` + // End of requested time window, milliseconds since Unix epoch. + ToTime int64 `json:"to_time"` + // Total number of elements to be deleted. + TotalUnrestricted int64 `json:"total_unrestricted"` + // Update time of the deletion request. + UpdatedAt string `json:"updated_at"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewDataDeletionResponseItemAttributes instantiates a new DataDeletionResponseItemAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewDataDeletionResponseItemAttributes(createdAt string, createdBy string, fromTime int64, isCreated bool, orgId int64, product string, query string, startingAt string, status string, toTime int64, totalUnrestricted int64, updatedAt string) *DataDeletionResponseItemAttributes { + this := DataDeletionResponseItemAttributes{} + this.CreatedAt = createdAt + this.CreatedBy = createdBy + this.FromTime = fromTime + this.IsCreated = isCreated + this.OrgId = orgId + this.Product = product + this.Query = query + this.StartingAt = startingAt + this.Status = status + this.ToTime = toTime + this.TotalUnrestricted = totalUnrestricted + this.UpdatedAt = updatedAt + return &this +} + +// NewDataDeletionResponseItemAttributesWithDefaults instantiates a new DataDeletionResponseItemAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewDataDeletionResponseItemAttributesWithDefaults() *DataDeletionResponseItemAttributes { + this := DataDeletionResponseItemAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *DataDeletionResponseItemAttributes) GetCreatedAt() string { + if o == nil { + var ret string + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetCreatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *DataDeletionResponseItemAttributes) SetCreatedAt(v string) { + o.CreatedAt = v +} + +// GetCreatedBy returns the CreatedBy field value. +func (o *DataDeletionResponseItemAttributes) GetCreatedBy() string { + if o == nil { + var ret string + return ret + } + return o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetCreatedByOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatedBy, true +} + +// SetCreatedBy sets field value. +func (o *DataDeletionResponseItemAttributes) SetCreatedBy(v string) { + o.CreatedBy = v +} + +// GetFromTime returns the FromTime field value. +func (o *DataDeletionResponseItemAttributes) GetFromTime() int64 { + if o == nil { + var ret int64 + return ret + } + return o.FromTime +} + +// GetFromTimeOk returns a tuple with the FromTime field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetFromTimeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.FromTime, true +} + +// SetFromTime sets field value. +func (o *DataDeletionResponseItemAttributes) SetFromTime(v int64) { + o.FromTime = v +} + +// GetIndexes returns the Indexes field value if set, zero value otherwise. +func (o *DataDeletionResponseItemAttributes) GetIndexes() []string { + if o == nil || o.Indexes == nil { + var ret []string + return ret + } + return o.Indexes +} + +// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetIndexesOk() (*[]string, bool) { + if o == nil || o.Indexes == nil { + return nil, false + } + return &o.Indexes, true +} + +// HasIndexes returns a boolean if a field has been set. +func (o *DataDeletionResponseItemAttributes) HasIndexes() bool { + return o != nil && o.Indexes != nil +} + +// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. +func (o *DataDeletionResponseItemAttributes) SetIndexes(v []string) { + o.Indexes = v +} + +// GetIsCreated returns the IsCreated field value. +func (o *DataDeletionResponseItemAttributes) GetIsCreated() bool { + if o == nil { + var ret bool + return ret + } + return o.IsCreated +} + +// GetIsCreatedOk returns a tuple with the IsCreated field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetIsCreatedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsCreated, true +} + +// SetIsCreated sets field value. +func (o *DataDeletionResponseItemAttributes) SetIsCreated(v bool) { + o.IsCreated = v +} + +// GetOrgId returns the OrgId field value. +func (o *DataDeletionResponseItemAttributes) GetOrgId() int64 { + if o == nil { + var ret int64 + return ret + } + return o.OrgId +} + +// GetOrgIdOk returns a tuple with the OrgId field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetOrgIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.OrgId, true +} + +// SetOrgId sets field value. +func (o *DataDeletionResponseItemAttributes) SetOrgId(v int64) { + o.OrgId = v +} + +// GetProduct returns the Product field value. +func (o *DataDeletionResponseItemAttributes) GetProduct() string { + if o == nil { + var ret string + return ret + } + return o.Product +} + +// GetProductOk returns a tuple with the Product field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetProductOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Product, true +} + +// SetProduct sets field value. +func (o *DataDeletionResponseItemAttributes) SetProduct(v string) { + o.Product = v +} + +// GetQuery returns the Query field value. +func (o *DataDeletionResponseItemAttributes) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *DataDeletionResponseItemAttributes) SetQuery(v string) { + o.Query = v +} + +// GetStartingAt returns the StartingAt field value. +func (o *DataDeletionResponseItemAttributes) GetStartingAt() string { + if o == nil { + var ret string + return ret + } + return o.StartingAt +} + +// GetStartingAtOk returns a tuple with the StartingAt field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetStartingAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.StartingAt, true +} + +// SetStartingAt sets field value. +func (o *DataDeletionResponseItemAttributes) SetStartingAt(v string) { + o.StartingAt = v +} + +// GetStatus returns the Status field value. +func (o *DataDeletionResponseItemAttributes) GetStatus() string { + if o == nil { + var ret string + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value. +func (o *DataDeletionResponseItemAttributes) SetStatus(v string) { + o.Status = v +} + +// GetToTime returns the ToTime field value. +func (o *DataDeletionResponseItemAttributes) GetToTime() int64 { + if o == nil { + var ret int64 + return ret + } + return o.ToTime +} + +// GetToTimeOk returns a tuple with the ToTime field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetToTimeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.ToTime, true +} + +// SetToTime sets field value. +func (o *DataDeletionResponseItemAttributes) SetToTime(v int64) { + o.ToTime = v +} + +// GetTotalUnrestricted returns the TotalUnrestricted field value. +func (o *DataDeletionResponseItemAttributes) GetTotalUnrestricted() int64 { + if o == nil { + var ret int64 + return ret + } + return o.TotalUnrestricted +} + +// GetTotalUnrestrictedOk returns a tuple with the TotalUnrestricted field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetTotalUnrestrictedOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.TotalUnrestricted, true +} + +// SetTotalUnrestricted sets field value. +func (o *DataDeletionResponseItemAttributes) SetTotalUnrestricted(v int64) { + o.TotalUnrestricted = v +} + +// GetUpdatedAt returns the UpdatedAt field value. +func (o *DataDeletionResponseItemAttributes) GetUpdatedAt() string { + if o == nil { + var ret string + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseItemAttributes) GetUpdatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.UpdatedAt, true +} + +// SetUpdatedAt sets field value. +func (o *DataDeletionResponseItemAttributes) SetUpdatedAt(v string) { + o.UpdatedAt = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DataDeletionResponseItemAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["created_at"] = o.CreatedAt + toSerialize["created_by"] = o.CreatedBy + toSerialize["from_time"] = o.FromTime + if o.Indexes != nil { + toSerialize["indexes"] = o.Indexes + } + toSerialize["is_created"] = o.IsCreated + toSerialize["org_id"] = o.OrgId + toSerialize["product"] = o.Product + toSerialize["query"] = o.Query + toSerialize["starting_at"] = o.StartingAt + toSerialize["status"] = o.Status + toSerialize["to_time"] = o.ToTime + toSerialize["total_unrestricted"] = o.TotalUnrestricted + toSerialize["updated_at"] = o.UpdatedAt + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DataDeletionResponseItemAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *string `json:"created_at"` + CreatedBy *string `json:"created_by"` + FromTime *int64 `json:"from_time"` + Indexes []string `json:"indexes,omitempty"` + IsCreated *bool `json:"is_created"` + OrgId *int64 `json:"org_id"` + Product *string `json:"product"` + Query *string `json:"query"` + StartingAt *string `json:"starting_at"` + Status *string `json:"status"` + ToTime *int64 `json:"to_time"` + TotalUnrestricted *int64 `json:"total_unrestricted"` + UpdatedAt *string `json:"updated_at"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.CreatedBy == nil { + return fmt.Errorf("required field created_by missing") + } + if all.FromTime == nil { + return fmt.Errorf("required field from_time missing") + } + if all.IsCreated == nil { + return fmt.Errorf("required field is_created missing") + } + if all.OrgId == nil { + return fmt.Errorf("required field org_id missing") + } + if all.Product == nil { + return fmt.Errorf("required field product missing") + } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } + if all.StartingAt == nil { + return fmt.Errorf("required field starting_at missing") + } + if all.Status == nil { + return fmt.Errorf("required field status missing") + } + if all.ToTime == nil { + return fmt.Errorf("required field to_time missing") + } + if all.TotalUnrestricted == nil { + return fmt.Errorf("required field total_unrestricted missing") + } + if all.UpdatedAt == nil { + return fmt.Errorf("required field updated_at missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "created_by", "from_time", "indexes", "is_created", "org_id", "product", "query", "starting_at", "status", "to_time", "total_unrestricted", "updated_at"}) + } else { + return err + } + o.CreatedAt = *all.CreatedAt + o.CreatedBy = *all.CreatedBy + o.FromTime = *all.FromTime + o.Indexes = all.Indexes + o.IsCreated = *all.IsCreated + o.OrgId = *all.OrgId + o.Product = *all.Product + o.Query = *all.Query + o.StartingAt = *all.StartingAt + o.Status = *all.Status + o.ToTime = *all.ToTime + o.TotalUnrestricted = *all.TotalUnrestricted + o.UpdatedAt = *all.UpdatedAt + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_data_deletion_response_meta.go b/api/datadogV2/model_data_deletion_response_meta.go new file mode 100644 index 00000000000..8117c746ce8 --- /dev/null +++ b/api/datadogV2/model_data_deletion_response_meta.go @@ -0,0 +1,242 @@ +// 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 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DataDeletionResponseMeta The metadata of the data deletion requests. +type DataDeletionResponseMeta struct { + // The total deletion requests created by product. + CountProduct map[string]int64 `json:"count_product,omitempty"` + // The total deletion requests created by status. + CountStatus map[string]int64 `json:"count_status,omitempty"` + // The next page when searching deletion requests created in the current organization. + NextPage *string `json:"next_page,omitempty"` + // The product of the deletion request. + Product *string `json:"product,omitempty"` + // The status of the executed request. + RequestStatus *string `json:"request_status,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewDataDeletionResponseMeta instantiates a new DataDeletionResponseMeta object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewDataDeletionResponseMeta() *DataDeletionResponseMeta { + this := DataDeletionResponseMeta{} + return &this +} + +// NewDataDeletionResponseMetaWithDefaults instantiates a new DataDeletionResponseMeta object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewDataDeletionResponseMetaWithDefaults() *DataDeletionResponseMeta { + this := DataDeletionResponseMeta{} + return &this +} + +// GetCountProduct returns the CountProduct field value if set, zero value otherwise. +func (o *DataDeletionResponseMeta) GetCountProduct() map[string]int64 { + if o == nil || o.CountProduct == nil { + var ret map[string]int64 + return ret + } + return o.CountProduct +} + +// GetCountProductOk returns a tuple with the CountProduct field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseMeta) GetCountProductOk() (*map[string]int64, bool) { + if o == nil || o.CountProduct == nil { + return nil, false + } + return &o.CountProduct, true +} + +// HasCountProduct returns a boolean if a field has been set. +func (o *DataDeletionResponseMeta) HasCountProduct() bool { + return o != nil && o.CountProduct != nil +} + +// SetCountProduct gets a reference to the given map[string]int64 and assigns it to the CountProduct field. +func (o *DataDeletionResponseMeta) SetCountProduct(v map[string]int64) { + o.CountProduct = v +} + +// GetCountStatus returns the CountStatus field value if set, zero value otherwise. +func (o *DataDeletionResponseMeta) GetCountStatus() map[string]int64 { + if o == nil || o.CountStatus == nil { + var ret map[string]int64 + return ret + } + return o.CountStatus +} + +// GetCountStatusOk returns a tuple with the CountStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseMeta) GetCountStatusOk() (*map[string]int64, bool) { + if o == nil || o.CountStatus == nil { + return nil, false + } + return &o.CountStatus, true +} + +// HasCountStatus returns a boolean if a field has been set. +func (o *DataDeletionResponseMeta) HasCountStatus() bool { + return o != nil && o.CountStatus != nil +} + +// SetCountStatus gets a reference to the given map[string]int64 and assigns it to the CountStatus field. +func (o *DataDeletionResponseMeta) SetCountStatus(v map[string]int64) { + o.CountStatus = v +} + +// GetNextPage returns the NextPage field value if set, zero value otherwise. +func (o *DataDeletionResponseMeta) GetNextPage() string { + if o == nil || o.NextPage == nil { + var ret string + return ret + } + return *o.NextPage +} + +// GetNextPageOk returns a tuple with the NextPage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseMeta) GetNextPageOk() (*string, bool) { + if o == nil || o.NextPage == nil { + return nil, false + } + return o.NextPage, true +} + +// HasNextPage returns a boolean if a field has been set. +func (o *DataDeletionResponseMeta) HasNextPage() bool { + return o != nil && o.NextPage != nil +} + +// SetNextPage gets a reference to the given string and assigns it to the NextPage field. +func (o *DataDeletionResponseMeta) SetNextPage(v string) { + o.NextPage = &v +} + +// GetProduct returns the Product field value if set, zero value otherwise. +func (o *DataDeletionResponseMeta) GetProduct() string { + if o == nil || o.Product == nil { + var ret string + return ret + } + return *o.Product +} + +// GetProductOk returns a tuple with the Product field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseMeta) GetProductOk() (*string, bool) { + if o == nil || o.Product == nil { + return nil, false + } + return o.Product, true +} + +// HasProduct returns a boolean if a field has been set. +func (o *DataDeletionResponseMeta) HasProduct() bool { + return o != nil && o.Product != nil +} + +// SetProduct gets a reference to the given string and assigns it to the Product field. +func (o *DataDeletionResponseMeta) SetProduct(v string) { + o.Product = &v +} + +// GetRequestStatus returns the RequestStatus field value if set, zero value otherwise. +func (o *DataDeletionResponseMeta) GetRequestStatus() string { + if o == nil || o.RequestStatus == nil { + var ret string + return ret + } + return *o.RequestStatus +} + +// GetRequestStatusOk returns a tuple with the RequestStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataDeletionResponseMeta) GetRequestStatusOk() (*string, bool) { + if o == nil || o.RequestStatus == nil { + return nil, false + } + return o.RequestStatus, true +} + +// HasRequestStatus returns a boolean if a field has been set. +func (o *DataDeletionResponseMeta) HasRequestStatus() bool { + return o != nil && o.RequestStatus != nil +} + +// SetRequestStatus gets a reference to the given string and assigns it to the RequestStatus field. +func (o *DataDeletionResponseMeta) SetRequestStatus(v string) { + o.RequestStatus = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DataDeletionResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CountProduct != nil { + toSerialize["count_product"] = o.CountProduct + } + if o.CountStatus != nil { + toSerialize["count_status"] = o.CountStatus + } + if o.NextPage != nil { + toSerialize["next_page"] = o.NextPage + } + if o.Product != nil { + toSerialize["product"] = o.Product + } + if o.RequestStatus != nil { + toSerialize["request_status"] = o.RequestStatus + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DataDeletionResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CountProduct map[string]int64 `json:"count_product,omitempty"` + CountStatus map[string]int64 `json:"count_status,omitempty"` + NextPage *string `json:"next_page,omitempty"` + Product *string `json:"product,omitempty"` + RequestStatus *string `json:"request_status,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"count_product", "count_status", "next_page", "product", "request_status"}) + } else { + return err + } + o.CountProduct = all.CountProduct + o.CountStatus = all.CountStatus + o.NextPage = all.NextPage + o.Product = all.Product + o.RequestStatus = all.RequestStatus + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_data_deletions_response_body.go b/api/datadogV2/model_get_data_deletions_response_body.go new file mode 100644 index 00000000000..d2b708b3b67 --- /dev/null +++ b/api/datadogV2/model_get_data_deletions_response_body.go @@ -0,0 +1,146 @@ +// 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 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetDataDeletionsResponseBody The response from the get data deletion requests endpoint. +type GetDataDeletionsResponseBody struct { + // The list of data deletion requests that matches the query. + Data []DataDeletionResponseItem `json:"data,omitempty"` + // The metadata of the data deletion requests. + Meta *DataDeletionResponseMeta `json:"meta,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewGetDataDeletionsResponseBody instantiates a new GetDataDeletionsResponseBody object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewGetDataDeletionsResponseBody() *GetDataDeletionsResponseBody { + this := GetDataDeletionsResponseBody{} + return &this +} + +// NewGetDataDeletionsResponseBodyWithDefaults instantiates a new GetDataDeletionsResponseBody object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewGetDataDeletionsResponseBodyWithDefaults() *GetDataDeletionsResponseBody { + this := GetDataDeletionsResponseBody{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *GetDataDeletionsResponseBody) GetData() []DataDeletionResponseItem { + if o == nil || o.Data == nil { + var ret []DataDeletionResponseItem + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetDataDeletionsResponseBody) GetDataOk() (*[]DataDeletionResponseItem, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *GetDataDeletionsResponseBody) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []DataDeletionResponseItem and assigns it to the Data field. +func (o *GetDataDeletionsResponseBody) SetData(v []DataDeletionResponseItem) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *GetDataDeletionsResponseBody) GetMeta() DataDeletionResponseMeta { + if o == nil || o.Meta == nil { + var ret DataDeletionResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetDataDeletionsResponseBody) GetMetaOk() (*DataDeletionResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *GetDataDeletionsResponseBody) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given DataDeletionResponseMeta and assigns it to the Meta field. +func (o *GetDataDeletionsResponseBody) SetMeta(v DataDeletionResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetDataDeletionsResponseBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetDataDeletionsResponseBody) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []DataDeletionResponseItem `json:"data,omitempty"` + Meta *DataDeletionResponseMeta `json:"meta,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) + } else { + return err + } + + hasInvalidField := false + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/examples/v2/data-deletion/CancelDataDeletionRequest.go b/examples/v2/data-deletion/CancelDataDeletionRequest.go new file mode 100644 index 00000000000..d33c9daf90f --- /dev/null +++ b/examples/v2/data-deletion/CancelDataDeletionRequest.go @@ -0,0 +1,32 @@ +// Cancels a data deletion request returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "deletion_request" in the system + DeletionRequestDataID := os.Getenv("DELETION_REQUEST_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewDataDeletionApi(apiClient) + resp, r, err := api.CancelDataDeletionRequest(ctx, DeletionRequestDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DataDeletionApi.CancelDataDeletionRequest`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `DataDeletionApi.CancelDataDeletionRequest`:\n%s\n", responseContent) +} diff --git a/examples/v2/data-deletion/CreateDataDeletionRequest.go b/examples/v2/data-deletion/CreateDataDeletionRequest.go new file mode 100644 index 00000000000..4d303338869 --- /dev/null +++ b/examples/v2/data-deletion/CreateDataDeletionRequest.go @@ -0,0 +1,45 @@ +// Creates a data deletion request returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.CreateDataDeletionRequestBody{ + Data: datadogV2.CreateDataDeletionRequestBodyData{ + Attributes: datadogV2.CreateDataDeletionRequestBodyAttributes{ + From: 1672527600000, + Indexes: []string{ + "index-1", + "index-2", + }, + Query: map[string]string{ + "host": "abc", + "service": "xyz", + }, + To: 1704063600000, + }, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewDataDeletionApi(apiClient) + resp, r, err := api.CreateDataDeletionRequest(ctx, "logs", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DataDeletionApi.CreateDataDeletionRequest`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `DataDeletionApi.CreateDataDeletionRequest`:\n%s\n", responseContent) +} diff --git a/examples/v2/data-deletion/GetDataDeletionRequests.go b/examples/v2/data-deletion/GetDataDeletionRequests.go new file mode 100644 index 00000000000..a48dde67a50 --- /dev/null +++ b/examples/v2/data-deletion/GetDataDeletionRequests.go @@ -0,0 +1,29 @@ +// Gets a list of data deletion requests returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewDataDeletionApi(apiClient) + resp, r, err := api.GetDataDeletionRequests(ctx, *datadogV2.NewGetDataDeletionRequestsOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DataDeletionApi.GetDataDeletionRequests`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `DataDeletionApi.GetDataDeletionRequests`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index a0379fa7046..7c324b9f5fa 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -59,6 +59,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "CloudCostManagementApi": reflect.ValueOf(datadogV2.NewCloudCostManagementApi), "UsageMeteringApi": reflect.ValueOf(datadogV2.NewUsageMeteringApi), "DashboardListsApi": reflect.ValueOf(datadogV2.NewDashboardListsApi), + "DataDeletionApi": reflect.ValueOf(datadogV2.NewDataDeletionApi), "DomainAllowlistApi": reflect.ValueOf(datadogV2.NewDomainAllowlistApi), "DORAMetricsApi": reflect.ValueOf(datadogV2.NewDORAMetricsApi), "DowntimesApi": reflect.ValueOf(datadogV2.NewDowntimesApi), diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..4390af5977d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-11-15T08:56:51.182Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..c155d4e09ff --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Bad_Request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: PUT + url: https://api.datadoghq.com/api/v2/deletion/requests/id-1/cancel + response: + body: '{"errors":[{"status":"400","title":"Invalid Parameter","detail":"invalid + parameter \"id\" in \"path\"; expected type \"int\""}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_OK_response.freeze new file mode 100644 index 00000000000..04ac8a541df --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-11-15T08:57:02.769Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_OK_response.yaml new file mode 100644 index 00000000000..17795344c30 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_OK_response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"from":1672527600000,"indexes":["index-1","index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000}}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deletion/data/logs + response: + body: '{"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"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: PUT + url: https://api.datadoghq.com/api/v2/deletion/requests/303/cancel + response: + body: '{"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"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 2 + method: PUT + url: https://api.datadoghq.com/api/v2/deletion/requests/303/cancel + response: + body: '{"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"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Precondition_failed_error_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Precondition_failed_error_response.freeze new file mode 100644 index 00000000000..3bb79b73d33 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Precondition_failed_error_response.freeze @@ -0,0 +1 @@ +2024-11-15T08:57:14.890Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Precondition_failed_error_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Precondition_failed_error_response.yaml new file mode 100644 index 00000000000..ba0a0d92770 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Cancels_a_data_deletion_request_returns_Precondition_failed_error_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: PUT + url: https://api.datadoghq.com/api/v2/deletion/requests/-1/cancel + response: + body: '{"errors":[{"status":"412","code":"INVALID_ID","title":"INVALID_ID","detail":"INVALID_ID"}]}' + code: 412 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 412 Precondition Failed +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_OK_response.freeze new file mode 100644 index 00000000000..b74c2983af0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-11-15T08:59:09.810Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_OK_response.yaml new file mode 100644 index 00000000000..006349e7ccb --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_OK_response.yaml @@ -0,0 +1,41 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"from":1672527600000,"indexes":["index-1","index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000}}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deletion/data/logs + response: + body: '{"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"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: PUT + url: https://api.datadoghq.com/api/v2/deletion/requests/305/cancel + response: + body: '{"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"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_Precondition_failed_error_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_Precondition_failed_error_response.freeze new file mode 100644 index 00000000000..74ecbd427cf --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_Precondition_failed_error_response.freeze @@ -0,0 +1 @@ +2024-11-15T08:59:22.532Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_Precondition_failed_error_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_Precondition_failed_error_response.yaml new file mode 100644 index 00000000000..6655bacd223 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Creates_a_data_deletion_request_returns_Precondition_failed_error_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"from":1672527600000,"indexes":["index-1","index-2"],"query":{},"to":1704063600000}}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deletion/data/logs + response: + body: '{"errors":[{"status":"412","code":"INVALID_BODY","title":"INVALID_BODY","detail":"INVALID_BODY"}]}' + code: 412 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 412 Precondition Failed +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Gets_a_list_of_data_deletion_requests_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Gets_a_list_of_data_deletion_requests_returns_OK_response.freeze new file mode 100644 index 00000000000..108d0eae363 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Gets_a_list_of_data_deletion_requests_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-11-15T08:57:26.678Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Gets_a_list_of_data_deletion_requests_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Gets_a_list_of_data_deletion_requests_returns_OK_response.yaml new file mode 100644 index 00000000000..7252c0f7a87 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Data_Deletion/Scenario_Gets_a_list_of_data_deletion_requests_returns_OK_response.yaml @@ -0,0 +1,87 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"from":1672527600000,"indexes":["index-1","index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000}}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deletion/data/logs + response: + body: '{"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"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: GET + url: https://api.datadoghq.com/api/v2/deletion/requests + response: + body: '{"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}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 2 + method: PUT + url: https://api.datadoghq.com/api/v2/deletion/requests/304/cancel + response: + body: '{"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"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/features/v2/data_deletion.feature b/tests/scenarios/features/v2/data_deletion.feature new file mode 100644 index 00000000000..84c5830ead3 --- /dev/null +++ b/tests/scenarios/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/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 41cd8e0f22a..9619c3ce72b 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/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\": {\"service\": \"xyz\", \"host\": \"abc\"}\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/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index dcb4deb9a78..3038b13a12c 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/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": {