diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e03bade2cfe..85a6c58a698 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -48914,6 +48914,263 @@ components: type: string x-enum-varnames: - SECRET_RULE + SecurityEntityConfigRisks: + description: Configuration risks associated with the entity + properties: + hasIdentityRisk: + description: Whether the entity has identity risks + example: false + type: boolean + hasMisconfiguration: + description: Whether the entity has misconfigurations + example: true + type: boolean + hasPrivilegedRole: + description: Whether the entity has privileged roles + example: true + type: boolean + isPrivileged: + description: Whether the entity has privileged access + example: false + type: boolean + isProduction: + description: Whether the entity is in a production environment + example: true + type: boolean + isPubliclyAccessible: + description: Whether the entity is publicly accessible + example: true + type: boolean + required: + - hasMisconfiguration + - hasIdentityRisk + - isPubliclyAccessible + - isProduction + - hasPrivilegedRole + - isPrivileged + type: object + SecurityEntityMetadata: + description: Metadata about the entity from cloud providers + properties: + accountID: + description: Cloud account ID (AWS) + example: '123456789012' + type: string + environments: + description: Environment tags associated with the entity + example: + - production + - us-east-1 + items: + type: string + type: array + mitreTactics: + description: MITRE ATT&CK tactics detected + example: + - Credential Access + - Privilege Escalation + items: + type: string + type: array + mitreTechniques: + description: MITRE ATT&CK techniques detected + example: + - T1078 + - T1098 + items: + type: string + type: array + projectID: + description: Cloud project ID (GCP) + example: my-gcp-project + type: string + services: + description: Services associated with the entity + example: + - api-gateway + - lambda + items: + type: string + type: array + sources: + description: Data sources that detected this entity + example: + - cloudtrail + - cloud-security-posture-management + items: + type: string + type: array + subscriptionID: + description: Cloud subscription ID (Azure) + example: a1b2c3d4-e5f6-7890-abcd-ef1234567890 + type: string + required: + - sources + - environments + - services + - mitreTactics + - mitreTechniques + type: object + SecurityEntityRiskScore: + description: An entity risk score containing security risk assessment information + properties: + attributes: + $ref: '#/components/schemas/SecurityEntityRiskScoreAttributes' + id: + description: Unique identifier for the entity + example: arn:aws:iam::123456789012:user/john.doe + type: string + type: + $ref: '#/components/schemas/SecurityEntityRiskScoreType' + required: + - id + - type + - attributes + type: object + SecurityEntityRiskScoreAttributes: + description: Attributes of an entity risk score + properties: + 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 + example: john.doe + type: string + entityProviders: + description: Cloud providers associated with the entity + example: + - aws + items: + type: string + type: array + entityRoles: + description: Roles associated with the entity + example: + - Admin + - Developer + items: + type: string + type: array + entityType: + description: Type of the entity (e.g., aws_iam_user, aws_ec2_instance) + example: aws_iam_user + type: string + firstDetected: + description: Timestamp when the entity was first detected (Unix milliseconds) + example: 1704067200000 + format: int64 + type: integer + lastActivityTitle: + 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 + format: int64 + type: integer + riskScore: + description: Current risk score for the entity + example: 85.5 + format: double + type: number + riskScoreEvolution: + description: Change in risk score compared to previous period + example: 12.3 + format: double + type: number + severity: + $ref: '#/components/schemas/SecurityEntityRiskScoreAttributesSeverity' + signalsDetected: + description: Number of security signals detected for this entity + example: 15 + format: int64 + type: integer + required: + - entityID + - entityType + - entityProviders + - riskScore + - riskScoreEvolution + - severity + - firstDetected + - lastDetected + - lastActivityTitle + - signalsDetected + - configRisks + - entityMetadata + type: object + SecurityEntityRiskScoreAttributesSeverity: + description: Severity level based on risk score + enum: + - critical + - high + - medium + - low + - info + example: critical + type: string + x-enum-varnames: + - CRITICAL + - HIGH + - MEDIUM + - LOW + - INFO + SecurityEntityRiskScoreType: + description: Resource type + enum: + - security_entity_risk_score + example: security_entity_risk_score + type: string + x-enum-varnames: + - SECURITY_ENTITY_RISK_SCORE + SecurityEntityRiskScoresMeta: + description: Metadata for pagination + properties: + pageNumber: + description: Current page number (1-indexed) + example: 1 + format: int64 + type: integer + pageSize: + description: Number of items per page + example: 10 + format: int64 + type: integer + queryId: + description: Query ID for pagination consistency + example: abc123def456 + type: string + totalRowCount: + description: Total number of entities matching the query + example: 150 + format: int64 + type: integer + required: + - queryId + - totalRowCount + - pageSize + - pageNumber + type: object + SecurityEntityRiskScoresResponse: + description: Response containing a list of entity risk scores + properties: + data: + items: + $ref: '#/components/schemas/SecurityEntityRiskScore' + type: array + meta: + $ref: '#/components/schemas/SecurityEntityRiskScoresMeta' + required: + - data + - meta + type: object SecurityFilter: description: The security filter's properties. properties: @@ -79176,8 +79433,10 @@ paths: schema: example: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d type: string - - description: Retrieves the on-call user at the given timestamp (ISO-8601). - Defaults to the current time if omitted." + - description: Retrieves the on-call user at the given timestamp in RFC3339 + format (for example, `2025-05-07T02:53:01Z` or `2025-05-07T02:53:01+00:00`). + When using timezone offsets with `+` or `-`, ensure proper URL encoding + (`+` should be encoded as `%2B`). Defaults to the current time if omitted. in: query name: filter[at_ts] schema: @@ -84050,6 +84309,124 @@ paths: x-codegen-request-body-name: body x-unstable: '**Note**: This endpoint is in public beta. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/security-entities/risk-scores: + get: + description: Get a list of entity risk scores for your organization. Entity + risk scores provide security risk assessment for entities like cloud resources, + identities, or services based on detected signals, misconfigurations, and + identity risks. + operationId: ListEntityRiskScores + parameters: + - description: Start time for the query in Unix timestamp (milliseconds). Defaults + to 2 weeks ago. + in: query + name: from + required: false + schema: + example: 1704067200000 + format: int64 + type: integer + - description: End time for the query in Unix timestamp (milliseconds). Defaults + to now. + in: query + name: to + required: false + schema: + example: 1705276800000 + format: int64 + type: integer + - description: Size of the page to return. Maximum is 1000. + in: query + name: page[size] + required: false + schema: + default: 10 + example: 10 + type: integer + - description: Page number to return (1-indexed). + in: query + name: page[number] + required: false + schema: + default: 1 + example: 1 + type: integer + - description: Query ID for pagination consistency. + in: query + name: page[queryId] + required: false + schema: + example: abc123def456 + type: string + - description: 'Sort order for results. Format: `field:direction` where direction + is `asc` or `desc`. + + Supported fields: `riskScore`, `lastDetected`, `firstDetected`, `entityName`, + `signalsDetected`.' + in: query + name: filter[sort] + required: false + schema: + example: riskScore:desc + type: string + - description: 'Supports filtering by entity attributes, risk scores, severity, + and more. + + Example: `severity:critical AND entityType:aws_iam_user`' + in: query + name: filter[query] + required: false + schema: + example: severity:critical + type: string + - description: Filter by entity type(s). Can specify multiple values. + explode: true + in: query + name: entityType + required: false + schema: + example: + - aws_iam_user + - aws_ec2_instance + items: + example: aws_iam_user + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SecurityEntityRiskScoresResponse' + 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 + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List Entity Risk Scores + 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: @@ -93068,6 +93445,8 @@ tags: end times, prevent all alerting related to specified Datadog tags.' name: Downtimes +- description: Retrieves security risk scores for entities in your organization. + name: Entity Risk Scores - description: View and manage issues within Error Tracking. See the [Error Tracking page](https://docs.datadoghq.com/error_tracking/) for more information. name: Error Tracking diff --git a/examples/v2/entity-risk-scores/ListEntityRiskScores.rb b/examples/v2/entity-risk-scores/ListEntityRiskScores.rb new file mode 100644 index 00000000000..13338bf5e2f --- /dev/null +++ b/examples/v2/entity-risk-scores/ListEntityRiskScores.rb @@ -0,0 +1,8 @@ +# List Entity Risk Scores returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_entity_risk_scores".to_sym] = true +end +api_instance = DatadogAPIClient::V2::EntityRiskScoresAPI.new +p api_instance.list_entity_risk_scores() diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 8718f954283..6101c5cf45c 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3155,6 +3155,16 @@ "rule_id" => "String", "body" => "UpdateRuleRequest", }, + "v2.ListEntityRiskScores" => { + "from" => "Integer", + "to" => "Integer", + "page_size" => "Integer", + "page_number" => "Integer", + "page_query_id" => "String", + "filter_sort" => "String", + "filter_query" => "String", + "entity_type" => "Array", + }, "v2.ReorderScanningGroups" => { "body" => "SensitiveDataScannerConfigRequest", }, diff --git a/features/v2/entity_risk_scores.feature b/features/v2/entity_risk_scores.feature new file mode 100644 index 00000000000..f6e28ae7405 --- /dev/null +++ b/features/v2/entity_risk_scores.feature @@ -0,0 +1,20 @@ +@endpoint(entity-risk-scores) @endpoint(entity-risk-scores-v2) +Feature: Entity Risk Scores + Retrieves security risk scores for entities in your organization. + + Background: + 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: List Entity Risk Scores returns "Bad Request" response + 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 + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/security_risk_scores.feature b/features/v2/security_risk_scores.feature new file mode 100644 index 00000000000..8b91662d06a --- /dev/null +++ b/features/v2/security_risk_scores.feature @@ -0,0 +1,20 @@ +@endpoint(security-risk-scores) @endpoint(security-risk-scores-v2) +Feature: Entity Risk Scores + Retrieves security risk scores for entities in your organization. + + Background: + 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: List Entity Risk Scores returns "Bad Request" response + 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 + 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 1cd2195bba1..d2f20a4d85c 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -3842,6 +3842,12 @@ "type": "idempotent" } }, + "ListEntityRiskScores": { + "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 e715f704f7f..580c662dbcc 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -333,6 +333,7 @@ def initialize "v2.list_scorecard_rules": false, "v2.update_scorecard_outcomes_async": false, "v2.update_scorecard_rule": false, + "v2.list_entity_risk_scores": false, "v2.create_incident_service": false, "v2.delete_incident_service": false, "v2.get_incident_service": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index cb5166b4218..57b16cb9989 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -4044,6 +4044,14 @@ def overrides "v2.secret_rule_data_attributes_match_validation_invalid_http_status_code_items" => "SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems", "v2.secret_rule_data_attributes_match_validation_valid_http_status_code_items" => "SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems", "v2.secret_rule_data_type" => "SecretRuleDataType", + "v2.security_entity_config_risks" => "SecurityEntityConfigRisks", + "v2.security_entity_metadata" => "SecurityEntityMetadata", + "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_scores_meta" => "SecurityEntityRiskScoresMeta", + "v2.security_entity_risk_scores_response" => "SecurityEntityRiskScoresResponse", + "v2.security_entity_risk_score_type" => "SecurityEntityRiskScoreType", "v2.security_filter" => "SecurityFilter", "v2.security_filter_attributes" => "SecurityFilterAttributes", "v2.security_filter_create_attributes" => "SecurityFilterCreateAttributes", @@ -4882,6 +4890,7 @@ def overrides "v2.domain_allowlist_api" => "DomainAllowlistAPI", "v2.dora_metrics_api" => "DORAMetricsAPI", "v2.downtimes_api" => "DowntimesAPI", + "v2.entity_risk_scores_api" => "EntityRiskScoresAPI", "v2.error_tracking_api" => "ErrorTrackingAPI", "v2.events_api" => "EventsAPI", "v2.fastly_integration_api" => "FastlyIntegrationAPI", 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 new file mode 100644 index 00000000000..f9982ae7361 --- /dev/null +++ b/lib/datadog_api_client/v2/api/entity_risk_scores_api.rb @@ -0,0 +1,109 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class EntityRiskScoresAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # List Entity Risk Scores. + # + # @see #list_entity_risk_scores_with_http_info + def list_entity_risk_scores(opts = {}) + data, _status_code, _headers = list_entity_risk_scores_with_http_info(opts) + data + end + + # List Entity Risk Scores. + # + # Get a list of entity risk scores for your organization. Entity risk scores provide security risk assessment for entities like cloud resources, identities, or services based on detected signals, misconfigurations, and identity risks. + # + # @param opts [Hash] the optional parameters + # @option opts [Integer] :from Start time for the query in Unix timestamp (milliseconds). Defaults to 2 weeks ago. + # @option opts [Integer] :to End time for the query in Unix timestamp (milliseconds). Defaults to now. + # @option opts [Integer] :page_size Size of the page to return. Maximum is 1000. + # @option opts [Integer] :page_number Page number to return (1-indexed). + # @option opts [String] :page_query_id Query ID for pagination consistency. + # @option opts [String] :filter_sort Sort order for results. Format: `field:direction` where direction is `asc` or `desc`. Supported fields: `riskScore`, `lastDetected`, `firstDetected`, `entityName`, `signalsDetected`. + # @option opts [String] :filter_query Supports filtering by entity attributes, risk scores, severity, and more. Example: `severity:critical AND entityType:aws_iam_user` + # @option opts [Array] :entity_type Filter by entity type(s). Can specify multiple values. + # @return [Array<(SecurityEntityRiskScoresResponse, Integer, Hash)>] SecurityEntityRiskScoresResponse data, response status code and response headers + def list_entity_risk_scores_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_entity_risk_scores".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_entity_risk_scores") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_entity_risk_scores")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: EntityRiskScoresAPI.list_entity_risk_scores ...' + end + # resource path + local_var_path = '/api/v2/security-entities/risk-scores' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? + query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil? + query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? + query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? + query_params[:'page[queryId]'] = opts[:'page_query_id'] if !opts[:'page_query_id'].nil? + query_params[:'filter[sort]'] = opts[:'filter_sort'] if !opts[:'filter_sort'].nil? + query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil? + query_params[:'entityType'] = @api_client.build_collection_param(opts[:'entity_type'], :multi) if !opts[:'entity_type'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SecurityEntityRiskScoresResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_entity_risk_scores, + :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" + ) + new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER + + 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#list_entity_risk_scores\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/api/on_call_api.rb b/lib/datadog_api_client/v2/api/on_call_api.rb index 1ad0475daab..2cc14e5581b 100644 --- a/lib/datadog_api_client/v2/api/on_call_api.rb +++ b/lib/datadog_api_client/v2/api/on_call_api.rb @@ -791,7 +791,7 @@ def get_schedule_on_call_user(schedule_id, opts = {}) # @param schedule_id [String] The ID of the schedule. # @param opts [Hash] the optional parameters # @option opts [String] :include Specifies related resources to include in the response as a comma-separated list. Allowed value: `user`. - # @option opts [String] :filter_at_ts Retrieves the on-call user at the given timestamp (ISO-8601). Defaults to the current time if omitted." + # @option opts [String] :filter_at_ts Retrieves the on-call user at the given timestamp in RFC3339 format (for example, `2025-05-07T02:53:01Z` or `2025-05-07T02:53:01+00:00`). When using timezone offsets with `+` or `-`, ensure proper URL encoding (`+` should be encoded as `%2B`). Defaults to the current time if omitted. # @return [Array<(Shift, Integer, Hash)>] Shift data, response status code and response headers def get_schedule_on_call_user_with_http_info(schedule_id, opts = {}) diff --git a/lib/datadog_api_client/v2/models/security_entity_config_risks.rb b/lib/datadog_api_client/v2/models/security_entity_config_risks.rb new file mode 100644 index 00000000000..36b6d01c6f2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_entity_config_risks.rb @@ -0,0 +1,228 @@ +=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 + # Configuration risks associated with the entity + class SecurityEntityConfigRisks + include BaseGenericModel + + # Whether the entity has identity risks + attr_reader :has_identity_risk + + # Whether the entity has misconfigurations + attr_reader :has_misconfiguration + + # Whether the entity has privileged roles + attr_reader :has_privileged_role + + # Whether the entity has privileged access + attr_reader :is_privileged + + # Whether the entity is in a production environment + attr_reader :is_production + + # Whether the entity is publicly accessible + attr_reader :is_publicly_accessible + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'has_identity_risk' => :'hasIdentityRisk', + :'has_misconfiguration' => :'hasMisconfiguration', + :'has_privileged_role' => :'hasPrivilegedRole', + :'is_privileged' => :'isPrivileged', + :'is_production' => :'isProduction', + :'is_publicly_accessible' => :'isPubliclyAccessible' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'has_identity_risk' => :'Boolean', + :'has_misconfiguration' => :'Boolean', + :'has_privileged_role' => :'Boolean', + :'is_privileged' => :'Boolean', + :'is_production' => :'Boolean', + :'is_publicly_accessible' => :'Boolean' + } + 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::SecurityEntityConfigRisks` 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?(:'has_identity_risk') + self.has_identity_risk = attributes[:'has_identity_risk'] + end + + if attributes.key?(:'has_misconfiguration') + self.has_misconfiguration = attributes[:'has_misconfiguration'] + end + + if attributes.key?(:'has_privileged_role') + self.has_privileged_role = attributes[:'has_privileged_role'] + end + + if attributes.key?(:'is_privileged') + self.is_privileged = attributes[:'is_privileged'] + end + + if attributes.key?(:'is_production') + self.is_production = attributes[:'is_production'] + end + + if attributes.key?(:'is_publicly_accessible') + self.is_publicly_accessible = attributes[:'is_publicly_accessible'] + 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 @has_identity_risk.nil? + return false if @has_misconfiguration.nil? + return false if @has_privileged_role.nil? + return false if @is_privileged.nil? + return false if @is_production.nil? + return false if @is_publicly_accessible.nil? + true + end + + # Custom attribute writer method with validation + # @param has_identity_risk [Object] Object to be assigned + # @!visibility private + def has_identity_risk=(has_identity_risk) + if has_identity_risk.nil? + fail ArgumentError, 'invalid value for "has_identity_risk", has_identity_risk cannot be nil.' + end + @has_identity_risk = has_identity_risk + end + + # Custom attribute writer method with validation + # @param has_misconfiguration [Object] Object to be assigned + # @!visibility private + def has_misconfiguration=(has_misconfiguration) + if has_misconfiguration.nil? + fail ArgumentError, 'invalid value for "has_misconfiguration", has_misconfiguration cannot be nil.' + end + @has_misconfiguration = has_misconfiguration + end + + # Custom attribute writer method with validation + # @param has_privileged_role [Object] Object to be assigned + # @!visibility private + def has_privileged_role=(has_privileged_role) + if has_privileged_role.nil? + fail ArgumentError, 'invalid value for "has_privileged_role", has_privileged_role cannot be nil.' + end + @has_privileged_role = has_privileged_role + end + + # Custom attribute writer method with validation + # @param is_privileged [Object] Object to be assigned + # @!visibility private + def is_privileged=(is_privileged) + if is_privileged.nil? + fail ArgumentError, 'invalid value for "is_privileged", is_privileged cannot be nil.' + end + @is_privileged = is_privileged + end + + # Custom attribute writer method with validation + # @param is_production [Object] Object to be assigned + # @!visibility private + def is_production=(is_production) + if is_production.nil? + fail ArgumentError, 'invalid value for "is_production", is_production cannot be nil.' + end + @is_production = is_production + end + + # Custom attribute writer method with validation + # @param is_publicly_accessible [Object] Object to be assigned + # @!visibility private + def is_publicly_accessible=(is_publicly_accessible) + if is_publicly_accessible.nil? + fail ArgumentError, 'invalid value for "is_publicly_accessible", is_publicly_accessible cannot be nil.' + end + @is_publicly_accessible = is_publicly_accessible + 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 && + has_identity_risk == o.has_identity_risk && + has_misconfiguration == o.has_misconfiguration && + has_privileged_role == o.has_privileged_role && + is_privileged == o.is_privileged && + is_production == o.is_production && + is_publicly_accessible == o.is_publicly_accessible && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [has_identity_risk, has_misconfiguration, has_privileged_role, is_privileged, is_production, is_publicly_accessible, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_entity_metadata.rb b/lib/datadog_api_client/v2/models/security_entity_metadata.rb new file mode 100644 index 00000000000..cdc9e0d0ebb --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_entity_metadata.rb @@ -0,0 +1,247 @@ +=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 + # Metadata about the entity from cloud providers + class SecurityEntityMetadata + include BaseGenericModel + + # Cloud account ID (AWS) + attr_accessor :account_id + + # Environment tags associated with the entity + attr_reader :environments + + # MITRE ATT&CK tactics detected + attr_reader :mitre_tactics + + # MITRE ATT&CK techniques detected + attr_reader :mitre_techniques + + # Cloud project ID (GCP) + attr_accessor :project_id + + # Services associated with the entity + attr_reader :services + + # Data sources that detected this entity + attr_reader :sources + + # Cloud subscription ID (Azure) + attr_accessor :subscription_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'account_id' => :'accountID', + :'environments' => :'environments', + :'mitre_tactics' => :'mitreTactics', + :'mitre_techniques' => :'mitreTechniques', + :'project_id' => :'projectID', + :'services' => :'services', + :'sources' => :'sources', + :'subscription_id' => :'subscriptionID' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'account_id' => :'String', + :'environments' => :'Array', + :'mitre_tactics' => :'Array', + :'mitre_techniques' => :'Array', + :'project_id' => :'String', + :'services' => :'Array', + :'sources' => :'Array', + :'subscription_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::SecurityEntityMetadata` 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?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'environments') + if (value = attributes[:'environments']).is_a?(Array) + self.environments = value + end + end + + if attributes.key?(:'mitre_tactics') + if (value = attributes[:'mitre_tactics']).is_a?(Array) + self.mitre_tactics = value + end + end + + if attributes.key?(:'mitre_techniques') + if (value = attributes[:'mitre_techniques']).is_a?(Array) + self.mitre_techniques = value + end + end + + if attributes.key?(:'project_id') + self.project_id = attributes[:'project_id'] + end + + if attributes.key?(:'services') + if (value = attributes[:'services']).is_a?(Array) + self.services = value + end + end + + if attributes.key?(:'sources') + if (value = attributes[:'sources']).is_a?(Array) + self.sources = value + end + end + + if attributes.key?(:'subscription_id') + self.subscription_id = attributes[:'subscription_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 @environments.nil? + return false if @mitre_tactics.nil? + return false if @mitre_techniques.nil? + return false if @services.nil? + return false if @sources.nil? + true + end + + # Custom attribute writer method with validation + # @param environments [Object] Object to be assigned + # @!visibility private + def environments=(environments) + if environments.nil? + fail ArgumentError, 'invalid value for "environments", environments cannot be nil.' + end + @environments = environments + end + + # Custom attribute writer method with validation + # @param mitre_tactics [Object] Object to be assigned + # @!visibility private + def mitre_tactics=(mitre_tactics) + if mitre_tactics.nil? + fail ArgumentError, 'invalid value for "mitre_tactics", mitre_tactics cannot be nil.' + end + @mitre_tactics = mitre_tactics + end + + # Custom attribute writer method with validation + # @param mitre_techniques [Object] Object to be assigned + # @!visibility private + def mitre_techniques=(mitre_techniques) + if mitre_techniques.nil? + fail ArgumentError, 'invalid value for "mitre_techniques", mitre_techniques cannot be nil.' + end + @mitre_techniques = mitre_techniques + end + + # Custom attribute writer method with validation + # @param services [Object] Object to be assigned + # @!visibility private + def services=(services) + if services.nil? + fail ArgumentError, 'invalid value for "services", services cannot be nil.' + end + @services = services + end + + # Custom attribute writer method with validation + # @param sources [Object] Object to be assigned + # @!visibility private + def sources=(sources) + if sources.nil? + fail ArgumentError, 'invalid value for "sources", sources cannot be nil.' + end + @sources = sources + 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 && + account_id == o.account_id && + environments == o.environments && + mitre_tactics == o.mitre_tactics && + mitre_techniques == o.mitre_techniques && + project_id == o.project_id && + services == o.services && + sources == o.sources && + subscription_id == o.subscription_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [account_id, environments, mitre_tactics, mitre_techniques, project_id, services, sources, subscription_id, additional_properties].hash + end + end +end 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 new file mode 100644 index 00000000000..d949332ea1d --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_entity_risk_score.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An entity risk score containing security risk assessment information + class SecurityEntityRiskScore + include BaseGenericModel + + # Attributes of an entity risk score + attr_reader :attributes + + # Unique identifier for the entity + attr_reader :id + + # Resource type + 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' => :'SecurityEntityRiskScoreAttributes', + :'id' => :'String', + :'type' => :'SecurityEntityRiskScoreType' + } + 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::SecurityEntityRiskScore` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end 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 new file mode 100644 index 00000000000..70965bf1ed0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_entity_risk_score_attributes.rb @@ -0,0 +1,378 @@ +=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 entity risk score + class SecurityEntityRiskScoreAttributes + include BaseGenericModel + + # 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 + attr_accessor :entity_name + + # Cloud providers associated with the entity + attr_reader :entity_providers + + # 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 + + # Timestamp when the entity was first detected (Unix milliseconds) + attr_reader :first_detected + + # Title of the most recent signal detected for this entity + attr_reader :last_activity_title + + # Timestamp when the entity was last detected (Unix milliseconds) + attr_reader :last_detected + + # Current risk score for the entity + attr_reader :risk_score + + # 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 + attr_reader :signals_detected + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'config_risks' => :'configRisks', + :'entity_id' => :'entityID', + :'entity_metadata' => :'entityMetadata', + :'entity_name' => :'entityName', + :'entity_providers' => :'entityProviders', + :'entity_roles' => :'entityRoles', + :'entity_type' => :'entityType', + :'first_detected' => :'firstDetected', + :'last_activity_title' => :'lastActivityTitle', + :'last_detected' => :'lastDetected', + :'risk_score' => :'riskScore', + :'risk_score_evolution' => :'riskScoreEvolution', + :'severity' => :'severity', + :'signals_detected' => :'signalsDetected' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'config_risks' => :'SecurityEntityConfigRisks', + :'entity_id' => :'String', + :'entity_metadata' => :'SecurityEntityMetadata', + :'entity_name' => :'String', + :'entity_providers' => :'Array', + :'entity_roles' => :'Array', + :'entity_type' => :'String', + :'first_detected' => :'Integer', + :'last_activity_title' => :'String', + :'last_detected' => :'Integer', + :'risk_score' => :'Float', + :'risk_score_evolution' => :'Float', + :'severity' => :'SecurityEntityRiskScoreAttributesSeverity', + :'signals_detected' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityEntityRiskScoreAttributes` 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?(:'config_risks') + self.config_risks = attributes[:'config_risks'] + end + + if attributes.key?(:'entity_id') + self.entity_id = attributes[:'entity_id'] + end + + if attributes.key?(:'entity_metadata') + self.entity_metadata = attributes[:'entity_metadata'] + end + + if attributes.key?(:'entity_name') + self.entity_name = attributes[:'entity_name'] + end + + if attributes.key?(:'entity_providers') + if (value = attributes[:'entity_providers']).is_a?(Array) + self.entity_providers = value + end + end + + if attributes.key?(:'entity_roles') + if (value = attributes[:'entity_roles']).is_a?(Array) + self.entity_roles = value + end + end + + if attributes.key?(:'entity_type') + self.entity_type = attributes[:'entity_type'] + end + + if attributes.key?(:'first_detected') + self.first_detected = attributes[:'first_detected'] + end + + if attributes.key?(:'last_activity_title') + self.last_activity_title = attributes[:'last_activity_title'] + end + + if attributes.key?(:'last_detected') + self.last_detected = attributes[:'last_detected'] + end + + if attributes.key?(:'risk_score') + self.risk_score = attributes[:'risk_score'] + end + + if attributes.key?(:'risk_score_evolution') + self.risk_score_evolution = attributes[:'risk_score_evolution'] + end + + if attributes.key?(:'severity') + self.severity = attributes[:'severity'] + end + + if attributes.key?(:'signals_detected') + self.signals_detected = attributes[:'signals_detected'] + 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 @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 @first_detected.nil? + return false if @last_activity_title.nil? + return false if @last_detected.nil? + return false if @risk_score.nil? + return false if @risk_score_evolution.nil? + return false if @severity.nil? + return false if @signals_detected.nil? + true + end + + # Custom attribute writer method with validation + # @param config_risks [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.' + end + @config_risks = config_risks + end + + # Custom attribute writer method with validation + # @param entity_id [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.' + end + @entity_id = entity_id + end + + # Custom attribute writer method with validation + # @param entity_metadata [Object] Object to be assigned + # @!visibility private + def entity_metadata=(entity_metadata) + if entity_metadata.nil? + fail ArgumentError, 'invalid value for "entity_metadata", entity_metadata cannot be nil.' + end + @entity_metadata = entity_metadata + end + + # Custom attribute writer method with validation + # @param entity_providers [Object] Object to be assigned + # @!visibility private + def entity_providers=(entity_providers) + if entity_providers.nil? + fail ArgumentError, 'invalid value for "entity_providers", entity_providers cannot be nil.' + end + @entity_providers = entity_providers + end + + # Custom attribute writer method with validation + # @param entity_type [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.' + end + @entity_type = entity_type + end + + # Custom attribute writer method with validation + # @param first_detected [Object] Object to be assigned + # @!visibility private + def first_detected=(first_detected) + if first_detected.nil? + fail ArgumentError, 'invalid value for "first_detected", first_detected cannot be nil.' + end + @first_detected = first_detected + end + + # Custom attribute writer method with validation + # @param last_activity_title [Object] Object to be assigned + # @!visibility private + def last_activity_title=(last_activity_title) + if last_activity_title.nil? + fail ArgumentError, 'invalid value for "last_activity_title", last_activity_title cannot be nil.' + end + @last_activity_title = last_activity_title + end + + # Custom attribute writer method with validation + # @param last_detected [Object] Object to be assigned + # @!visibility private + def last_detected=(last_detected) + if last_detected.nil? + fail ArgumentError, 'invalid value for "last_detected", last_detected cannot be nil.' + end + @last_detected = last_detected + end + + # Custom attribute writer method with validation + # @param risk_score [Object] Object to be assigned + # @!visibility private + def risk_score=(risk_score) + if risk_score.nil? + fail ArgumentError, 'invalid value for "risk_score", risk_score cannot be nil.' + end + @risk_score = risk_score + end + + # Custom attribute writer method with validation + # @param risk_score_evolution [Object] Object to be assigned + # @!visibility private + def risk_score_evolution=(risk_score_evolution) + if risk_score_evolution.nil? + fail ArgumentError, 'invalid value for "risk_score_evolution", risk_score_evolution cannot be nil.' + end + @risk_score_evolution = risk_score_evolution + end + + # Custom attribute writer method with validation + # @param severity [Object] Object to be assigned + # @!visibility private + def severity=(severity) + if severity.nil? + fail ArgumentError, 'invalid value for "severity", severity cannot be nil.' + end + @severity = severity + end + + # Custom attribute writer method with validation + # @param signals_detected [Object] Object to be assigned + # @!visibility private + def signals_detected=(signals_detected) + if signals_detected.nil? + fail ArgumentError, 'invalid value for "signals_detected", signals_detected cannot be nil.' + end + @signals_detected = signals_detected + 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 && + 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_type == o.entity_type && + first_detected == o.first_detected && + last_activity_title == o.last_activity_title && + last_detected == o.last_detected && + risk_score == o.risk_score && + risk_score_evolution == o.risk_score_evolution && + severity == o.severity && + signals_detected == o.signals_detected && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @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 + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_entity_risk_score_attributes_severity.rb b/lib/datadog_api_client/v2/models/security_entity_risk_score_attributes_severity.rb new file mode 100644 index 00000000000..6bd598dd7cf --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_entity_risk_score_attributes_severity.rb @@ -0,0 +1,30 @@ +=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 + # Severity level based on risk score + class SecurityEntityRiskScoreAttributesSeverity + include BaseEnumModel + + CRITICAL = "critical".freeze + HIGH = "high".freeze + MEDIUM = "medium".freeze + LOW = "low".freeze + INFO = "info".freeze + 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 new file mode 100644 index 00000000000..6ed06baf78f --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_entity_risk_score_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 + # Resource type + class SecurityEntityRiskScoreType + include BaseEnumModel + + SECURITY_ENTITY_RISK_SCORE = "security_entity_risk_score".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/security_entity_risk_scores_meta.rb b/lib/datadog_api_client/v2/models/security_entity_risk_scores_meta.rb new file mode 100644 index 00000000000..b38a613a50b --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_entity_risk_scores_meta.rb @@ -0,0 +1,186 @@ +=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 + # Metadata for pagination + class SecurityEntityRiskScoresMeta + include BaseGenericModel + + # Current page number (1-indexed) + attr_reader :page_number + + # Number of items per page + attr_reader :page_size + + # Query ID for pagination consistency + attr_reader :query_id + + # Total number of entities matching the query + attr_reader :total_row_count + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'page_number' => :'pageNumber', + :'page_size' => :'pageSize', + :'query_id' => :'queryId', + :'total_row_count' => :'totalRowCount' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'page_number' => :'Integer', + :'page_size' => :'Integer', + :'query_id' => :'String', + :'total_row_count' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityEntityRiskScoresMeta` 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?(:'page_number') + self.page_number = attributes[:'page_number'] + end + + if attributes.key?(:'page_size') + self.page_size = attributes[:'page_size'] + end + + if attributes.key?(:'query_id') + self.query_id = attributes[:'query_id'] + end + + if attributes.key?(:'total_row_count') + self.total_row_count = attributes[:'total_row_count'] + 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 @page_number.nil? + return false if @page_size.nil? + return false if @query_id.nil? + return false if @total_row_count.nil? + true + end + + # Custom attribute writer method with validation + # @param page_number [Object] Object to be assigned + # @!visibility private + def page_number=(page_number) + if page_number.nil? + fail ArgumentError, 'invalid value for "page_number", page_number cannot be nil.' + end + @page_number = page_number + end + + # Custom attribute writer method with validation + # @param page_size [Object] Object to be assigned + # @!visibility private + def page_size=(page_size) + if page_size.nil? + fail ArgumentError, 'invalid value for "page_size", page_size cannot be nil.' + end + @page_size = page_size + end + + # Custom attribute writer method with validation + # @param query_id [Object] Object to be assigned + # @!visibility private + def query_id=(query_id) + if query_id.nil? + fail ArgumentError, 'invalid value for "query_id", query_id cannot be nil.' + end + @query_id = query_id + end + + # Custom attribute writer method with validation + # @param total_row_count [Object] Object to be assigned + # @!visibility private + def total_row_count=(total_row_count) + if total_row_count.nil? + fail ArgumentError, 'invalid value for "total_row_count", total_row_count cannot be nil.' + end + @total_row_count = total_row_count + 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 && + page_number == o.page_number && + page_size == o.page_size && + query_id == o.query_id && + total_row_count == o.total_row_count && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [page_number, page_size, query_id, total_row_count, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_entity_risk_scores_response.rb b/lib/datadog_api_client/v2/models/security_entity_risk_scores_response.rb new file mode 100644 index 00000000000..379f7982d7d --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_entity_risk_scores_response.rb @@ -0,0 +1,146 @@ +=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 list of entity risk scores + class SecurityEntityRiskScoresResponse + include BaseGenericModel + + # + attr_reader :data + + # Metadata for pagination + attr_reader :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'meta' => :'SecurityEntityRiskScoresMeta' + } + 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::SecurityEntityRiskScoresResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # 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? + return false if @meta.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 + + # Custom attribute writer method with validation + # @param meta [Object] Object to be assigned + # @!visibility private + def meta=(meta) + if meta.nil? + fail ArgumentError, 'invalid value for "meta", meta cannot be nil.' + end + @meta = meta + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta, additional_properties].hash + end + end +end