diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e83df8269e5f..7f2cc7c1b2c6 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3734,6 +3734,114 @@ components: description: The `markdownTextAnnotation` `text`. type: string type: object + AnonymizeUserError: + description: Error encountered when anonymizing a specific user. + properties: + error: + description: Error message describing why anonymization failed. + example: "" + type: string + user_id: + description: UUID of the user that failed to be anonymized. + example: "00000000-0000-0000-0000-000000000000" + type: string + required: + - user_id + - error + type: object + AnonymizeUsersRequest: + description: Request body for anonymizing users. + properties: + data: + $ref: "#/components/schemas/AnonymizeUsersRequestData" + required: + - data + type: object + AnonymizeUsersRequestAttributes: + description: Attributes of an anonymize users request. + properties: + user_ids: + description: List of user IDs (UUIDs) to anonymize. + example: + - "00000000-0000-0000-0000-000000000000" + items: + example: "00000000-0000-0000-0000-000000000000" + type: string + type: array + required: + - user_ids + type: object + AnonymizeUsersRequestData: + description: Object to anonymize a list of users. + properties: + attributes: + $ref: "#/components/schemas/AnonymizeUsersRequestAttributes" + id: + description: Unique identifier for the request. Not used server-side. + example: "00000000-0000-0000-0000-000000000000" + type: string + type: + $ref: "#/components/schemas/AnonymizeUsersRequestType" + required: + - type + - attributes + type: object + AnonymizeUsersRequestType: + default: anonymize_users_request + description: Type of the anonymize users request. + enum: + - anonymize_users_request + example: anonymize_users_request + type: string + x-enum-varnames: + - ANONYMIZE_USERS_REQUEST + AnonymizeUsersResponse: + description: Response containing the result of an anonymize users request. + properties: + data: + $ref: "#/components/schemas/AnonymizeUsersResponseData" + type: object + AnonymizeUsersResponseAttributes: + description: Attributes of an anonymize users response. + properties: + anonymize_errors: + description: List of errors encountered during anonymization, one entry per failed user. + items: + $ref: "#/components/schemas/AnonymizeUserError" + type: array + anonymized_user_ids: + description: List of user IDs (UUIDs) that were successfully anonymized. + example: + - "00000000-0000-0000-0000-000000000000" + items: + example: "00000000-0000-0000-0000-000000000000" + type: string + type: array + required: + - anonymized_user_ids + - anonymize_errors + type: object + AnonymizeUsersResponseData: + description: Response data for anonymizing users. + properties: + attributes: + $ref: "#/components/schemas/AnonymizeUsersResponseAttributes" + id: + description: Unique identifier of the response. + example: "00000000-0000-0000-0000-000000000000" + type: string + type: + $ref: "#/components/schemas/AnonymizeUsersResponseType" + type: object + AnonymizeUsersResponseType: + default: anonymize_users_response + description: Type of the anonymize users response. + enum: + - anonymize_users_response + example: anonymize_users_response + type: string + x-enum-varnames: + - ANONYMIZE_USERS_RESPONSE AnthropicAPIKey: description: The definition of the `AnthropicAPIKey` object. properties: @@ -76578,6 +76686,53 @@ paths: operator: OR permissions: - security_monitoring_findings_read + /api/v2/anonymize_users: + put: + description: |- + Anonymize a list of users, removing their personal data. This operation is irreversible. + Requires the `user_access_manage` permission. + operationId: AnonymizeUsers + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/AnonymizeUsersRequest" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/AnonymizeUsersResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Authentication error + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_access_manage + summary: Anonymize users + tags: + - Users + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: "**Note**: This endpoint is in Preview and may be subject to changes." /api/v2/api_keys: get: description: List all API keys available for your account. diff --git a/features/v2/undo.json b/features/v2/undo.json index 1f11ffb7e771..1df03bf26664 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -362,6 +362,12 @@ "type": "safe" } }, + "AnonymizeUsers": { + "tag": "Users", + "undo": { + "type": "idempotent" + } + }, "ListAPIKeys": { "tag": "Key Management", "undo": { diff --git a/features/v2/users.feature b/features/v2/users.feature index ce27d729985f..bb2f3fb989b5 100644 --- a/features/v2/users.feature +++ b/features/v2/users.feature @@ -7,6 +7,22 @@ Feature: Users And a valid "appKeyAuth" key in the system And an instance of "Users" API + @generated @skip @team:DataDog/team-aaa-identity + Scenario: Anonymize users returns "Bad Request" response + Given operation "AnonymizeUsers" enabled + And new "AnonymizeUsers" request + And body with value {"data": {"attributes": {"user_ids": ["00000000-0000-0000-0000-000000000000"]}, "id": "00000000-0000-0000-0000-000000000000", "type": "anonymize_users_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/team-aaa-identity + Scenario: Anonymize users returns "OK" response + Given operation "AnonymizeUsers" enabled + And new "AnonymizeUsers" request + And body with value {"data": {"attributes": {"user_ids": ["00000000-0000-0000-0000-000000000000"]}, "id": "00000000-0000-0000-0000-000000000000", "type": "anonymize_users_request"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/team-aaa-identity Scenario: Create a user returns "Bad Request" response Given new "CreateUser" request diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index 30e54e371363..a0bfcda41aa4 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -2772,6 +2772,100 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "AwsOnDemandResponse", }, + "UsersApi.V2.AnonymizeUsers": { + body: { + type: "AnonymizeUsersRequest", + format: "", + }, + operationResponseType: "AnonymizeUsersResponse", + }, + "UsersApi.V2.SendInvitations": { + body: { + type: "UserInvitationsRequest", + format: "", + }, + operationResponseType: "UserInvitationsResponse", + }, + "UsersApi.V2.GetInvitation": { + userInvitationUuid: { + type: "string", + format: "", + }, + operationResponseType: "UserInvitationResponse", + }, + "UsersApi.V2.ListUsers": { + pageSize: { + type: "number", + format: "int64", + }, + pageNumber: { + type: "number", + format: "int64", + }, + sort: { + type: "string", + format: "", + }, + sortDir: { + type: "QuerySortOrder", + format: "", + }, + filter: { + type: "string", + format: "", + }, + filterStatus: { + type: "string", + format: "", + }, + operationResponseType: "UsersResponse", + }, + "UsersApi.V2.CreateUser": { + body: { + type: "UserCreateRequest", + format: "", + }, + operationResponseType: "UserResponse", + }, + "UsersApi.V2.GetUser": { + userId: { + type: "string", + format: "", + }, + operationResponseType: "UserResponse", + }, + "UsersApi.V2.DisableUser": { + userId: { + type: "string", + format: "", + }, + operationResponseType: "{}", + }, + "UsersApi.V2.UpdateUser": { + userId: { + type: "string", + format: "", + }, + body: { + type: "UserUpdateRequest", + format: "", + }, + operationResponseType: "UserResponse", + }, + "UsersApi.V2.ListUserOrganizations": { + userId: { + type: "string", + format: "", + }, + operationResponseType: "UserResponse", + }, + "UsersApi.V2.ListUserPermissions": { + userId: { + type: "string", + format: "", + }, + operationResponseType: "PermissionsResponse", + }, "KeyManagementApi.V2.ListAPIKeys": { pageSize: { type: "number", @@ -11937,93 +12031,6 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "IncidentTeamResponse", }, - "UsersApi.V2.SendInvitations": { - body: { - type: "UserInvitationsRequest", - format: "", - }, - operationResponseType: "UserInvitationsResponse", - }, - "UsersApi.V2.GetInvitation": { - userInvitationUuid: { - type: "string", - format: "", - }, - operationResponseType: "UserInvitationResponse", - }, - "UsersApi.V2.ListUsers": { - pageSize: { - type: "number", - format: "int64", - }, - pageNumber: { - type: "number", - format: "int64", - }, - sort: { - type: "string", - format: "", - }, - sortDir: { - type: "QuerySortOrder", - format: "", - }, - filter: { - type: "string", - format: "", - }, - filterStatus: { - type: "string", - format: "", - }, - operationResponseType: "UsersResponse", - }, - "UsersApi.V2.CreateUser": { - body: { - type: "UserCreateRequest", - format: "", - }, - operationResponseType: "UserResponse", - }, - "UsersApi.V2.GetUser": { - userId: { - type: "string", - format: "", - }, - operationResponseType: "UserResponse", - }, - "UsersApi.V2.DisableUser": { - userId: { - type: "string", - format: "", - }, - operationResponseType: "{}", - }, - "UsersApi.V2.UpdateUser": { - userId: { - type: "string", - format: "", - }, - body: { - type: "UserUpdateRequest", - format: "", - }, - operationResponseType: "UserResponse", - }, - "UsersApi.V2.ListUserOrganizations": { - userId: { - type: "string", - format: "", - }, - operationResponseType: "UserResponse", - }, - "UsersApi.V2.ListUserPermissions": { - userId: { - type: "string", - format: "", - }, - operationResponseType: "PermissionsResponse", - }, "WidgetsApi.V2.SearchWidgets": { experienceType: { type: "WidgetExperienceType", diff --git a/services/users/README.md b/services/users/README.md index b6f73b89b772..0733eca3462e 100644 --- a/services/users/README.md +++ b/services/users/README.md @@ -25,10 +25,18 @@ import { UsersApiV2 } from "@datadog/datadog-api-client-users"; import { v2 } from "@datadog/datadog-api-client-users"; const configuration = createConfiguration(); +// Enable unstable operations +const configurationOpts = { + unstableOperations: { + "UsersApi.v2.anonymizeUsers": true + } +} + +const configuration = createConfiguration(configurationOpts); const apiInstance = new UsersApiV2(configuration); const params = {/* parameters */}; -apiInstance.sendInvitations(params).then((data) => { +apiInstance.anonymizeUsers(params).then((data) => { console.log("API called successfully. Returned data: " + JSON.stringify(data)); }).catch((error) => { console.error("Error calling API: " + error); diff --git a/services/users/src/v2/UsersApi.ts b/services/users/src/v2/UsersApi.ts index 7929fd7dd763..5fe44c0ee7b7 100644 --- a/services/users/src/v2/UsersApi.ts +++ b/services/users/src/v2/UsersApi.ts @@ -22,6 +22,8 @@ import { } from "@datadog/datadog-api-client"; import { TypingInfo } from "./models/TypingInfo"; +import { AnonymizeUsersRequest } from "./models/AnonymizeUsersRequest"; +import { AnonymizeUsersResponse } from "./models/AnonymizeUsersResponse"; import { APIErrorResponse } from "./models/APIErrorResponse"; import { PermissionsResponse } from "./models/PermissionsResponse"; import { QuerySortOrder } from "./models/QuerySortOrder"; @@ -44,6 +46,63 @@ export class UsersApiRequestFactory extends BaseAPIRequestFactory { this.userAgent = buildUserAgent("users", version); } } + public async anonymizeUsers( + body: AnonymizeUsersRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if (!_config.unstableOperations["UsersApi.v2.anonymizeUsers"]) { + throw new Error( + "Unstable operation 'anonymizeUsers' is disabled. Enable it by setting `configuration.unstableOperations['UsersApi.v2.anonymizeUsers'] = true`", + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "anonymizeUsers"); + } + + // Path Params + const localVarPath = "/api/v2/anonymize_users"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "UsersApi.v2.anonymizeUsers", + UsersApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.PUT, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "AnonymizeUsersRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async createUser( body: UserCreateRequest, _options?: Configuration, @@ -520,6 +579,66 @@ export class UsersApiRequestFactory extends BaseAPIRequestFactory { } export class UsersApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to anonymizeUsers + * @throws ApiException if the response code was not in [200, 299] + */ + public async anonymizeUsers( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: AnonymizeUsersResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "AnonymizeUsersResponse", + ) as AnonymizeUsersResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: AnonymizeUsersResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "AnonymizeUsersResponse", + "", + ) as AnonymizeUsersResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -1042,6 +1161,13 @@ export class UsersApiResponseProcessor { } } +export interface UsersApiAnonymizeUsersRequest { + /** + * @type AnonymizeUsersRequest + */ + body: AnonymizeUsersRequest; +} + export interface UsersApiCreateUserRequest { /** * @type UserCreateRequest @@ -1165,6 +1291,28 @@ export class UsersApi { responseProcessor || new UsersApiResponseProcessor(); } + /** + * Anonymize a list of users, removing their personal data. This operation is irreversible. + * Requires the `user_access_manage` permission. + * @param param The request object + */ + public anonymizeUsers( + param: UsersApiAnonymizeUsersRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.anonymizeUsers( + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.anonymizeUsers(responseContext); + }); + }); + } + /** * Create a user for your organization. * @param param The request object diff --git a/services/users/src/v2/index.ts b/services/users/src/v2/index.ts index 757100e43734..661d96a60abd 100644 --- a/services/users/src/v2/index.ts +++ b/services/users/src/v2/index.ts @@ -1,4 +1,5 @@ export { + UsersApiAnonymizeUsersRequest, UsersApiCreateUserRequest, UsersApiDisableUserRequest, UsersApiGetInvitationRequest, @@ -11,6 +12,15 @@ export { UsersApi, } from "./UsersApi"; +export { AnonymizeUserError } from "./models/AnonymizeUserError"; +export { AnonymizeUsersRequest } from "./models/AnonymizeUsersRequest"; +export { AnonymizeUsersRequestAttributes } from "./models/AnonymizeUsersRequestAttributes"; +export { AnonymizeUsersRequestData } from "./models/AnonymizeUsersRequestData"; +export { AnonymizeUsersRequestType } from "./models/AnonymizeUsersRequestType"; +export { AnonymizeUsersResponse } from "./models/AnonymizeUsersResponse"; +export { AnonymizeUsersResponseAttributes } from "./models/AnonymizeUsersResponseAttributes"; +export { AnonymizeUsersResponseData } from "./models/AnonymizeUsersResponseData"; +export { AnonymizeUsersResponseType } from "./models/AnonymizeUsersResponseType"; export { APIErrorResponse } from "./models/APIErrorResponse"; export { Organization } from "./models/Organization"; export { OrganizationAttributes } from "./models/OrganizationAttributes"; diff --git a/services/users/src/v2/models/AnonymizeUserError.ts b/services/users/src/v2/models/AnonymizeUserError.ts new file mode 100644 index 000000000000..52767caa753f --- /dev/null +++ b/services/users/src/v2/models/AnonymizeUserError.ts @@ -0,0 +1,54 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Error encountered when anonymizing a specific user. + */ +export class AnonymizeUserError { + /** + * Error message describing why anonymization failed. + */ + "error": string; + /** + * UUID of the user that failed to be anonymized. + */ + "userId": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + error: { + baseName: "error", + type: "string", + required: true, + }, + userId: { + baseName: "user_id", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AnonymizeUserError.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/users/src/v2/models/AnonymizeUsersRequest.ts b/services/users/src/v2/models/AnonymizeUsersRequest.ts new file mode 100644 index 000000000000..4b5f012e397e --- /dev/null +++ b/services/users/src/v2/models/AnonymizeUsersRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { AnonymizeUsersRequestData } from "./AnonymizeUsersRequestData"; + +/** + * Request body for anonymizing users. + */ +export class AnonymizeUsersRequest { + /** + * Object to anonymize a list of users. + */ + "data": AnonymizeUsersRequestData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "AnonymizeUsersRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AnonymizeUsersRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/users/src/v2/models/AnonymizeUsersRequestAttributes.ts b/services/users/src/v2/models/AnonymizeUsersRequestAttributes.ts new file mode 100644 index 000000000000..81d7574f7912 --- /dev/null +++ b/services/users/src/v2/models/AnonymizeUsersRequestAttributes.ts @@ -0,0 +1,45 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Attributes of an anonymize users request. + */ +export class AnonymizeUsersRequestAttributes { + /** + * List of user IDs (UUIDs) to anonymize. + */ + "userIds": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + userIds: { + baseName: "user_ids", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AnonymizeUsersRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/users/src/v2/models/AnonymizeUsersRequestData.ts b/services/users/src/v2/models/AnonymizeUsersRequestData.ts new file mode 100644 index 000000000000..b66b2dfc6b10 --- /dev/null +++ b/services/users/src/v2/models/AnonymizeUsersRequestData.ts @@ -0,0 +1,65 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { AnonymizeUsersRequestAttributes } from "./AnonymizeUsersRequestAttributes"; +import { AnonymizeUsersRequestType } from "./AnonymizeUsersRequestType"; + +/** + * Object to anonymize a list of users. + */ +export class AnonymizeUsersRequestData { + /** + * Attributes of an anonymize users request. + */ + "attributes": AnonymizeUsersRequestAttributes; + /** + * Unique identifier for the request. Not used server-side. + */ + "id"?: string; + /** + * Type of the anonymize users request. + */ + "type": AnonymizeUsersRequestType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "AnonymizeUsersRequestAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "AnonymizeUsersRequestType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AnonymizeUsersRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/users/src/v2/models/AnonymizeUsersRequestType.ts b/services/users/src/v2/models/AnonymizeUsersRequestType.ts new file mode 100644 index 000000000000..a7247a5c01c9 --- /dev/null +++ b/services/users/src/v2/models/AnonymizeUsersRequestType.ts @@ -0,0 +1,9 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Type of the anonymize users request. + */ +export type AnonymizeUsersRequestType = + | typeof ANONYMIZE_USERS_REQUEST + | UnparsedObject; +export const ANONYMIZE_USERS_REQUEST = "anonymize_users_request"; diff --git a/services/users/src/v2/models/AnonymizeUsersResponse.ts b/services/users/src/v2/models/AnonymizeUsersResponse.ts new file mode 100644 index 000000000000..f637479b5e3e --- /dev/null +++ b/services/users/src/v2/models/AnonymizeUsersResponse.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { AnonymizeUsersResponseData } from "./AnonymizeUsersResponseData"; + +/** + * Response containing the result of an anonymize users request. + */ +export class AnonymizeUsersResponse { + /** + * Response data for anonymizing users. + */ + "data"?: AnonymizeUsersResponseData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "AnonymizeUsersResponseData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AnonymizeUsersResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/users/src/v2/models/AnonymizeUsersResponseAttributes.ts b/services/users/src/v2/models/AnonymizeUsersResponseAttributes.ts new file mode 100644 index 000000000000..26abafd9904a --- /dev/null +++ b/services/users/src/v2/models/AnonymizeUsersResponseAttributes.ts @@ -0,0 +1,56 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { AnonymizeUserError } from "./AnonymizeUserError"; + +/** + * Attributes of an anonymize users response. + */ +export class AnonymizeUsersResponseAttributes { + /** + * List of errors encountered during anonymization, one entry per failed user. + */ + "anonymizeErrors": Array; + /** + * List of user IDs (UUIDs) that were successfully anonymized. + */ + "anonymizedUserIds": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + anonymizeErrors: { + baseName: "anonymize_errors", + type: "Array", + required: true, + }, + anonymizedUserIds: { + baseName: "anonymized_user_ids", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AnonymizeUsersResponseAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/users/src/v2/models/AnonymizeUsersResponseData.ts b/services/users/src/v2/models/AnonymizeUsersResponseData.ts new file mode 100644 index 000000000000..91e0ada8ca1d --- /dev/null +++ b/services/users/src/v2/models/AnonymizeUsersResponseData.ts @@ -0,0 +1,63 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { AnonymizeUsersResponseAttributes } from "./AnonymizeUsersResponseAttributes"; +import { AnonymizeUsersResponseType } from "./AnonymizeUsersResponseType"; + +/** + * Response data for anonymizing users. + */ +export class AnonymizeUsersResponseData { + /** + * Attributes of an anonymize users response. + */ + "attributes"?: AnonymizeUsersResponseAttributes; + /** + * Unique identifier of the response. + */ + "id"?: string; + /** + * Type of the anonymize users response. + */ + "type"?: AnonymizeUsersResponseType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "AnonymizeUsersResponseAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "AnonymizeUsersResponseType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AnonymizeUsersResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/users/src/v2/models/AnonymizeUsersResponseType.ts b/services/users/src/v2/models/AnonymizeUsersResponseType.ts new file mode 100644 index 000000000000..5c69d1e6e9f1 --- /dev/null +++ b/services/users/src/v2/models/AnonymizeUsersResponseType.ts @@ -0,0 +1,9 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Type of the anonymize users response. + */ +export type AnonymizeUsersResponseType = + | typeof ANONYMIZE_USERS_RESPONSE + | UnparsedObject; +export const ANONYMIZE_USERS_RESPONSE = "anonymize_users_response"; diff --git a/services/users/src/v2/models/TypingInfo.ts b/services/users/src/v2/models/TypingInfo.ts index 50b54bad5f71..65b634d4e651 100644 --- a/services/users/src/v2/models/TypingInfo.ts +++ b/services/users/src/v2/models/TypingInfo.ts @@ -1,6 +1,13 @@ import { ModelTypingInfo } from "@datadog/datadog-api-client"; import { APIErrorResponse } from "./APIErrorResponse"; +import { AnonymizeUserError } from "./AnonymizeUserError"; +import { AnonymizeUsersRequest } from "./AnonymizeUsersRequest"; +import { AnonymizeUsersRequestAttributes } from "./AnonymizeUsersRequestAttributes"; +import { AnonymizeUsersRequestData } from "./AnonymizeUsersRequestData"; +import { AnonymizeUsersResponse } from "./AnonymizeUsersResponse"; +import { AnonymizeUsersResponseAttributes } from "./AnonymizeUsersResponseAttributes"; +import { AnonymizeUsersResponseData } from "./AnonymizeUsersResponseData"; import { Organization } from "./Organization"; import { OrganizationAttributes } from "./OrganizationAttributes"; import { Pagination } from "./Pagination"; @@ -43,6 +50,8 @@ import { UsersResponse } from "./UsersResponse"; export const TypingInfo: ModelTypingInfo = { enumsMap: { + AnonymizeUsersRequestType: ["anonymize_users_request"], + AnonymizeUsersResponseType: ["anonymize_users_response"], OrganizationsType: ["orgs"], PermissionsType: ["permissions"], QuerySortOrder: ["asc", "desc"], @@ -55,6 +64,13 @@ export const TypingInfo: ModelTypingInfo = { }, typeMap: { APIErrorResponse: APIErrorResponse, + AnonymizeUserError: AnonymizeUserError, + AnonymizeUsersRequest: AnonymizeUsersRequest, + AnonymizeUsersRequestAttributes: AnonymizeUsersRequestAttributes, + AnonymizeUsersRequestData: AnonymizeUsersRequestData, + AnonymizeUsersResponse: AnonymizeUsersResponse, + AnonymizeUsersResponseAttributes: AnonymizeUsersResponseAttributes, + AnonymizeUsersResponseData: AnonymizeUsersResponseData, Organization: Organization, OrganizationAttributes: OrganizationAttributes, Pagination: Pagination,