diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9713873b6586..a02697caa79d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -76116,73 +76116,90 @@ components: - attributes type: object SecurityEntityRiskScoreAttributes: - description: Attributes of an entity risk score + description: Attributes of an entity risk score. properties: + accountIds: + description: Cloud account IDs associated with the entity. + example: ["222233334444", "3333333555555"] + items: + description: A cloud account ID. + type: string + type: array configRisks: $ref: "#/components/schemas/SecurityEntityConfigRisks" - entityID: - description: Unique identifier for the entity - example: "arn:aws:iam::123456789012:user/john.doe" - type: string entityMetadata: $ref: "#/components/schemas/SecurityEntityMetadata" entityName: - description: Human-readable name of the entity + description: Human-readable name of the entity. example: "john.doe" type: string entityProviders: - description: Cloud providers associated with the entity - example: ["aws"] + description: Cloud providers associated with the entity. + example: ["AWS"] items: description: A cloud provider name. type: string type: array entityRoles: - description: Roles associated with the entity - example: ["Admin", "Developer"] + description: Roles associated with the entity. + example: [] items: description: A role assigned to the entity. type: string type: array + entitySubTypes: + description: Sub-types associated with the entity. + example: ["Root"] + items: + description: An entity sub-type label. + type: string + type: array entityType: - description: Type of the entity (e.g., aws_iam_user, aws_ec2_instance) + description: Type of the entity (for example, aws_iam_user, aws_ec2_instance). example: "aws_iam_user" type: string + entityTypes: + description: All types associated with the entity. + example: ["Root", "User Name"] + items: + description: An entity type label. + type: string + type: array firstDetected: - description: Timestamp when the entity was first detected (Unix milliseconds) - example: 1704067200000 + description: Timestamp when the entity was first detected (Unix milliseconds). + example: 1778876604661 format: int64 type: integer lastActivityTitle: - description: Title of the most recent signal detected for this entity + description: Title of the most recent signal detected for this entity. example: "Suspicious API call detected" type: string lastDetected: - description: Timestamp when the entity was last detected (Unix milliseconds) - example: 1705276800000 + description: Timestamp when the entity was last detected (Unix milliseconds). + example: 1780064607093 format: int64 type: integer riskScore: - description: Current risk score for the entity + description: Current risk score for the entity. example: 85 format: int64 type: integer riskScoreEvolution: - description: Change in risk score compared to previous period + description: Change in risk score compared to previous period. example: 12 format: int64 type: integer severity: $ref: "#/components/schemas/SecurityEntityRiskScoreAttributesSeverity" signalsDetected: - description: Number of security signals detected for this entity + description: Number of security signals detected for this entity. example: 15 format: int64 type: integer required: - - entityID - - entityType - entityProviders + - entitySubTypes + - accountIds - riskScore - riskScoreEvolution - severity @@ -76209,11 +76226,19 @@ components: - MEDIUM - LOW - INFO + SecurityEntityRiskScoreResponse: + description: Response containing a single entity risk score + properties: + data: + $ref: "#/components/schemas/SecurityEntityRiskScore" + required: + - data + type: object SecurityEntityRiskScoreType: - description: Resource type + description: Resource type. enum: - - security_entity_risk_score - example: security_entity_risk_score + - SecurityEntityRiskScore + example: SecurityEntityRiskScore type: string x-enum-varnames: - SECURITY_ENTITY_RISK_SCORE @@ -153097,6 +153122,8 @@ paths: value: data: - attributes: + accountIds: + - "123456789012" configRisks: hasIdentityRisk: false hasMisconfiguration: true @@ -153104,21 +153131,25 @@ paths: isPrivileged: false isProduction: true isPubliclyAccessible: true - entityID: "arn:aws:iam::123456789012:user/test-user" entityMetadata: environments: - production - mitreTactics: [] - mitreTechniques: [] + mitreTactics: + - ta0006-credential-access + mitreTechniques: + - t1078-valid-accounts services: - api-gateway sources: - cloudtrail entityName: test-user entityProviders: - - aws + - AWS entityRoles: [] - entityType: aws_iam_user + entitySubTypes: + - "IAM User" + entityTypes: + - "IAMUser" firstDetected: 1704067200000 lastActivityTitle: "Suspicious API call detected" lastDetected: 1705276800000 @@ -153127,10 +153158,12 @@ paths: severity: critical signalsDetected: 15 id: "arn:aws:iam::123456789012:user/test-user" - type: security_entity_risk_score + type: SecurityEntityRiskScore meta: - page: - total: 1 + pageNumber: 1 + pageSize: 10 + queryId: "abc123def456" + totalRowCount: 1 schema: $ref: "#/components/schemas/SecurityEntityRiskScoresResponse" description: OK @@ -153160,6 +153193,100 @@ paths: x-unstable: |- **Note**: This endpoint is in public beta and it's subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/security-entities/risk-scores/{entity_id}: + get: + description: |- + Get the risk score for a specific entity by its ID. Returns security risk assessment including risk score, severity, detected signals, misconfigurations, and identity risks. + operationId: GetEntityRiskScore + parameters: + - description: The URL-encoded unique identifier for the entity. + in: path + name: entity_id + required: true + schema: + example: "arn:aws:iam::123456789012:user/john.doe" + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + accountIds: + - "123456789012" + configRisks: + hasIdentityRisk: false + hasMisconfiguration: true + hasPrivilegedRole: false + isPrivileged: false + isProduction: true + isPubliclyAccessible: true + entityMetadata: + environments: + - production + mitreTactics: + - ta0006-credential-access + mitreTechniques: + - t1078-valid-accounts + services: + - api-gateway + sources: + - cloudtrail + entityName: "test-user" + entityProviders: + - AWS + entityRoles: [] + entitySubTypes: + - "IAM User" + entityTypes: + - "IAMUser" + firstDetected: 1704067200000 + lastActivityTitle: "Suspicious API call detected" + lastDetected: 1705276800000 + riskScore: 85 + riskScoreEvolution: 12 + severity: critical + signalsDetected: 15 + id: "arn:aws:iam::123456789012:user/test-user" + type: SecurityEntityRiskScore + schema: + $ref: "#/components/schemas/SecurityEntityRiskScoreResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get Entity Risk Score + tags: + - Entity Risk Scores + x-unstable: |- + **Note**: This endpoint is in public beta and it's subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/security/cloud_workload/policy/download: get: description: |- diff --git a/examples/v2/entity-risk-scores/GetEntityRiskScore.rb b/examples/v2/entity-risk-scores/GetEntityRiskScore.rb new file mode 100644 index 000000000000..8495db26df40 --- /dev/null +++ b/examples/v2/entity-risk-scores/GetEntityRiskScore.rb @@ -0,0 +1,8 @@ +# Get Entity Risk Score returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_entity_risk_score".to_sym] = true +end +api_instance = DatadogAPIClient::V2::EntityRiskScoresAPI.new +p api_instance.get_entity_risk_score("arn:aws:iam::123456789012:user/john.doe") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 70200438564f..04b92a1c7f38 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -4786,6 +4786,9 @@ "filter_query" => "String", "entity_type" => "Array", }, + "v2.GetEntityRiskScore" => { + "entity_id" => "String", + }, "v2.ReorderScanningGroups" => { "body" => "SensitiveDataScannerConfigRequest", }, diff --git a/features/v2/entity_risk_scores.feature b/features/v2/entity_risk_scores.feature index f6e28ae74051..be283af2fba1 100644 --- a/features/v2/entity_risk_scores.feature +++ b/features/v2/entity_risk_scores.feature @@ -6,15 +6,41 @@ Feature: Entity Risk Scores Given a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system And an instance of "EntityRiskScores" API - And operation "ListEntityRiskScores" enabled - And new "ListEntityRiskScores" request + + @generated @skip @team:DataDog/cloud-siem + Scenario: Get Entity Risk Score returns "Bad Request" response + Given operation "GetEntityRiskScore" enabled + And new "GetEntityRiskScore" request + And request contains "entity_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-siem + Scenario: Get Entity Risk Score returns "Not Found" response + Given operation "GetEntityRiskScore" enabled + And new "GetEntityRiskScore" request + And request contains "entity_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/cloud-siem + Scenario: Get Entity Risk Score returns "OK" response + Given operation "GetEntityRiskScore" enabled + And new "GetEntityRiskScore" request + And request contains "entity_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK @generated @skip @team:DataDog/cloud-siem Scenario: List Entity Risk Scores returns "Bad Request" response + Given operation "ListEntityRiskScores" enabled + And new "ListEntityRiskScores" request When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/cloud-siem Scenario: List Entity Risk Scores returns "OK" response + Given operation "ListEntityRiskScores" enabled + And new "ListEntityRiskScores" request When the request is sent Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 8e00370969b9..07db45886a9f 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -6396,6 +6396,12 @@ "type": "safe" } }, + "GetEntityRiskScore": { + "tag": "Entity Risk Scores", + "undo": { + "type": "safe" + } + }, "DownloadCloudWorkloadPolicyFile": { "tag": "CSM Threats", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index a26c3a014fe8..42fbfd24dcc9 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -571,6 +571,7 @@ def initialize "v2.query_aggregated_signals_problems": false, "v2.query_aggregated_waterfall": false, "v2.create_scorecard_outcomes_batch": false, + "v2.get_entity_risk_score": false, "v2.list_entity_risk_scores": false, "v2.create_incident_service": false, "v2.delete_incident_service": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 3a00b3c62dca..798974113cbd 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5806,6 +5806,7 @@ def overrides "v2.security_entity_risk_score" => "SecurityEntityRiskScore", "v2.security_entity_risk_score_attributes" => "SecurityEntityRiskScoreAttributes", "v2.security_entity_risk_score_attributes_severity" => "SecurityEntityRiskScoreAttributesSeverity", + "v2.security_entity_risk_score_response" => "SecurityEntityRiskScoreResponse", "v2.security_entity_risk_scores_meta" => "SecurityEntityRiskScoresMeta", "v2.security_entity_risk_scores_response" => "SecurityEntityRiskScoresResponse", "v2.security_entity_risk_score_type" => "SecurityEntityRiskScoreType", diff --git a/lib/datadog_api_client/v2/api/entity_risk_scores_api.rb b/lib/datadog_api_client/v2/api/entity_risk_scores_api.rb index f9982ae73610..c0b5d20a69ba 100644 --- a/lib/datadog_api_client/v2/api/entity_risk_scores_api.rb +++ b/lib/datadog_api_client/v2/api/entity_risk_scores_api.rb @@ -23,6 +23,77 @@ def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end + # Get Entity Risk Score. + # + # @see #get_entity_risk_score_with_http_info + def get_entity_risk_score(entity_id, opts = {}) + data, _status_code, _headers = get_entity_risk_score_with_http_info(entity_id, opts) + data + end + + # Get Entity Risk Score. + # + # Get the risk score for a specific entity by its ID. Returns security risk assessment including risk score, severity, detected signals, misconfigurations, and identity risks. + # + # @param entity_id [String] The URL-encoded unique identifier for the entity. + # @param opts [Hash] the optional parameters + # @return [Array<(SecurityEntityRiskScoreResponse, Integer, Hash)>] SecurityEntityRiskScoreResponse data, response status code and response headers + def get_entity_risk_score_with_http_info(entity_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_entity_risk_score".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_entity_risk_score") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_entity_risk_score")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: EntityRiskScoresAPI.get_entity_risk_score ...' + end + # verify the required parameter 'entity_id' is set + if @api_client.config.client_side_validation && entity_id.nil? + fail ArgumentError, "Missing the required parameter 'entity_id' when calling EntityRiskScoresAPI.get_entity_risk_score" + end + # resource path + local_var_path = '/api/v2/security-entities/risk-scores/{entity_id}'.sub('{entity_id}', CGI.escape(entity_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SecurityEntityRiskScoreResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_entity_risk_score, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: EntityRiskScoresAPI#get_entity_risk_score\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List Entity Risk Scores. # # @see #list_entity_risk_scores_with_http_info diff --git a/lib/datadog_api_client/v2/models/security_entity_risk_score.rb b/lib/datadog_api_client/v2/models/security_entity_risk_score.rb index d949332ea1d7..87d36cad67dd 100644 --- a/lib/datadog_api_client/v2/models/security_entity_risk_score.rb +++ b/lib/datadog_api_client/v2/models/security_entity_risk_score.rb @@ -21,13 +21,13 @@ module DatadogAPIClient::V2 class SecurityEntityRiskScore include BaseGenericModel - # Attributes of an entity risk score + # Attributes of an entity risk score. attr_reader :attributes # Unique identifier for the entity attr_reader :id - # Resource type + # Resource type. attr_reader :type attr_accessor :additional_properties diff --git a/lib/datadog_api_client/v2/models/security_entity_risk_score_attributes.rb b/lib/datadog_api_client/v2/models/security_entity_risk_score_attributes.rb index 39181bd43734..154ee8a1b180 100644 --- a/lib/datadog_api_client/v2/models/security_entity_risk_score_attributes.rb +++ b/lib/datadog_api_client/v2/models/security_entity_risk_score_attributes.rb @@ -17,50 +17,56 @@ require 'time' module DatadogAPIClient::V2 - # Attributes of an entity risk score + # Attributes of an entity risk score. class SecurityEntityRiskScoreAttributes include BaseGenericModel + # Cloud account IDs associated with the entity. + attr_reader :account_ids + # Configuration risks associated with the entity attr_reader :config_risks - # Unique identifier for the entity - attr_reader :entity_id - # Metadata about the entity from cloud providers attr_reader :entity_metadata - # Human-readable name of the entity + # Human-readable name of the entity. attr_accessor :entity_name - # Cloud providers associated with the entity + # Cloud providers associated with the entity. attr_reader :entity_providers - # Roles associated with the entity + # Roles associated with the entity. attr_accessor :entity_roles - # Type of the entity (e.g., aws_iam_user, aws_ec2_instance) - attr_reader :entity_type + # Sub-types associated with the entity. + attr_reader :entity_sub_types + + # Type of the entity (for example, aws_iam_user, aws_ec2_instance). + attr_accessor :entity_type + + # All types associated with the entity. + attr_accessor :entity_types - # Timestamp when the entity was first detected (Unix milliseconds) + # Timestamp when the entity was first detected (Unix milliseconds). attr_reader :first_detected - # Title of the most recent signal detected for this entity + # Title of the most recent signal detected for this entity. attr_reader :last_activity_title - # Timestamp when the entity was last detected (Unix milliseconds) + # Timestamp when the entity was last detected (Unix milliseconds). attr_reader :last_detected - # Current risk score for the entity + # Current risk score for the entity. attr_reader :risk_score - # Change in risk score compared to previous period + # Change in risk score compared to previous period. attr_reader :risk_score_evolution # Severity level based on risk score attr_reader :severity - # Number of security signals detected for this entity + # Number of security signals detected for this entity. attr_reader :signals_detected attr_accessor :additional_properties @@ -69,13 +75,15 @@ class SecurityEntityRiskScoreAttributes # @!visibility private def self.attribute_map { + :'account_ids' => :'accountIds', :'config_risks' => :'configRisks', - :'entity_id' => :'entityID', :'entity_metadata' => :'entityMetadata', :'entity_name' => :'entityName', :'entity_providers' => :'entityProviders', :'entity_roles' => :'entityRoles', + :'entity_sub_types' => :'entitySubTypes', :'entity_type' => :'entityType', + :'entity_types' => :'entityTypes', :'first_detected' => :'firstDetected', :'last_activity_title' => :'lastActivityTitle', :'last_detected' => :'lastDetected', @@ -90,13 +98,15 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'account_ids' => :'Array', :'config_risks' => :'SecurityEntityConfigRisks', - :'entity_id' => :'String', :'entity_metadata' => :'SecurityEntityMetadata', :'entity_name' => :'String', :'entity_providers' => :'Array', :'entity_roles' => :'Array', + :'entity_sub_types' => :'Array', :'entity_type' => :'String', + :'entity_types' => :'Array', :'first_detected' => :'Integer', :'last_activity_title' => :'String', :'last_detected' => :'Integer', @@ -125,12 +135,14 @@ def initialize(attributes = {}) end } - if attributes.key?(:'config_risks') - self.config_risks = attributes[:'config_risks'] + if attributes.key?(:'account_ids') + if (value = attributes[:'account_ids']).is_a?(Array) + self.account_ids = value + end end - if attributes.key?(:'entity_id') - self.entity_id = attributes[:'entity_id'] + if attributes.key?(:'config_risks') + self.config_risks = attributes[:'config_risks'] end if attributes.key?(:'entity_metadata') @@ -153,10 +165,22 @@ def initialize(attributes = {}) end end + if attributes.key?(:'entity_sub_types') + if (value = attributes[:'entity_sub_types']).is_a?(Array) + self.entity_sub_types = value + end + end + if attributes.key?(:'entity_type') self.entity_type = attributes[:'entity_type'] end + if attributes.key?(:'entity_types') + if (value = attributes[:'entity_types']).is_a?(Array) + self.entity_types = value + end + end + if attributes.key?(:'first_detected') self.first_detected = attributes[:'first_detected'] end @@ -190,11 +214,11 @@ def initialize(attributes = {}) # @return true if the model is valid # @!visibility private def valid? + return false if @account_ids.nil? return false if @config_risks.nil? - return false if @entity_id.nil? return false if @entity_metadata.nil? return false if @entity_providers.nil? - return false if @entity_type.nil? + return false if @entity_sub_types.nil? return false if @first_detected.nil? return false if @last_activity_title.nil? return false if @last_detected.nil? @@ -206,23 +230,23 @@ def valid? end # Custom attribute writer method with validation - # @param config_risks [Object] Object to be assigned + # @param account_ids [Object] Object to be assigned # @!visibility private - def config_risks=(config_risks) - if config_risks.nil? - fail ArgumentError, 'invalid value for "config_risks", config_risks cannot be nil.' + def account_ids=(account_ids) + if account_ids.nil? + fail ArgumentError, 'invalid value for "account_ids", account_ids cannot be nil.' end - @config_risks = config_risks + @account_ids = account_ids end # Custom attribute writer method with validation - # @param entity_id [Object] Object to be assigned + # @param config_risks [Object] Object to be assigned # @!visibility private - def entity_id=(entity_id) - if entity_id.nil? - fail ArgumentError, 'invalid value for "entity_id", entity_id cannot be nil.' + def config_risks=(config_risks) + if config_risks.nil? + fail ArgumentError, 'invalid value for "config_risks", config_risks cannot be nil.' end - @entity_id = entity_id + @config_risks = config_risks end # Custom attribute writer method with validation @@ -246,13 +270,13 @@ def entity_providers=(entity_providers) end # Custom attribute writer method with validation - # @param entity_type [Object] Object to be assigned + # @param entity_sub_types [Object] Object to be assigned # @!visibility private - def entity_type=(entity_type) - if entity_type.nil? - fail ArgumentError, 'invalid value for "entity_type", entity_type cannot be nil.' + def entity_sub_types=(entity_sub_types) + if entity_sub_types.nil? + fail ArgumentError, 'invalid value for "entity_sub_types", entity_sub_types cannot be nil.' end - @entity_type = entity_type + @entity_sub_types = entity_sub_types end # Custom attribute writer method with validation @@ -351,13 +375,15 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && + account_ids == o.account_ids && config_risks == o.config_risks && - entity_id == o.entity_id && entity_metadata == o.entity_metadata && entity_name == o.entity_name && entity_providers == o.entity_providers && entity_roles == o.entity_roles && + entity_sub_types == o.entity_sub_types && entity_type == o.entity_type && + entity_types == o.entity_types && first_detected == o.first_detected && last_activity_title == o.last_activity_title && last_detected == o.last_detected && @@ -372,7 +398,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [config_risks, entity_id, entity_metadata, entity_name, entity_providers, entity_roles, entity_type, first_detected, last_activity_title, last_detected, risk_score, risk_score_evolution, severity, signals_detected, additional_properties].hash + [account_ids, config_risks, entity_metadata, entity_name, entity_providers, entity_roles, entity_sub_types, entity_type, entity_types, first_detected, last_activity_title, last_detected, risk_score, risk_score_evolution, severity, signals_detected, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/security_entity_risk_score_response.rb b/lib/datadog_api_client/v2/models/security_entity_risk_score_response.rb new file mode 100644 index 000000000000..77903e0e64e4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_entity_risk_score_response.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 + # Response containing a single entity risk score + class SecurityEntityRiskScoreResponse + include BaseGenericModel + + # An entity risk score containing security risk assessment information + 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' => :'SecurityEntityRiskScore' + } + 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::SecurityEntityRiskScoreResponse` 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/security_entity_risk_score_type.rb b/lib/datadog_api_client/v2/models/security_entity_risk_score_type.rb index 6ed06baf78fb..40d77f40adb0 100644 --- a/lib/datadog_api_client/v2/models/security_entity_risk_score_type.rb +++ b/lib/datadog_api_client/v2/models/security_entity_risk_score_type.rb @@ -17,10 +17,10 @@ require 'time' module DatadogAPIClient::V2 - # Resource type + # Resource type. class SecurityEntityRiskScoreType include BaseEnumModel - SECURITY_ENTITY_RISK_SCORE = "security_entity_risk_score".freeze + SECURITY_ENTITY_RISK_SCORE = "SecurityEntityRiskScore".freeze end end