From 3cfd53058604cf381717ce3904c077a3346ff69c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 30 Oct 2026 11:50:33 +0000 Subject: [PATCH] Regenerate client from commit 35647a9 of spec repo --- .generator/schemas/v2/openapi.yaml | 132 +++++++++++-- .../CreateVariantForFeatureFlag.rb | 13 +- .../UpdateVariantForFeatureFlag.rb | 10 +- features/scenarios_model_mapping.rb | 2 +- features/v2/feature_flags.feature | 16 +- lib/datadog_api_client/inflector.rb | 8 + .../v2/api/feature_flags_api.rb | 16 +- .../v2/models/create_variant.rb | 2 +- .../v2/models/create_variant_data.rb | 144 ++++++++++++++ .../v2/models/create_variant_request.rb | 123 ++++++++++++ .../v2/models/update_variant_attributes.rb | 115 +++++++++++ .../v2/models/update_variant_data.rb | 154 +++++++++++++++ .../v2/models/update_variant_request.rb | 40 ++-- .../v2/models/variant_data_type.rb | 26 +++ .../v2/models/variant_response.rb | 123 ++++++++++++ .../v2/models/variant_response_attributes.rb | 185 ++++++++++++++++++ .../v2/models/variant_response_data.rb | 165 ++++++++++++++++ 17 files changed, 1213 insertions(+), 61 deletions(-) create mode 100644 lib/datadog_api_client/v2/models/create_variant_data.rb create mode 100644 lib/datadog_api_client/v2/models/create_variant_request.rb create mode 100644 lib/datadog_api_client/v2/models/update_variant_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/update_variant_data.rb create mode 100644 lib/datadog_api_client/v2/models/variant_data_type.rb create mode 100644 lib/datadog_api_client/v2/models/variant_response.rb create mode 100644 lib/datadog_api_client/v2/models/variant_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/variant_response_data.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5d4592e52b5a..2af26bffc464 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -28217,7 +28217,7 @@ components: - data type: object CreateVariant: - description: Request to create a variant. + description: Attributes for creating a variant. properties: key: description: The unique key of the variant. @@ -28236,6 +28236,25 @@ components: - name - value type: object + CreateVariantData: + description: Data for adding a variant to a feature flag. + properties: + attributes: + $ref: "#/components/schemas/CreateVariant" + type: + $ref: "#/components/schemas/VariantDataType" + required: + - type + - attributes + type: object + CreateVariantRequest: + description: Request to add a variant to a feature flag. + properties: + data: + $ref: "#/components/schemas/CreateVariantData" + required: + - data + type: object CreateWorkflowRequest: description: A request object for creating a new workflow. example: @@ -141665,8 +141684,8 @@ components: required: - data type: object - UpdateVariantRequest: - description: Request to update an existing variant's name and value. + UpdateVariantAttributes: + description: Attributes for updating a variant. properties: name: description: The display name of the variant. @@ -141677,6 +141696,30 @@ components: example: "new_value" type: string type: object + UpdateVariantData: + description: Data for updating a variant. + properties: + attributes: + $ref: "#/components/schemas/UpdateVariantAttributes" + id: + description: The ID of the variant. If you include it, use the same value as the `variant_id` path parameter. + example: "550e8400-e29b-41d4-a716-446655440002" + format: uuid + type: string + type: + $ref: "#/components/schemas/VariantDataType" + required: + - type + - attributes + type: object + UpdateVariantRequest: + description: Request to update an existing variant's name and value. + properties: + data: + $ref: "#/components/schemas/UpdateVariantData" + required: + - data + type: object UpdateWorkflowRequest: description: A request object for updating an existing workflow. example: @@ -143625,6 +143668,69 @@ components: - name - value type: object + VariantDataType: + description: The resource type for variants. + enum: + - "variants" + example: "variants" + type: string + x-enum-varnames: + - VARIANTS + VariantResponse: + description: Response containing a variant. + properties: + data: + $ref: "#/components/schemas/VariantResponseData" + required: + - data + type: object + VariantResponseAttributes: + description: Attributes of a variant. + properties: + created_at: + description: The timestamp when the variant was created. + example: "2023-01-01T00:00:00Z" + format: date-time + type: string + key: + description: The unique key of the variant. + example: "variant-abc123" + type: string + name: + description: The name of the variant. + example: "Variant ABC123" + type: string + updated_at: + description: The timestamp when the variant was last updated. + example: "2023-01-01T00:00:00Z" + format: date-time + type: string + value: + description: The value of the variant as a string. + example: "true" + type: string + required: + - key + - name + - value + type: object + VariantResponseData: + description: A variant resource. + properties: + attributes: + $ref: "#/components/schemas/VariantResponseAttributes" + id: + description: The unique identifier of the variant. + example: "550e8400-e29b-41d4-a716-446655440002" + format: uuid + type: string + type: + $ref: "#/components/schemas/VariantDataType" + required: + - id + - type + - attributes + type: object VariantWeight: description: Variant weight details. properties: @@ -177827,7 +177933,7 @@ paths: value: dark type: variants schema: - $ref: "#/components/schemas/CreateVariant" + $ref: "#/components/schemas/CreateVariantRequest" required: true responses: "201": @@ -177846,7 +177952,7 @@ paths: id: "550e8400-e29b-41d4-a716-446655440002" type: variants schema: - $ref: "#/components/schemas/Variant" + $ref: "#/components/schemas/VariantResponse" description: Created "400": content: @@ -177963,22 +178069,6 @@ paths: required: true responses: "200": - content: - application/json: - examples: - default: - value: - data: - attributes: - created_at: "2024-01-01T00:00:00+00:00" - key: dark - name: Dark Theme Updated - updated_at: "2024-06-01T00:00:00+00:00" - value: dark_v2 - id: "550e8400-e29b-41d4-a716-446655440002" - type: variants - schema: - $ref: "#/components/schemas/Variant" description: OK "400": content: diff --git a/examples/v2/feature-flags/CreateVariantForFeatureFlag.rb b/examples/v2/feature-flags/CreateVariantForFeatureFlag.rb index cc05d56145f5..1789250cdf07 100644 --- a/examples/v2/feature-flags/CreateVariantForFeatureFlag.rb +++ b/examples/v2/feature-flags/CreateVariantForFeatureFlag.rb @@ -6,9 +6,14 @@ end api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new -body = DatadogAPIClient::V2::CreateVariant.new({ - key: "variant-abc123", - name: "Variant ABC123", - value: "true", +body = DatadogAPIClient::V2::CreateVariantRequest.new({ + data: DatadogAPIClient::V2::CreateVariantData.new({ + attributes: DatadogAPIClient::V2::CreateVariant.new({ + key: "variant-abc123", + name: "Variant ABC123", + value: "true", + }), + type: DatadogAPIClient::V2::VariantDataType::VARIANTS, + }), }) p api_instance.create_variant_for_feature_flag("550e8400-e29b-41d4-a716-446655440000", body) diff --git a/examples/v2/feature-flags/UpdateVariantForFeatureFlag.rb b/examples/v2/feature-flags/UpdateVariantForFeatureFlag.rb index 4311a4bbfa49..cfada257d31e 100644 --- a/examples/v2/feature-flags/UpdateVariantForFeatureFlag.rb +++ b/examples/v2/feature-flags/UpdateVariantForFeatureFlag.rb @@ -7,7 +7,13 @@ api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new body = DatadogAPIClient::V2::UpdateVariantRequest.new({ - name: "Variant ABC123 Updated", - value: "new_value", + data: DatadogAPIClient::V2::UpdateVariantData.new({ + attributes: DatadogAPIClient::V2::UpdateVariantAttributes.new({ + name: "Variant ABC123 Updated", + value: "new_value", + }), + id: "550e8400-e29b-41d4-a716-446655440002", + type: DatadogAPIClient::V2::VariantDataType::VARIANTS, + }), }) p api_instance.update_variant_for_feature_flag("550e8400-e29b-41d4-a716-446655440000", "550e8400-e29b-41d4-a716-446655440002", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index aa0c5e019906..5cd9f511c2ef 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3918,7 +3918,7 @@ }, "v2.CreateVariantForFeatureFlag" => { "feature_flag_id" => "UUID", - "body" => "CreateVariant", + "body" => "CreateVariantRequest", }, "v2.DeleteVariantFromFeatureFlag" => { "feature_flag_id" => "UUID", diff --git a/features/v2/feature_flags.feature b/features/v2/feature_flags.feature index c2a82ad2841c..98d3aa2f7d94 100644 --- a/features/v2/feature_flags.feature +++ b/features/v2/feature_flags.feature @@ -11,7 +11,7 @@ Feature: Feature Flags Scenario: Add a variant to a feature flag returns "Bad Request" response Given new "CreateVariantForFeatureFlag" request And request contains "feature_flag_id" parameter from "REPLACE.ME" - And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"} + And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}} When the request is sent Then the response status is 400 Bad Request @@ -19,7 +19,7 @@ Feature: Feature Flags Scenario: Add a variant to a feature flag returns "Conflict - A variant with this key already exists on the flag." response Given new "CreateVariantForFeatureFlag" request And request contains "feature_flag_id" parameter from "REPLACE.ME" - And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"} + And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}} When the request is sent Then the response status is 409 Conflict - A variant with this key already exists on the flag. @@ -27,7 +27,7 @@ Feature: Feature Flags Scenario: Add a variant to a feature flag returns "Created" response Given new "CreateVariantForFeatureFlag" request And request contains "feature_flag_id" parameter from "REPLACE.ME" - And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"} + And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}} When the request is sent Then the response status is 201 Created @@ -35,7 +35,7 @@ Feature: Feature Flags Scenario: Add a variant to a feature flag returns "Not Found" response Given new "CreateVariantForFeatureFlag" request And request contains "feature_flag_id" parameter from "REPLACE.ME" - And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"} + And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}} When the request is sent Then the response status is 404 Not Found @@ -1092,7 +1092,7 @@ Feature: Feature Flags Given new "UpdateVariantForFeatureFlag" request And request contains "feature_flag_id" parameter from "REPLACE.ME" And request contains "variant_id" parameter from "REPLACE.ME" - And body with value {"name": "Variant ABC123 Updated", "value": "new_value"} + And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}} When the request is sent Then the response status is 400 Bad Request @@ -1101,7 +1101,7 @@ Feature: Feature Flags Given new "UpdateVariantForFeatureFlag" request And request contains "feature_flag_id" parameter from "REPLACE.ME" And request contains "variant_id" parameter from "REPLACE.ME" - And body with value {"name": "Variant ABC123 Updated", "value": "new_value"} + And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}} When the request is sent Then the response status is 409 Conflict - A pending suggestion already exists for this property. @@ -1110,7 +1110,7 @@ Feature: Feature Flags Given new "UpdateVariantForFeatureFlag" request And request contains "feature_flag_id" parameter from "REPLACE.ME" And request contains "variant_id" parameter from "REPLACE.ME" - And body with value {"name": "Variant ABC123 Updated", "value": "new_value"} + And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}} When the request is sent Then the response status is 404 Not Found @@ -1119,7 +1119,7 @@ Feature: Feature Flags Given new "UpdateVariantForFeatureFlag" request And request contains "feature_flag_id" parameter from "REPLACE.ME" And request contains "variant_id" parameter from "REPLACE.ME" - And body with value {"name": "Variant ABC123 Updated", "value": "new_value"} + And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}} When the request is sent Then the response status is 200 OK diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 255635c1a4e3..21e12b486f7b 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2742,6 +2742,8 @@ def overrides "v2.create_upload_response_data_type" => "CreateUploadResponseDataType", "v2.create_user_notification_channel_request" => "CreateUserNotificationChannelRequest", "v2.create_variant" => "CreateVariant", + "v2.create_variant_data" => "CreateVariantData", + "v2.create_variant_request" => "CreateVariantRequest", "v2.create_workflow_request" => "CreateWorkflowRequest", "v2.create_workflow_response" => "CreateWorkflowResponse", "v2.creator" => "Creator", @@ -9600,6 +9602,8 @@ def overrides "v2.update_tenancy_config_data_type" => "UpdateTenancyConfigDataType", "v2.update_tenancy_config_request" => "UpdateTenancyConfigRequest", "v2.update_user_identity_providers_request" => "UpdateUserIdentityProvidersRequest", + "v2.update_variant_attributes" => "UpdateVariantAttributes", + "v2.update_variant_data" => "UpdateVariantData", "v2.update_variant_request" => "UpdateVariantRequest", "v2.update_workflow_request" => "UpdateWorkflowRequest", "v2.update_workflow_response" => "UpdateWorkflowResponse", @@ -9739,6 +9743,10 @@ def overrides "v2.validation_response" => "ValidationResponse", "v2.value_type" => "ValueType", "v2.variant" => "Variant", + "v2.variant_data_type" => "VariantDataType", + "v2.variant_response" => "VariantResponse", + "v2.variant_response_attributes" => "VariantResponseAttributes", + "v2.variant_response_data" => "VariantResponseData", "v2.variant_weight" => "VariantWeight", "v2.variant_weight_request" => "VariantWeightRequest", "v2.version_history_update" => "VersionHistoryUpdate", diff --git a/lib/datadog_api_client/v2/api/feature_flags_api.rb b/lib/datadog_api_client/v2/api/feature_flags_api.rb index b79868e59f12..24f3a706f577 100644 --- a/lib/datadog_api_client/v2/api/feature_flags_api.rb +++ b/lib/datadog_api_client/v2/api/feature_flags_api.rb @@ -319,9 +319,9 @@ def create_variant_for_feature_flag(feature_flag_id, body, opts = {}) # the new variant in subsequent allocation syncs. # # @param feature_flag_id [UUID] The ID of the feature flag. - # @param body [CreateVariant] + # @param body [CreateVariantRequest] # @param opts [Hash] the optional parameters - # @return [Array<(Variant, Integer, Hash)>] Variant data, response status code and response headers + # @return [Array<(VariantResponse, Integer, Hash)>] VariantResponse data, response status code and response headers def create_variant_for_feature_flag_with_http_info(feature_flag_id, body, opts = {}) if @api_client.config.debugging @@ -355,7 +355,7 @@ def create_variant_for_feature_flag_with_http_info(feature_flag_id, body, opts = post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type - return_type = opts[:debug_return_type] || 'Variant' + return_type = opts[:debug_return_type] || 'VariantResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] @@ -1696,8 +1696,8 @@ def update_saved_filter_attributes_with_http_info(saved_filter_id, body, opts = # # @see #update_variant_for_feature_flag_with_http_info def update_variant_for_feature_flag(feature_flag_id, variant_id, body, opts = {}) - data, _status_code, _headers = update_variant_for_feature_flag_with_http_info(feature_flag_id, variant_id, body, opts) - data + update_variant_for_feature_flag_with_http_info(feature_flag_id, variant_id, body, opts) + nil end # Update a variant. @@ -1710,7 +1710,7 @@ def update_variant_for_feature_flag(feature_flag_id, variant_id, body, opts = {} # @param variant_id [UUID] The ID of the variant. # @param body [UpdateVariantRequest] # @param opts [Hash] the optional parameters - # @return [Array<(Variant, Integer, Hash)>] Variant data, response status code and response headers + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def update_variant_for_feature_flag_with_http_info(feature_flag_id, variant_id, body, opts = {}) if @api_client.config.debugging @@ -1737,7 +1737,7 @@ def update_variant_for_feature_flag_with_http_info(feature_flag_id, variant_id, # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) @@ -1748,7 +1748,7 @@ def update_variant_for_feature_flag_with_http_info(feature_flag_id, variant_id, post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type - return_type = opts[:debug_return_type] || 'Variant' + return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] diff --git a/lib/datadog_api_client/v2/models/create_variant.rb b/lib/datadog_api_client/v2/models/create_variant.rb index a18d682fbad4..3bc44bb0eb16 100644 --- a/lib/datadog_api_client/v2/models/create_variant.rb +++ b/lib/datadog_api_client/v2/models/create_variant.rb @@ -17,7 +17,7 @@ require 'time' module DatadogAPIClient::V2 - # Request to create a variant. + # Attributes for creating a variant. class CreateVariant include BaseGenericModel diff --git a/lib/datadog_api_client/v2/models/create_variant_data.rb b/lib/datadog_api_client/v2/models/create_variant_data.rb new file mode 100644 index 000000000000..91d439785b19 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_variant_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for adding a variant to a feature flag. + class CreateVariantData + include BaseGenericModel + + # Attributes for creating a variant. + attr_reader :attributes + + # The resource type for variants. + 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', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CreateVariant', + :'type' => :'VariantDataType' + } + 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::CreateVariantData` 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?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + 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, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_variant_request.rb b/lib/datadog_api_client/v2/models/create_variant_request.rb new file mode 100644 index 000000000000..348c254ae081 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_variant_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to add a variant to a feature flag. + class CreateVariantRequest + include BaseGenericModel + + # Data for adding a variant to a feature flag. + 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' => :'CreateVariantData' + } + 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::CreateVariantRequest` 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/update_variant_attributes.rb b/lib/datadog_api_client/v2/models/update_variant_attributes.rb new file mode 100644 index 000000000000..7fd3d5e2fdb8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_variant_attributes.rb @@ -0,0 +1,115 @@ +=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 for updating a variant. + class UpdateVariantAttributes + include BaseGenericModel + + # The display name of the variant. + attr_accessor :name + + # The value of the variant as a string. + attr_accessor :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'value' => :'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::UpdateVariantAttributes` 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + 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 && + name == o.name && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_variant_data.rb b/lib/datadog_api_client/v2/models/update_variant_data.rb new file mode 100644 index 000000000000..bc6575dc8ccd --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_variant_data.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for updating a variant. + class UpdateVariantData + include BaseGenericModel + + # Attributes for updating a variant. + attr_reader :attributes + + # The ID of the variant. If you include it, use the same value as the `variant_id` path parameter. + attr_accessor :id + + # The resource type for variants. + 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' => :'UpdateVariantAttributes', + :'id' => :'UUID', + :'type' => :'VariantDataType' + } + 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::UpdateVariantData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_variant_request.rb b/lib/datadog_api_client/v2/models/update_variant_request.rb index 3a80b65f6244..ac1a1cca5502 100644 --- a/lib/datadog_api_client/v2/models/update_variant_request.rb +++ b/lib/datadog_api_client/v2/models/update_variant_request.rb @@ -21,11 +21,8 @@ module DatadogAPIClient::V2 class UpdateVariantRequest include BaseGenericModel - # The display name of the variant. - attr_accessor :name - - # The value of the variant as a string. - attr_accessor :value + # Data for updating a variant. + attr_reader :data attr_accessor :additional_properties @@ -33,8 +30,7 @@ class UpdateVariantRequest # @!visibility private def self.attribute_map { - :'name' => :'name', - :'value' => :'value' + :'data' => :'data' } end @@ -42,8 +38,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'name' => :'String', - :'value' => :'String' + :'data' => :'UpdateVariantData' } end @@ -65,13 +60,27 @@ def initialize(attributes = {}) end } - if attributes.key?(:'name') - self.name = attributes[:'name'] + 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 - if attributes.key?(:'value') - self.value = attributes[:'value'] + # 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. @@ -100,8 +109,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && - name == o.name && - value == o.value && + data == o.data && additional_properties == o.additional_properties end @@ -109,7 +117,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [name, value, additional_properties].hash + [data, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/variant_data_type.rb b/lib/datadog_api_client/v2/models/variant_data_type.rb new file mode 100644 index 000000000000..ce3e3767127d --- /dev/null +++ b/lib/datadog_api_client/v2/models/variant_data_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 resource type for variants. + class VariantDataType + include BaseEnumModel + + VARIANTS = "variants".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/variant_response.rb b/lib/datadog_api_client/v2/models/variant_response.rb new file mode 100644 index 000000000000..07294ad66f52 --- /dev/null +++ b/lib/datadog_api_client/v2/models/variant_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a variant. + class VariantResponse + include BaseGenericModel + + # A variant resource. + 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' => :'VariantResponseData' + } + 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::VariantResponse` 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/variant_response_attributes.rb b/lib/datadog_api_client/v2/models/variant_response_attributes.rb new file mode 100644 index 000000000000..a251e10f8bcb --- /dev/null +++ b/lib/datadog_api_client/v2/models/variant_response_attributes.rb @@ -0,0 +1,185 @@ +=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 a variant. + class VariantResponseAttributes + include BaseGenericModel + + # The timestamp when the variant was created. + attr_accessor :created_at + + # The unique key of the variant. + attr_reader :key + + # The name of the variant. + attr_reader :name + + # The timestamp when the variant was last updated. + attr_accessor :updated_at + + # The value of the variant as a string. + attr_reader :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'key' => :'key', + :'name' => :'name', + :'updated_at' => :'updated_at', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'key' => :'String', + :'name' => :'String', + :'updated_at' => :'Time', + :'value' => :'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::VariantResponseAttributes` 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?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + 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 @key.nil? + return false if @name.nil? + return false if @value.nil? + true + end + + # Custom attribute writer method with validation + # @param key [Object] Object to be assigned + # @!visibility private + def key=(key) + if key.nil? + fail ArgumentError, 'invalid value for "key", key cannot be nil.' + end + @key = key + 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 value [Object] Object to be assigned + # @!visibility private + def value=(value) + if value.nil? + fail ArgumentError, 'invalid value for "value", value cannot be nil.' + end + @value = value + 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 && + created_at == o.created_at && + key == o.key && + name == o.name && + updated_at == o.updated_at && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, key, name, updated_at, value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/variant_response_data.rb b/lib/datadog_api_client/v2/models/variant_response_data.rb new file mode 100644 index 000000000000..31aebc20424c --- /dev/null +++ b/lib/datadog_api_client/v2/models/variant_response_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 + # A variant resource. + class VariantResponseData + include BaseGenericModel + + # Attributes of a variant. + attr_reader :attributes + + # The unique identifier of the variant. + attr_reader :id + + # The resource type for variants. + 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' => :'VariantResponseAttributes', + :'id' => :'UUID', + :'type' => :'VariantDataType' + } + 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::VariantResponseData` 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