diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e1ccda720e53..c354fca49e31 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1314,6 +1314,67 @@ components: required: true schema: type: string + RuleBasedViewFramework: + description: Compliance framework handle to filter rules and findings by. + in: query + name: framework + required: false + schema: + default: "" + example: hipaa + type: string + RuleBasedViewIncludeRulesWithoutFindings: + description: When `true`, includes rules in the response that have no associated findings. + in: query + name: include_rules_without_findings + required: false + schema: + default: false + example: false + type: boolean + RuleBasedViewIsCustom: + description: Set to `true` when the requested `framework` is a custom framework. + in: query + name: is_custom + required: false + schema: + example: false + type: boolean + RuleBasedViewQuery: + description: Additional event-platform filters applied to the underlying findings query. For example, `scored:true project_id:datadog-prod-us5`. + in: query + name: query + required: false + schema: + default: "" + example: scored:true + type: string + RuleBasedViewQueryFindingsWithoutFrameworkVersion: + description: When `true`, returns findings without a `framework_version` tag. Used for findings from custom frameworks or those created before framework versioning was introduced. + in: query + name: query_findings_without_framework_version + required: false + schema: + default: false + example: false + type: boolean + RuleBasedViewTo: + description: Timestamp of the query end, in milliseconds since the Unix epoch. + in: query + name: to + required: true + schema: + example: 1739982278000 + format: int64 + type: integer + RuleBasedViewVersion: + description: Version of the compliance framework to filter rules and findings by. + in: query + name: version + required: false + schema: + example: "1" + type: string RuleId: description: The ID of the rule. in: path @@ -60636,6 +60697,194 @@ components: example: Deployments automated via Deployment Trains type: string type: object + RuleBasedViewAttributes: + description: Attributes of the rule-based view. + properties: + count: + description: Total number of rules in the view. + example: 1 + format: int64 + type: integer + rules: + $ref: "#/components/schemas/RuleBasedViewRules" + required: + - count + - rules + type: object + RuleBasedViewComplianceFramework: + description: Compliance framework mapping for a rule. + properties: + control: + description: Identifier of the control inside the requirement. + example: 164.308-a-4-i + type: string + framework: + description: Handle of the compliance framework. + example: hipaa + type: string + is_default: + description: Whether the framework is a Datadog default framework. `true` indicates a Datadog framework and `false` indicates a custom framework. + example: true + type: boolean + message: + description: Optional message describing the framework mapping for the rule. + example: "" + type: string + requirement: + description: Name of the requirement that contains the control. + example: Information-Access-Management + type: string + version: + description: Version of the compliance framework. + example: "1" + type: string + type: object + RuleBasedViewComplianceFrameworks: + description: List of compliance framework mappings associated with the rule. + items: + $ref: "#/components/schemas/RuleBasedViewComplianceFramework" + type: array + RuleBasedViewData: + description: Data envelope for the rule-based view response. + properties: + attributes: + $ref: "#/components/schemas/RuleBasedViewAttributes" + id: + description: Unique identifier of the rule-based view document. + example: JSONAPI_USELESS_ID + type: string + type: + $ref: "#/components/schemas/RuleBasedViewType" + required: + - attributes + - id + - type + type: object + RuleBasedViewResourceAttributes: + description: List of resource attribute names exposed by the rule. + example: + - instance_id + items: + description: Name of a resource attribute exposed by the rule. + example: instance_id + type: string + type: array + RuleBasedViewResponse: + description: Response containing an aggregated view of compliance rules with their finding statistics. + properties: + data: + $ref: "#/components/schemas/RuleBasedViewData" + required: + - data + type: object + RuleBasedViewRule: + description: A compliance rule along with its evaluation statistics and framework mappings. + properties: + compliance_frameworks: + $ref: "#/components/schemas/RuleBasedViewComplianceFrameworks" + enabled: + description: Whether the rule is enabled. + example: true + type: boolean + id: + description: Unique identifier of the rule. + example: qjx-udx-xo8 + type: string + name: + description: Human-readable name of the rule. + example: IAM roles should not allow untrusted GitHub Actions to assume them + type: string + resourceAttributes: + $ref: "#/components/schemas/RuleBasedViewResourceAttributes" + resourceCategory: + description: Resource category targeted by the rule. + example: identity + type: string + resourceType: + description: Resource type targeted by the rule. + example: aws_iam_role + type: string + stats: + $ref: "#/components/schemas/RuleBasedViewRuleStats" + status: + description: Severity associated with the rule (for example, `info`, `low`, `medium`, `high`, or `critical`). + example: critical + type: string + tags: + $ref: "#/components/schemas/RuleBasedViewRuleTags" + type: + $ref: "#/components/schemas/RuleBasedViewRuleCategory" + required: + - compliance_frameworks + - enabled + - id + - name + - resourceAttributes + - resourceCategory + - resourceType + - stats + - status + - tags + - type + type: object + RuleBasedViewRuleCategory: + description: The category of the security rule. + enum: + - cloud_configuration + - infrastructure_configuration + - api_security + example: cloud_configuration + type: string + x-enum-varnames: + - CLOUD_CONFIGURATION + - INFRASTRUCTURE_CONFIGURATION + - API_SECURITY + RuleBasedViewRuleStats: + description: Counts of findings for the rule, grouped by their evaluation status. + properties: + fail: + description: Number of findings that failed evaluation. + example: 0 + format: int64 + type: integer + muted: + description: Number of findings that have been muted. + example: 0 + format: int64 + type: integer + pass: + description: Number of findings that passed evaluation. + example: 3 + format: int64 + type: integer + required: + - fail + - pass + - muted + type: object + RuleBasedViewRuleTags: + description: List of tags attached to the rule. + example: + - security:compliance + items: + description: A tag attached to the rule. + example: security:compliance + type: string + type: array + RuleBasedViewRules: + description: List of rules in the rule-based view. + items: + $ref: "#/components/schemas/RuleBasedViewRule" + type: array + RuleBasedViewType: + default: rule_based_view + description: The type of the resource. The value should always be `rule_based_view`. + enum: + - rule_based_view + example: rule_based_view + type: string + x-enum-varnames: + - RULE_BASED_VIEW RuleId: description: The unique ID for a scorecard rule. example: q8MQxk8TCqrHnWkx @@ -95228,6 +95477,89 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and may be subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/compliance_findings/rule_based_view: + get: + description: |- + Get an aggregated view of compliance rules with their pass, fail, and muted finding counts. + Supports filtering by compliance framework, framework version, and additional query filters. + operationId: GetRuleBasedView + parameters: + - $ref: "#/components/parameters/RuleBasedViewTo" + - $ref: "#/components/parameters/RuleBasedViewFramework" + - $ref: "#/components/parameters/RuleBasedViewVersion" + - $ref: "#/components/parameters/RuleBasedViewQueryFindingsWithoutFrameworkVersion" + - $ref: "#/components/parameters/RuleBasedViewIncludeRulesWithoutFindings" + - $ref: "#/components/parameters/RuleBasedViewIsCustom" + - $ref: "#/components/parameters/RuleBasedViewQuery" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + count: 1 + rules: + - compliance_frameworks: + - control: 164.308-a-4-i + framework: hipaa + is_default: true + message: "" + requirement: Information-Access-Management + version: "1" + enabled: true + id: qjx-udx-xo8 + name: IAM roles should not allow untrusted GitHub Actions to assume them + resourceAttributes: [] + resourceCategory: identity + resourceType: aws_iam_role + stats: + fail: 0 + muted: 0 + pass: 3 + status: critical + tags: + - security:compliance + - cloud_provider:aws + - framework:hipaa + type: cloud_configuration + id: JSONAPI_USELESS_ID + type: rule_based_view + schema: + $ref: "#/components/schemas/RuleBasedViewResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "503": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Service Unavailable + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_findings_read + summary: Get the rule-based view of compliance findings + tags: ["Compliance"] + "x-permission": + operator: OR + permissions: + - security_monitoring_findings_read + x-unstable: |- + **Note**: This endpoint is in Preview and subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/container_images: get: description: |- @@ -147630,6 +147962,12 @@ tags: - description: |- Retrieve and analyze code coverage data from Code Coverage. See the [Code Coverage page](https://docs.datadoghq.com/code_coverage/) for more information. name: Code Coverage + - description: |- + Datadog Cloud Security Misconfigurations provides aggregated views of + compliance rules and findings across your cloud resources, helping you assess + posture against industry frameworks (such as HIPAA, SOC 2, ISO 27001) and custom + frameworks. Learn more at https://docs.datadoghq.com/security/cloud_security_management/misconfigurations/#maintain-compliance-with-industry-frameworks-and-benchmarks. + name: "Compliance" - description: |- Manage your Datadog Confluent Cloud integration accounts and account resources directly through the Datadog API. See the [Confluent Cloud page](https://docs.datadoghq.com/integrations/confluent_cloud/) for more information. name: Confluent Cloud diff --git a/examples/v2/compliance/GetRuleBasedView.rb b/examples/v2/compliance/GetRuleBasedView.rb new file mode 100644 index 000000000000..edd374aef551 --- /dev/null +++ b/examples/v2/compliance/GetRuleBasedView.rb @@ -0,0 +1,8 @@ +# Get the rule-based view of compliance findings returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_rule_based_view".to_sym] = true +end +api_instance = DatadogAPIClient::V2::ComplianceAPI.new +p api_instance.get_rule_based_view(1739982278000) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 20e95b8dcbdc..327230032135 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2087,6 +2087,15 @@ "v2.GetCodeCoverageCommitSummary" => { "body" => "CommitCoverageSummaryRequest", }, + "v2.GetRuleBasedView" => { + "to" => "Integer", + "framework" => "String", + "version" => "String", + "query_findings_without_framework_version" => "Boolean", + "include_rules_without_findings" => "Boolean", + "is_custom" => "Boolean", + "query" => "String", + }, "v2.ListContainerImages" => { "filter_tags" => "String", "group_by" => "String", diff --git a/features/v2/compliance.feature b/features/v2/compliance.feature new file mode 100644 index 000000000000..e59eba055be3 --- /dev/null +++ b/features/v2/compliance.feature @@ -0,0 +1,27 @@ +@endpoint(compliance) @endpoint(compliance-v2) +Feature: Compliance + Datadog Cloud Security Misconfigurations provides aggregated views of + compliance rules and findings across your cloud resources, helping you + assess posture against industry frameworks (such as HIPAA, SOC 2, ISO + 27001) and custom frameworks. Learn more at https://docs.datadoghq.com/sec + urity/cloud_security_management/misconfigurations/#maintain-compliance- + with-industry-frameworks-and-benchmarks. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Compliance" API + And operation "GetRuleBasedView" enabled + And new "GetRuleBasedView" request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get the rule-based view of compliance findings returns "Bad Request" response + Given request contains "to" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get the rule-based view of compliance findings returns "OK" response + Given request contains "to" parameter from "REPLACE.ME" + 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 40d310f9a51f..35b117222c31 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1253,6 +1253,12 @@ "type": "safe" } }, + "GetRuleBasedView": { + "tag": "Compliance", + "undo": { + "type": "safe" + } + }, "ListContainerImages": { "tag": "Container Images", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index f67e75659404..f82dd5b795de 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -293,6 +293,7 @@ def initialize "v2.search_security_monitoring_histsignals": false, "v2.get_code_coverage_branch_summary": false, "v2.get_code_coverage_commit_summary": false, + "v2.get_rule_based_view": false, "v2.get_cost_anomaly": false, "v2.list_cost_anomalies": false, "v2.create_dashboard_secure_embed": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 4b52a34435e5..45ad6b34a48b 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -4871,6 +4871,14 @@ def overrides "v2.routing_rule_type" => "RoutingRuleType", "v2.rule_attributes" => "RuleAttributes", "v2.rule_attributes_request" => "RuleAttributesRequest", + "v2.rule_based_view_attributes" => "RuleBasedViewAttributes", + "v2.rule_based_view_compliance_framework" => "RuleBasedViewComplianceFramework", + "v2.rule_based_view_data" => "RuleBasedViewData", + "v2.rule_based_view_response" => "RuleBasedViewResponse", + "v2.rule_based_view_rule" => "RuleBasedViewRule", + "v2.rule_based_view_rule_category" => "RuleBasedViewRuleCategory", + "v2.rule_based_view_rule_stats" => "RuleBasedViewRuleStats", + "v2.rule_based_view_type" => "RuleBasedViewType", "v2.rule_outcome_relationships" => "RuleOutcomeRelationships", "v2.ruleset_resp" => "RulesetResp", "v2.ruleset_resp_array" => "RulesetRespArray", @@ -6460,6 +6468,7 @@ def overrides "v2.cloud_network_monitoring_api" => "CloudNetworkMonitoringAPI", "v2.cloudflare_integration_api" => "CloudflareIntegrationAPI", "v2.code_coverage_api" => "CodeCoverageAPI", + "v2.compliance_api" => "ComplianceAPI", "v2.confluent_cloud_api" => "ConfluentCloudAPI", "v2.container_images_api" => "ContainerImagesAPI", "v2.containers_api" => "ContainersAPI", diff --git a/lib/datadog_api_client/v2/api/compliance_api.rb b/lib/datadog_api_client/v2/api/compliance_api.rb new file mode 100644 index 000000000000..507dd54e14b9 --- /dev/null +++ b/lib/datadog_api_client/v2/api/compliance_api.rb @@ -0,0 +1,111 @@ +=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 ComplianceAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Get the rule-based view of compliance findings. + # + # @see #get_rule_based_view_with_http_info + def get_rule_based_view(to, opts = {}) + data, _status_code, _headers = get_rule_based_view_with_http_info(to, opts) + data + end + + # Get the rule-based view of compliance findings. + # + # Get an aggregated view of compliance rules with their pass, fail, and muted finding counts. + # Supports filtering by compliance framework, framework version, and additional query filters. + # + # @param to [Integer] Timestamp of the query end, in milliseconds since the Unix epoch. + # @param opts [Hash] the optional parameters + # @option opts [String] :framework Compliance framework handle to filter rules and findings by. + # @option opts [String] :version Version of the compliance framework to filter rules and findings by. + # @option opts [Boolean] :query_findings_without_framework_version When `true`, returns findings without a `framework_version` tag. Used for findings from custom frameworks or those created before framework versioning was introduced. + # @option opts [Boolean] :include_rules_without_findings When `true`, includes rules in the response that have no associated findings. + # @option opts [Boolean] :is_custom Set to `true` when the requested `framework` is a custom framework. + # @option opts [String] :query Additional event-platform filters applied to the underlying findings query. For example, `scored:true project_id:datadog-prod-us5`. + # @return [Array<(RuleBasedViewResponse, Integer, Hash)>] RuleBasedViewResponse data, response status code and response headers + def get_rule_based_view_with_http_info(to, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_rule_based_view".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_rule_based_view") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_rule_based_view")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ComplianceAPI.get_rule_based_view ...' + end + # verify the required parameter 'to' is set + if @api_client.config.client_side_validation && to.nil? + fail ArgumentError, "Missing the required parameter 'to' when calling ComplianceAPI.get_rule_based_view" + end + # resource path + local_var_path = '/api/v2/compliance_findings/rule_based_view' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'to'] = to + query_params[:'framework'] = opts[:'framework'] if !opts[:'framework'].nil? + query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil? + query_params[:'query_findings_without_framework_version'] = opts[:'query_findings_without_framework_version'] if !opts[:'query_findings_without_framework_version'].nil? + query_params[:'include_rules_without_findings'] = opts[:'include_rules_without_findings'] if !opts[:'include_rules_without_findings'].nil? + query_params[:'is_custom'] = opts[:'is_custom'] if !opts[:'is_custom'].nil? + query_params[:'query'] = opts[:'query'] if !opts[:'query'].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] || 'RuleBasedViewResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_rule_based_view, + :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: ComplianceAPI#get_rule_based_view\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/models/rule_based_view_attributes.rb b/lib/datadog_api_client/v2/models/rule_based_view_attributes.rb new file mode 100644 index 000000000000..c9e25d3f1e11 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rule_based_view_attributes.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 + # Attributes of the rule-based view. + class RuleBasedViewAttributes + include BaseGenericModel + + # Total number of rules in the view. + attr_reader :count + + # List of rules in the rule-based view. + attr_reader :rules + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'count' => :'count', + :'rules' => :'rules' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'count' => :'Integer', + :'rules' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RuleBasedViewAttributes` 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?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'rules') + if (value = attributes[:'rules']).is_a?(Array) + self.rules = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @count.nil? + return false if @rules.nil? + true + end + + # Custom attribute writer method with validation + # @param count [Object] Object to be assigned + # @!visibility private + def count=(count) + if count.nil? + fail ArgumentError, 'invalid value for "count", count cannot be nil.' + end + @count = count + end + + # Custom attribute writer method with validation + # @param rules [Object] Object to be assigned + # @!visibility private + def rules=(rules) + if rules.nil? + fail ArgumentError, 'invalid value for "rules", rules cannot be nil.' + end + @rules = rules + 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 && + count == o.count && + rules == o.rules && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [count, rules, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rule_based_view_compliance_framework.rb b/lib/datadog_api_client/v2/models/rule_based_view_compliance_framework.rb new file mode 100644 index 000000000000..5a866cc8919b --- /dev/null +++ b/lib/datadog_api_client/v2/models/rule_based_view_compliance_framework.rb @@ -0,0 +1,155 @@ +=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 + # Compliance framework mapping for a rule. + class RuleBasedViewComplianceFramework + include BaseGenericModel + + # Identifier of the control inside the requirement. + attr_accessor :control + + # Handle of the compliance framework. + attr_accessor :framework + + # Whether the framework is a Datadog default framework. `true` indicates a Datadog framework and `false` indicates a custom framework. + attr_accessor :is_default + + # Optional message describing the framework mapping for the rule. + attr_accessor :message + + # Name of the requirement that contains the control. + attr_accessor :requirement + + # Version of the compliance framework. + attr_accessor :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'control' => :'control', + :'framework' => :'framework', + :'is_default' => :'is_default', + :'message' => :'message', + :'requirement' => :'requirement', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'control' => :'String', + :'framework' => :'String', + :'is_default' => :'Boolean', + :'message' => :'String', + :'requirement' => :'String', + :'version' => :'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::RuleBasedViewComplianceFramework` 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?(:'control') + self.control = attributes[:'control'] + end + + if attributes.key?(:'framework') + self.framework = attributes[:'framework'] + end + + if attributes.key?(:'is_default') + self.is_default = attributes[:'is_default'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'requirement') + self.requirement = attributes[:'requirement'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + control == o.control && + framework == o.framework && + is_default == o.is_default && + message == o.message && + requirement == o.requirement && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [control, framework, is_default, message, requirement, version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rule_based_view_data.rb b/lib/datadog_api_client/v2/models/rule_based_view_data.rb new file mode 100644 index 000000000000..64d5b68535ba --- /dev/null +++ b/lib/datadog_api_client/v2/models/rule_based_view_data.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 + # Data envelope for the rule-based view response. + class RuleBasedViewData + include BaseGenericModel + + # Attributes of the rule-based view. + attr_reader :attributes + + # Unique identifier of the rule-based view document. + attr_reader :id + + # The type of the resource. The value should always be `rule_based_view`. + 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' => :'RuleBasedViewAttributes', + :'id' => :'String', + :'type' => :'RuleBasedViewType' + } + 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::RuleBasedViewData` 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/rule_based_view_response.rb b/lib/datadog_api_client/v2/models/rule_based_view_response.rb new file mode 100644 index 000000000000..d99153c5cf39 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rule_based_view_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 an aggregated view of compliance rules with their finding statistics. + class RuleBasedViewResponse + include BaseGenericModel + + # Data envelope for the rule-based view response. + 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' => :'RuleBasedViewData' + } + 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::RuleBasedViewResponse` 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/rule_based_view_rule.rb b/lib/datadog_api_client/v2/models/rule_based_view_rule.rb new file mode 100644 index 000000000000..20eb98da299a --- /dev/null +++ b/lib/datadog_api_client/v2/models/rule_based_view_rule.rb @@ -0,0 +1,339 @@ +=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 + # A compliance rule along with its evaluation statistics and framework mappings. + class RuleBasedViewRule + include BaseGenericModel + + # List of compliance framework mappings associated with the rule. + attr_reader :compliance_frameworks + + # Whether the rule is enabled. + attr_reader :enabled + + # Unique identifier of the rule. + attr_reader :id + + # Human-readable name of the rule. + attr_reader :name + + # List of resource attribute names exposed by the rule. + attr_reader :resource_attributes + + # Resource category targeted by the rule. + attr_reader :resource_category + + # Resource type targeted by the rule. + attr_reader :resource_type + + # Counts of findings for the rule, grouped by their evaluation status. + attr_reader :stats + + # Severity associated with the rule (for example, `info`, `low`, `medium`, `high`, or `critical`). + attr_reader :status + + # List of tags attached to the rule. + attr_reader :tags + + # The category of the security rule. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'compliance_frameworks' => :'compliance_frameworks', + :'enabled' => :'enabled', + :'id' => :'id', + :'name' => :'name', + :'resource_attributes' => :'resourceAttributes', + :'resource_category' => :'resourceCategory', + :'resource_type' => :'resourceType', + :'stats' => :'stats', + :'status' => :'status', + :'tags' => :'tags', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'compliance_frameworks' => :'Array', + :'enabled' => :'Boolean', + :'id' => :'String', + :'name' => :'String', + :'resource_attributes' => :'Array', + :'resource_category' => :'String', + :'resource_type' => :'String', + :'stats' => :'RuleBasedViewRuleStats', + :'status' => :'String', + :'tags' => :'Array', + :'type' => :'RuleBasedViewRuleCategory' + } + 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::RuleBasedViewRule` 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?(:'compliance_frameworks') + if (value = attributes[:'compliance_frameworks']).is_a?(Array) + self.compliance_frameworks = value + end + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'resource_attributes') + if (value = attributes[:'resource_attributes']).is_a?(Array) + self.resource_attributes = value + end + end + + if attributes.key?(:'resource_category') + self.resource_category = attributes[:'resource_category'] + end + + if attributes.key?(:'resource_type') + self.resource_type = attributes[:'resource_type'] + end + + if attributes.key?(:'stats') + self.stats = attributes[:'stats'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + 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 @compliance_frameworks.nil? + return false if @enabled.nil? + return false if @id.nil? + return false if @name.nil? + return false if @resource_attributes.nil? + return false if @resource_category.nil? + return false if @resource_type.nil? + return false if @stats.nil? + return false if @status.nil? + return false if @tags.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param compliance_frameworks [Object] Object to be assigned + # @!visibility private + def compliance_frameworks=(compliance_frameworks) + if compliance_frameworks.nil? + fail ArgumentError, 'invalid value for "compliance_frameworks", compliance_frameworks cannot be nil.' + end + @compliance_frameworks = compliance_frameworks + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + 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 name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param resource_attributes [Object] Object to be assigned + # @!visibility private + def resource_attributes=(resource_attributes) + if resource_attributes.nil? + fail ArgumentError, 'invalid value for "resource_attributes", resource_attributes cannot be nil.' + end + @resource_attributes = resource_attributes + end + + # Custom attribute writer method with validation + # @param resource_category [Object] Object to be assigned + # @!visibility private + def resource_category=(resource_category) + if resource_category.nil? + fail ArgumentError, 'invalid value for "resource_category", resource_category cannot be nil.' + end + @resource_category = resource_category + end + + # Custom attribute writer method with validation + # @param resource_type [Object] Object to be assigned + # @!visibility private + def resource_type=(resource_type) + if resource_type.nil? + fail ArgumentError, 'invalid value for "resource_type", resource_type cannot be nil.' + end + @resource_type = resource_type + end + + # Custom attribute writer method with validation + # @param stats [Object] Object to be assigned + # @!visibility private + def stats=(stats) + if stats.nil? + fail ArgumentError, 'invalid value for "stats", stats cannot be nil.' + end + @stats = stats + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Custom attribute writer method with validation + # @param tags [Object] Object to be assigned + # @!visibility private + def tags=(tags) + if tags.nil? + fail ArgumentError, 'invalid value for "tags", tags cannot be nil.' + end + @tags = tags + 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 && + compliance_frameworks == o.compliance_frameworks && + enabled == o.enabled && + id == o.id && + name == o.name && + resource_attributes == o.resource_attributes && + resource_category == o.resource_category && + resource_type == o.resource_type && + stats == o.stats && + status == o.status && + tags == o.tags && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [compliance_frameworks, enabled, id, name, resource_attributes, resource_category, resource_type, stats, status, tags, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rule_based_view_rule_category.rb b/lib/datadog_api_client/v2/models/rule_based_view_rule_category.rb new file mode 100644 index 000000000000..7fde976fcd6a --- /dev/null +++ b/lib/datadog_api_client/v2/models/rule_based_view_rule_category.rb @@ -0,0 +1,28 @@ +=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 + # The category of the security rule. + class RuleBasedViewRuleCategory + include BaseEnumModel + + CLOUD_CONFIGURATION = "cloud_configuration".freeze + INFRASTRUCTURE_CONFIGURATION = "infrastructure_configuration".freeze + API_SECURITY = "api_security".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/rule_based_view_rule_stats.rb b/lib/datadog_api_client/v2/models/rule_based_view_rule_stats.rb new file mode 100644 index 000000000000..36dc176ba19e --- /dev/null +++ b/lib/datadog_api_client/v2/models/rule_based_view_rule_stats.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 + # Counts of findings for the rule, grouped by their evaluation status. + class RuleBasedViewRuleStats + include BaseGenericModel + + # Number of findings that failed evaluation. + attr_reader :fail + + # Number of findings that have been muted. + attr_reader :muted + + # Number of findings that passed evaluation. + attr_reader :pass + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'fail' => :'fail', + :'muted' => :'muted', + :'pass' => :'pass' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'fail' => :'Integer', + :'muted' => :'Integer', + :'pass' => :'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::RuleBasedViewRuleStats` 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?(:'fail') + self.fail = attributes[:'fail'] + end + + if attributes.key?(:'muted') + self.muted = attributes[:'muted'] + end + + if attributes.key?(:'pass') + self.pass = attributes[:'pass'] + 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 @fail.nil? + return false if @muted.nil? + return false if @pass.nil? + true + end + + # Custom attribute writer method with validation + # @param fail [Object] Object to be assigned + # @!visibility private + def fail=(fail) + if fail.nil? + fail ArgumentError, 'invalid value for "fail", fail cannot be nil.' + end + @fail = fail + end + + # Custom attribute writer method with validation + # @param muted [Object] Object to be assigned + # @!visibility private + def muted=(muted) + if muted.nil? + fail ArgumentError, 'invalid value for "muted", muted cannot be nil.' + end + @muted = muted + end + + # Custom attribute writer method with validation + # @param pass [Object] Object to be assigned + # @!visibility private + def pass=(pass) + if pass.nil? + fail ArgumentError, 'invalid value for "pass", pass cannot be nil.' + end + @pass = pass + 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 && + fail == o.fail && + muted == o.muted && + pass == o.pass && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [fail, muted, pass, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rule_based_view_type.rb b/lib/datadog_api_client/v2/models/rule_based_view_type.rb new file mode 100644 index 000000000000..88b847575836 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rule_based_view_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 + # The type of the resource. The value should always be `rule_based_view`. + class RuleBasedViewType + include BaseEnumModel + + RULE_BASED_VIEW = "rule_based_view".freeze + end +end