From 842b1cf8939aad54dddda82dce0978541fd5ca45 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 20 Oct 2026 17:37:29 +0000 Subject: [PATCH] Regenerate client from commit c24d398 of spec repo --- .generator/schemas/v2/openapi.yaml | 134 ++--------------- examples/v2/bits-ai/TriggerInvestigation.rb | 4 +- lib/datadog_api_client/inflector.rb | 7 +- ...m_inferred_journey_candidate_attributes.rb | 33 +---- ...dem_inferred_journey_ignored_attributes.rb | 33 +---- .../v2/models/dem_inferred_journey_item.rb | 63 ++++++++ .../dem_search_inferred_journeys_response.rb | 2 +- ...ch_inferred_journeys_response_data_item.rb | 95 ------------ .../deployment_gates_evaluation_rule.rb | 32 +++- .../v2/models/llm_obs_content_block.rb | 19 +-- .../v2/models/llm_obs_content_block_type.rb | 2 +- .../models/llm_obs_frontend_content_block.rb | 137 ------------------ .../llm_obs_frontend_content_block_type.rb | 26 ---- .../v2/models/llm_obs_legacy_content_block.rb | 105 -------------- .../llm_obs_legacy_content_block_type.rb | 32 ---- ...y_monitoring_content_pack_state_details.rb | 32 +++- ...ng_integration_config_create_attributes.rb | 32 +++- ...ng_integration_config_update_attributes.rb | 32 +++- ...gration_credentials_validate_attributes.rb | 32 +++- .../v2/models/trigger_attributes.rb | 132 +++++------------ .../v2/models/trigger_type.rb | 27 ---- 21 files changed, 251 insertions(+), 760 deletions(-) create mode 100644 lib/datadog_api_client/v2/models/dem_inferred_journey_item.rb delete mode 100644 lib/datadog_api_client/v2/models/dem_search_inferred_journeys_response_data_item.rb delete mode 100644 lib/datadog_api_client/v2/models/llm_obs_frontend_content_block.rb delete mode 100644 lib/datadog_api_client/v2/models/llm_obs_frontend_content_block_type.rb delete mode 100644 lib/datadog_api_client/v2/models/llm_obs_legacy_content_block.rb delete mode 100644 lib/datadog_api_client/v2/models/llm_obs_legacy_content_block_type.rb delete mode 100644 lib/datadog_api_client/v2/models/trigger_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 0168ec45e3bc..0eb131fbc4b6 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -34993,6 +34993,7 @@ components: x-enum-varnames: - CREATE_TEST_SUITE_FOR_JOURNEY_REQUEST DemInferredJourneyCandidateAttributes: + additionalProperties: false description: Attributes of an inferred journey candidate. properties: created_at: @@ -35058,6 +35059,7 @@ components: - attributes type: object DemInferredJourneyIgnoredAttributes: + additionalProperties: false description: Attributes of an ignored inferred journey. properties: created_at: @@ -35122,6 +35124,11 @@ components: - type - attributes type: object + DemInferredJourneyItem: + description: A single inferred journey item, either a candidate or an ignored journey. + oneOf: + - $ref: "#/components/schemas/DemInferredJourneyCandidateData" + - $ref: "#/components/schemas/DemInferredJourneyIgnoredData" DemInferredJourneyStatus: default: candidate description: The status of an inferred DEM journey. @@ -35551,10 +35558,7 @@ components: data: description: List of inferred journey items matching the search criteria. items: - anyOf: - - $ref: "#/components/schemas/DemInferredJourneyCandidateData" - - $ref: "#/components/schemas/DemInferredJourneyIgnoredData" - description: A single inferred journey item, either a candidate or an ignored journey. + $ref: "#/components/schemas/DemInferredJourneyItem" type: array required: - data @@ -36456,11 +36460,6 @@ components: - DEPLOYMENT_GATES_EVALUATION_RESULT_RESPONSE DeploymentGatesEvaluationRule: description: A rule to evaluate as part of a deployment gate evaluation. - discriminator: - mapping: - faulty_deployment_detection: "#/components/schemas/DeploymentGatesFDDRule" - monitor: "#/components/schemas/DeploymentGatesMonitorRule" - propertyName: type oneOf: - $ref: "#/components/schemas/DeploymentGatesMonitorRule" - $ref: "#/components/schemas/DeploymentGatesFDDRule" @@ -68154,9 +68153,6 @@ components: type: string type: object LLMObsContentBlock: - anyOf: - - $ref: "#/components/schemas/LLMObsFrontendContentBlock" - - $ref: "#/components/schemas/LLMObsLegacyContentBlock" description: |- A single content block rendered inside a `display_block` interaction. `type` discriminates which other fields are meaningful: @@ -68165,7 +68161,7 @@ components: - `header`: `content` must be a string; `level`, when set, must be one of `sm`, `md`, `lg`, `xl`. - `json`: `content` must be a well-formed JSON value (object, array, or scalar). - `image`: `url` is required. - - `widget`: `tileDef` is required (any well-formed JSON; the frontend owns the renderable schema). + - `univiz`: `tileDef` is required (any well-formed JSON; the frontend owns the renderable schema). - `llmobs_trace`: `traceId` is required; `interactionType`, when set, must be `trace` or `experiment_trace`. - `frontend`: `code` is required and must be a non-empty string; `label` is optional. @@ -68181,7 +68177,7 @@ components: description: |- Block payload. A string for `markdown`, `header`, and `text`; an arbitrary JSON value (object, array, or scalar) for `json`. Omitted - for `image`, `widget`, `llmobs_trace`, and `frontend`. + for `image`, `univiz`, `llmobs_trace`, and `frontend`. example: "## Triage Instructions" height: description: Optional rendered height. Must be positive when set. @@ -68198,7 +68194,7 @@ components: $ref: "#/components/schemas/LLMObsContentBlockHeaderLevel" tileDef: description: |- - Tile definition for a `widget` block. Required for `widget`. The + Tile definition for a `univiz` block. Required for `univiz`. The schema is owned by the frontend renderer. example: requests: @@ -68221,8 +68217,6 @@ components: description: URL of the image. Required for `image` blocks. example: "https://example.com/image.png" type: string - required: - - type type: object LLMObsContentBlockHeaderLevel: description: Visual size for a `header` block. @@ -68277,7 +68271,7 @@ components: - text - json - image - - widget + - univiz - llmobs_trace - frontend example: markdown @@ -68288,7 +68282,7 @@ components: - TEXT - JSON - IMAGE - - WIDGET + - UNIVIZ - LLMOBS_TRACE - FRONTEND LLMObsContentBlocks: @@ -71210,29 +71204,11 @@ components: required: - data type: object - LLMObsFrontendContentBlock: - description: Validation requirements for a `frontend` display block. - properties: - code: - $ref: "#/components/schemas/LLMObsFrontendContentBlockCode" - type: - $ref: "#/components/schemas/LLMObsFrontendContentBlockType" - required: - - code - type: object LLMObsFrontendContentBlockCode: description: HTML code rendered by a `frontend` block. Required for `frontend` blocks. example: '
Ready for review
' minLength: 1 type: string - LLMObsFrontendContentBlockType: - description: Type discriminator for a `frontend` display block. - enum: - - frontend - example: frontend - type: string - x-enum-varnames: - - FRONTEND LLMObsInferenceCode: description: A generated code snippet for running an inference request programmatically. properties: @@ -71838,32 +71814,6 @@ components: - CATEGORICAL - BOOLEAN - TEXT - LLMObsLegacyContentBlock: - description: Validation requirements for an existing non-frontend display block. - properties: - type: - $ref: "#/components/schemas/LLMObsLegacyContentBlockType" - type: object - LLMObsLegacyContentBlockType: - description: Type discriminator for an existing non-frontend display block. - enum: - - markdown - - header - - text - - json - - image - - widget - - llmobs_trace - example: markdown - type: string - x-enum-varnames: - - MARKDOWN - - HEADER - - TEXT - - JSON - - IMAGE - - WIDGET - - LLMOBS_TRACE LLMObsMetricAssessment: description: Assessment result for an Agent Observability experiment metric. enum: @@ -113157,16 +113107,6 @@ components: description: |- Type-specific details for a content pack state. The set of fields present depends on the content pack's `type`. When Cloud SIEM is inactive for the requesting organization, `onboarding` is returned instead of the content pack's usual type, such as `logs` or `vulnerability`.` - discriminator: - mapping: - appsec: "#/components/schemas/SecurityMonitoringContentPackAppSecDetails" - audit: "#/components/schemas/SecurityMonitoringContentPackAuditDetails" - entity: "#/components/schemas/SecurityMonitoringContentPackEntityDetails" - logs: "#/components/schemas/SecurityMonitoringContentPackLogsDetails" - onboarding: "#/components/schemas/SecurityMonitoringContentPackOnboardingDetails" - threat_intel: "#/components/schemas/SecurityMonitoringContentPackThreatIntelDetails" - vulnerability: "#/components/schemas/SecurityMonitoringContentPackVulnerabilityDetails" - propertyName: type oneOf: - $ref: "#/components/schemas/SecurityMonitoringContentPackLogsDetails" - $ref: "#/components/schemas/SecurityMonitoringContentPackThreatIntelDetails" @@ -114383,14 +114323,6 @@ components: type: object SecurityMonitoringIntegrationConfigCreateAttributes: description: The attributes of the entity context sync configuration to create. - discriminator: - mapping: - CROWDSTRIKE: "#/components/schemas/SecurityMonitoringCrowdStrikeIntegrationConfigCreateAttributes" - ENTRA_ID: "#/components/schemas/SecurityMonitoringEntraIdIntegrationConfigCreateAttributes" - GOOGLE_WORKSPACE: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes" - OKTA: "#/components/schemas/SecurityMonitoringOktaIntegrationConfigCreateAttributes" - SENTINELONE: "#/components/schemas/SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes" - propertyName: integration_type oneOf: - $ref: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationConfigCreateAttributes" - $ref: "#/components/schemas/SecurityMonitoringOktaIntegrationConfigCreateAttributes" @@ -114542,14 +114474,6 @@ components: - INITIALIZING SecurityMonitoringIntegrationConfigUpdateAttributes: description: Fields to update on the entity context sync configuration. All fields other than the integration type are optional. - discriminator: - mapping: - CROWDSTRIKE: "#/components/schemas/SecurityMonitoringCrowdStrikeIntegrationConfigUpdateAttributes" - ENTRA_ID: "#/components/schemas/SecurityMonitoringEntraIdIntegrationConfigUpdateAttributes" - GOOGLE_WORKSPACE: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes" - OKTA: "#/components/schemas/SecurityMonitoringOktaIntegrationConfigUpdateAttributes" - SENTINELONE: "#/components/schemas/SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes" - propertyName: integration_type oneOf: - $ref: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationConfigUpdateAttributes" - $ref: "#/components/schemas/SecurityMonitoringOktaIntegrationConfigUpdateAttributes" @@ -114588,14 +114512,6 @@ components: type: object SecurityMonitoringIntegrationCredentialsValidateAttributes: description: The credentials to validate against the external entity source. - discriminator: - mapping: - CROWDSTRIKE: "#/components/schemas/SecurityMonitoringCrowdStrikeIntegrationCredentialsValidateAttributes" - ENTRA_ID: "#/components/schemas/SecurityMonitoringEntraIdIntegrationCredentialsValidateAttributes" - GOOGLE_WORKSPACE: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes" - OKTA: "#/components/schemas/SecurityMonitoringOktaIntegrationCredentialsValidateAttributes" - SENTINELONE: "#/components/schemas/SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes" - propertyName: integration_type oneOf: - $ref: "#/components/schemas/SecurityMonitoringGoogleWorkspaceIntegrationCredentialsValidateAttributes" - $ref: "#/components/schemas/SecurityMonitoringOktaIntegrationCredentialsValidateAttributes" @@ -135167,9 +135083,6 @@ components: - $ref: "#/components/schemas/SoftwareCatalogTriggerWrapper" - $ref: "#/components/schemas/WorkflowTriggerWrapper" TriggerAttributes: - anyOf: - - $ref: "#/components/schemas/MonitorAlertTrigger" - - $ref: "#/components/schemas/GeneralInvestigationTrigger" description: The trigger definition for starting an investigation. example: monitor_alert_trigger: @@ -135177,14 +135090,9 @@ components: event_ts: 1700000000000 monitor_id: 12345678 type: monitor_alert_trigger - properties: - general_investigation: - $ref: "#/components/schemas/GeneralInvestigationAttributes" - monitor_alert_trigger: - $ref: "#/components/schemas/MonitorAlertTriggerAttributes" - type: - $ref: "#/components/schemas/TriggerType" - type: object + oneOf: + - $ref: "#/components/schemas/MonitorAlertTrigger" + - $ref: "#/components/schemas/GeneralInvestigationTrigger" TriggerInvestigationRequest: description: Request to trigger a new investigation. properties: @@ -135285,16 +135193,6 @@ components: x-enum-varnames: - SECURITY_FINDINGS - SECURITY_SIGNALS - TriggerType: - description: The type of trigger for the investigation. - enum: - - monitor_alert_trigger - - general_investigation - example: monitor_alert_trigger - type: string - x-enum-varnames: - - MONITOR_ALERT_TRIGGER - - GENERAL_INVESTIGATION TriggerWorkflowAutomationAction: description: "Triggers a Workflow Automation." properties: diff --git a/examples/v2/bits-ai/TriggerInvestigation.rb b/examples/v2/bits-ai/TriggerInvestigation.rb index 3fbf27e349ef..aa4ceb944322 100644 --- a/examples/v2/bits-ai/TriggerInvestigation.rb +++ b/examples/v2/bits-ai/TriggerInvestigation.rb @@ -9,13 +9,13 @@ body = DatadogAPIClient::V2::TriggerInvestigationRequest.new({ data: DatadogAPIClient::V2::TriggerInvestigationRequestData.new({ attributes: DatadogAPIClient::V2::TriggerInvestigationRequestDataAttributes.new({ - trigger: DatadogAPIClient::V2::TriggerAttributes.new({ + trigger: DatadogAPIClient::V2::MonitorAlertTrigger.new({ monitor_alert_trigger: DatadogAPIClient::V2::MonitorAlertTriggerAttributes.new({ event_id: "1234567890123456789", event_ts: 1700000000000, monitor_id: 12345678, }), - type: DatadogAPIClient::V2::TriggerType::MONITOR_ALERT_TRIGGER, + type: DatadogAPIClient::V2::MonitorAlertTriggerType::MONITOR_ALERT_TRIGGER, }), }), type: DatadogAPIClient::V2::TriggerInvestigationRequestType::TRIGGER_INVESTIGATION_REQUEST, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index dfba5bb9b7f5..a49e862988f0 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3114,6 +3114,7 @@ def overrides "v2.dem_inferred_journey_candidate_data" => "DemInferredJourneyCandidateData", "v2.dem_inferred_journey_ignored_attributes" => "DemInferredJourneyIgnoredAttributes", "v2.dem_inferred_journey_ignored_data" => "DemInferredJourneyIgnoredData", + "v2.dem_inferred_journey_item" => "DemInferredJourneyItem", "v2.dem_inferred_journey_status" => "DemInferredJourneyStatus", "v2.dem_journey_create_attributes" => "DemJourneyCreateAttributes", "v2.dem_journey_create_data" => "DemJourneyCreateData", @@ -3136,7 +3137,6 @@ def overrides "v2.dem_rum_step" => "DemRumStep", "v2.dem_rum_step_type" => "DemRumStepType", "v2.dem_search_inferred_journeys_response" => "DemSearchInferredJourneysResponse", - "v2.dem_search_inferred_journeys_response_data_item" => "DemSearchInferredJourneysResponse_dataItem", "v2.dem_test_suite_nested" => "DemTestSuiteNested", "v2.dem_user" => "DemUser", "v2.dem_variant" => "DemVariant", @@ -5308,8 +5308,6 @@ def overrides "v2.llm_obs_experiment_update_data_request" => "LLMObsExperimentUpdateDataRequest", "v2.llm_obs_experiment_update_request" => "LLMObsExperimentUpdateRequest", "v2.llm_obs_experiment_user" => "LLMObsExperimentUser", - "v2.llm_obs_frontend_content_block" => "LLMObsFrontendContentBlock", - "v2.llm_obs_frontend_content_block_type" => "LLMObsFrontendContentBlockType", "v2.llm_obs_inference_code" => "LLMObsInferenceCode", "v2.llm_obs_inference_content" => "LLMObsInferenceContent", "v2.llm_obs_inference_content_value" => "LLMObsInferenceContentValue", @@ -5328,8 +5326,6 @@ def overrides "v2.llm_obs_internal_reasoning" => "LLMObsInternalReasoning", "v2.llm_obs_label_schema" => "LLMObsLabelSchema", "v2.llm_obs_label_schema_type" => "LLMObsLabelSchemaType", - "v2.llm_obs_legacy_content_block" => "LLMObsLegacyContentBlock", - "v2.llm_obs_legacy_content_block_type" => "LLMObsLegacyContentBlockType", "v2.llm_obs_metric_assessment" => "LLMObsMetricAssessment", "v2.llm_obs_metric_score_type" => "LLMObsMetricScoreType", "v2.llm_obs_open_ai_metadata" => "LLMObsOpenAIMetadata", @@ -9249,7 +9245,6 @@ def overrides "v2.trigger_investigation_response_type" => "TriggerInvestigationResponseType", "v2.trigger_rate_limit" => "TriggerRateLimit", "v2.trigger_source" => "TriggerSource", - "v2.trigger_type" => "TriggerType", "v2.trigger_workflow_automation_action" => "TriggerWorkflowAutomationAction", "v2.trigger_workflow_automation_action_type" => "TriggerWorkflowAutomationActionType", "v2.twilio_alerts_logs_integration_dataflow_request" => "TwilioAlertsLogsIntegrationDataflowRequest", diff --git a/lib/datadog_api_client/v2/models/dem_inferred_journey_candidate_attributes.rb b/lib/datadog_api_client/v2/models/dem_inferred_journey_candidate_attributes.rb index d7d3a01c4d65..d5c043c024aa 100644 --- a/lib/datadog_api_client/v2/models/dem_inferred_journey_candidate_attributes.rb +++ b/lib/datadog_api_client/v2/models/dem_inferred_journey_candidate_attributes.rb @@ -48,8 +48,6 @@ class DemInferredJourneyCandidateAttributes # List of variants associated with a DEM journey. attr_reader :variants - attr_accessor :additional_properties - # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map @@ -99,14 +97,12 @@ def initialize(attributes = {}) fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DemInferredJourneyCandidateAttributes` 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 + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::DemInferredJourneyCandidateAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end + h[k.to_sym] = v } if attributes.key?(:'created_at') @@ -223,26 +219,6 @@ def variants=(variants) @variants = variants 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 @@ -257,15 +233,14 @@ def ==(o) rank == o.rank && tags == o.tags && test_suite == o.test_suite && - variants == o.variants && - additional_properties == o.additional_properties + variants == o.variants end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash - [created_at, description, journey_rum, name, org_id, rank, tags, test_suite, variants, additional_properties].hash + [created_at, description, journey_rum, name, org_id, rank, tags, test_suite, variants].hash end end end diff --git a/lib/datadog_api_client/v2/models/dem_inferred_journey_ignored_attributes.rb b/lib/datadog_api_client/v2/models/dem_inferred_journey_ignored_attributes.rb index 2976752d7545..83e045a1bccd 100644 --- a/lib/datadog_api_client/v2/models/dem_inferred_journey_ignored_attributes.rb +++ b/lib/datadog_api_client/v2/models/dem_inferred_journey_ignored_attributes.rb @@ -48,8 +48,6 @@ class DemInferredJourneyIgnoredAttributes # List of variants associated with a DEM journey. attr_reader :variants - attr_accessor :additional_properties - # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map @@ -98,14 +96,12 @@ def initialize(attributes = {}) fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DemInferredJourneyIgnoredAttributes` 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 + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::DemInferredJourneyIgnoredAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end + h[k.to_sym] = v } if attributes.key?(:'created_at') @@ -233,26 +229,6 @@ def variants=(variants) @variants = variants 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 @@ -267,15 +243,14 @@ def ==(o) org_id == o.org_id && tags == o.tags && test_suite == o.test_suite && - variants == o.variants && - additional_properties == o.additional_properties + variants == o.variants end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash - [created_at, description, ignored_at, journey_rum, name, org_id, tags, test_suite, variants, additional_properties].hash + [created_at, description, ignored_at, journey_rum, name, org_id, tags, test_suite, variants].hash end end end diff --git a/lib/datadog_api_client/v2/models/dem_inferred_journey_item.rb b/lib/datadog_api_client/v2/models/dem_inferred_journey_item.rb new file mode 100644 index 000000000000..7cc0603c7302 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dem_inferred_journey_item.rb @@ -0,0 +1,63 @@ +=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 single inferred journey item, either a candidate or an ignored journey. + module DemInferredJourneyItem + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'DemInferredJourneyCandidateData', + :'DemInferredJourneyIgnoredData' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/dem_search_inferred_journeys_response.rb b/lib/datadog_api_client/v2/models/dem_search_inferred_journeys_response.rb index 63ee9864bfa4..dc9d0dc4c6f9 100644 --- a/lib/datadog_api_client/v2/models/dem_search_inferred_journeys_response.rb +++ b/lib/datadog_api_client/v2/models/dem_search_inferred_journeys_response.rb @@ -38,7 +38,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'data' => :'Array' + :'data' => :'Array' } end diff --git a/lib/datadog_api_client/v2/models/dem_search_inferred_journeys_response_data_item.rb b/lib/datadog_api_client/v2/models/dem_search_inferred_journeys_response_data_item.rb deleted file mode 100644 index 2e539bedcd35..000000000000 --- a/lib/datadog_api_client/v2/models/dem_search_inferred_journeys_response_data_item.rb +++ /dev/null @@ -1,95 +0,0 @@ -=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 single inferred journey item, either a candidate or an ignored journey. - class DemSearchInferredJourneysResponse_dataItem - include BaseGenericModel - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - } - 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::DemSearchInferredJourneysResponse_dataItem` 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 - } - 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 && - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [additional_properties].hash - end - end -end diff --git a/lib/datadog_api_client/v2/models/deployment_gates_evaluation_rule.rb b/lib/datadog_api_client/v2/models/deployment_gates_evaluation_rule.rb index 5abee6237ac2..bdf3d9ff9bd0 100644 --- a/lib/datadog_api_client/v2/models/deployment_gates_evaluation_rule.rb +++ b/lib/datadog_api_client/v2/models/deployment_gates_evaluation_rule.rb @@ -21,6 +21,7 @@ module DatadogAPIClient::V2 module DeploymentGatesEvaluationRule class << self include BaseOneOfModel + include BaseOneOfModelNoDiscriminator # List of class defined in oneOf (OpenAPI v3) def openapi_one_of @@ -29,18 +30,33 @@ def openapi_one_of :'DeploymentGatesFDDRule' ] end - # Discriminator's property name (OpenAPI v3) - def openapi_discriminator_name - :'type' - end - # Builds the object # @param data [Mixed] Data to be matched against the list of oneOf items # @return [Object] Returns the model or the data itself def build(data) - discriminator_value = data[openapi_discriminator_name] - return nil unless discriminator_value - + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end end end end diff --git a/lib/datadog_api_client/v2/models/llm_obs_content_block.rb b/lib/datadog_api_client/v2/models/llm_obs_content_block.rb index 204b74cd1b44..572072ffe297 100644 --- a/lib/datadog_api_client/v2/models/llm_obs_content_block.rb +++ b/lib/datadog_api_client/v2/models/llm_obs_content_block.rb @@ -24,7 +24,7 @@ module DatadogAPIClient::V2 # - `header`: `content` must be a string; `level`, when set, must be one of `sm`, `md`, `lg`, `xl`. # - `json`: `content` must be a well-formed JSON value (object, array, or scalar). # - `image`: `url` is required. - # - `widget`: `tileDef` is required (any well-formed JSON; the frontend owns the renderable schema). + # - `univiz`: `tileDef` is required (any well-formed JSON; the frontend owns the renderable schema). # - `llmobs_trace`: `traceId` is required; `interactionType`, when set, must be `trace` or `experiment_trace`. # - `frontend`: `code` is required and must be a non-empty string; `label` is optional. # @@ -40,7 +40,7 @@ class LLMObsContentBlock # Block payload. A string for `markdown`, `header`, and `text`; an # arbitrary JSON value (object, array, or scalar) for `json`. Omitted - # for `image`, `widget`, `llmobs_trace`, and `frontend`. + # for `image`, `univiz`, `llmobs_trace`, and `frontend`. attr_accessor :content # Optional rendered height. Must be positive when set. @@ -56,7 +56,7 @@ class LLMObsContentBlock # Visual size for a `header` block. attr_accessor :level - # Tile definition for a `widget` block. Required for `widget`. The + # Tile definition for a `univiz` block. Required for `univiz`. The # schema is owned by the frontend renderer. attr_accessor :tile_def @@ -68,7 +68,7 @@ class LLMObsContentBlock # Discriminator for a single `display_block` content block. Adding a # variant requires coordinated changes in the frontend renderer. - attr_reader :type + attr_accessor :type # URL of the image. Required for `image` blocks. attr_accessor :url @@ -185,7 +185,6 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if !@code.nil? && @code.to_s.length < 1 - return false if @type.nil? true end @@ -199,16 +198,6 @@ def code=(code) @code = code 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 diff --git a/lib/datadog_api_client/v2/models/llm_obs_content_block_type.rb b/lib/datadog_api_client/v2/models/llm_obs_content_block_type.rb index 5e5496743983..4bfc8c78a31b 100644 --- a/lib/datadog_api_client/v2/models/llm_obs_content_block_type.rb +++ b/lib/datadog_api_client/v2/models/llm_obs_content_block_type.rb @@ -27,7 +27,7 @@ class LLMObsContentBlockType TEXT = "text".freeze JSON = "json".freeze IMAGE = "image".freeze - WIDGET = "widget".freeze + UNIVIZ = "univiz".freeze LLMOBS_TRACE = "llmobs_trace".freeze FRONTEND = "frontend".freeze end diff --git a/lib/datadog_api_client/v2/models/llm_obs_frontend_content_block.rb b/lib/datadog_api_client/v2/models/llm_obs_frontend_content_block.rb deleted file mode 100644 index 005ea40f6952..000000000000 --- a/lib/datadog_api_client/v2/models/llm_obs_frontend_content_block.rb +++ /dev/null @@ -1,137 +0,0 @@ -=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 - # Validation requirements for a `frontend` display block. - class LLMObsFrontendContentBlock - include BaseGenericModel - - # HTML code rendered by a `frontend` block. Required for `frontend` blocks. - attr_reader :code - - # Type discriminator for a `frontend` display block. - attr_accessor :type - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'code' => :'code', - :'type' => :'type' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'code' => :'String', - :'type' => :'LLMObsFrontendContentBlockType' - } - 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::LLMObsFrontendContentBlock` 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?(:'code') - self.code = attributes[:'code'] - 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 @code.nil? - return false if @code.to_s.length < 1 - true - end - - # Custom attribute writer method with validation - # @param code [Object] Object to be assigned - # @!visibility private - def code=(code) - if code.nil? - fail ArgumentError, 'invalid value for "code", code cannot be nil.' - end - if code.to_s.length < 1 - fail ArgumentError, 'invalid value for "code", the character length must be great than or equal to 1.' - end - @code = code - 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 && - code == o.code && - type == o.type && - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [code, type, additional_properties].hash - end - end -end diff --git a/lib/datadog_api_client/v2/models/llm_obs_frontend_content_block_type.rb b/lib/datadog_api_client/v2/models/llm_obs_frontend_content_block_type.rb deleted file mode 100644 index 4548f0435583..000000000000 --- a/lib/datadog_api_client/v2/models/llm_obs_frontend_content_block_type.rb +++ /dev/null @@ -1,26 +0,0 @@ -=begin -#Datadog API V2 Collection - -#Collection of all Datadog Public endpoints. - -The version of the OpenAPI document: 1.0 -Contact: support@datadoghq.com -Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator - - Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - This product includes software developed at Datadog (https://www.datadoghq.com/). - Copyright 2020-Present Datadog, Inc. - -=end - -require 'date' -require 'time' - -module DatadogAPIClient::V2 - # Type discriminator for a `frontend` display block. - class LLMObsFrontendContentBlockType - include BaseEnumModel - - FRONTEND = "frontend".freeze - end -end diff --git a/lib/datadog_api_client/v2/models/llm_obs_legacy_content_block.rb b/lib/datadog_api_client/v2/models/llm_obs_legacy_content_block.rb deleted file mode 100644 index 5f2d43994db7..000000000000 --- a/lib/datadog_api_client/v2/models/llm_obs_legacy_content_block.rb +++ /dev/null @@ -1,105 +0,0 @@ -=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 - # Validation requirements for an existing non-frontend display block. - class LLMObsLegacyContentBlock - include BaseGenericModel - - # Type discriminator for an existing non-frontend display block. - attr_accessor :type - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'type' => :'type' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'type' => :'LLMObsLegacyContentBlockType' - } - 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::LLMObsLegacyContentBlock` 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?(:'type') - self.type = attributes[:'type'] - end - end - - # Returns the object in the form of hash, with additionalProperties support. - # @return [Hash] Returns the object in the form of hash - # @!visibility private - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - self.additional_properties.each_pair do |attr, value| - hash[attr] = value - end - hash - end - - # Checks equality by comparing each attribute. - # @param o [Object] Object to be compared - # @!visibility private - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [type, additional_properties].hash - end - end -end diff --git a/lib/datadog_api_client/v2/models/llm_obs_legacy_content_block_type.rb b/lib/datadog_api_client/v2/models/llm_obs_legacy_content_block_type.rb deleted file mode 100644 index f067094868c3..000000000000 --- a/lib/datadog_api_client/v2/models/llm_obs_legacy_content_block_type.rb +++ /dev/null @@ -1,32 +0,0 @@ -=begin -#Datadog API V2 Collection - -#Collection of all Datadog Public endpoints. - -The version of the OpenAPI document: 1.0 -Contact: support@datadoghq.com -Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator - - Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - This product includes software developed at Datadog (https://www.datadoghq.com/). - Copyright 2020-Present Datadog, Inc. - -=end - -require 'date' -require 'time' - -module DatadogAPIClient::V2 - # Type discriminator for an existing non-frontend display block. - class LLMObsLegacyContentBlockType - include BaseEnumModel - - MARKDOWN = "markdown".freeze - HEADER = "header".freeze - TEXT = "text".freeze - JSON = "json".freeze - IMAGE = "image".freeze - WIDGET = "widget".freeze - LLMOBS_TRACE = "llmobs_trace".freeze - end -end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_content_pack_state_details.rb b/lib/datadog_api_client/v2/models/security_monitoring_content_pack_state_details.rb index 4a56ccb8fa8e..fdea711c5784 100644 --- a/lib/datadog_api_client/v2/models/security_monitoring_content_pack_state_details.rb +++ b/lib/datadog_api_client/v2/models/security_monitoring_content_pack_state_details.rb @@ -22,6 +22,7 @@ module DatadogAPIClient::V2 module SecurityMonitoringContentPackStateDetails class << self include BaseOneOfModel + include BaseOneOfModelNoDiscriminator # List of class defined in oneOf (OpenAPI v3) def openapi_one_of @@ -35,18 +36,33 @@ def openapi_one_of :'SecurityMonitoringContentPackOnboardingDetails' ] end - # Discriminator's property name (OpenAPI v3) - def openapi_discriminator_name - :'type' - end - # Builds the object # @param data [Mixed] Data to be matched against the list of oneOf items # @return [Object] Returns the model or the data itself def build(data) - discriminator_value = data[openapi_discriminator_name] - return nil unless discriminator_value - + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end end end end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_integration_config_create_attributes.rb b/lib/datadog_api_client/v2/models/security_monitoring_integration_config_create_attributes.rb index 76b39accb1e4..327eeb189f2d 100644 --- a/lib/datadog_api_client/v2/models/security_monitoring_integration_config_create_attributes.rb +++ b/lib/datadog_api_client/v2/models/security_monitoring_integration_config_create_attributes.rb @@ -21,6 +21,7 @@ module DatadogAPIClient::V2 module SecurityMonitoringIntegrationConfigCreateAttributes class << self include BaseOneOfModel + include BaseOneOfModelNoDiscriminator # List of class defined in oneOf (OpenAPI v3) def openapi_one_of @@ -32,18 +33,33 @@ def openapi_one_of :'SecurityMonitoringSentinelOneIntegrationConfigCreateAttributes' ] end - # Discriminator's property name (OpenAPI v3) - def openapi_discriminator_name - :'integration_type' - end - # Builds the object # @param data [Mixed] Data to be matched against the list of oneOf items # @return [Object] Returns the model or the data itself def build(data) - discriminator_value = data[openapi_discriminator_name] - return nil unless discriminator_value - + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end end end end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_integration_config_update_attributes.rb b/lib/datadog_api_client/v2/models/security_monitoring_integration_config_update_attributes.rb index d23755ffccc6..989df713db21 100644 --- a/lib/datadog_api_client/v2/models/security_monitoring_integration_config_update_attributes.rb +++ b/lib/datadog_api_client/v2/models/security_monitoring_integration_config_update_attributes.rb @@ -21,6 +21,7 @@ module DatadogAPIClient::V2 module SecurityMonitoringIntegrationConfigUpdateAttributes class << self include BaseOneOfModel + include BaseOneOfModelNoDiscriminator # List of class defined in oneOf (OpenAPI v3) def openapi_one_of @@ -32,18 +33,33 @@ def openapi_one_of :'SecurityMonitoringSentinelOneIntegrationConfigUpdateAttributes' ] end - # Discriminator's property name (OpenAPI v3) - def openapi_discriminator_name - :'integration_type' - end - # Builds the object # @param data [Mixed] Data to be matched against the list of oneOf items # @return [Object] Returns the model or the data itself def build(data) - discriminator_value = data[openapi_discriminator_name] - return nil unless discriminator_value - + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end end end end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_integration_credentials_validate_attributes.rb b/lib/datadog_api_client/v2/models/security_monitoring_integration_credentials_validate_attributes.rb index f1ee6378270a..b4c4bf03d4dc 100644 --- a/lib/datadog_api_client/v2/models/security_monitoring_integration_credentials_validate_attributes.rb +++ b/lib/datadog_api_client/v2/models/security_monitoring_integration_credentials_validate_attributes.rb @@ -21,6 +21,7 @@ module DatadogAPIClient::V2 module SecurityMonitoringIntegrationCredentialsValidateAttributes class << self include BaseOneOfModel + include BaseOneOfModelNoDiscriminator # List of class defined in oneOf (OpenAPI v3) def openapi_one_of @@ -32,18 +33,33 @@ def openapi_one_of :'SecurityMonitoringSentinelOneIntegrationCredentialsValidateAttributes' ] end - # Discriminator's property name (OpenAPI v3) - def openapi_discriminator_name - :'integration_type' - end - # Builds the object # @param data [Mixed] Data to be matched against the list of oneOf items # @return [Object] Returns the model or the data itself def build(data) - discriminator_value = data[openapi_discriminator_name] - return nil unless discriminator_value - + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end end end end diff --git a/lib/datadog_api_client/v2/models/trigger_attributes.rb b/lib/datadog_api_client/v2/models/trigger_attributes.rb index fcc6884f6f43..ae392be75d06 100644 --- a/lib/datadog_api_client/v2/models/trigger_attributes.rb +++ b/lib/datadog_api_client/v2/models/trigger_attributes.rb @@ -18,108 +18,46 @@ module DatadogAPIClient::V2 # The trigger definition for starting an investigation. - class TriggerAttributes - include BaseGenericModel - - # Attributes for a general investigation, not tied to a specific monitor alert. - attr_accessor :general_investigation - - # Attributes for a monitor alert trigger. - attr_accessor :monitor_alert_trigger - - # The type of trigger for the investigation. - attr_accessor :type - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'general_investigation' => :'general_investigation', - :'monitor_alert_trigger' => :'monitor_alert_trigger', - :'type' => :'type' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'general_investigation' => :'GeneralInvestigationAttributes', - :'monitor_alert_trigger' => :'MonitorAlertTriggerAttributes', - :'type' => :'TriggerType' - } - 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::TriggerAttributes` initialize method" + module TriggerAttributes + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'MonitorAlertTrigger', + :'GeneralInvestigationTrigger' + ] 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 + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end end - } - - if attributes.key?(:'general_investigation') - self.general_investigation = attributes[:'general_investigation'] - end - if attributes.key?(:'monitor_alert_trigger') - self.monitor_alert_trigger = attributes[:'monitor_alert_trigger'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - end - - # Returns the object in the form of hash, with additionalProperties support. - # @return [Hash] Returns the object in the form of hash - # @!visibility private - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) 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 && - general_investigation == o.general_investigation && - monitor_alert_trigger == o.monitor_alert_trigger && - type == o.type && - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [general_investigation, monitor_alert_trigger, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/trigger_type.rb b/lib/datadog_api_client/v2/models/trigger_type.rb deleted file mode 100644 index ddd3373a85ce..000000000000 --- a/lib/datadog_api_client/v2/models/trigger_type.rb +++ /dev/null @@ -1,27 +0,0 @@ -=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 trigger for the investigation. - class TriggerType - include BaseEnumModel - - MONITOR_ALERT_TRIGGER = "monitor_alert_trigger".freeze - GENERAL_INVESTIGATION = "general_investigation".freeze - end -end