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/examples/v2/users/AnonymizeUsers.rb b/examples/v2/users/AnonymizeUsers.rb new file mode 100644 index 000000000000..45af5881713e --- /dev/null +++ b/examples/v2/users/AnonymizeUsers.rb @@ -0,0 +1,20 @@ +# Anonymize users returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.anonymize_users".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsersAPI.new + +body = DatadogAPIClient::V2::AnonymizeUsersRequest.new({ + data: DatadogAPIClient::V2::AnonymizeUsersRequestData.new({ + attributes: DatadogAPIClient::V2::AnonymizeUsersRequestAttributes.new({ + user_ids: [ + "00000000-0000-0000-0000-000000000000", + ], + }), + id: "00000000-0000-0000-0000-000000000000", + type: DatadogAPIClient::V2::AnonymizeUsersRequestType::ANONYMIZE_USERS_REQUEST, + }), +}) +p api_instance.anonymize_users(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 9c7dbfe9962b..afa164e80d63 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -992,6 +992,42 @@ "v2.GetAwsOnDemandTask" => { "task_id" => "String", }, + "v2.AnonymizeUsers" => { + "body" => "AnonymizeUsersRequest", + }, + "v2.SendInvitations" => { + "body" => "UserInvitationsRequest", + }, + "v2.GetInvitation" => { + "user_invitation_uuid" => "String", + }, + "v2.ListUsers" => { + "page_size" => "Integer", + "page_number" => "Integer", + "sort" => "String", + "sort_dir" => "QuerySortOrder", + "filter" => "String", + "filter_status" => "String", + }, + "v2.CreateUser" => { + "body" => "UserCreateRequest", + }, + "v2.DisableUser" => { + "user_id" => "String", + }, + "v2.GetUser" => { + "user_id" => "String", + }, + "v2.UpdateUser" => { + "user_id" => "String", + "body" => "UserUpdateRequest", + }, + "v2.ListUserOrganizations" => { + "user_id" => "String", + }, + "v2.ListUserPermissions" => { + "user_id" => "String", + }, "v2.ListAPIKeys" => { "page_size" => "Integer", "page_number" => "Integer", @@ -4228,39 +4264,6 @@ "team_id" => "String", "body" => "IncidentTeamUpdateRequest", }, - "v2.SendInvitations" => { - "body" => "UserInvitationsRequest", - }, - "v2.GetInvitation" => { - "user_invitation_uuid" => "String", - }, - "v2.ListUsers" => { - "page_size" => "Integer", - "page_number" => "Integer", - "sort" => "String", - "sort_dir" => "QuerySortOrder", - "filter" => "String", - "filter_status" => "String", - }, - "v2.CreateUser" => { - "body" => "UserCreateRequest", - }, - "v2.DisableUser" => { - "user_id" => "String", - }, - "v2.GetUser" => { - "user_id" => "String", - }, - "v2.UpdateUser" => { - "user_id" => "String", - "body" => "UserUpdateRequest", - }, - "v2.ListUserOrganizations" => { - "user_id" => "String", - }, - "v2.ListUserPermissions" => { - "user_id" => "String", - }, "v2.SearchWidgets" => { "experience_type" => "WidgetExperienceType", "filter_widget_type" => "WidgetType", 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/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 74df85e5c1a9..41e4b529587f 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -203,6 +203,7 @@ def initialize "v2.list_fleet_schedules": false, "v2.trigger_fleet_schedule": false, "v2.update_fleet_schedule": false, + "v2.anonymize_users": false, "v2.create_open_api": false, "v2.delete_open_api": false, "v2.get_open_api": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index b38f547854a2..0ec1d9fb1785 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1091,6 +1091,15 @@ def overrides "v2.annotation_display" => "AnnotationDisplay", "v2.annotation_display_bounds" => "AnnotationDisplayBounds", "v2.annotation_markdown_text_annotation" => "AnnotationMarkdownTextAnnotation", + "v2.anonymize_user_error" => "AnonymizeUserError", + "v2.anonymize_users_request" => "AnonymizeUsersRequest", + "v2.anonymize_users_request_attributes" => "AnonymizeUsersRequestAttributes", + "v2.anonymize_users_request_data" => "AnonymizeUsersRequestData", + "v2.anonymize_users_request_type" => "AnonymizeUsersRequestType", + "v2.anonymize_users_response" => "AnonymizeUsersResponse", + "v2.anonymize_users_response_attributes" => "AnonymizeUsersResponseAttributes", + "v2.anonymize_users_response_data" => "AnonymizeUsersResponseData", + "v2.anonymize_users_response_type" => "AnonymizeUsersResponseType", "v2.anthropic_api_key" => "AnthropicAPIKey", "v2.anthropic_api_key_type" => "AnthropicAPIKeyType", "v2.anthropic_api_key_update" => "AnthropicAPIKeyUpdate", diff --git a/lib/datadog_api_client/v2/api/users_api.rb b/lib/datadog_api_client/v2/api/users_api.rb index 71cb5bfe4bf3..14dd65917d1f 100644 --- a/lib/datadog_api_client/v2/api/users_api.rb +++ b/lib/datadog_api_client/v2/api/users_api.rb @@ -23,6 +23,80 @@ def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end + # Anonymize users. + # + # @see #anonymize_users_with_http_info + def anonymize_users(body, opts = {}) + data, _status_code, _headers = anonymize_users_with_http_info(body, opts) + data + end + + # Anonymize users. + # + # Anonymize a list of users, removing their personal data. This operation is irreversible. + # Requires the `user_access_manage` permission. + # + # @param body [AnonymizeUsersRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(AnonymizeUsersResponse, Integer, Hash)>] AnonymizeUsersResponse data, response status code and response headers + def anonymize_users_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.anonymize_users".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.anonymize_users") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.anonymize_users")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsersAPI.anonymize_users ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling UsersAPI.anonymize_users" + end + # resource path + local_var_path = '/api/v2/anonymize_users' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'AnonymizeUsersResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :anonymize_users, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsersAPI#anonymize_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create a user. # # @see #create_user_with_http_info diff --git a/lib/datadog_api_client/v2/models/anonymize_user_error.rb b/lib/datadog_api_client/v2/models/anonymize_user_error.rb new file mode 100644 index 000000000000..eb29f73e3e49 --- /dev/null +++ b/lib/datadog_api_client/v2/models/anonymize_user_error.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Error encountered when anonymizing a specific user. + class AnonymizeUserError + include BaseGenericModel + + # Error message describing why anonymization failed. + attr_reader :error + + # UUID of the user that failed to be anonymized. + attr_reader :user_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'error' => :'error', + :'user_id' => :'user_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'error' => :'String', + :'user_id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnonymizeUserError` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @error.nil? + return false if @user_id.nil? + true + end + + # Custom attribute writer method with validation + # @param error [Object] Object to be assigned + # @!visibility private + def error=(error) + if error.nil? + fail ArgumentError, 'invalid value for "error", error cannot be nil.' + end + @error = error + end + + # Custom attribute writer method with validation + # @param user_id [Object] Object to be assigned + # @!visibility private + def user_id=(user_id) + if user_id.nil? + fail ArgumentError, 'invalid value for "user_id", user_id cannot be nil.' + end + @user_id = user_id + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + error == o.error && + user_id == o.user_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [error, user_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/anonymize_users_request.rb b/lib/datadog_api_client/v2/models/anonymize_users_request.rb new file mode 100644 index 000000000000..a26a541c631b --- /dev/null +++ b/lib/datadog_api_client/v2/models/anonymize_users_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for anonymizing users. + class AnonymizeUsersRequest + include BaseGenericModel + + # Object to anonymize a list of users. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AnonymizeUsersRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnonymizeUsersRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/anonymize_users_request_attributes.rb b/lib/datadog_api_client/v2/models/anonymize_users_request_attributes.rb new file mode 100644 index 000000000000..26707c587e05 --- /dev/null +++ b/lib/datadog_api_client/v2/models/anonymize_users_request_attributes.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of an anonymize users request. + class AnonymizeUsersRequestAttributes + include BaseGenericModel + + # List of user IDs (UUIDs) to anonymize. + attr_reader :user_ids + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'user_ids' => :'user_ids' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'user_ids' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnonymizeUsersRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'user_ids') + if (value = attributes[:'user_ids']).is_a?(Array) + self.user_ids = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @user_ids.nil? + true + end + + # Custom attribute writer method with validation + # @param user_ids [Object] Object to be assigned + # @!visibility private + def user_ids=(user_ids) + if user_ids.nil? + fail ArgumentError, 'invalid value for "user_ids", user_ids cannot be nil.' + end + @user_ids = user_ids + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_ids == o.user_ids && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [user_ids, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/anonymize_users_request_data.rb b/lib/datadog_api_client/v2/models/anonymize_users_request_data.rb new file mode 100644 index 000000000000..d40887ee4a49 --- /dev/null +++ b/lib/datadog_api_client/v2/models/anonymize_users_request_data.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Object to anonymize a list of users. + class AnonymizeUsersRequestData + include BaseGenericModel + + # Attributes of an anonymize users request. + attr_reader :attributes + + # Unique identifier for the request. Not used server-side. + attr_accessor :id + + # Type of the anonymize users request. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AnonymizeUsersRequestAttributes', + :'id' => :'String', + :'type' => :'AnonymizeUsersRequestType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnonymizeUsersRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/anonymize_users_request_type.rb b/lib/datadog_api_client/v2/models/anonymize_users_request_type.rb new file mode 100644 index 000000000000..c18ffc7b9ca5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/anonymize_users_request_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the anonymize users request. + class AnonymizeUsersRequestType + include BaseEnumModel + + ANONYMIZE_USERS_REQUEST = "anonymize_users_request".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/anonymize_users_response.rb b/lib/datadog_api_client/v2/models/anonymize_users_response.rb new file mode 100644 index 000000000000..a6f9d6e59d30 --- /dev/null +++ b/lib/datadog_api_client/v2/models/anonymize_users_response.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing the result of an anonymize users request. + class AnonymizeUsersResponse + include BaseGenericModel + + # Response data for anonymizing users. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AnonymizeUsersResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnonymizeUsersResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/anonymize_users_response_attributes.rb b/lib/datadog_api_client/v2/models/anonymize_users_response_attributes.rb new file mode 100644 index 000000000000..57c66be38808 --- /dev/null +++ b/lib/datadog_api_client/v2/models/anonymize_users_response_attributes.rb @@ -0,0 +1,148 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of an anonymize users response. + class AnonymizeUsersResponseAttributes + include BaseGenericModel + + # List of errors encountered during anonymization, one entry per failed user. + attr_reader :anonymize_errors + + # List of user IDs (UUIDs) that were successfully anonymized. + attr_reader :anonymized_user_ids + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'anonymize_errors' => :'anonymize_errors', + :'anonymized_user_ids' => :'anonymized_user_ids' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'anonymize_errors' => :'Array', + :'anonymized_user_ids' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnonymizeUsersResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'anonymize_errors') + if (value = attributes[:'anonymize_errors']).is_a?(Array) + self.anonymize_errors = value + end + end + + if attributes.key?(:'anonymized_user_ids') + if (value = attributes[:'anonymized_user_ids']).is_a?(Array) + self.anonymized_user_ids = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @anonymize_errors.nil? + return false if @anonymized_user_ids.nil? + true + end + + # Custom attribute writer method with validation + # @param anonymize_errors [Object] Object to be assigned + # @!visibility private + def anonymize_errors=(anonymize_errors) + if anonymize_errors.nil? + fail ArgumentError, 'invalid value for "anonymize_errors", anonymize_errors cannot be nil.' + end + @anonymize_errors = anonymize_errors + end + + # Custom attribute writer method with validation + # @param anonymized_user_ids [Object] Object to be assigned + # @!visibility private + def anonymized_user_ids=(anonymized_user_ids) + if anonymized_user_ids.nil? + fail ArgumentError, 'invalid value for "anonymized_user_ids", anonymized_user_ids cannot be nil.' + end + @anonymized_user_ids = anonymized_user_ids + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + anonymize_errors == o.anonymize_errors && + anonymized_user_ids == o.anonymized_user_ids && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [anonymize_errors, anonymized_user_ids, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/anonymize_users_response_data.rb b/lib/datadog_api_client/v2/models/anonymize_users_response_data.rb new file mode 100644 index 000000000000..b7d98fc14753 --- /dev/null +++ b/lib/datadog_api_client/v2/models/anonymize_users_response_data.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response data for anonymizing users. + class AnonymizeUsersResponseData + include BaseGenericModel + + # Attributes of an anonymize users response. + attr_accessor :attributes + + # Unique identifier of the response. + attr_accessor :id + + # Type of the anonymize users response. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AnonymizeUsersResponseAttributes', + :'id' => :'String', + :'type' => :'AnonymizeUsersResponseType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnonymizeUsersResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/anonymize_users_response_type.rb b/lib/datadog_api_client/v2/models/anonymize_users_response_type.rb new file mode 100644 index 000000000000..b06c2b772289 --- /dev/null +++ b/lib/datadog_api_client/v2/models/anonymize_users_response_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of the anonymize users response. + class AnonymizeUsersResponseType + include BaseEnumModel + + ANONYMIZE_USERS_RESPONSE = "anonymize_users_response".freeze + end +end