diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb715496a..1fe0e1f167d1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -23651,6 +23651,61 @@ components: required: - type type: object + GlobalVariableData: + description: Synthetics global variable data. Wrapper around the global variable + object. + properties: + attributes: + $ref: '#/components/schemas/SyntheticsGlobalVariable' + id: + description: Global variable identifier. + type: string + type: + $ref: '#/components/schemas/GlobalVariableType' + type: object + GlobalVariableJsonPatchRequest: + description: JSON Patch request for global variable. + properties: + data: + $ref: '#/components/schemas/GlobalVariableJsonPatchRequestData' + required: + - data + type: object + GlobalVariableJsonPatchRequestData: + properties: + attributes: + $ref: '#/components/schemas/GlobalVariableJsonPatchRequestDataAttributes' + type: + $ref: '#/components/schemas/GlobalVariableJsonPatchType' + type: object + GlobalVariableJsonPatchRequestDataAttributes: + properties: + json_patch: + description: JSON Patch operations following RFC 6902. + items: + $ref: '#/components/schemas/JsonPatchOperation' + type: array + type: object + GlobalVariableJsonPatchType: + description: Global variable JSON Patch type. + enum: + - global_variables_json_patch + type: string + x-enum-varnames: + - GLOBAL_VARIABLES_JSON_PATCH + GlobalVariableResponse: + description: Global variable response. + properties: + data: + $ref: '#/components/schemas/GlobalVariableData' + type: object + GlobalVariableType: + description: Global variable type. + enum: + - global_variables + type: string + x-enum-varnames: + - GLOBAL_VARIABLES GoogleMeetConfigurationReference: description: A reference to a Google Meet Configuration resource. nullable: true @@ -28404,6 +28459,40 @@ components: - to - index type: object + JsonPatchOperation: + description: A JSON Patch operation as per RFC 6902. + properties: + op: + $ref: '#/components/schemas/JsonPatchOperationOp' + path: + description: A JSON Pointer path (e.g., "/name", "/value/secure"). + example: /name + type: string + value: + description: The value to use for the operation (not applicable for "remove" + and "test" operations). + required: + - op + - path + type: object + JsonPatchOperationOp: + description: The operation to perform. + enum: + - add + - remove + - replace + - move + - copy + - test + example: add + type: string + x-enum-varnames: + - ADD + - REMOVE + - REPLACE + - MOVE + - COPY + - TEST KindAttributes: description: Kind attributes. properties: @@ -51322,6 +51411,178 @@ components: format: double type: number type: object + SyntheticsGlobalVariable: + description: Synthetic global variable. + properties: + attributes: + $ref: '#/components/schemas/SyntheticsGlobalVariableAttributes' + description: + description: Description of the global variable. + example: Example description + type: string + id: + description: Unique identifier of the global variable. + readOnly: true + type: string + is_fido: + description: Determines if the global variable is a FIDO variable. + type: boolean + is_totp: + description: Determines if the global variable is a TOTP/MFA variable. + type: boolean + name: + description: Name of the global variable. Unique across Synthetic global + variables. + example: MY_VARIABLE + type: string + parse_test_options: + $ref: '#/components/schemas/SyntheticsGlobalVariableParseTestOptions' + parse_test_public_id: + description: A Synthetic test ID to use as a test to generate the variable + value. + example: abc-def-123 + type: string + tags: + description: Tags of the global variable. + example: + - team:front + - test:workflow-1 + items: + description: Tag name. + type: string + type: array + value: + $ref: '#/components/schemas/SyntheticsGlobalVariableValue' + required: + - description + - name + - tags + - value + type: object + SyntheticsGlobalVariableAttributes: + description: Attributes of the global variable. + properties: + restricted_roles: + $ref: '#/components/schemas/SyntheticsRestrictedRoles' + type: object + SyntheticsGlobalVariableOptions: + description: Options for the Global Variable for MFA. + properties: + totp_parameters: + $ref: '#/components/schemas/SyntheticsGlobalVariableTOTPParameters' + type: object + SyntheticsGlobalVariableParseTestOptions: + description: Parser options to use for retrieving a Synthetic global variable + from a Synthetic test. Used in conjunction with `parse_test_public_id`. + properties: + field: + description: When type is `http_header`, name of the header to use to extract + the value. + example: content-type + type: string + localVariableName: + description: When type is `local_variable`, name of the local variable to + use to extract the value. + example: LOCAL_VARIABLE + type: string + parser: + $ref: '#/components/schemas/SyntheticsVariableParser' + type: + $ref: '#/components/schemas/SyntheticsGlobalVariableParseTestOptionsType' + required: + - type + type: object + SyntheticsGlobalVariableParseTestOptionsType: + description: Type of value to extract from a test for a Synthetic global variable. + enum: + - http_body + - http_header + - http_status_code + - local_variable + example: http_body + type: string + x-enum-varnames: + - HTTP_BODY + - HTTP_HEADER + - HTTP_STATUS_CODE + - LOCAL_VARIABLE + SyntheticsGlobalVariableParserType: + description: Type of parser for a Synthetic global variable from a synthetics + test. + enum: + - raw + - json_path + - regex + - x_path + example: raw + type: string + x-enum-varnames: + - RAW + - JSON_PATH + - REGEX + - X_PATH + SyntheticsGlobalVariableTOTPParameters: + description: Parameters for the TOTP/MFA variable + properties: + digits: + description: Number of digits for the OTP code. + example: 6 + format: int32 + maximum: 10 + minimum: 4 + type: integer + refresh_interval: + description: Interval for which to refresh the token (in seconds). + example: 30 + format: int32 + maximum: 999 + minimum: 0 + type: integer + type: object + SyntheticsGlobalVariableValue: + description: Value of the global variable. + example: + secure: true + value: value + properties: + options: + $ref: '#/components/schemas/SyntheticsGlobalVariableOptions' + secure: + description: Determines if the value of the variable is hidden. + type: boolean + value: + description: 'Value of the global variable. When reading a global variable, + + the value will not be present if the variable is hidden with the `secure` + property.' + example: example-value + type: string + type: object + SyntheticsRestrictedRoles: + description: A list of role identifiers that can be pulled from the Roles API, + for restricting read and write access. + example: + - xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + items: + description: UUID for a role. + example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + type: string + type: array + SyntheticsVariableParser: + description: Details of the parser to use for the global variable. + example: + type: regex + value: .* + properties: + type: + $ref: '#/components/schemas/SyntheticsGlobalVariableParserType' + value: + description: Regex or JSON path used for the parser. Not used with type + `raw`. + type: string + required: + - type + type: object TableResultV2: description: A reference table resource containing its full configuration and state. @@ -81694,6 +81955,60 @@ paths: operator: OR permissions: - billing_edit + /api/v2/synthetics/variables/{variable_id}/jsonpatch: + patch: + description: 'Patch a global variable using JSON Patch (RFC 6902). + + This endpoint allows partial updates to a global variable by specifying only + the fields to modify. + + + Common operations include: + + - Replace field values: `{"op": "replace", "path": "/name", "value": "new_name"}` + + - Update nested values: `{"op": "replace", "path": "/value/value", "value": + "new_value"}` + + - Add/update tags: `{"op": "add", "path": "/tags/-", "value": "new_tag"}` + + - Remove fields: `{"op": "remove", "path": "/description"}`' + operationId: PatchGlobalVariable + parameters: + - description: The ID of the global variable. + in: path + name: variable_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GlobalVariableJsonPatchRequest' + description: JSON Patch document with operations to apply. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GlobalVariableResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Patch a global variable + tags: + - Synthetics + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - synthetics_global_variable_write /api/v2/tags/enrichment: get: description: List all tag pipeline rulesets - Retrieve a list of all tag pipeline diff --git a/examples/v2/synthetics/PatchGlobalVariable.rb b/examples/v2/synthetics/PatchGlobalVariable.rb new file mode 100644 index 000000000000..af3fe628954e --- /dev/null +++ b/examples/v2/synthetics/PatchGlobalVariable.rb @@ -0,0 +1,19 @@ +# Patch a global variable returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SyntheticsAPI.new + +body = DatadogAPIClient::V2::GlobalVariableJsonPatchRequest.new({ + data: DatadogAPIClient::V2::GlobalVariableJsonPatchRequestData.new({ + attributes: DatadogAPIClient::V2::GlobalVariableJsonPatchRequestDataAttributes.new({ + json_patch: [ + DatadogAPIClient::V2::JsonPatchOperation.new({ + op: DatadogAPIClient::V2::JsonPatchOperationOp::ADD, + path: "/name", + }), + ], + }), + type: DatadogAPIClient::V2::GlobalVariableJsonPatchType::GLOBAL_VARIABLES_JSON_PATCH, + }), +}) +p api_instance.patch_global_variable("variable_id", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 15e1897d6c51..44f87e752f23 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3090,6 +3090,10 @@ "v2.SetOnDemandConcurrencyCap" => { "body" => "OnDemandConcurrencyCapAttributes", }, + "v2.PatchGlobalVariable" => { + "variable_id" => "String", + "body" => "GlobalVariableJsonPatchRequest", + }, "v2.ListTeams" => { "page_number" => "Integer", "page_size" => "Integer", diff --git a/features/v2/synthetics.feature b/features/v2/synthetics.feature index 73efa73ec291..133993b11b7b 100644 --- a/features/v2/synthetics.feature +++ b/features/v2/synthetics.feature @@ -20,6 +20,30 @@ Feature: Synthetics When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/synthetics-managing + Scenario: Patch a global variable returns "Bad Request" response + Given new "PatchGlobalVariable" request + And request contains "variable_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"json_patch": [{"op": "add", "path": "/name"}]}, "type": "global_variables_json_patch"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/synthetics-managing + Scenario: Patch a global variable returns "Not Found" response + Given new "PatchGlobalVariable" request + And request contains "variable_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"json_patch": [{"op": "add", "path": "/name"}]}, "type": "global_variables_json_patch"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/synthetics-managing + Scenario: Patch a global variable returns "OK" response + Given new "PatchGlobalVariable" request + And request contains "variable_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"json_patch": [{"op": "add", "path": "/name"}]}, "type": "global_variables_json_patch"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/synthetics-managing Scenario: Save new value for on-demand concurrency cap returns "OK" response Given new "SetOnDemandConcurrencyCap" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 3799e64e630d..f4cbbb2baae9 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -4284,6 +4284,12 @@ "type": "safe" } }, + "PatchGlobalVariable": { + "tag": "Synthetics", + "undo": { + "type": "safe" + } + }, "ListTagPipelinesRulesets": { "tag": "Cloud Cost Management", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 427fdcf8659c..c4853888ce97 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2378,6 +2378,13 @@ def overrides "v2.gitlab_integration" => "GitlabIntegration", "v2.gitlab_integration_type" => "GitlabIntegrationType", "v2.gitlab_integration_update" => "GitlabIntegrationUpdate", + "v2.global_variable_data" => "GlobalVariableData", + "v2.global_variable_json_patch_request" => "GlobalVariableJsonPatchRequest", + "v2.global_variable_json_patch_request_data" => "GlobalVariableJsonPatchRequestData", + "v2.global_variable_json_patch_request_data_attributes" => "GlobalVariableJsonPatchRequestDataAttributes", + "v2.global_variable_json_patch_type" => "GlobalVariableJsonPatchType", + "v2.global_variable_response" => "GlobalVariableResponse", + "v2.global_variable_type" => "GlobalVariableType", "v2.google_meet_configuration_reference" => "GoogleMeetConfigurationReference", "v2.google_meet_configuration_reference_data" => "GoogleMeetConfigurationReferenceData", "v2.grey_noise_api_key" => "GreyNoiseAPIKey", @@ -2676,6 +2683,8 @@ def overrides "v2.jsonapi_error_item" => "JSONAPIErrorItem", "v2.jsonapi_error_item_source" => "JSONAPIErrorItemSource", "v2.jsonapi_error_response" => "JSONAPIErrorResponse", + "v2.json_patch_operation" => "JsonPatchOperation", + "v2.json_patch_operation_op" => "JsonPatchOperationOp", "v2.kind_attributes" => "KindAttributes", "v2.kind_data" => "KindData", "v2.kind_metadata" => "KindMetadata", @@ -4179,6 +4188,15 @@ def overrides "v2.step" => "Step", "v2.step_display" => "StepDisplay", "v2.step_display_bounds" => "StepDisplayBounds", + "v2.synthetics_global_variable" => "SyntheticsGlobalVariable", + "v2.synthetics_global_variable_attributes" => "SyntheticsGlobalVariableAttributes", + "v2.synthetics_global_variable_options" => "SyntheticsGlobalVariableOptions", + "v2.synthetics_global_variable_parser_type" => "SyntheticsGlobalVariableParserType", + "v2.synthetics_global_variable_parse_test_options" => "SyntheticsGlobalVariableParseTestOptions", + "v2.synthetics_global_variable_parse_test_options_type" => "SyntheticsGlobalVariableParseTestOptionsType", + "v2.synthetics_global_variable_totp_parameters" => "SyntheticsGlobalVariableTOTPParameters", + "v2.synthetics_global_variable_value" => "SyntheticsGlobalVariableValue", + "v2.synthetics_variable_parser" => "SyntheticsVariableParser", "v2.table_result_v2" => "TableResultV2", "v2.table_result_v2_array" => "TableResultV2Array", "v2.table_result_v2_data" => "TableResultV2Data", diff --git a/lib/datadog_api_client/v2/api/synthetics_api.rb b/lib/datadog_api_client/v2/api/synthetics_api.rb index 449dfcfe3f8a..4132779827f4 100644 --- a/lib/datadog_api_client/v2/api/synthetics_api.rb +++ b/lib/datadog_api_client/v2/api/synthetics_api.rb @@ -83,6 +83,85 @@ def get_on_demand_concurrency_cap_with_http_info(opts = {}) return data, status_code, headers end + # Patch a global variable. + # + # @see #patch_global_variable_with_http_info + def patch_global_variable(variable_id, body, opts = {}) + data, _status_code, _headers = patch_global_variable_with_http_info(variable_id, body, opts) + data + end + + # Patch a global variable. + # + # Patch a global variable using JSON Patch (RFC 6902). + # This endpoint allows partial updates to a global variable by specifying only the fields to modify. + # + # Common operations include: + # - Replace field values: `{"op": "replace", "path": "/name", "value": "new_name"}` + # - Update nested values: `{"op": "replace", "path": "/value/value", "value": "new_value"}` + # - Add/update tags: `{"op": "add", "path": "/tags/-", "value": "new_tag"}` + # - Remove fields: `{"op": "remove", "path": "/description"}` + # + # @param variable_id [String] The ID of the global variable. + # @param body [GlobalVariableJsonPatchRequest] JSON Patch document with operations to apply. + # @param opts [Hash] the optional parameters + # @return [Array<(GlobalVariableResponse, Integer, Hash)>] GlobalVariableResponse data, response status code and response headers + def patch_global_variable_with_http_info(variable_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SyntheticsAPI.patch_global_variable ...' + end + # verify the required parameter 'variable_id' is set + if @api_client.config.client_side_validation && variable_id.nil? + fail ArgumentError, "Missing the required parameter 'variable_id' when calling SyntheticsAPI.patch_global_variable" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling SyntheticsAPI.patch_global_variable" + end + # resource path + local_var_path = '/api/v2/synthetics/variables/{variable_id}/jsonpatch'.sub('{variable_id}', CGI.escape(variable_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'GlobalVariableResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :patch_global_variable, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SyntheticsAPI#patch_global_variable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Save new value for on-demand concurrency cap. # # @see #set_on_demand_concurrency_cap_with_http_info diff --git a/lib/datadog_api_client/v2/models/global_variable_data.rb b/lib/datadog_api_client/v2/models/global_variable_data.rb new file mode 100644 index 000000000000..4a6e26450eb2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/global_variable_data.rb @@ -0,0 +1,125 @@ +=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 + # Synthetics global variable data. Wrapper around the global variable object. + class GlobalVariableData + include BaseGenericModel + + # Synthetic global variable. + attr_accessor :attributes + + # Global variable identifier. + attr_accessor :id + + # Global variable type. + attr_accessor :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' => :'SyntheticsGlobalVariable', + :'id' => :'String', + :'type' => :'GlobalVariableType' + } + 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::GlobalVariableData` 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 + + # 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/global_variable_json_patch_request.rb b/lib/datadog_api_client/v2/models/global_variable_json_patch_request.rb new file mode 100644 index 000000000000..8a4616e7f61a --- /dev/null +++ b/lib/datadog_api_client/v2/models/global_variable_json_patch_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 + # JSON Patch request for global variable. + class GlobalVariableJsonPatchRequest + include BaseGenericModel + + # + 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' => :'GlobalVariableJsonPatchRequestData' + } + 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::GlobalVariableJsonPatchRequest` 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/global_variable_json_patch_request_data.rb b/lib/datadog_api_client/v2/models/global_variable_json_patch_request_data.rb new file mode 100644 index 000000000000..27539d01ef69 --- /dev/null +++ b/lib/datadog_api_client/v2/models/global_variable_json_patch_request_data.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 + # + class GlobalVariableJsonPatchRequestData + include BaseGenericModel + + # + attr_accessor :attributes + + # Global variable JSON Patch type. + attr_accessor :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' => :'GlobalVariableJsonPatchRequestDataAttributes', + :'type' => :'GlobalVariableJsonPatchType' + } + 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::GlobalVariableJsonPatchRequestData` 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 + + # 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/global_variable_json_patch_request_data_attributes.rb b/lib/datadog_api_client/v2/models/global_variable_json_patch_request_data_attributes.rb new file mode 100644 index 000000000000..1ba82b51b97a --- /dev/null +++ b/lib/datadog_api_client/v2/models/global_variable_json_patch_request_data_attributes.rb @@ -0,0 +1,107 @@ +=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 + # + class GlobalVariableJsonPatchRequestDataAttributes + include BaseGenericModel + + # JSON Patch operations following RFC 6902. + attr_accessor :json_patch + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'json_patch' => :'json_patch' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'json_patch' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GlobalVariableJsonPatchRequestDataAttributes` 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?(:'json_patch') + if (value = attributes[:'json_patch']).is_a?(Array) + self.json_patch = value + end + 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 && + json_patch == o.json_patch && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [json_patch, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/global_variable_json_patch_type.rb b/lib/datadog_api_client/v2/models/global_variable_json_patch_type.rb new file mode 100644 index 000000000000..2dc1642f61f1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/global_variable_json_patch_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 + # Global variable JSON Patch type. + class GlobalVariableJsonPatchType + include BaseEnumModel + + GLOBAL_VARIABLES_JSON_PATCH = "global_variables_json_patch".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/global_variable_response.rb b/lib/datadog_api_client/v2/models/global_variable_response.rb new file mode 100644 index 000000000000..6988d88613c3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/global_variable_response.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 + # Global variable response. + class GlobalVariableResponse + include BaseGenericModel + + # Synthetics global variable data. Wrapper around the global variable object. + attr_accessor :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' => :'GlobalVariableData' + } + 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::GlobalVariableResponse` 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 + + # 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/global_variable_type.rb b/lib/datadog_api_client/v2/models/global_variable_type.rb new file mode 100644 index 000000000000..db2f15e0426d --- /dev/null +++ b/lib/datadog_api_client/v2/models/global_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 + # Global variable type. + class GlobalVariableType + include BaseEnumModel + + GLOBAL_VARIABLES = "global_variables".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/json_patch_operation.rb b/lib/datadog_api_client/v2/models/json_patch_operation.rb new file mode 100644 index 000000000000..9e4d24be5b98 --- /dev/null +++ b/lib/datadog_api_client/v2/models/json_patch_operation.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 + # A JSON Patch operation as per RFC 6902. + class JsonPatchOperation + include BaseGenericModel + + # The operation to perform. + attr_reader :op + + # A JSON Pointer path (e.g., "/name", "/value/secure"). + attr_reader :path + + # The value to use for the operation (not applicable for "remove" and "test" operations). + attr_accessor :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'op' => :'op', + :'path' => :'path', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'op' => :'JsonPatchOperationOp', + :'path' => :'String', + :'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::JsonPatchOperation` 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?(:'op') + self.op = attributes[:'op'] + end + + if attributes.key?(:'path') + self.path = attributes[:'path'] + 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 @op.nil? + return false if @path.nil? + true + end + + # Custom attribute writer method with validation + # @param op [Object] Object to be assigned + # @!visibility private + def op=(op) + if op.nil? + fail ArgumentError, 'invalid value for "op", op cannot be nil.' + end + @op = op + end + + # Custom attribute writer method with validation + # @param path [Object] Object to be assigned + # @!visibility private + def path=(path) + if path.nil? + fail ArgumentError, 'invalid value for "path", path cannot be nil.' + end + @path = path + 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 && + op == o.op && + path == o.path && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [op, path, value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/json_patch_operation_op.rb b/lib/datadog_api_client/v2/models/json_patch_operation_op.rb new file mode 100644 index 000000000000..dc235cd446b8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/json_patch_operation_op.rb @@ -0,0 +1,31 @@ +=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 operation to perform. + class JsonPatchOperationOp + include BaseEnumModel + + ADD = "add".freeze + REMOVE = "remove".freeze + REPLACE = "replace".freeze + MOVE = "move".freeze + COPY = "copy".freeze + TEST = "test".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_global_variable.rb b/lib/datadog_api_client/v2/models/synthetics_global_variable.rb new file mode 100644 index 000000000000..476f255d5e34 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_global_variable.rb @@ -0,0 +1,248 @@ +=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 + # Synthetic global variable. + class SyntheticsGlobalVariable + include BaseGenericModel + + # Attributes of the global variable. + attr_accessor :attributes + + # Description of the global variable. + attr_reader :description + + # Unique identifier of the global variable. + attr_accessor :id + + # Determines if the global variable is a FIDO variable. + attr_accessor :is_fido + + # Determines if the global variable is a TOTP/MFA variable. + attr_accessor :is_totp + + # Name of the global variable. Unique across Synthetic global variables. + attr_reader :name + + # Parser options to use for retrieving a Synthetic global variable from a Synthetic test. Used in conjunction with `parse_test_public_id`. + attr_accessor :parse_test_options + + # A Synthetic test ID to use as a test to generate the variable value. + attr_accessor :parse_test_public_id + + # Tags of the global variable. + attr_reader :tags + + # Value of the global variable. + attr_reader :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'description' => :'description', + :'id' => :'id', + :'is_fido' => :'is_fido', + :'is_totp' => :'is_totp', + :'name' => :'name', + :'parse_test_options' => :'parse_test_options', + :'parse_test_public_id' => :'parse_test_public_id', + :'tags' => :'tags', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SyntheticsGlobalVariableAttributes', + :'description' => :'String', + :'id' => :'String', + :'is_fido' => :'Boolean', + :'is_totp' => :'Boolean', + :'name' => :'String', + :'parse_test_options' => :'SyntheticsGlobalVariableParseTestOptions', + :'parse_test_public_id' => :'String', + :'tags' => :'Array', + :'value' => :'SyntheticsGlobalVariableValue' + } + 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::SyntheticsGlobalVariable` 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?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'is_fido') + self.is_fido = attributes[:'is_fido'] + end + + if attributes.key?(:'is_totp') + self.is_totp = attributes[:'is_totp'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'parse_test_options') + self.parse_test_options = attributes[:'parse_test_options'] + end + + if attributes.key?(:'parse_test_public_id') + self.parse_test_public_id = attributes[:'parse_test_public_id'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + 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 @description.nil? + return false if @name.nil? + return false if @tags.nil? + return false if @value.nil? + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + 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 tags [Object] Object to be assigned + # @!visibility private + def tags=(tags) + if tags.nil? + fail ArgumentError, 'invalid value for "tags", tags cannot be nil.' + end + @tags = tags + end + + # Custom attribute writer method with validation + # @param 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 && + attributes == o.attributes && + description == o.description && + id == o.id && + is_fido == o.is_fido && + is_totp == o.is_totp && + name == o.name && + parse_test_options == o.parse_test_options && + parse_test_public_id == o.parse_test_public_id && + tags == o.tags && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, description, id, is_fido, is_totp, name, parse_test_options, parse_test_public_id, tags, value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_global_variable_attributes.rb b/lib/datadog_api_client/v2/models/synthetics_global_variable_attributes.rb new file mode 100644 index 000000000000..bbd86d16c15e --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_global_variable_attributes.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the global variable. + class SyntheticsGlobalVariableAttributes + include BaseGenericModel + + # A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. + attr_accessor :restricted_roles + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'restricted_roles' => :'restricted_roles' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'restricted_roles' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsGlobalVariableAttributes` 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?(:'restricted_roles') + if (value = attributes[:'restricted_roles']).is_a?(Array) + self.restricted_roles = value + end + 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 && + restricted_roles == o.restricted_roles && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [restricted_roles, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_global_variable_options.rb b/lib/datadog_api_client/v2/models/synthetics_global_variable_options.rb new file mode 100644 index 000000000000..9bf3ae52ae34 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_global_variable_options.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 + # Options for the Global Variable for MFA. + class SyntheticsGlobalVariableOptions + include BaseGenericModel + + # Parameters for the TOTP/MFA variable + attr_accessor :totp_parameters + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'totp_parameters' => :'totp_parameters' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'totp_parameters' => :'SyntheticsGlobalVariableTOTPParameters' + } + 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::SyntheticsGlobalVariableOptions` 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?(:'totp_parameters') + self.totp_parameters = attributes[:'totp_parameters'] + 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 && + totp_parameters == o.totp_parameters && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [totp_parameters, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_global_variable_parse_test_options.rb b/lib/datadog_api_client/v2/models/synthetics_global_variable_parse_test_options.rb new file mode 100644 index 000000000000..1a4f289f0269 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_global_variable_parse_test_options.rb @@ -0,0 +1,153 @@ +=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 + # Parser options to use for retrieving a Synthetic global variable from a Synthetic test. Used in conjunction with `parse_test_public_id`. + class SyntheticsGlobalVariableParseTestOptions + include BaseGenericModel + + # When type is `http_header`, name of the header to use to extract the value. + attr_accessor :field + + # When type is `local_variable`, name of the local variable to use to extract the value. + attr_accessor :local_variable_name + + # Details of the parser to use for the global variable. + attr_accessor :parser + + # Type of value to extract from a test for a Synthetic global variable. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'field' => :'field', + :'local_variable_name' => :'localVariableName', + :'parser' => :'parser', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'field' => :'String', + :'local_variable_name' => :'String', + :'parser' => :'SyntheticsVariableParser', + :'type' => :'SyntheticsGlobalVariableParseTestOptionsType' + } + 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::SyntheticsGlobalVariableParseTestOptions` 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?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'local_variable_name') + self.local_variable_name = attributes[:'local_variable_name'] + end + + if attributes.key?(:'parser') + self.parser = attributes[:'parser'] + 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 @type.nil? + true + 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 && + field == o.field && + local_variable_name == o.local_variable_name && + parser == o.parser && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [field, local_variable_name, parser, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_global_variable_parse_test_options_type.rb b/lib/datadog_api_client/v2/models/synthetics_global_variable_parse_test_options_type.rb new file mode 100644 index 000000000000..c3016c19445e --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_global_variable_parse_test_options_type.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of value to extract from a test for a Synthetic global variable. + class SyntheticsGlobalVariableParseTestOptionsType + include BaseEnumModel + + HTTP_BODY = "http_body".freeze + HTTP_HEADER = "http_header".freeze + HTTP_STATUS_CODE = "http_status_code".freeze + LOCAL_VARIABLE = "local_variable".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_global_variable_parser_type.rb b/lib/datadog_api_client/v2/models/synthetics_global_variable_parser_type.rb new file mode 100644 index 000000000000..51d233497a6a --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_global_variable_parser_type.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type of parser for a Synthetic global variable from a synthetics test. + class SyntheticsGlobalVariableParserType + include BaseEnumModel + + RAW = "raw".freeze + JSON_PATH = "json_path".freeze + REGEX = "regex".freeze + X_PATH = "x_path".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_global_variable_totp_parameters.rb b/lib/datadog_api_client/v2/models/synthetics_global_variable_totp_parameters.rb new file mode 100644 index 000000000000..1c9827bad4a2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_global_variable_totp_parameters.rb @@ -0,0 +1,152 @@ +=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 + # Parameters for the TOTP/MFA variable + class SyntheticsGlobalVariableTOTPParameters + include BaseGenericModel + + # Number of digits for the OTP code. + attr_reader :digits + + # Interval for which to refresh the token (in seconds). + attr_reader :refresh_interval + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'digits' => :'digits', + :'refresh_interval' => :'refresh_interval' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'digits' => :'Integer', + :'refresh_interval' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsGlobalVariableTOTPParameters` 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?(:'digits') + self.digits = attributes[:'digits'] + end + + if attributes.key?(:'refresh_interval') + self.refresh_interval = attributes[:'refresh_interval'] + 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 !@digits.nil? && @digits > 10 + return false if !@digits.nil? && @digits < 4 + return false if !@refresh_interval.nil? && @refresh_interval > 999 + return false if !@refresh_interval.nil? && @refresh_interval < 0 + true + end + + # Custom attribute writer method with validation + # @param digits [Object] Object to be assigned + # @!visibility private + def digits=(digits) + if !digits.nil? && digits > 10 + fail ArgumentError, 'invalid value for "digits", must be smaller than or equal to 10.' + end + if !digits.nil? && digits < 4 + fail ArgumentError, 'invalid value for "digits", must be greater than or equal to 4.' + end + @digits = digits + end + + # Custom attribute writer method with validation + # @param refresh_interval [Object] Object to be assigned + # @!visibility private + def refresh_interval=(refresh_interval) + if !refresh_interval.nil? && refresh_interval > 999 + fail ArgumentError, 'invalid value for "refresh_interval", must be smaller than or equal to 999.' + end + if !refresh_interval.nil? && refresh_interval < 0 + fail ArgumentError, 'invalid value for "refresh_interval", must be greater than or equal to 0.' + end + @refresh_interval = refresh_interval + 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 && + digits == o.digits && + refresh_interval == o.refresh_interval && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [digits, refresh_interval, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_global_variable_value.rb b/lib/datadog_api_client/v2/models/synthetics_global_variable_value.rb new file mode 100644 index 000000000000..b1a7e3bb7aab --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_global_variable_value.rb @@ -0,0 +1,126 @@ +=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 + # Value of the global variable. + class SyntheticsGlobalVariableValue + include BaseGenericModel + + # Options for the Global Variable for MFA. + attr_accessor :options + + # Determines if the value of the variable is hidden. + attr_accessor :secure + + # Value of the global variable. When reading a global variable, + # the value will not be present if the variable is hidden with the `secure` property. + attr_accessor :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'options' => :'options', + :'secure' => :'secure', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'options' => :'SyntheticsGlobalVariableOptions', + :'secure' => :'Boolean', + :'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::SyntheticsGlobalVariableValue` 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?(:'options') + self.options = attributes[:'options'] + end + + if attributes.key?(:'secure') + self.secure = attributes[:'secure'] + 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 && + options == o.options && + secure == o.secure && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [options, secure, value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_variable_parser.rb b/lib/datadog_api_client/v2/models/synthetics_variable_parser.rb new file mode 100644 index 000000000000..b583a07b8002 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_variable_parser.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 + # Details of the parser to use for the global variable. + class SyntheticsVariableParser + include BaseGenericModel + + # Type of parser for a Synthetic global variable from a synthetics test. + attr_reader :type + + # Regex or JSON path used for the parser. Not used with type `raw`. + attr_accessor :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'type' => :'type', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'type' => :'SyntheticsGlobalVariableParserType', + :'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::SyntheticsVariableParser` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + 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 @type.nil? + true + 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 && + type == o.type && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [type, value, additional_properties].hash + end + end +end