diff --git a/.apigentools-info b/.apigentools-info index 023a6f04f6e..c299a232c9d 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-02-12 18:33:48.053303", - "spec_repo_commit": "6a4cfb82" + "regenerated": "2025-02-13 21:39:46.795320", + "spec_repo_commit": "2d82a1c7" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-02-12 18:33:48.069553", - "spec_repo_commit": "6a4cfb82" + "regenerated": "2025-02-13 21:39:46.810686", + "spec_repo_commit": "2d82a1c7" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 198c15204dc..ad89a5e6f3b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1778,6 +1778,193 @@ components: oneOf: - $ref: '#/components/schemas/AWSIntegrationUpdate' - $ref: '#/components/schemas/HTTPIntegrationUpdate' + ActionQuery: + description: An action query. This query type is used to trigger an action, + such as sending a HTTP request. + properties: + events: + description: Events to listen for downstream of the action query. + items: + $ref: '#/components/schemas/AppBuilderEvent' + type: array + id: + description: The ID of the action query. + example: 65bb1f25-52e1-4510-9f8d-22d1516ed693 + format: uuid + type: string + name: + description: A unique identifier for this action query. This name is also + used to access the query's result throughout the app. + example: fetchPendingOrders + type: string + properties: + $ref: '#/components/schemas/ActionQueryProperties' + type: + $ref: '#/components/schemas/ActionQueryType' + required: + - id + - name + - type + - properties + type: object + ActionQueryCondition: + description: Whether to run this query. If specified, the query will only run + if this condition evaluates to `true` in JavaScript and all other conditions + are also met. + oneOf: + - type: boolean + - example: ${true} + type: string + ActionQueryDebounceInMs: + description: The minimum time in milliseconds that must pass before the query + can be triggered again. This is useful for preventing accidental double-clicks + from triggering the query multiple times. + oneOf: + - example: 310.5 + format: double + type: number + - description: If this is a string, it must be a valid JavaScript expression + that evaluates to a number. + example: ${1000} + type: string + ActionQueryMockedOutputs: + description: The mocked outputs of the action query. This is useful for testing + the app without actually running the action. + oneOf: + - type: string + - $ref: '#/components/schemas/ActionQueryMockedOutputsObject' + ActionQueryMockedOutputsEnabled: + description: Whether to enable the mocked outputs for testing. + oneOf: + - type: boolean + - description: If this is a string, it must be a valid JavaScript expression + that evaluates to a boolean. + example: ${true} + type: string + ActionQueryMockedOutputsObject: + description: The mocked outputs of the action query. + properties: + enabled: + $ref: '#/components/schemas/ActionQueryMockedOutputsEnabled' + outputs: + description: The mocked outputs of the action query, serialized as JSON. + example: '{"status": "success"}' + type: string + required: + - enabled + type: object + ActionQueryOnlyTriggerManually: + description: Determines when this query is executed. If set to `false`, the + query will run when the app loads and whenever any query arguments change. + If set to `true`, the query will only run when manually triggered from elsewhere + in the app. + oneOf: + - type: boolean + - description: If this is a string, it must be a valid JavaScript expression + that evaluates to a boolean. + example: ${true} + type: string + ActionQueryPollingIntervalInMs: + description: If specified, the app will poll the query at the specified interval + in milliseconds. The minimum polling interval is 15 seconds. The query will + only poll when the app's browser tab is active. + oneOf: + - example: 30000.0 + format: double + minimum: 15000.0 + type: number + - description: If this is a string, it must be a valid JavaScript expression + that evaluates to a number. + example: ${15000} + type: string + ActionQueryProperties: + description: The properties of the action query. + properties: + condition: + $ref: '#/components/schemas/ActionQueryCondition' + debounceInMs: + $ref: '#/components/schemas/ActionQueryDebounceInMs' + mockedOutputs: + $ref: '#/components/schemas/ActionQueryMockedOutputs' + onlyTriggerManually: + $ref: '#/components/schemas/ActionQueryOnlyTriggerManually' + outputs: + description: The post-query transformation function, which is a JavaScript + function that changes the query's `.outputs` property after the query's + execution. + example: ${((outputs) => {return outputs.body.data})(self.rawOutputs)} + type: string + pollingIntervalInMs: + $ref: '#/components/schemas/ActionQueryPollingIntervalInMs' + requiresConfirmation: + $ref: '#/components/schemas/ActionQueryRequiresConfirmation' + showToastOnError: + $ref: '#/components/schemas/ActionQueryShowToastOnError' + spec: + $ref: '#/components/schemas/ActionQuerySpec' + required: + - spec + type: object + ActionQueryRequiresConfirmation: + description: Whether to prompt the user to confirm this query before it runs. + oneOf: + - type: boolean + - description: If this is a string, it must be a valid JavaScript expression + that evaluates to a boolean. + example: ${true} + type: string + ActionQueryShowToastOnError: + description: Whether to display a toast to the user when the query returns an + error. + oneOf: + - type: boolean + - description: If this is a string, it must be a valid JavaScript expression + that evaluates to a boolean. + example: ${true} + type: string + ActionQuerySpec: + description: The definition of the action query. + oneOf: + - type: string + - $ref: '#/components/schemas/ActionQuerySpecObject' + ActionQuerySpecInput: + additionalProperties: {} + description: The inputs to the action query. See the [Actions Catalog](https://docs.datadoghq.com/actions/actions_catalog/) + for more detail on each action and its inputs. + type: object + ActionQuerySpecInputs: + description: The inputs to the action query. These are the values that are passed + to the action when it is triggered. + oneOf: + - type: string + - $ref: '#/components/schemas/ActionQuerySpecInput' + ActionQuerySpecObject: + description: The action query spec object. + properties: + connectionId: + description: The ID of the custom connection to use for this action query. + example: 65bb1f25-52e1-4510-9f8d-22d1516ed693 + format: uuid + type: string + fqn: + description: The fully qualified name of the action type. + example: com.datadoghq.http.request + type: string + inputs: + $ref: '#/components/schemas/ActionQuerySpecInputs' + required: + - fqn + - connectionId + type: object + ActionQueryType: + default: action + description: The action query type. + enum: + - action + example: action + type: string + x-enum-varnames: + - ACTION ActiveBillingDimensionsAttributes: description: List of active billing dimensions. properties: @@ -9528,6 +9715,48 @@ components: type: number type: array type: object + DataTransform: + description: A data transformer, which is custom JavaScript code that executes + and transforms data when its inputs change. + properties: + id: + description: The ID of the data transformer. + example: 65bb1f25-52e1-4510-9f8d-22d1516ed693 + format: uuid + type: string + name: + description: A unique identifier for this data transformer. This name is + also used to access the transformer's result throughout the app. + example: combineTwoOrders + type: string + properties: + $ref: '#/components/schemas/DataTransformProperties' + type: + $ref: '#/components/schemas/DataTransformType' + required: + - id + - name + - type + - properties + type: object + DataTransformProperties: + description: The properties of the data transformer. + properties: + outputs: + description: A JavaScript function that returns the transformed data. + example: "${(() => {return {\n allItems: [...fetchOrder1.outputs.items, + ...fetchOrder2.outputs.items],\n}})()}" + type: string + type: object + DataTransformType: + default: dataTransform + description: The data transform type. + enum: + - dataTransform + example: dataTransform + type: string + x-enum-varnames: + - DATATRANSFORM Date: description: Date as Unix timestamp in milliseconds. example: 1722439510282 @@ -21649,34 +21878,12 @@ components: $ref: '#/components/schemas/Deployment' type: object Query: - description: A query used by an app. This can take the form of an external action, - a data transformation, or a state variable change. - properties: - events: - description: Events to listen for downstream of the query. - items: - $ref: '#/components/schemas/AppBuilderEvent' - type: array - id: - description: The ID of the query. - example: 65bb1f25-52e1-4510-9f8d-22d1516ed693 - format: uuid - type: string - name: - description: The name of the query. The name must be unique within the app - and is visible in the app editor. - example: '' - type: string - properties: - description: The properties of the query. The properties vary depending - on the query type. - type: - $ref: '#/components/schemas/QueryType' - required: - - id - - name - - type - type: object + description: A data query used by an app. This can take the form of an external + action, a data transformation, or a state variable. + oneOf: + - $ref: '#/components/schemas/ActionQuery' + - $ref: '#/components/schemas/DataTransform' + - $ref: '#/components/schemas/StateVariable' QueryFormula: description: A formula for calculation based on one or more queries. properties: @@ -21700,18 +21907,6 @@ components: x-enum-varnames: - ASC - DESC - QueryType: - description: The query type. - enum: - - action - - stateVariable - - dataTransform - example: action - type: string - x-enum-varnames: - - ACTION - - STATEVARIABLE - - DATATRANSFORM RUMAggregateBucketValue: description: A bucket value, can be either a timeseries or a single value. oneOf: @@ -29660,6 +29855,46 @@ components: - PASS - FAIL - SKIP + StateVariable: + description: A variable, which can be set and read by other components in the + app. + properties: + id: + description: The ID of the state variable. + example: 65bb1f25-52e1-4510-9f8d-22d1516ed693 + format: uuid + type: string + name: + description: A unique identifier for this state variable. This name is also + used to access the variable's value throughout the app. + example: ordersToSubmit + type: string + properties: + $ref: '#/components/schemas/StateVariableProperties' + type: + $ref: '#/components/schemas/StateVariableType' + required: + - id + - name + - type + - properties + type: object + StateVariableProperties: + description: The properties of the state variable. + properties: + defaultValue: + description: The default value of the state variable. + example: ${['order_3145', 'order_4920']} + type: object + StateVariableType: + default: stateVariable + description: The state variable type. + enum: + - stateVariable + example: stateVariable + type: string + x-enum-varnames: + - STATEVARIABLE Step: description: A Step is a sub-component of a workflow. Each Step performs an action. @@ -33675,6 +33910,12 @@ paths: schema: $ref: '#/components/schemas/JSONAPIErrorResponse' description: Not Found + '410': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Gone '429': $ref: '#/components/responses/TooManyRequestsResponse' summary: Get App diff --git a/cassettes/features/v2/app_builder/Get-App-returns-Gone-response.frozen b/cassettes/features/v2/app_builder/Get-App-returns-Gone-response.frozen new file mode 100644 index 00000000000..57dcd9946ad --- /dev/null +++ b/cassettes/features/v2/app_builder/Get-App-returns-Gone-response.frozen @@ -0,0 +1 @@ +2025-02-07T20:29:56.260Z \ No newline at end of file diff --git a/cassettes/features/v2/app_builder/Get-App-returns-Gone-response.yml b/cassettes/features/v2/app_builder/Get-App-returns-Gone-response.yml new file mode 100644 index 00000000000..b7cf0d3ce5f --- /dev/null +++ b/cassettes/features/v2/app_builder/Get-App-returns-Gone-response.yml @@ -0,0 +1,62 @@ +http_interactions: +- recorded_at: Fri, 07 Feb 2025 20:29:56 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"components":[{"events":[],"name":"grid0","properties":{"children":[{"events":[],"name":"gridCell0","properties":{"children":[{"events":[],"name":"calloutValue0","properties":{"isDisabled":false,"isLoading":false,"isVisible":true,"label":"CPU + Usage","size":"sm","style":"vivid_yellow","unit":"kB","value":"42"},"type":"calloutValue"}],"isVisible":"true","layout":{"default":{"height":8,"width":2,"x":0,"y":0}}},"type":"gridCell"}]},"type":"grid"}],"description":"This + is a simple example app","name":"Example App","queries":[],"rootInstanceName":"grid0"},"type":"appDefinitions"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/app-builder/apps + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"efe62908-33df-4612-a297-c001f8ecb4ba","type":"appDefinitions"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Fri, 07 Feb 2025 20:29:56 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/app-builder/apps/efe62908-33df-4612-a297-c001f8ecb4ba?version=31 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"app version not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 410 + message: Gone +- recorded_at: Fri, 07 Feb 2025 20:29:56 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/app-builder/apps/efe62908-33df-4612-a297-c001f8ecb4ba + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"efe62908-33df-4612-a297-c001f8ecb4ba","type":"appDefinitions"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/features/v2/app_builder.feature b/features/v2/app_builder.feature index 1c8226e8970..189ec9a0852 100644 --- a/features/v2/app_builder.feature +++ b/features/v2/app_builder.feature @@ -99,6 +99,16 @@ Feature: App Builder When the request is sent Then the response status is 400 Bad Request + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Get App returns "Gone" response + Given operation "GetApp" enabled + And new "GetApp" request + And there is a valid "app" in the system + And request contains "app_id" parameter from "app.data.id" + And request contains "version" parameter with value "31" + When the request is sent + Then the response status is 410 Gone + @skip-typescript @team:DataDog/app-builder-backend Scenario: Get App returns "Not Found" response Given operation "GetApp" enabled diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 8d0667b532e..4f3e754e34e 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -916,6 +916,21 @@ def overrides "v2.action_connection_data_update" => "ActionConnectionDataUpdate", "v2.action_connection_integration" => "ActionConnectionIntegration", "v2.action_connection_integration_update" => "ActionConnectionIntegrationUpdate", + "v2.action_query" => "ActionQuery", + "v2.action_query_condition" => "ActionQueryCondition", + "v2.action_query_debounce_in_ms" => "ActionQueryDebounceInMs", + "v2.action_query_mocked_outputs" => "ActionQueryMockedOutputs", + "v2.action_query_mocked_outputs_enabled" => "ActionQueryMockedOutputsEnabled", + "v2.action_query_mocked_outputs_object" => "ActionQueryMockedOutputsObject", + "v2.action_query_only_trigger_manually" => "ActionQueryOnlyTriggerManually", + "v2.action_query_polling_interval_in_ms" => "ActionQueryPollingIntervalInMs", + "v2.action_query_properties" => "ActionQueryProperties", + "v2.action_query_requires_confirmation" => "ActionQueryRequiresConfirmation", + "v2.action_query_show_toast_on_error" => "ActionQueryShowToastOnError", + "v2.action_query_spec" => "ActionQuerySpec", + "v2.action_query_spec_inputs" => "ActionQuerySpecInputs", + "v2.action_query_spec_object" => "ActionQuerySpecObject", + "v2.action_query_type" => "ActionQueryType", "v2.active_billing_dimensions_attributes" => "ActiveBillingDimensionsAttributes", "v2.active_billing_dimensions_body" => "ActiveBillingDimensionsBody", "v2.active_billing_dimensions_response" => "ActiveBillingDimensionsResponse", @@ -1434,6 +1449,9 @@ def overrides "v2.data_deletion_response_item_attributes" => "DataDeletionResponseItemAttributes", "v2.data_deletion_response_meta" => "DataDeletionResponseMeta", "v2.data_scalar_column" => "DataScalarColumn", + "v2.data_transform" => "DataTransform", + "v2.data_transform_properties" => "DataTransformProperties", + "v2.data_transform_type" => "DataTransformType", "v2.delete_app_response" => "DeleteAppResponse", "v2.delete_app_response_data" => "DeleteAppResponseData", "v2.delete_apps_request" => "DeleteAppsRequest", @@ -2246,7 +2264,6 @@ def overrides "v2.query" => "Query", "v2.query_formula" => "QueryFormula", "v2.query_sort_order" => "QuerySortOrder", - "v2.query_type" => "QueryType", "v2.readiness_gate" => "ReadinessGate", "v2.readiness_gate_threshold_type" => "ReadinessGateThresholdType", "v2.relationship_item" => "RelationshipItem", @@ -2755,6 +2772,9 @@ def overrides "v2.spec" => "Spec", "v2.spec_version" => "SpecVersion", "v2.state" => "State", + "v2.state_variable" => "StateVariable", + "v2.state_variable_properties" => "StateVariableProperties", + "v2.state_variable_type" => "StateVariableType", "v2.step" => "Step", "v2.step_display" => "StepDisplay", "v2.step_display_bounds" => "StepDisplayBounds", diff --git a/lib/datadog_api_client/v2/models/action_query.rb b/lib/datadog_api_client/v2/models/action_query.rb new file mode 100644 index 00000000000..d9263e27374 --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query.rb @@ -0,0 +1,198 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An action query. This query type is used to trigger an action, such as sending a HTTP request. + class ActionQuery + include BaseGenericModel + + # Events to listen for downstream of the action query. + attr_accessor :events + + # The ID of the action query. + attr_reader :id + + # A unique identifier for this action query. This name is also used to access the query's result throughout the app. + attr_reader :name + + # The properties of the action query. + attr_reader :properties + + # The action query type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'events' => :'events', + :'id' => :'id', + :'name' => :'name', + :'properties' => :'properties', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'events' => :'Array', + :'id' => :'UUID', + :'name' => :'String', + :'properties' => :'ActionQueryProperties', + :'type' => :'ActionQueryType' + } + 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::ActionQuery` 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?(:'events') + if (value = attributes[:'events']).is_a?(Array) + self.events = value + end + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + 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 @id.nil? + return false if @name.nil? + return false if @properties.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param properties [Object] Object to be assigned + # @!visibility private + def properties=(properties) + if properties.nil? + fail ArgumentError, 'invalid value for "properties", properties cannot be nil.' + end + @properties = properties + 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 && + events == o.events && + id == o.id && + name == o.name && + properties == o.properties && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [events, id, name, properties, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/action_query_condition.rb b/lib/datadog_api_client/v2/models/action_query_condition.rb new file mode 100644 index 00000000000..6071a3749f7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_condition.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 + # Whether to run this query. If specified, the query will only run if this condition evaluates to `true` in JavaScript and all other conditions are also met. + module ActionQueryCondition + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Boolean', + :'String' + ] + 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/action_query_debounce_in_ms.rb b/lib/datadog_api_client/v2/models/action_query_debounce_in_ms.rb new file mode 100644 index 00000000000..fec61bd8762 --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_debounce_in_ms.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 + # The minimum time in milliseconds that must pass before the query can be triggered again. This is useful for preventing accidental double-clicks from triggering the query multiple times. + module ActionQueryDebounceInMs + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Float', + :'String' + ] + 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/action_query_mocked_outputs.rb b/lib/datadog_api_client/v2/models/action_query_mocked_outputs.rb new file mode 100644 index 00000000000..9e53e50dcb1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_mocked_outputs.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 + # The mocked outputs of the action query. This is useful for testing the app without actually running the action. + module ActionQueryMockedOutputs + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'String', + :'ActionQueryMockedOutputsObject' + ] + 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/action_query_mocked_outputs_enabled.rb b/lib/datadog_api_client/v2/models/action_query_mocked_outputs_enabled.rb new file mode 100644 index 00000000000..c3e48600c2b --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_mocked_outputs_enabled.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 + # Whether to enable the mocked outputs for testing. + module ActionQueryMockedOutputsEnabled + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Boolean', + :'String' + ] + 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/action_query_mocked_outputs_object.rb b/lib/datadog_api_client/v2/models/action_query_mocked_outputs_object.rb new file mode 100644 index 00000000000..673f3778ed8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_mocked_outputs_object.rb @@ -0,0 +1,133 @@ +=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 mocked outputs of the action query. + class ActionQueryMockedOutputsObject + include BaseGenericModel + + # Whether to enable the mocked outputs for testing. + attr_reader :enabled + + # The mocked outputs of the action query, serialized as JSON. + attr_accessor :outputs + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'enabled' => :'enabled', + :'outputs' => :'outputs' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'enabled' => :'ActionQueryMockedOutputsEnabled', + :'outputs' => :'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::ActionQueryMockedOutputsObject` 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?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'outputs') + self.outputs = attributes[:'outputs'] + 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 @enabled.nil? + true + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + end + + # 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 && + enabled == o.enabled && + outputs == o.outputs && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [enabled, outputs, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/action_query_only_trigger_manually.rb b/lib/datadog_api_client/v2/models/action_query_only_trigger_manually.rb new file mode 100644 index 00000000000..8f2a979876b --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_only_trigger_manually.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 + # Determines when this query is executed. If set to `false`, the query will run when the app loads and whenever any query arguments change. If set to `true`, the query will only run when manually triggered from elsewhere in the app. + module ActionQueryOnlyTriggerManually + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Boolean', + :'String' + ] + 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/action_query_polling_interval_in_ms.rb b/lib/datadog_api_client/v2/models/action_query_polling_interval_in_ms.rb new file mode 100644 index 00000000000..52c43e40217 --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_polling_interval_in_ms.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 + # If specified, the app will poll the query at the specified interval in milliseconds. The minimum polling interval is 15 seconds. The query will only poll when the app's browser tab is active. + module ActionQueryPollingIntervalInMs + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Float', + :'String' + ] + 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/action_query_properties.rb b/lib/datadog_api_client/v2/models/action_query_properties.rb new file mode 100644 index 00000000000..91eda4d1921 --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_properties.rb @@ -0,0 +1,203 @@ +=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 properties of the action query. + class ActionQueryProperties + include BaseGenericModel + + # Whether to run this query. If specified, the query will only run if this condition evaluates to `true` in JavaScript and all other conditions are also met. + attr_accessor :condition + + # The minimum time in milliseconds that must pass before the query can be triggered again. This is useful for preventing accidental double-clicks from triggering the query multiple times. + attr_accessor :debounce_in_ms + + # The mocked outputs of the action query. This is useful for testing the app without actually running the action. + attr_accessor :mocked_outputs + + # Determines when this query is executed. If set to `false`, the query will run when the app loads and whenever any query arguments change. If set to `true`, the query will only run when manually triggered from elsewhere in the app. + attr_accessor :only_trigger_manually + + # The post-query transformation function, which is a JavaScript function that changes the query's `.outputs` property after the query's execution. + attr_accessor :outputs + + # If specified, the app will poll the query at the specified interval in milliseconds. The minimum polling interval is 15 seconds. The query will only poll when the app's browser tab is active. + attr_accessor :polling_interval_in_ms + + # Whether to prompt the user to confirm this query before it runs. + attr_accessor :requires_confirmation + + # Whether to display a toast to the user when the query returns an error. + attr_accessor :show_toast_on_error + + # The definition of the action query. + attr_reader :spec + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'condition' => :'condition', + :'debounce_in_ms' => :'debounceInMs', + :'mocked_outputs' => :'mockedOutputs', + :'only_trigger_manually' => :'onlyTriggerManually', + :'outputs' => :'outputs', + :'polling_interval_in_ms' => :'pollingIntervalInMs', + :'requires_confirmation' => :'requiresConfirmation', + :'show_toast_on_error' => :'showToastOnError', + :'spec' => :'spec' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'condition' => :'ActionQueryCondition', + :'debounce_in_ms' => :'ActionQueryDebounceInMs', + :'mocked_outputs' => :'ActionQueryMockedOutputs', + :'only_trigger_manually' => :'ActionQueryOnlyTriggerManually', + :'outputs' => :'String', + :'polling_interval_in_ms' => :'ActionQueryPollingIntervalInMs', + :'requires_confirmation' => :'ActionQueryRequiresConfirmation', + :'show_toast_on_error' => :'ActionQueryShowToastOnError', + :'spec' => :'ActionQuerySpec' + } + 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::ActionQueryProperties` 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?(:'condition') + self.condition = attributes[:'condition'] + end + + if attributes.key?(:'debounce_in_ms') + self.debounce_in_ms = attributes[:'debounce_in_ms'] + end + + if attributes.key?(:'mocked_outputs') + self.mocked_outputs = attributes[:'mocked_outputs'] + end + + if attributes.key?(:'only_trigger_manually') + self.only_trigger_manually = attributes[:'only_trigger_manually'] + end + + if attributes.key?(:'outputs') + self.outputs = attributes[:'outputs'] + end + + if attributes.key?(:'polling_interval_in_ms') + self.polling_interval_in_ms = attributes[:'polling_interval_in_ms'] + end + + if attributes.key?(:'requires_confirmation') + self.requires_confirmation = attributes[:'requires_confirmation'] + end + + if attributes.key?(:'show_toast_on_error') + self.show_toast_on_error = attributes[:'show_toast_on_error'] + end + + if attributes.key?(:'spec') + self.spec = attributes[:'spec'] + 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 @spec.nil? + true + end + + # Custom attribute writer method with validation + # @param spec [Object] Object to be assigned + # @!visibility private + def spec=(spec) + if spec.nil? + fail ArgumentError, 'invalid value for "spec", spec cannot be nil.' + end + @spec = spec + 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 && + condition == o.condition && + debounce_in_ms == o.debounce_in_ms && + mocked_outputs == o.mocked_outputs && + only_trigger_manually == o.only_trigger_manually && + outputs == o.outputs && + polling_interval_in_ms == o.polling_interval_in_ms && + requires_confirmation == o.requires_confirmation && + show_toast_on_error == o.show_toast_on_error && + spec == o.spec && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [condition, debounce_in_ms, mocked_outputs, only_trigger_manually, outputs, polling_interval_in_ms, requires_confirmation, show_toast_on_error, spec, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/action_query_requires_confirmation.rb b/lib/datadog_api_client/v2/models/action_query_requires_confirmation.rb new file mode 100644 index 00000000000..7e2a6360dee --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_requires_confirmation.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 + # Whether to prompt the user to confirm this query before it runs. + module ActionQueryRequiresConfirmation + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Boolean', + :'String' + ] + 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/action_query_show_toast_on_error.rb b/lib/datadog_api_client/v2/models/action_query_show_toast_on_error.rb new file mode 100644 index 00000000000..7ba6e249aa3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_show_toast_on_error.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 + # Whether to display a toast to the user when the query returns an error. + module ActionQueryShowToastOnError + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Boolean', + :'String' + ] + 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/action_query_spec.rb b/lib/datadog_api_client/v2/models/action_query_spec.rb new file mode 100644 index 00000000000..d91a9e35cd4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_spec.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 + # The definition of the action query. + module ActionQuerySpec + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'String', + :'ActionQuerySpecObject' + ] + 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/action_query_spec_inputs.rb b/lib/datadog_api_client/v2/models/action_query_spec_inputs.rb new file mode 100644 index 00000000000..e801237b927 --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_spec_inputs.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 + # The inputs to the action query. These are the values that are passed to the action when it is triggered. + module ActionQuerySpecInputs + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'String', + :'ActionQuerySpecInput' + ] + 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/action_query_spec_object.rb b/lib/datadog_api_client/v2/models/action_query_spec_object.rb new file mode 100644 index 00000000000..3ef871ae1fa --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_spec_object.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 + # The action query spec object. + class ActionQuerySpecObject + include BaseGenericModel + + # The ID of the custom connection to use for this action query. + attr_reader :connection_id + + # The fully qualified name of the action type. + attr_reader :fqn + + # The inputs to the action query. These are the values that are passed to the action when it is triggered. + attr_accessor :inputs + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'connection_id' => :'connectionId', + :'fqn' => :'fqn', + :'inputs' => :'inputs' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'connection_id' => :'UUID', + :'fqn' => :'String', + :'inputs' => :'ActionQuerySpecInputs' + } + 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::ActionQuerySpecObject` 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?(:'connection_id') + self.connection_id = attributes[:'connection_id'] + end + + if attributes.key?(:'fqn') + self.fqn = attributes[:'fqn'] + end + + if attributes.key?(:'inputs') + self.inputs = attributes[:'inputs'] + 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 @connection_id.nil? + return false if @fqn.nil? + true + end + + # Custom attribute writer method with validation + # @param connection_id [Object] Object to be assigned + # @!visibility private + def connection_id=(connection_id) + if connection_id.nil? + fail ArgumentError, 'invalid value for "connection_id", connection_id cannot be nil.' + end + @connection_id = connection_id + end + + # Custom attribute writer method with validation + # @param fqn [Object] Object to be assigned + # @!visibility private + def fqn=(fqn) + if fqn.nil? + fail ArgumentError, 'invalid value for "fqn", fqn cannot be nil.' + end + @fqn = fqn + 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 && + connection_id == o.connection_id && + fqn == o.fqn && + inputs == o.inputs && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [connection_id, fqn, inputs, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/action_query_type.rb b/lib/datadog_api_client/v2/models/action_query_type.rb new file mode 100644 index 00000000000..fc3403ef636 --- /dev/null +++ b/lib/datadog_api_client/v2/models/action_query_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 action query type. + class ActionQueryType + include BaseEnumModel + + ACTION = "action".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/data_transform.rb b/lib/datadog_api_client/v2/models/data_transform.rb new file mode 100644 index 00000000000..4ab2c194616 --- /dev/null +++ b/lib/datadog_api_client/v2/models/data_transform.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A data transformer, which is custom JavaScript code that executes and transforms data when its inputs change. + class DataTransform + include BaseGenericModel + + # The ID of the data transformer. + attr_reader :id + + # A unique identifier for this data transformer. This name is also used to access the transformer's result throughout the app. + attr_reader :name + + # The properties of the data transformer. + attr_reader :properties + + # The data transform type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'properties' => :'properties', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'UUID', + :'name' => :'String', + :'properties' => :'DataTransformProperties', + :'type' => :'DataTransformType' + } + 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::DataTransform` 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + 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 @id.nil? + return false if @name.nil? + return false if @properties.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param properties [Object] Object to be assigned + # @!visibility private + def properties=(properties) + if properties.nil? + fail ArgumentError, 'invalid value for "properties", properties cannot be nil.' + end + @properties = properties + 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 && + id == o.id && + name == o.name && + properties == o.properties && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, name, properties, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/data_transform_properties.rb b/lib/datadog_api_client/v2/models/data_transform_properties.rb new file mode 100644 index 00000000000..9080a602daa --- /dev/null +++ b/lib/datadog_api_client/v2/models/data_transform_properties.rb @@ -0,0 +1,105 @@ +=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 properties of the data transformer. + class DataTransformProperties + include BaseGenericModel + + # A JavaScript function that returns the transformed data. + attr_accessor :outputs + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'outputs' => :'outputs' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'outputs' => :'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::DataTransformProperties` 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?(:'outputs') + self.outputs = attributes[:'outputs'] + 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 && + outputs == o.outputs && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [outputs, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/query_type.rb b/lib/datadog_api_client/v2/models/data_transform_type.rb similarity index 84% rename from lib/datadog_api_client/v2/models/query_type.rb rename to lib/datadog_api_client/v2/models/data_transform_type.rb index a73c621c67f..6cc272a14e8 100644 --- a/lib/datadog_api_client/v2/models/query_type.rb +++ b/lib/datadog_api_client/v2/models/data_transform_type.rb @@ -17,12 +17,10 @@ require 'time' module DatadogAPIClient::V2 - # The query type. - class QueryType + # The data transform type. + class DataTransformType include BaseEnumModel - ACTION = "action".freeze - STATEVARIABLE = "stateVariable".freeze DATATRANSFORM = "dataTransform".freeze end end diff --git a/lib/datadog_api_client/v2/models/query.rb b/lib/datadog_api_client/v2/models/query.rb index 17dca357c15..4974bb40515 100644 --- a/lib/datadog_api_client/v2/models/query.rb +++ b/lib/datadog_api_client/v2/models/query.rb @@ -17,171 +17,48 @@ require 'time' module DatadogAPIClient::V2 - # A query used by an app. This can take the form of an external action, a data transformation, or a state variable change. - class Query - include BaseGenericModel - - # Events to listen for downstream of the query. - attr_accessor :events - - # The ID of the query. - attr_reader :id - - # The name of the query. The name must be unique within the app and is visible in the app editor. - attr_reader :name - - # The properties of the query. The properties vary depending on the query type. - attr_accessor :properties - - # The query type. - attr_reader :type - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'events' => :'events', - :'id' => :'id', - :'name' => :'name', - :'properties' => :'properties', - :'type' => :'type' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'events' => :'Array', - :'id' => :'UUID', - :'name' => :'String', - :'properties' => :'Object', - :'type' => :'QueryType' - } - 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::Query` initialize method" + # A data query used by an app. This can take the form of an external action, a data transformation, or a state variable. + module Query + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'ActionQuery', + :'DataTransform', + :'StateVariable' + ] 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?(:'events') - if (value = attributes[:'events']).is_a?(Array) - self.events = value + # 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 - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'properties') - self.properties = attributes[:'properties'] - 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 @id.nil? - return false if @name.nil? - return false if @type.nil? - true - end - - # Custom attribute writer method with validation - # @param id [Object] Object to be assigned - # @!visibility private - def id=(id) - if id.nil? - fail ArgumentError, 'invalid value for "id", id cannot be nil.' - end - @id = id - end - - # Custom attribute writer method with validation - # @param name [Object] Object to be assigned - # @!visibility private - def name=(name) - if name.nil? - fail ArgumentError, 'invalid value for "name", name cannot be nil.' - end - @name = name - end - - # Custom attribute writer method with validation - # @param 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}")) + 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 && - events == o.events && - id == o.id && - name == o.name && - properties == o.properties && - type == o.type && - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [events, id, name, properties, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/state_variable.rb b/lib/datadog_api_client/v2/models/state_variable.rb new file mode 100644 index 00000000000..c1aaefa8a95 --- /dev/null +++ b/lib/datadog_api_client/v2/models/state_variable.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A variable, which can be set and read by other components in the app. + class StateVariable + include BaseGenericModel + + # The ID of the state variable. + attr_reader :id + + # A unique identifier for this state variable. This name is also used to access the variable's value throughout the app. + attr_reader :name + + # The properties of the state variable. + attr_reader :properties + + # The state variable type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'properties' => :'properties', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'UUID', + :'name' => :'String', + :'properties' => :'StateVariableProperties', + :'type' => :'StateVariableType' + } + 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::StateVariable` 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + 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 @id.nil? + return false if @name.nil? + return false if @properties.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param properties [Object] Object to be assigned + # @!visibility private + def properties=(properties) + if properties.nil? + fail ArgumentError, 'invalid value for "properties", properties cannot be nil.' + end + @properties = properties + 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 && + id == o.id && + name == o.name && + properties == o.properties && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, name, properties, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/state_variable_properties.rb b/lib/datadog_api_client/v2/models/state_variable_properties.rb new file mode 100644 index 00000000000..48f4cddc41e --- /dev/null +++ b/lib/datadog_api_client/v2/models/state_variable_properties.rb @@ -0,0 +1,105 @@ +=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 properties of the state variable. + class StateVariableProperties + include BaseGenericModel + + # The default value of the state variable. + attr_accessor :default_value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'default_value' => :'defaultValue' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'default_value' => :'Object' + } + 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::StateVariableProperties` 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?(:'default_value') + self.default_value = attributes[:'default_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 && + default_value == o.default_value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [default_value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/state_variable_type.rb b/lib/datadog_api_client/v2/models/state_variable_type.rb new file mode 100644 index 00000000000..e828bf50dbd --- /dev/null +++ b/lib/datadog_api_client/v2/models/state_variable_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 state variable type. + class StateVariableType + include BaseEnumModel + + STATEVARIABLE = "stateVariable".freeze + end +end