From 7f5e83585b42e7d1c4f7cb072bae03ec076e711e Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 16:14:43 +0000 Subject: [PATCH 1/3] Regenerate client from commit 68baeaf of spec repo (#3471) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 8 ++++++++ lib/datadog_api_client/v2/api/metrics_api.rb | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fd5ed0088f50..649870838dca 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -143665,7 +143665,10 @@ paths: - metrics_read /api/v2/metrics/config/bulk-tags: delete: + deprecated: true description: |- + **Note**: This endpoint is deprecated. Use [Tag Indexing Rules](/api/latest/metrics/#create-a-tag-indexing-rule) (`POST /api/v2/metrics/tag-indexing-rules`) instead. + Delete all custom lists of queryable tag keys for a set of existing count, gauge, rate, and distribution metrics. Metrics are selected by passing a metric name prefix. Results can be sent to a set of account email addresses, just like the same operation in the Datadog web app. @@ -143736,8 +143739,12 @@ paths: operator: OR permissions: - metric_tags_write + x-sunset: "2027-01-01" post: + deprecated: true description: |- + **Note**: This endpoint is deprecated. Use [Tag Indexing Rules](/api/latest/metrics/#create-a-tag-indexing-rule) (`POST /api/v2/metrics/tag-indexing-rules`) instead. + Create and define a list of queryable tag keys for a set of existing count, gauge, rate, and distribution metrics. Metrics are selected by passing a metric name prefix. Use the Delete method of this API path to remove tag configurations. Results can be sent to a set of account email addresses, just like the same operation in the Datadog web app. @@ -143816,6 +143823,7 @@ paths: operator: OR permissions: - metric_tags_write + x-sunset: "2027-01-01" /api/v2/metrics/tag-indexing-rules: get: description: List tag indexing rules for an org, sorted by `rule_order`, with offset/limit pagination. diff --git a/lib/datadog_api_client/v2/api/metrics_api.rb b/lib/datadog_api_client/v2/api/metrics_api.rb index 9ba4035fcf97..7195d0e3ee11 100644 --- a/lib/datadog_api_client/v2/api/metrics_api.rb +++ b/lib/datadog_api_client/v2/api/metrics_api.rb @@ -33,6 +33,8 @@ def create_bulk_tags_metrics_configuration(body, opts = {}) # Configure tags for multiple metrics. # + # **Note**: This endpoint is deprecated. Use [Tag Indexing Rules](/api/latest/metrics/#create-a-tag-indexing-rule) (`POST /api/v2/metrics/tag-indexing-rules`) instead. + # # Create and define a list of queryable tag keys for a set of existing count, gauge, rate, and distribution metrics. # Metrics are selected by passing a metric name prefix. Use the Delete method of this API path to remove tag configurations. # Results can be sent to a set of account email addresses, just like the same operation in the Datadog web app. @@ -41,10 +43,13 @@ def create_bulk_tags_metrics_configuration(body, opts = {}) # the same exclusion state, metric tag configurations do not support mixed inclusion and exclusion for tags on the same metric. # Can only be used with application keys of users with the `Manage Tags for Metrics` permission. # + # @deprecated This API is deprecated. + # # @param body [MetricBulkTagConfigCreateRequest] # @param opts [Hash] the optional parameters # @return [Array<(MetricBulkTagConfigResponse, Integer, Hash)>] MetricBulkTagConfigResponse data, response status code and response headers def create_bulk_tags_metrics_configuration_with_http_info(body, opts = {}) + warn "[DEPRECATION] `CreateBulkTagsMetricsConfiguration` is deprecated." if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsAPI.create_bulk_tags_metrics_configuration ...' @@ -324,15 +329,20 @@ def delete_bulk_tags_metrics_configuration(body, opts = {}) # Delete tags for multiple metrics. # + # **Note**: This endpoint is deprecated. Use [Tag Indexing Rules](/api/latest/metrics/#create-a-tag-indexing-rule) (`POST /api/v2/metrics/tag-indexing-rules`) instead. + # # Delete all custom lists of queryable tag keys for a set of existing count, gauge, rate, and distribution metrics. # Metrics are selected by passing a metric name prefix. # Results can be sent to a set of account email addresses, just like the same operation in the Datadog web app. # Can only be used with application keys of users with the `Manage Tags for Metrics` permission. # + # @deprecated This API is deprecated. + # # @param body [MetricBulkTagConfigDeleteRequest] # @param opts [Hash] the optional parameters # @return [Array<(MetricBulkTagConfigResponse, Integer, Hash)>] MetricBulkTagConfigResponse data, response status code and response headers def delete_bulk_tags_metrics_configuration_with_http_info(body, opts = {}) + warn "[DEPRECATION] `DeleteBulkTagsMetricsConfiguration` is deprecated." if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsAPI.delete_bulk_tags_metrics_configuration ...' From ba3cafbe387490f79942bb2ffeebefc141b0b680 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 17:48:38 +0000 Subject: [PATCH 2/3] Regenerate client from commit f4bff5f of spec repo (#3444) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 302 ++++++++++++++++ .../ListNetworkHealthInsights.rb | 8 + features/scenarios_model_mapping.rb | 4 + features/v2/network_health_insights.feature | 23 ++ features/v2/undo.json | 6 + lib/datadog_api_client/configuration.rb | 1 + lib/datadog_api_client/inflector.rb | 8 + .../v2/api/network_health_insights_api.rb | 100 ++++++ .../v2/models/network_health_insight.rb | 165 +++++++++ .../network_health_insight_attributes.rb | 328 ++++++++++++++++++ .../models/network_health_insight_category.rb | 30 ++ .../network_health_insight_failure_type.rb | 34 ++ .../network_health_insight_traffic_volume.rb | 125 +++++++ .../network_health_insights_response.rb | 125 +++++++ .../v2/models/network_health_insights_type.rb | 26 ++ 15 files changed, 1285 insertions(+) create mode 100644 examples/v2/network-health-insights/ListNetworkHealthInsights.rb create mode 100644 features/v2/network_health_insights.feature create mode 100644 lib/datadog_api_client/v2/api/network_health_insights_api.rb create mode 100644 lib/datadog_api_client/v2/models/network_health_insight.rb create mode 100644 lib/datadog_api_client/v2/models/network_health_insight_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/network_health_insight_category.rb create mode 100644 lib/datadog_api_client/v2/models/network_health_insight_failure_type.rb create mode 100644 lib/datadog_api_client/v2/models/network_health_insight_traffic_volume.rb create mode 100644 lib/datadog_api_client/v2/models/network_health_insights_response.rb create mode 100644 lib/datadog_api_client/v2/models/network_health_insights_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 649870838dca..44461f06afca 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -58756,6 +58756,191 @@ components: - type - attributes type: object + NetworkHealthInsight: + description: A single network health insight describing a service-to-service connectivity issue. + properties: + attributes: + $ref: "#/components/schemas/NetworkHealthInsightAttributes" + id: + description: Unique identifier for this network health insight. + example: example-insight-id + type: string + type: + $ref: "#/components/schemas/NetworkHealthInsightsType" + required: + - type + - id + - attributes + type: object + NetworkHealthInsightAttributes: + description: Detailed attributes of a network health insight. + properties: + account_id: + description: AWS account identifier where the certificate is located. Only set for `tls-cert` insights. + example: "123456789012" + type: string + certificate_id: + description: ARN or identifier of the certificate. Only set for `tls-cert` insights. + example: "arn:aws:acm:us-east-1:123456789012:certificate/abcd1234-a123-456b-a123-12345678901f" + type: string + certificate_lifetime_percent: + description: |- + Percentage of the certificate's validity period that has elapsed, ranging from 0 to 100. + Only set for `tls-cert` insights. + example: 96.7 + format: double + type: number + client_region: + description: AWS region where the client is located. Only set for `tls-cert` insights. + example: us-west-2 + type: string + client_service: + description: |- + Name of the service making the request (DNS query or TLS-secured connection). + Set to `N/A` when the client service cannot be determined. + example: network-logger + type: string + days_until_expiration: + description: |- + Number of days remaining until the certificate expires. Negative values indicate the + certificate has already expired. Only set for `tls-cert` insights. + example: 3 + format: int64 + type: integer + dns_query: + description: Domain name that was being resolved when the DNS failure occurred. Only set for `dns` insights. + example: kafka-broker.internal.domain.com + type: string + dns_server: + description: DNS server that received the failing query. Only set for `dns` insights. + example: cluster-dns + type: string + domain_name: + description: Domain name covered by the certificate. Only set for `tls-cert` insights. + example: api.example.com + type: string + failure_magnitude: + description: |- + Count of failed events observed during the query window. Only set for `dns`, `tcp`, + and `security-group` insights. + example: 150 + format: int64 + minimum: 0 + type: integer + failure_rate: + description: |- + Percentage of requests that failed during the query window, ranging from 0 to 100. + Only set for `dns`, `tcp`, and `security-group` insights. + example: 91 + format: double + maximum: 100 + minimum: 0 + type: number + failure_type: + $ref: "#/components/schemas/NetworkHealthInsightFailureType" + loadbalancer_id: + description: ARN of the load balancer using the certificate. Only set for `tls-cert` insights. + example: "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/my-lb/50dc6c495c0c9188" + type: string + server_region: + description: AWS region where the server or load balancer is located. Only set for `tls-cert` insights. + example: us-east-1 + type: string + server_service: + description: Name of the target service the client was trying to reach. + example: kafka + type: string + total_requests: + description: |- + Total number of requests observed during the query window. Provides context for + `failure_magnitude` and `failure_rate`. Only set for `dns`, `tcp`, and `security-group` insights. + example: 1200 + format: int64 + minimum: 0 + type: integer + traffic_volume: + $ref: "#/components/schemas/NetworkHealthInsightTrafficVolume" + type: + $ref: "#/components/schemas/NetworkHealthInsightCategory" + type: object + NetworkHealthInsightCategory: + description: |- + Category of network health insight. Indicates whether the insight relates to a DNS issue (`dns`), + a TCP issue (`tcp`), a TLS certificate issue (`tls-cert`), or a security group denial (`security-group`). + enum: + - dns + - tcp + - tls-cert + - security-group + example: dns + type: string + x-enum-varnames: + - DNS + - TCP + - TLS_CERT + - SECURITY_GROUP + NetworkHealthInsightFailureType: + description: |- + Specific failure type within the insight category. For DNS insights: `timeout`, `nxdomain`, + `servfail`, or `general_failure`. For TLS certificate insights: `expired` or `expiring_soon`. + For security group insights: `denied`. + enum: + - timeout + - nxdomain + - servfail + - general_failure + - expired + - expiring_soon + - denied + example: nxdomain + type: string + x-enum-varnames: + - TIMEOUT + - NXDOMAIN + - SERVFAIL + - GENERAL_FAILURE + - EXPIRED + - EXPIRING_SOON + - DENIED + NetworkHealthInsightTrafficVolume: + description: Network traffic volume metrics between the client and server services during the query window. + properties: + bytes_read: + description: Total bytes read from the server to the client during the query window. + example: 1800000 + format: int64 + type: integer + bytes_written: + description: Total bytes written from the client to the server during the query window. + example: 2500000 + format: int64 + type: integer + total_traffic: + description: Sum of bytes written and bytes read across the query window. + example: 4300000 + format: int64 + type: integer + type: object + NetworkHealthInsightsResponse: + description: Response containing a list of network health insights for the organization. + properties: + data: + description: Array of network health insights returned for the query window. + items: + $ref: "#/components/schemas/NetworkHealthInsight" + type: array + required: + - data + type: object + NetworkHealthInsightsType: + default: network-health-insights + description: The resource type for network health insights. Always `network-health-insights`. + enum: + - network-health-insights + example: network-health-insights + type: string + x-enum-varnames: + - NETWORK_HEALTH_INSIGHTS NodeType: additionalProperties: {} description: A tree-sitter node type definition for a given language, describing the node's structure, subtypes, and fields. @@ -147568,6 +147753,118 @@ paths: summary: Update the tags for an interface tags: - Network Device Monitoring + /api/v2/network-health-insights: + get: + description: |- + Return network health insights for the organization within the given time window. + Insights are produced by analyzing DNS failures pre-classified by `network-dns-logger`, + TLS certificate metrics, and denied security group connections. Each insight + identifies the client and server services involved, the type of issue, and the + magnitude of the failure observed during the query window. + operationId: ListNetworkHealthInsights + parameters: + - description: |- + Unix timestamp (number of seconds since epoch) of the start of the query window. + If not provided, the start of the query window will be 15 minutes before the `to` timestamp. + If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`. + example: "1716800000" + in: query + name: from + required: false + schema: + type: string + - description: |- + Unix timestamp (number of seconds since epoch) of the end of the query window. + If not provided, the end of the query window will be the current time. + If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`. + example: "1716800900" + in: query + name: to + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + client_service: "network-logger" + dns_query: "kafka-broker.internal.domain.com" + dns_server: "cluster-dns" + failure_magnitude: 150 + failure_rate: 91 + failure_type: "nxdomain" + server_service: "kafka" + total_requests: 1200 + traffic_volume: + bytes_read: 1800000 + bytes_written: 2500000 + total_traffic: 4300000 + type: "dns" + id: "example-insight-id" + type: "network-health-insights" + - attributes: + account_id: "123456789012" + certificate_id: "arn:aws:acm:us-east-1:123456789012:certificate/abcd1234-a123-456b-a123-12345678901f" + certificate_lifetime_percent: 96.7 + client_region: "us-west-2" + client_service: "N/A" + days_until_expiration: 3 + domain_name: "api.example.com" + failure_type: "expiring_soon" + loadbalancer_id: "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/my-lb/50dc6c495c0c9188" + server_region: "us-east-1" + server_service: "web-frontend" + type: "tls-cert" + id: "example-cert-insight-id" + type: "network-health-insights" + - attributes: + client_service: "web-frontend" + failure_magnitude: 85 + failure_rate: 68.5 + failure_type: "denied" + server_service: "database" + total_requests: 124 + type: "security-group" + id: "example-security-group-insight-id" + type: "network-health-insights" + schema: + $ref: "#/components/schemas/NetworkHealthInsightsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: List network health insights + tags: + - Network Health Insights + x-permission: + operator: OR + permissions: + - network_health_insights_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/network/connections/aggregate: get: description: Get all aggregated connections. @@ -184667,6 +184964,11 @@ tags: - description: |- The Network Device Monitoring API allows you to fetch devices and interfaces and their attributes. See the [Network Device Monitoring page](https://docs.datadoghq.com/network_monitoring/) for more information. name: Network Device Monitoring + - description: |- + Analyze network health by surfacing actionable insights for services experiencing connectivity issues. + Insights are derived from DNS failure data (timeouts, NXDOMAIN, SERVFAIL, general failures), + TLS certificate health (expired, expiring soon), and security group denials. + name: Network Health Insights - description: |- Configure OAuth2 clients for Datadog. Supports RFC 7591 Dynamic Client Registration and management of OAuth2 client scopes restrictions. diff --git a/examples/v2/network-health-insights/ListNetworkHealthInsights.rb b/examples/v2/network-health-insights/ListNetworkHealthInsights.rb new file mode 100644 index 000000000000..2ba6c2b6b050 --- /dev/null +++ b/examples/v2/network-health-insights/ListNetworkHealthInsights.rb @@ -0,0 +1,8 @@ +# List network health insights returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_network_health_insights".to_sym] = true +end +api_instance = DatadogAPIClient::V2::NetworkHealthInsightsAPI.new +p api_instance.list_network_health_insights() diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 4302b7a08ef5..826703044334 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -4121,6 +4121,10 @@ "interface_id" => "String", "body" => "ListInterfaceTagsResponse", }, + "v2.ListNetworkHealthInsights" => { + "from" => "String", + "to" => "String", + }, "v2.GetAggregatedConnections" => { "from" => "Integer", "to" => "Integer", diff --git a/features/v2/network_health_insights.feature b/features/v2/network_health_insights.feature new file mode 100644 index 000000000000..c5036b6af542 --- /dev/null +++ b/features/v2/network_health_insights.feature @@ -0,0 +1,23 @@ +@endpoint(network-health-insights) @endpoint(network-health-insights-v2) +Feature: Network Health Insights + Analyze network health by surfacing actionable insights for services + experiencing connectivity issues. Insights are derived from DNS failure + data (timeouts, NXDOMAIN, SERVFAIL, general failures), TLS certificate + health (expired, expiring soon), and security group denials. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "NetworkHealthInsights" API + And operation "ListNetworkHealthInsights" enabled + And new "ListNetworkHealthInsights" request + + @generated @skip @team:DataDog/cloud-network-monitoring + Scenario: List network health insights returns "Bad Request" response + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-network-monitoring + Scenario: List network health insights returns "OK" response + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 2de79b4feb4e..0118bfb67de0 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5145,6 +5145,12 @@ "type": "idempotent" } }, + "ListNetworkHealthInsights": { + "tag": "Network Health Insights", + "undo": { + "type": "safe" + } + }, "GetAggregatedConnections": { "tag": "Cloud Network Monitoring", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index e72b5758ecad..05c83b9c8abf 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -554,6 +554,7 @@ def initialize "v2.update_monitor_user_template": false, "v2.validate_existing_monitor_user_template": false, "v2.validate_monitor_user_template": false, + "v2.list_network_health_insights": false, "v2.delete_scopes_restriction": false, "v2.get_o_auth2_well_known_sites": false, "v2.get_scopes_restriction": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 0f0830cc8eb9..c6eae3783161 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -4633,6 +4633,13 @@ def overrides "v2.mute_findings_response_data" => "MuteFindingsResponseData", "v2.ndk_sourcemap_attributes" => "NDKSourcemapAttributes", "v2.ndk_sourcemap_data" => "NDKSourcemapData", + "v2.network_health_insight" => "NetworkHealthInsight", + "v2.network_health_insight_attributes" => "NetworkHealthInsightAttributes", + "v2.network_health_insight_category" => "NetworkHealthInsightCategory", + "v2.network_health_insight_failure_type" => "NetworkHealthInsightFailureType", + "v2.network_health_insights_response" => "NetworkHealthInsightsResponse", + "v2.network_health_insights_type" => "NetworkHealthInsightsType", + "v2.network_health_insight_traffic_volume" => "NetworkHealthInsightTrafficVolume", "v2.node_types_response" => "NodeTypesResponse", "v2.node_types_response_data" => "NodeTypesResponseData", "v2.node_types_response_data_attributes" => "NodeTypesResponseDataAttributes", @@ -7623,6 +7630,7 @@ def overrides "v2.model_lab_api_api" => "ModelLabAPIAPI", "v2.monitors_api" => "MonitorsAPI", "v2.network_device_monitoring_api" => "NetworkDeviceMonitoringAPI", + "v2.network_health_insights_api" => "NetworkHealthInsightsAPI", "v2.o_auth2_client_public_api" => "OAuth2ClientPublicAPI", "v2.observability_pipelines_api" => "ObservabilityPipelinesAPI", "v2.oci_integration_api" => "OCIIntegrationAPI", diff --git a/lib/datadog_api_client/v2/api/network_health_insights_api.rb b/lib/datadog_api_client/v2/api/network_health_insights_api.rb new file mode 100644 index 000000000000..142376839c97 --- /dev/null +++ b/lib/datadog_api_client/v2/api/network_health_insights_api.rb @@ -0,0 +1,100 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class NetworkHealthInsightsAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # List network health insights. + # + # @see #list_network_health_insights_with_http_info + def list_network_health_insights(opts = {}) + data, _status_code, _headers = list_network_health_insights_with_http_info(opts) + data + end + + # List network health insights. + # + # Return network health insights for the organization within the given time window. + # Insights are produced by analyzing DNS failures pre-classified by `network-dns-logger`, + # TLS certificate metrics, and denied security group connections. Each insight + # identifies the client and server services involved, the type of issue, and the + # magnitude of the failure observed during the query window. + # + # @param opts [Hash] the optional parameters + # @option opts [String] :from Unix timestamp (number of seconds since epoch) of the start of the query window. If not provided, the start of the query window will be 15 minutes before the `to` timestamp. If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`. + # @option opts [String] :to Unix timestamp (number of seconds since epoch) of the end of the query window. If not provided, the end of the query window will be the current time. If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`. + # @return [Array<(NetworkHealthInsightsResponse, Integer, Hash)>] NetworkHealthInsightsResponse data, response status code and response headers + def list_network_health_insights_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_network_health_insights".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_network_health_insights") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_network_health_insights")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: NetworkHealthInsightsAPI.list_network_health_insights ...' + end + # resource path + local_var_path = '/api/v2/network-health-insights' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? + query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'NetworkHealthInsightsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_network_health_insights, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: NetworkHealthInsightsAPI#list_network_health_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insight.rb b/lib/datadog_api_client/v2/models/network_health_insight.rb new file mode 100644 index 000000000000..bc460a6c21ff --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insight.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A single network health insight describing a service-to-service connectivity issue. + class NetworkHealthInsight + include BaseGenericModel + + # Detailed attributes of a network health insight. + attr_reader :attributes + + # Unique identifier for this network health insight. + attr_reader :id + + # The resource type for network health insights. Always `network-health-insights`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'NetworkHealthInsightAttributes', + :'id' => :'String', + :'type' => :'NetworkHealthInsightsType' + } + 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::NetworkHealthInsight` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insight_attributes.rb b/lib/datadog_api_client/v2/models/network_health_insight_attributes.rb new file mode 100644 index 000000000000..7bdfdbd58c0a --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insight_attributes.rb @@ -0,0 +1,328 @@ +=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 + # Detailed attributes of a network health insight. + class NetworkHealthInsightAttributes + include BaseGenericModel + + # AWS account identifier where the certificate is located. Only set for `tls-cert` insights. + attr_accessor :account_id + + # ARN or identifier of the certificate. Only set for `tls-cert` insights. + attr_accessor :certificate_id + + # Percentage of the certificate's validity period that has elapsed, ranging from 0 to 100. + # Only set for `tls-cert` insights. + attr_accessor :certificate_lifetime_percent + + # AWS region where the client is located. Only set for `tls-cert` insights. + attr_accessor :client_region + + # Name of the service making the request (DNS query or TLS-secured connection). + # Set to `N/A` when the client service cannot be determined. + attr_accessor :client_service + + # Number of days remaining until the certificate expires. Negative values indicate the + # certificate has already expired. Only set for `tls-cert` insights. + attr_accessor :days_until_expiration + + # Domain name that was being resolved when the DNS failure occurred. Only set for `dns` insights. + attr_accessor :dns_query + + # DNS server that received the failing query. Only set for `dns` insights. + attr_accessor :dns_server + + # Domain name covered by the certificate. Only set for `tls-cert` insights. + attr_accessor :domain_name + + # Count of failed events observed during the query window. Only set for `dns`, `tcp`, + # and `security-group` insights. + attr_reader :failure_magnitude + + # Percentage of requests that failed during the query window, ranging from 0 to 100. + # Only set for `dns`, `tcp`, and `security-group` insights. + attr_reader :failure_rate + + # Specific failure type within the insight category. For DNS insights: `timeout`, `nxdomain`, + # `servfail`, or `general_failure`. For TLS certificate insights: `expired` or `expiring_soon`. + # For security group insights: `denied`. + attr_accessor :failure_type + + # ARN of the load balancer using the certificate. Only set for `tls-cert` insights. + attr_accessor :loadbalancer_id + + # AWS region where the server or load balancer is located. Only set for `tls-cert` insights. + attr_accessor :server_region + + # Name of the target service the client was trying to reach. + attr_accessor :server_service + + # Total number of requests observed during the query window. Provides context for + # `failure_magnitude` and `failure_rate`. Only set for `dns`, `tcp`, and `security-group` insights. + attr_reader :total_requests + + # Network traffic volume metrics between the client and server services during the query window. + attr_accessor :traffic_volume + + # Category of network health insight. Indicates whether the insight relates to a DNS issue (`dns`), + # a TCP issue (`tcp`), a TLS certificate issue (`tls-cert`), or a security group denial (`security-group`). + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'account_id' => :'account_id', + :'certificate_id' => :'certificate_id', + :'certificate_lifetime_percent' => :'certificate_lifetime_percent', + :'client_region' => :'client_region', + :'client_service' => :'client_service', + :'days_until_expiration' => :'days_until_expiration', + :'dns_query' => :'dns_query', + :'dns_server' => :'dns_server', + :'domain_name' => :'domain_name', + :'failure_magnitude' => :'failure_magnitude', + :'failure_rate' => :'failure_rate', + :'failure_type' => :'failure_type', + :'loadbalancer_id' => :'loadbalancer_id', + :'server_region' => :'server_region', + :'server_service' => :'server_service', + :'total_requests' => :'total_requests', + :'traffic_volume' => :'traffic_volume', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'account_id' => :'String', + :'certificate_id' => :'String', + :'certificate_lifetime_percent' => :'Float', + :'client_region' => :'String', + :'client_service' => :'String', + :'days_until_expiration' => :'Integer', + :'dns_query' => :'String', + :'dns_server' => :'String', + :'domain_name' => :'String', + :'failure_magnitude' => :'Integer', + :'failure_rate' => :'Float', + :'failure_type' => :'NetworkHealthInsightFailureType', + :'loadbalancer_id' => :'String', + :'server_region' => :'String', + :'server_service' => :'String', + :'total_requests' => :'Integer', + :'traffic_volume' => :'NetworkHealthInsightTrafficVolume', + :'type' => :'NetworkHealthInsightCategory' + } + 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::NetworkHealthInsightAttributes` 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?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'certificate_id') + self.certificate_id = attributes[:'certificate_id'] + end + + if attributes.key?(:'certificate_lifetime_percent') + self.certificate_lifetime_percent = attributes[:'certificate_lifetime_percent'] + end + + if attributes.key?(:'client_region') + self.client_region = attributes[:'client_region'] + end + + if attributes.key?(:'client_service') + self.client_service = attributes[:'client_service'] + end + + if attributes.key?(:'days_until_expiration') + self.days_until_expiration = attributes[:'days_until_expiration'] + end + + if attributes.key?(:'dns_query') + self.dns_query = attributes[:'dns_query'] + end + + if attributes.key?(:'dns_server') + self.dns_server = attributes[:'dns_server'] + end + + if attributes.key?(:'domain_name') + self.domain_name = attributes[:'domain_name'] + end + + if attributes.key?(:'failure_magnitude') + self.failure_magnitude = attributes[:'failure_magnitude'] + end + + if attributes.key?(:'failure_rate') + self.failure_rate = attributes[:'failure_rate'] + end + + if attributes.key?(:'failure_type') + self.failure_type = attributes[:'failure_type'] + end + + if attributes.key?(:'loadbalancer_id') + self.loadbalancer_id = attributes[:'loadbalancer_id'] + end + + if attributes.key?(:'server_region') + self.server_region = attributes[:'server_region'] + end + + if attributes.key?(:'server_service') + self.server_service = attributes[:'server_service'] + end + + if attributes.key?(:'total_requests') + self.total_requests = attributes[:'total_requests'] + end + + if attributes.key?(:'traffic_volume') + self.traffic_volume = attributes[:'traffic_volume'] + 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 !@failure_magnitude.nil? && @failure_magnitude < 0 + return false if !@failure_rate.nil? && @failure_rate > 100 + return false if !@failure_rate.nil? && @failure_rate < 0 + return false if !@total_requests.nil? && @total_requests < 0 + true + end + + # Custom attribute writer method with validation + # @param failure_magnitude [Object] Object to be assigned + # @!visibility private + def failure_magnitude=(failure_magnitude) + if !failure_magnitude.nil? && failure_magnitude < 0 + fail ArgumentError, 'invalid value for "failure_magnitude", must be greater than or equal to 0.' + end + @failure_magnitude = failure_magnitude + end + + # Custom attribute writer method with validation + # @param failure_rate [Object] Object to be assigned + # @!visibility private + def failure_rate=(failure_rate) + if !failure_rate.nil? && failure_rate > 100 + fail ArgumentError, 'invalid value for "failure_rate", must be smaller than or equal to 100.' + end + if !failure_rate.nil? && failure_rate < 0 + fail ArgumentError, 'invalid value for "failure_rate", must be greater than or equal to 0.' + end + @failure_rate = failure_rate + end + + # Custom attribute writer method with validation + # @param total_requests [Object] Object to be assigned + # @!visibility private + def total_requests=(total_requests) + if !total_requests.nil? && total_requests < 0 + fail ArgumentError, 'invalid value for "total_requests", must be greater than or equal to 0.' + end + @total_requests = total_requests + 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 && + account_id == o.account_id && + certificate_id == o.certificate_id && + certificate_lifetime_percent == o.certificate_lifetime_percent && + client_region == o.client_region && + client_service == o.client_service && + days_until_expiration == o.days_until_expiration && + dns_query == o.dns_query && + dns_server == o.dns_server && + domain_name == o.domain_name && + failure_magnitude == o.failure_magnitude && + failure_rate == o.failure_rate && + failure_type == o.failure_type && + loadbalancer_id == o.loadbalancer_id && + server_region == o.server_region && + server_service == o.server_service && + total_requests == o.total_requests && + traffic_volume == o.traffic_volume && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [account_id, certificate_id, certificate_lifetime_percent, client_region, client_service, days_until_expiration, dns_query, dns_server, domain_name, failure_magnitude, failure_rate, failure_type, loadbalancer_id, server_region, server_service, total_requests, traffic_volume, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insight_category.rb b/lib/datadog_api_client/v2/models/network_health_insight_category.rb new file mode 100644 index 000000000000..91b72338e201 --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insight_category.rb @@ -0,0 +1,30 @@ +=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 + # Category of network health insight. Indicates whether the insight relates to a DNS issue (`dns`), + # a TCP issue (`tcp`), a TLS certificate issue (`tls-cert`), or a security group denial (`security-group`). + class NetworkHealthInsightCategory + include BaseEnumModel + + DNS = "dns".freeze + TCP = "tcp".freeze + TLS_CERT = "tls-cert".freeze + SECURITY_GROUP = "security-group".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insight_failure_type.rb b/lib/datadog_api_client/v2/models/network_health_insight_failure_type.rb new file mode 100644 index 000000000000..5d67c1bccf27 --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insight_failure_type.rb @@ -0,0 +1,34 @@ +=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 + # Specific failure type within the insight category. For DNS insights: `timeout`, `nxdomain`, + # `servfail`, or `general_failure`. For TLS certificate insights: `expired` or `expiring_soon`. + # For security group insights: `denied`. + class NetworkHealthInsightFailureType + include BaseEnumModel + + TIMEOUT = "timeout".freeze + NXDOMAIN = "nxdomain".freeze + SERVFAIL = "servfail".freeze + GENERAL_FAILURE = "general_failure".freeze + EXPIRED = "expired".freeze + EXPIRING_SOON = "expiring_soon".freeze + DENIED = "denied".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insight_traffic_volume.rb b/lib/datadog_api_client/v2/models/network_health_insight_traffic_volume.rb new file mode 100644 index 000000000000..a0f75570f2e3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insight_traffic_volume.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 + # Network traffic volume metrics between the client and server services during the query window. + class NetworkHealthInsightTrafficVolume + include BaseGenericModel + + # Total bytes read from the server to the client during the query window. + attr_accessor :bytes_read + + # Total bytes written from the client to the server during the query window. + attr_accessor :bytes_written + + # Sum of bytes written and bytes read across the query window. + attr_accessor :total_traffic + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'bytes_read' => :'bytes_read', + :'bytes_written' => :'bytes_written', + :'total_traffic' => :'total_traffic' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'bytes_read' => :'Integer', + :'bytes_written' => :'Integer', + :'total_traffic' => :'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::NetworkHealthInsightTrafficVolume` 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?(:'bytes_read') + self.bytes_read = attributes[:'bytes_read'] + end + + if attributes.key?(:'bytes_written') + self.bytes_written = attributes[:'bytes_written'] + end + + if attributes.key?(:'total_traffic') + self.total_traffic = attributes[:'total_traffic'] + 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 && + bytes_read == o.bytes_read && + bytes_written == o.bytes_written && + total_traffic == o.total_traffic && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [bytes_read, bytes_written, total_traffic, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insights_response.rb b/lib/datadog_api_client/v2/models/network_health_insights_response.rb new file mode 100644 index 000000000000..8f8f86a0be70 --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insights_response.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 + # Response containing a list of network health insights for the organization. + class NetworkHealthInsightsResponse + include BaseGenericModel + + # Array of network health insights returned for the query window. + 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' => :'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::NetworkHealthInsightsResponse` 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') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @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/network_health_insights_type.rb b/lib/datadog_api_client/v2/models/network_health_insights_type.rb new file mode 100644 index 000000000000..61e365d23b18 --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insights_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The resource type for network health insights. Always `network-health-insights`. + class NetworkHealthInsightsType + include BaseEnumModel + + NETWORK_HEALTH_INSIGHTS = "network-health-insights".freeze + end +end From a484349f3057a2aa9b4b0effe200adf8327cab77 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 17:53:01 +0000 Subject: [PATCH 3/3] Regenerate client from commit 51a87ea of spec repo (#3475) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 688 +++++++++++++++++- ...e-a-form-returns-Not-Found-response.frozen | 1 + ...lone-a-form-returns-Not-Found-response.yml | 25 + ...-version-returns-Not-Found-response.frozen | 1 + ...orm-version-returns-Not-Found-response.yml | 27 + ...-a-form-version-returns-OK-response.frozen | 1 + ...ate-a-form-version-returns-OK-response.yml | 70 ++ ...-version-returns-Not-Found-response.frozen | 1 + ...orm-version-returns-Not-Found-response.yml | 25 + ...-a-form-version-returns-OK-response.frozen | 1 + ...ish-a-form-version-returns-OK-response.yml | 66 ++ ...e-a-form-returns-Not-Found-response.frozen | 1 + ...date-a-form-returns-Not-Found-response.yml | 26 + .../Update-a-form-returns-OK-response.frozen | 1 + .../Update-a-form-returns-OK-response.yml | 69 ++ ...-version-returns-Not-Found-response.frozen | 1 + ...orm-version-returns-Not-Found-response.yml | 27 + ...-a-form-version-returns-OK-response.frozen | 1 + ...ish-a-form-version-returns-OK-response.yml | 71 ++ examples/v2/forms/CloneForm.rb | 17 + examples/v2/forms/PublishForm.rb | 20 + examples/v2/forms/UpdateForm.rb | 29 + .../v2/forms/UpsertAndPublishFormVersion.rb | 34 + examples/v2/forms/UpsertFormVersion.rb | 37 + features/scenarios_model_mapping.rb | 20 + features/v2/forms.feature | 143 +++- features/v2/undo.json | 37 + lib/datadog_api_client/configuration.rb | 5 + lib/datadog_api_client/inflector.rb | 25 + lib/datadog_api_client/v2/api/forms_api.rb | 391 ++++++++++ .../v2/models/clone_form_data.rb | 133 ++++ .../v2/models/clone_form_data_attributes.rb | 105 +++ .../v2/models/clone_form_request.rb | 123 ++++ .../v2/models/form_publication_data.rb | 165 +++++ .../v2/models/form_publication_response.rb | 123 ++++ .../v2/models/form_publication_type.rb | 26 + .../v2/models/form_update_attributes.rb | 125 ++++ .../v2/models/form_version_data.rb | 165 +++++ .../v2/models/form_version_response.rb | 123 ++++ .../v2/models/form_version_type.rb | 26 + .../v2/models/latest_version_match_policy.rb | 27 + .../v2/models/publish_form_data.rb | 144 ++++ .../v2/models/publish_form_data_attributes.rb | 123 ++++ .../v2/models/publish_form_request.rb | 123 ++++ .../v2/models/update_form_data.rb | 154 ++++ .../v2/models/update_form_data_attributes.rb | 123 ++++ .../v2/models/update_form_request.rb | 123 ++++ .../upsert_and_publish_form_version_data.rb | 144 ++++ ...nd_publish_form_version_data_attributes.rb | 165 +++++ ...upsert_and_publish_form_version_request.rb | 123 ++++ ..._and_publish_form_version_upsert_params.rb | 123 ++++ .../v2/models/upsert_form_version_data.rb | 144 ++++ .../upsert_form_version_data_attributes.rb | 186 +++++ .../v2/models/upsert_form_version_request.rb | 123 ++++ .../upsert_form_version_upsert_params.rb | 151 ++++ 55 files changed, 4948 insertions(+), 3 deletions(-) create mode 100644 cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.frozen create mode 100644 cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.yml create mode 100644 cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.frozen create mode 100644 cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.yml create mode 100644 cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/forms/Update-a-form-returns-OK-response.frozen create mode 100644 cassettes/features/v2/forms/Update-a-form-returns-OK-response.yml create mode 100644 cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-OK-response.frozen create mode 100644 cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-OK-response.yml create mode 100644 examples/v2/forms/CloneForm.rb create mode 100644 examples/v2/forms/PublishForm.rb create mode 100644 examples/v2/forms/UpdateForm.rb create mode 100644 examples/v2/forms/UpsertAndPublishFormVersion.rb create mode 100644 examples/v2/forms/UpsertFormVersion.rb create mode 100644 lib/datadog_api_client/v2/models/clone_form_data.rb create mode 100644 lib/datadog_api_client/v2/models/clone_form_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/clone_form_request.rb create mode 100644 lib/datadog_api_client/v2/models/form_publication_data.rb create mode 100644 lib/datadog_api_client/v2/models/form_publication_response.rb create mode 100644 lib/datadog_api_client/v2/models/form_publication_type.rb create mode 100644 lib/datadog_api_client/v2/models/form_update_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/form_version_data.rb create mode 100644 lib/datadog_api_client/v2/models/form_version_response.rb create mode 100644 lib/datadog_api_client/v2/models/form_version_type.rb create mode 100644 lib/datadog_api_client/v2/models/latest_version_match_policy.rb create mode 100644 lib/datadog_api_client/v2/models/publish_form_data.rb create mode 100644 lib/datadog_api_client/v2/models/publish_form_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/publish_form_request.rb create mode 100644 lib/datadog_api_client/v2/models/update_form_data.rb create mode 100644 lib/datadog_api_client/v2/models/update_form_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/update_form_request.rb create mode 100644 lib/datadog_api_client/v2/models/upsert_and_publish_form_version_data.rb create mode 100644 lib/datadog_api_client/v2/models/upsert_and_publish_form_version_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/upsert_and_publish_form_version_request.rb create mode 100644 lib/datadog_api_client/v2/models/upsert_and_publish_form_version_upsert_params.rb create mode 100644 lib/datadog_api_client/v2/models/upsert_form_version_data.rb create mode 100644 lib/datadog_api_client/v2/models/upsert_form_version_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/upsert_form_version_request.rb create mode 100644 lib/datadog_api_client/v2/models/upsert_form_version_upsert_params.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 44461f06afca..bf25604f04a3 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -17307,6 +17307,32 @@ components: required: - type type: object + CloneFormData: + description: The data for cloning a form. + properties: + attributes: + $ref: "#/components/schemas/CloneFormDataAttributes" + type: + $ref: "#/components/schemas/FormType" + required: + - type + type: object + CloneFormDataAttributes: + description: The attributes for cloning a form. + properties: + name: + description: The name for the cloned form. Defaults to "Copy of (source form name)" if not provided. + example: Copy of My Form + type: string + type: object + CloneFormRequest: + description: A request to clone a form. + properties: + data: + $ref: "#/components/schemas/CloneFormData" + required: + - data + type: object CloudAssetType: description: The cloud asset type enum: @@ -37342,6 +37368,39 @@ components: - user_id - user_uuid type: object + FormPublicationData: + description: A form publication resource object. + properties: + attributes: + $ref: "#/components/schemas/FormPublicationAttributes" + id: + description: The ID of the form publication. + example: "42" + type: string + type: + $ref: "#/components/schemas/FormPublicationType" + required: + - id + - type + - attributes + type: object + FormPublicationResponse: + description: A response containing a single form publication. + properties: + data: + $ref: "#/components/schemas/FormPublicationData" + required: + - data + type: object + FormPublicationType: + default: form_publications + description: The resource type for a form publication. + enum: + - form_publications + example: form_publications + type: string + x-enum-varnames: + - FORM_PUBLICATIONS FormResponse: description: A response containing a single form. properties: @@ -37418,6 +37477,20 @@ components: - DARK_BLUE - MAGENTA - INDIGO + FormUpdateAttributes: + description: The fields to update on a form. At least one field must be provided. + properties: + datastore_config: + $ref: "#/components/schemas/FormDatastoreConfigAttributes" + description: + description: The updated description of the form. + example: An updated description. + type: string + name: + description: The updated name of the form. + example: Updated Form Name + type: string + type: object FormVersionAttributes: description: The attributes of a form version. properties: @@ -37477,6 +37550,30 @@ components: - user_uuid - version type: object + FormVersionData: + description: A form version resource object. + properties: + attributes: + $ref: "#/components/schemas/FormVersionAttributes" + id: + description: The ID of the form version. + example: "126" + type: string + type: + $ref: "#/components/schemas/FormVersionType" + required: + - id + - type + - attributes + type: object + FormVersionResponse: + description: A response containing a single form version. + properties: + data: + $ref: "#/components/schemas/FormVersionData" + required: + - data + type: object FormVersionState: description: The state of a form version. enum: @@ -37487,6 +37584,15 @@ components: x-enum-varnames: - DRAFT - FROZEN + FormVersionType: + default: form_versions + description: The resource type for a form version. + enum: + - form_versions + example: form_versions + type: string + x-enum-varnames: + - FORM_VERSIONS FormsResponse: description: A response containing a list of forms. properties: @@ -51954,6 +52060,16 @@ components: - PHP - KOTLIN - SWIFT + LatestVersionMatchPolicy: + description: The policy for matching the latest form version during an upsert operation. + enum: + - none + - if_etag_match + example: none + type: string + x-enum-varnames: + - NONE + - IF_ETAG_MATCH LaunchDarklyAPIKey: description: The definition of the `LaunchDarklyAPIKey` object. properties: @@ -71542,6 +71658,36 @@ components: data: $ref: "#/components/schemas/Deployment" type: object + PublishFormData: + description: The data for publishing a form version. + properties: + attributes: + $ref: "#/components/schemas/PublishFormDataAttributes" + type: + $ref: "#/components/schemas/FormPublicationType" + required: + - type + - attributes + type: object + PublishFormDataAttributes: + description: The attributes for publishing a form version. + properties: + version: + description: The version number to publish. + example: 1 + format: int64 + type: integer + required: + - version + type: object + PublishFormRequest: + description: A request to publish a form version. + properties: + data: + $ref: "#/components/schemas/PublishFormData" + required: + - data + type: object PublishRequestType: default: publishRequest description: The publish-request resource type. @@ -100428,6 +100574,38 @@ components: - id - success type: object + UpdateFormData: + description: The data for updating a form. + properties: + attributes: + $ref: "#/components/schemas/UpdateFormDataAttributes" + id: + description: The ID of the form. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + format: uuid + type: string + type: + $ref: "#/components/schemas/FormType" + required: + - type + - attributes + type: object + UpdateFormDataAttributes: + description: The attributes for updating a form. + properties: + form_update: + $ref: "#/components/schemas/FormUpdateAttributes" + required: + - form_update + type: object + UpdateFormRequest: + description: A request to update a form. + properties: + data: + $ref: "#/components/schemas/UpdateFormData" + required: + - data + type: object UpdateOnCallNotificationRuleRequest: description: A top-level wrapper for updating a notification rule for a user example: @@ -101140,6 +101318,49 @@ components: - key - type type: object + UpsertAndPublishFormVersionData: + description: The data for upserting and publishing a form version. + properties: + attributes: + $ref: "#/components/schemas/UpsertAndPublishFormVersionDataAttributes" + type: + $ref: "#/components/schemas/FormVersionType" + required: + - type + - attributes + type: object + UpsertAndPublishFormVersionDataAttributes: + description: The attributes for upserting and publishing a form version. + properties: + data_definition: + $ref: "#/components/schemas/FormDataDefinition" + ui_definition: + $ref: "#/components/schemas/FormUiDefinition" + upsert_params: + $ref: "#/components/schemas/UpsertAndPublishFormVersionUpsertParams" + required: + - data_definition + - ui_definition + - upsert_params + type: object + UpsertAndPublishFormVersionRequest: + description: A request to upsert and publish a form version in a single transaction. + properties: + data: + $ref: "#/components/schemas/UpsertAndPublishFormVersionData" + required: + - data + type: object + UpsertAndPublishFormVersionUpsertParams: + description: Concurrency control parameters for the upsert and publish operation. + properties: + etag: + description: The ETag of the latest version used for optimistic concurrency control. + example: b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d + type: string + required: + - etag + type: object UpsertCatalogEntityRequest: description: Create or update entity request. oneOf: @@ -101210,6 +101431,59 @@ components: - id - attributes type: object + UpsertFormVersionData: + description: The data for creating or updating a form version. + properties: + attributes: + $ref: "#/components/schemas/UpsertFormVersionDataAttributes" + type: + $ref: "#/components/schemas/FormVersionType" + required: + - type + - attributes + type: object + UpsertFormVersionDataAttributes: + description: The attributes for creating or updating a form version. + properties: + data_definition: + $ref: "#/components/schemas/FormDataDefinition" + state: + $ref: "#/components/schemas/FormVersionState" + ui_definition: + $ref: "#/components/schemas/FormUiDefinition" + upsert_params: + $ref: "#/components/schemas/UpsertFormVersionUpsertParams" + required: + - state + - data_definition + - ui_definition + - upsert_params + type: object + UpsertFormVersionRequest: + description: A request to create or update a form version. + properties: + data: + $ref: "#/components/schemas/UpsertFormVersionData" + required: + - data + type: object + UpsertFormVersionUpsertParams: + description: Concurrency control parameters for the form version upsert operation. + properties: + etag: + description: The ETag of the latest version. Required when `match_policy` is `if_etag_match`. + example: b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d + nullable: true + type: string + insert_only: + description: If true, only a new version may be inserted; updating the current draft is not allowed. + example: false + type: boolean + match_policy: + $ref: "#/components/schemas/LatestVersionMatchPolicy" + required: + - match_policy + type: object UpsertOAuthScopesRestrictionData: description: Data object of an upsert OAuth2 scopes restriction request. properties: @@ -128265,6 +128539,417 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: Update a form's properties such as its name, description, or datastore configuration. + operationId: UpdateForm + parameters: + - description: The ID of the form. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + in: path + name: form_id + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + form_update: + description: An updated description. + name: Updated Form Name + type: forms + schema: + $ref: "#/components/schemas/UpdateFormRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active: true + anonymous: false + created_at: "2026-05-29T20:06:14.895284Z" + datastore_config: + datastore_id: 5108ea24-dd83-4696-9caa-f069f73d0fad + primary_column_name: id + primary_key_generation_strategy: none + description: An updated description. + end_date: + idp_survey: false + modified_at: "2026-05-29T20:06:15.000000Z" + name: Updated Form Name + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + type: forms + schema: + $ref: "#/components/schemas/FormResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update a form + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/forms/{form_id}/clone: + post: + description: Clone an existing form. The clone is created in draft mode using the source form's latest version. + operationId: CloneForm + parameters: + - description: The ID of the form to clone. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + in: path + name: form_id + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: Copy of My Form + type: forms + schema: + $ref: "#/components/schemas/CloneFormRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active: true + anonymous: false + created_at: "2026-05-30T10:00:00.000000Z" + datastore_config: + datastore_id: a2b3c4d5-e6f7-8901-2345-6789abcdef01 + primary_column_name: id + primary_key_generation_strategy: none + description: A form to collect user feedback. + end_date: + idp_survey: false + modified_at: "2026-05-30T10:00:00.000000Z" + name: Copy of My Form + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 7a1e9054-5f6a-4b08-9e3d-c2f189a3bce0 + type: forms + schema: + $ref: "#/components/schemas/FormResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Clone a form + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/forms/{form_id}/publish: + post: + description: Publish a specific version of a form, making it available for submissions. + operationId: PublishForm + parameters: + - description: The ID of the form. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + in: path + name: form_id + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + version: 1 + type: form_publications + schema: + $ref: "#/components/schemas/PublishFormRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2026-05-29T20:06:13.677353Z" + form_id: afc67600-0511-43b1-9b18-578fb4979bd3 + form_version: 1 + id: "42" + modified_at: "2026-05-29T20:06:13.677353Z" + org_id: 2 + publish_seq: 1 + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: "42" + type: form_publications + schema: + $ref: "#/components/schemas/FormPublicationResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Publish a form version + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/forms/{form_id}/versions: + post: + description: |- + Create or update the latest draft version of a form. The `upsert_params` field controls + optimistic concurrency behavior. + operationId: UpsertFormVersion + parameters: + - description: The ID of the form. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + in: path + name: form_id + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + data_definition: {} + state: draft + ui_definition: {} + upsert_params: + match_policy: none + type: form_versions + schema: + $ref: "#/components/schemas/UpsertFormVersionRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2026-05-29T20:06:14.895921Z" + data_definition: + $ref: "#/components/schemas/FormDataDefinition" + definition_signature: '{"signature":"b7f312957a80cea2c8c9950532b205a90a3f8a7ebb7e52fc25437a25d903d545","version":1}' + etag: b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d + modified_at: "2026-05-29T20:06:14.949163Z" + state: draft + ui_definition: {} + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + version: 2 + id: "126" + type: form_versions + schema: + $ref: "#/components/schemas/FormVersionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create or update a form version + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/forms/{form_id}/versions/upsert_and_publish: + post: + description: Upsert the latest form version and publish it in a single atomic transaction. + operationId: UpsertAndPublishFormVersion + parameters: + - description: The ID of the form. + example: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + in: path + name: form_id + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + data_definition: {} + ui_definition: {} + upsert_params: + etag: b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d + type: form_versions + schema: + $ref: "#/components/schemas/UpsertAndPublishFormVersionRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active: true + anonymous: false + created_at: "2026-05-29T20:06:14.895284Z" + datastore_config: + datastore_id: 5108ea24-dd83-4696-9caa-f069f73d0fad + primary_column_name: id + primary_key_generation_strategy: none + description: A form to collect user feedback. + end_date: + idp_survey: false + modified_at: "2026-05-29T20:06:15.000000Z" + name: User Feedback Form + org_id: 2 + self_service: false + single_response: false + user_id: 10001 + user_uuid: 1fc709aa-be19-4539-a47d-52a30d78a978 + id: 22f6006a-2302-4926-9396-d2dfcf7b0b34 + type: forms + schema: + $ref: "#/components/schemas/FormResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Upsert and publish a form version + tags: + - Forms + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/hamr: get: description: |- @@ -184826,7 +185511,8 @@ tags: - Upgrade the Datadog Agent to specific versions name: Fleet Automation - description: |- - The Datadog Forms API lets you create and manage forms within the App Builder platform. You can configure form settings, manage versions, publish forms, and handle sharing configurations. + The Datadog Forms API lets you create and manage forms within the App Builder platform. + You can configure form settings, manage versions, and publish forms. name: Forms - description: |- Configure your Datadog-Google Cloud Platform (GCP) integration directly diff --git a/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.frozen b/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..3cb13361bfbb --- /dev/null +++ b/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:49:58.475Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.yml b/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.yml new file mode 100644 index 000000000000..9ca595b76cec --- /dev/null +++ b/cassettes/features/v2/forms/Clone-a-form-returns-Not-Found-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:49:58 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"name":"Copy of My Form"},"type":"forms"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/00000000-0000-0000-0000-000000000001/clone + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","id":"32db2695-29bd-4280-b547-3737365608c3","title":"form + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.frozen b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..e11ef0b046e8 --- /dev/null +++ b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:49:59.498Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.yml b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.yml new file mode 100644 index 000000000000..fb226f26fd69 --- /dev/null +++ b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-Not-Found-response.yml @@ -0,0 +1,27 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:49:59 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"data_definition":{"description":"Welcome to + the Engineering Experience Survey.","required":[],"title":"Developer Experience + Survey","type":"object"},"state":"frozen","ui_definition":{"ui:order":[],"ui:theme":{"primaryColor":"gray"}},"upsert_params":{"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","insert_only":false,"match_policy":"none"}},"type":"form_versions"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/00000000-0000-0000-0000-000000000001/versions + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","id":"f24e2ab1-4ba1-48cf-a4a2-86a32cc2e702","title":"form + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.frozen b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.frozen new file mode 100644 index 000000000000..825b0d0aab6c --- /dev/null +++ b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:49:59.826Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.yml b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.yml new file mode 100644 index 000000000000..86153dacd82b --- /dev/null +++ b/cassettes/features/v2/forms/Create-or-update-a-form-version-returns-OK-response.yml @@ -0,0 +1,70 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:49:59 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + simple test form.","idp_survey":false,"name":"Test-Create_or_update_a_form_version_returns_OK_response-1781117399","single_response":false,"ui_definition":{}},"type":"forms"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"49ccfa97-825c-46f8-872b-5368fd1b56a4","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-10T18:50:00.188982Z","datastore_config":{"datastore_id":"be7e7cf5-6a73-4d07-9654-a40997bee800","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-10T18:50:00.188982Z","name":"Test-Create_or_update_a_form_version_returns_OK_response-1781117399","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"376765","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"S2KAuCoip8JbyZNOT2gYbpUouidttEGvYWyvqeoMQjE=\\\",\\\"timestamp\\\":1781117400,\\\"proof\\\":\\\"MGUCMQDyae03EWzAe3gENsZt4WVLiPP8TGQg7UO7I28dcEK5w70MRYRf9x18lDXfOEDoPrgCMCHlQeXp/K5AKKmyVYwtJd9VI1SsJoOBOXbj26BhPKZBF386oH7LxK45J12htxj9hw==\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-10T18:50:00.188982Z","modified_at":"2026-06-10T18:50:00.188982Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:49:59 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"data_definition":{"description":"Welcome to + the Engineering Experience Survey.","required":[],"title":"Developer Experience + Survey","type":"object"},"state":"frozen","ui_definition":{"ui:order":[],"ui:theme":{"primaryColor":"gray"}},"upsert_params":{"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","insert_only":false,"match_policy":"none"}},"type":"form_versions"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/49ccfa97-825c-46f8-872b-5368fd1b56a4/versions + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"376765","type":"form_versions","attributes":{"created_at":"2026-06-10T18:50:00.188982Z","data_definition":{"description":"Welcome + to the Engineering Experience Survey.","required":[],"title":"Developer Experience + Survey","type":"object"},"definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1781117400,\\\"proof\\\":\\\"MGQCMGbAihRvSVO+KjM9uttjprG+2ZR6D5kKoXwIS4em5mjg9StXgu/pi08NfU4WMdTD8wIwcxxGWh+MzG6awNnii2Cjl46YNhPBV39JpU03mlQsb+9cGVgqL2JYVsDaAJ0G+YzN\\\"}\",\"version\":1}","etag":"30586851d6ab0b26080d3f34629e5e2cfb9f2f57457eec927b72eafefae81e48","modified_at":"2026-06-10T18:50:00.568923Z","state":"frozen","ui_definition":{"ui:order":[],"ui:theme":{"primaryColor":"gray"}},"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":1}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:49:59 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/49ccfa97-825c-46f8-872b-5368fd1b56a4 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"49ccfa97-825c-46f8-872b-5368fd1b56a4","type":"forms"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.frozen b/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..bb764fbf5b28 --- /dev/null +++ b/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:50:01.064Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.yml b/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.yml new file mode 100644 index 000000000000..4fee5eb7c931 --- /dev/null +++ b/cassettes/features/v2/forms/Publish-a-form-version-returns-Not-Found-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:50:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"version":1},"type":"form_publications"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/00000000-0000-0000-0000-000000000001/publish + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","id":"890f7bea-c0e2-45f9-a06a-e3214a19be57","title":"form + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.frozen b/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.frozen new file mode 100644 index 000000000000..1468de2aa1d6 --- /dev/null +++ b/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:50:01.393Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.yml b/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.yml new file mode 100644 index 000000000000..8b1165067622 --- /dev/null +++ b/cassettes/features/v2/forms/Publish-a-form-version-returns-OK-response.yml @@ -0,0 +1,66 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:50:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + simple test form.","idp_survey":false,"name":"Test-Publish_a_form_version_returns_OK_response-1781117401","single_response":false,"ui_definition":{}},"type":"forms"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"c73796e4-0dd3-4da4-8a9a-9297ba412b3e","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-10T18:50:01.747408Z","datastore_config":{"datastore_id":"23249c30-b740-4a4b-8c23-34fb653dfdea","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-10T18:50:01.747408Z","name":"Test-Publish_a_form_version_returns_OK_response-1781117401","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"376767","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1781117401,\\\"proof\\\":\\\"MGYCMQCE98ZIPD8JYrsEi1xXxe+8SVCjLroQbr+RRxKDmhfT++nN4tdcUXYYNtpNJDundgwCMQDG5TdraksHELR6ovN9xQtacfKq3wr2rKAIejh6Ut7m+jO5dmLml90pBOQMnAFXed4=\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-10T18:50:01.747408Z","modified_at":"2026-06-10T18:50:01.747408Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:50:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"version":1},"type":"form_publications"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/c73796e4-0dd3-4da4-8a9a-9297ba412b3e/publish + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"380020","type":"form_publications","attributes":{"created_at":"2026-06-10T18:50:02.131227Z","form_id":"c73796e4-0dd3-4da4-8a9a-9297ba412b3e","form_version":1,"modified_at":"2026-06-10T18:50:02.131227Z","org_id":321813,"publish_seq":1,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:50:01 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/c73796e4-0dd3-4da4-8a9a-9297ba412b3e + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"c73796e4-0dd3-4da4-8a9a-9297ba412b3e","type":"forms"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.frozen b/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..6a4eb039c7e2 --- /dev/null +++ b/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:50:02.747Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.yml b/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.yml new file mode 100644 index 000000000000..28f905b40b24 --- /dev/null +++ b/cassettes/features/v2/forms/Update-a-form-returns-Not-Found-response.yml @@ -0,0 +1,26 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:50:02 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"form_update":{"datastore_config":{"datastore_id":"5108ea24-dd83-4696-9caa-f069f73d0fad","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"An + updated description.","name":"Updated Form Name"}},"id":"22f6006a-2302-4926-9396-d2dfcf7b0b34","type":"forms"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/forms/00000000-0000-0000-0000-000000000001 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","id":"c5564241-69a8-4a9e-af78-20c7913fbf5b","title":"form + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Update-a-form-returns-OK-response.frozen b/cassettes/features/v2/forms/Update-a-form-returns-OK-response.frozen new file mode 100644 index 000000000000..131934de132a --- /dev/null +++ b/cassettes/features/v2/forms/Update-a-form-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-10T18:50:03.118Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Update-a-form-returns-OK-response.yml b/cassettes/features/v2/forms/Update-a-form-returns-OK-response.yml new file mode 100644 index 000000000000..2e1e28f97f38 --- /dev/null +++ b/cassettes/features/v2/forms/Update-a-form-returns-OK-response.yml @@ -0,0 +1,69 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 18:50:03 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + simple test form.","idp_survey":false,"name":"Test-Update_a_form_returns_OK_response-1781117403","single_response":false,"ui_definition":{}},"type":"forms"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"a365c4e1-5c1f-476f-9330-091fe52a6483","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-10T18:50:03.541399Z","datastore_config":{"datastore_id":"ec62b00b-6683-4943-8bd0-28d56f5dca64","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-10T18:50:03.541399Z","name":"Test-Update_a_form_returns_OK_response-1781117403","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"376768","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1781117403,\\\"proof\\\":\\\"MGUCMFvO8GziqWVPfIg06kFsX3mHcT5e/Ub8cJ/9H1oJXqCp56oL/IRLCI351BB2xHXTFAIxALOhp9M+jw87Xn+Qvl//9uiS011jgg6a8e0UftJ1NY+G/ycp/aLzZrFKaBCt6RG8sA==\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-10T18:50:03.541399Z","modified_at":"2026-06-10T18:50:03.541399Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:50:03 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"form_update":{"datastore_config":{"datastore_id":"5108ea24-dd83-4696-9caa-f069f73d0fad","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"An + updated description.","name":"Updated Form Name"}},"id":"22f6006a-2302-4926-9396-d2dfcf7b0b34","type":"forms"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/forms/a365c4e1-5c1f-476f-9330-091fe52a6483 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"a365c4e1-5c1f-476f-9330-091fe52a6483","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-10T18:50:03.541399Z","datastore_config":{"datastore_id":"5108ea24-dd83-4696-9caa-f069f73d0fad","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"An + updated description.","idp_survey":false,"modified_at":"2026-06-10T18:50:03.926234Z","name":"Updated + Form Name","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"376768","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1781117403,\\\"proof\\\":\\\"MGUCMFvO8GziqWVPfIg06kFsX3mHcT5e/Ub8cJ/9H1oJXqCp56oL/IRLCI351BB2xHXTFAIxALOhp9M+jw87Xn+Qvl//9uiS011jgg6a8e0UftJ1NY+G/ycp/aLzZrFKaBCt6RG8sA==\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-10T18:50:03.541399Z","modified_at":"2026-06-10T18:50:03.541399Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 10 Jun 2026 18:50:03 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/a365c4e1-5c1f-476f-9330-091fe52a6483 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"a365c4e1-5c1f-476f-9330-091fe52a6483","type":"forms"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-Not-Found-response.frozen b/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..a7e8da40bcf7 --- /dev/null +++ b/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-06-11T15:57:52.090Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-Not-Found-response.yml b/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-Not-Found-response.yml new file mode 100644 index 000000000000..fd8dc5fb18e3 --- /dev/null +++ b/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-Not-Found-response.yml @@ -0,0 +1,27 @@ +http_interactions: +- recorded_at: Thu, 11 Jun 2026 15:57:52 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"data_definition":{"description":"Welcome to + the Engineering Experience Survey.","required":[],"title":"Developer Experience + Survey","type":"object"},"ui_definition":{"ui:order":[],"ui:theme":{"primaryColor":"gray"}},"upsert_params":{"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d"}},"type":"form_versions"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/00000000-0000-0000-0000-000000000001/versions/upsert_and_publish + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","id":"08399bf1-1d71-4160-bc73-e858e01fde0f","title":"form + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-OK-response.frozen b/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-OK-response.frozen new file mode 100644 index 000000000000..2bab83cd013d --- /dev/null +++ b/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-11T15:57:52.936Z \ No newline at end of file diff --git a/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-OK-response.yml b/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-OK-response.yml new file mode 100644 index 000000000000..3d1c84b4b35e --- /dev/null +++ b/cassettes/features/v2/forms/Upsert-and-publish-a-form-version-returns-OK-response.yml @@ -0,0 +1,71 @@ +http_interactions: +- recorded_at: Thu, 11 Jun 2026 15:57:52 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"anonymous":false,"data_definition":{},"description":"A + simple test form.","idp_survey":false,"name":"Test-Upsert_and_publish_a_form_version_returns_OK_response-1781193472","single_response":false,"ui_definition":{}},"type":"forms"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"25824ea9-3c52-4f43-8539-a2d4cd7f9a3b","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-11T15:57:53.185492Z","datastore_config":{"datastore_id":"37899277-a526-4668-966b-e26a258347a4","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-11T15:57:53.185492Z","name":"Test-Upsert_and_publish_a_form_version_returns_OK_response-1781193472","org_id":321813,"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"380435","state":"draft","version":1,"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"S2KAuCoip8JbyZNOT2gYbpUouidttEGvYWyvqeoMQjE=\\\",\\\"timestamp\\\":1781193473,\\\"proof\\\":\\\"MGUCMQD5kghzucjG+znH/JVQhgs9+82KuT/veBwvMPxHafCX3toxbVfSadP16IDWljuo2SYCMFjmS1y3rcGEBUCajP/BE82sUdc9L8jxA57Jz6lvCsuDKC7BfFYVq2FjSrj19aS9Pg==\\\"}\",\"version\":1}","data_definition":{},"ui_definition":{},"created_at":"2026-06-11T15:57:53.185492Z","modified_at":"2026-06-11T15:57:53.185492Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Thu, 11 Jun 2026 15:57:52 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"data_definition":{"description":"Welcome to + the Engineering Experience Survey.","required":[],"title":"Developer Experience + Survey","type":"object"},"ui_definition":{"ui:order":[],"ui:theme":{"primaryColor":"gray"}},"upsert_params":{"etag":"b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d"}},"type":"form_versions"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/forms/25824ea9-3c52-4f43-8539-a2d4cd7f9a3b/versions/upsert_and_publish + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"25824ea9-3c52-4f43-8539-a2d4cd7f9a3b","type":"forms","attributes":{"active":true,"anonymous":false,"created_at":"2026-06-11T15:57:53.185492Z","datastore_config":{"datastore_id":"37899277-a526-4668-966b-e26a258347a4","primary_column_name":"id","primary_key_generation_strategy":"none"},"description":"A + simple test form.","idp_survey":false,"modified_at":"2026-06-11T15:57:53.185492Z","name":"Test-Upsert_and_publish_a_form_version_returns_OK_response-1781193472","org_id":321813,"publication":{"id":"383651","org_id":321813,"form_id":"25824ea9-3c52-4f43-8539-a2d4cd7f9a3b","publish_seq":1,"form_version":1,"created_at":"2026-06-11T15:57:53.39063Z","modified_at":"2026-06-11T15:57:53.39063Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"self_service":false,"single_response":false,"user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","version":{"id":"380435","state":"frozen","version":1,"etag":"30586851d6ab0b26080d3f34629e5e2cfb9f2f57457eec927b72eafefae81e48","definition_signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"XOOWpRG1rFvaLHaG9qLf+GG78llET0BKnZtokyAtLfg=\\\",\\\"timestamp\\\":1781193473,\\\"proof\\\":\\\"MGUCMQCtGifKZr+EjEtnFk2ZKxy0DThB02mQ5wMJ3vB5L7zgTpHR+6k38mxLM1CqP2YFeQgCMHL7aBH2pJzR7yrv2YvaWNnv2puOld4laoRAWzCcuHgxHVWnp7wEcrvebyDbNej+2g==\\\"}\",\"version\":1}","data_definition":{"description":"Welcome + to the Engineering Experience Survey.","required":[],"title":"Developer Experience + Survey","type":"object"},"ui_definition":{"ui:order":[],"ui:theme":{"primaryColor":"gray"}},"created_at":"2026-06-11T15:57:53.185492Z","modified_at":"2026-06-11T15:57:53.39063Z","user_id":2320499,"user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Thu, 11 Jun 2026 15:57:52 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v2/forms/25824ea9-3c52-4f43-8539-a2d4cd7f9a3b + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"25824ea9-3c52-4f43-8539-a2d4cd7f9a3b","type":"forms"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v2/forms/CloneForm.rb b/examples/v2/forms/CloneForm.rb new file mode 100644 index 000000000000..122aaa8dd6d5 --- /dev/null +++ b/examples/v2/forms/CloneForm.rb @@ -0,0 +1,17 @@ +# Clone a form returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.clone_form".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FormsAPI.new + +body = DatadogAPIClient::V2::CloneFormRequest.new({ + data: DatadogAPIClient::V2::CloneFormData.new({ + attributes: DatadogAPIClient::V2::CloneFormDataAttributes.new({ + name: "Copy of My Form", + }), + type: DatadogAPIClient::V2::FormType::FORMS, + }), +}) +p api_instance.clone_form("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", body) diff --git a/examples/v2/forms/PublishForm.rb b/examples/v2/forms/PublishForm.rb new file mode 100644 index 000000000000..d3fd25ffea5b --- /dev/null +++ b/examples/v2/forms/PublishForm.rb @@ -0,0 +1,20 @@ +# Publish a form version returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.publish_form".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FormsAPI.new + +# there is a valid "form" in the system +FORM_DATA_ID = ENV["FORM_DATA_ID"] + +body = DatadogAPIClient::V2::PublishFormRequest.new({ + data: DatadogAPIClient::V2::PublishFormData.new({ + attributes: DatadogAPIClient::V2::PublishFormDataAttributes.new({ + version: 1, + }), + type: DatadogAPIClient::V2::FormPublicationType::FORM_PUBLICATIONS, + }), +}) +p api_instance.publish_form(FORM_DATA_ID, body) diff --git a/examples/v2/forms/UpdateForm.rb b/examples/v2/forms/UpdateForm.rb new file mode 100644 index 000000000000..569eead70ec6 --- /dev/null +++ b/examples/v2/forms/UpdateForm.rb @@ -0,0 +1,29 @@ +# Update a form returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_form".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FormsAPI.new + +# there is a valid "form" in the system +FORM_DATA_ID = ENV["FORM_DATA_ID"] + +body = DatadogAPIClient::V2::UpdateFormRequest.new({ + data: DatadogAPIClient::V2::UpdateFormData.new({ + attributes: DatadogAPIClient::V2::UpdateFormDataAttributes.new({ + form_update: DatadogAPIClient::V2::FormUpdateAttributes.new({ + datastore_config: DatadogAPIClient::V2::FormDatastoreConfigAttributes.new({ + datastore_id: "5108ea24-dd83-4696-9caa-f069f73d0fad", + primary_column_name: "id", + primary_key_generation_strategy: "none", + }), + description: "An updated description.", + name: "Updated Form Name", + }), + }), + id: FORM_DATA_ID, + type: DatadogAPIClient::V2::FormType::FORMS, + }), +}) +p api_instance.update_form(FORM_DATA_ID, body) diff --git a/examples/v2/forms/UpsertAndPublishFormVersion.rb b/examples/v2/forms/UpsertAndPublishFormVersion.rb new file mode 100644 index 000000000000..1ec6ef21b08c --- /dev/null +++ b/examples/v2/forms/UpsertAndPublishFormVersion.rb @@ -0,0 +1,34 @@ +# Upsert and publish a form version returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.upsert_and_publish_form_version".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FormsAPI.new + +# there is a valid "form" in the system +FORM_DATA_ID = ENV["FORM_DATA_ID"] + +body = DatadogAPIClient::V2::UpsertAndPublishFormVersionRequest.new({ + data: DatadogAPIClient::V2::UpsertAndPublishFormVersionData.new({ + attributes: DatadogAPIClient::V2::UpsertAndPublishFormVersionDataAttributes.new({ + data_definition: DatadogAPIClient::V2::FormDataDefinition.new({ + description: "Welcome to the Engineering Experience Survey.", + required: [], + title: "Developer Experience Survey", + type: DatadogAPIClient::V2::FormDataDefinitionType::OBJECT, + }), + ui_definition: DatadogAPIClient::V2::FormUiDefinition.new({ + ui_order: [], + ui_theme: DatadogAPIClient::V2::FormUiDefinitionUiTheme.new({ + primary_color: DatadogAPIClient::V2::FormUiDefinitionUiThemePrimaryColor::GRAY, + }), + }), + upsert_params: DatadogAPIClient::V2::UpsertAndPublishFormVersionUpsertParams.new({ + etag: "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d", + }), + }), + type: DatadogAPIClient::V2::FormVersionType::FORM_VERSIONS, + }), +}) +p api_instance.upsert_and_publish_form_version(FORM_DATA_ID, body) diff --git a/examples/v2/forms/UpsertFormVersion.rb b/examples/v2/forms/UpsertFormVersion.rb new file mode 100644 index 000000000000..e483fc119792 --- /dev/null +++ b/examples/v2/forms/UpsertFormVersion.rb @@ -0,0 +1,37 @@ +# Create or update a form version returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.upsert_form_version".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FormsAPI.new + +# there is a valid "form" in the system +FORM_DATA_ID = ENV["FORM_DATA_ID"] + +body = DatadogAPIClient::V2::UpsertFormVersionRequest.new({ + data: DatadogAPIClient::V2::UpsertFormVersionData.new({ + attributes: DatadogAPIClient::V2::UpsertFormVersionDataAttributes.new({ + data_definition: DatadogAPIClient::V2::FormDataDefinition.new({ + description: "Welcome to the Engineering Experience Survey.", + required: [], + title: "Developer Experience Survey", + type: DatadogAPIClient::V2::FormDataDefinitionType::OBJECT, + }), + state: DatadogAPIClient::V2::FormVersionState::FROZEN, + ui_definition: DatadogAPIClient::V2::FormUiDefinition.new({ + ui_order: [], + ui_theme: DatadogAPIClient::V2::FormUiDefinitionUiTheme.new({ + primary_color: DatadogAPIClient::V2::FormUiDefinitionUiThemePrimaryColor::GRAY, + }), + }), + upsert_params: DatadogAPIClient::V2::UpsertFormVersionUpsertParams.new({ + etag: "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d", + insert_only: false, + match_policy: DatadogAPIClient::V2::LatestVersionMatchPolicy::NONE, + }), + }), + type: DatadogAPIClient::V2::FormVersionType::FORM_VERSIONS, + }), +}) +p api_instance.upsert_form_version(FORM_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 826703044334..03c9c598d6d0 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3192,6 +3192,26 @@ "form_id" => "UUID", "version" => "String", }, + "v2.UpdateForm" => { + "form_id" => "UUID", + "body" => "UpdateFormRequest", + }, + "v2.CloneForm" => { + "form_id" => "UUID", + "body" => "CloneFormRequest", + }, + "v2.PublishForm" => { + "form_id" => "UUID", + "body" => "PublishFormRequest", + }, + "v2.UpsertFormVersion" => { + "form_id" => "UUID", + "body" => "UpsertFormVersionRequest", + }, + "v2.UpsertAndPublishFormVersion" => { + "form_id" => "UUID", + "body" => "UpsertAndPublishFormVersionRequest", + }, "v2.CreateHamrOrgConnection" => { "body" => "HamrOrgConnectionRequest", }, diff --git a/features/v2/forms.feature b/features/v2/forms.feature index 40823edbc0f2..eb380d0f845a 100644 --- a/features/v2/forms.feature +++ b/features/v2/forms.feature @@ -1,14 +1,41 @@ @endpoint(forms) @endpoint(forms-v2) Feature: Forms The Datadog Forms API lets you create and manage forms within the App - Builder platform. You can configure form settings, manage versions, - publish forms, and handle sharing configurations. + Builder platform. You can configure form settings, manage versions, and + publish forms. Background: Given a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system And an instance of "Forms" API + @generated @skip @team:DataDog/app-builder-backend + Scenario: Clone a form returns "Bad Request" response + Given operation "CloneForm" enabled + And new "CloneForm" request + And request contains "form_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Copy of My Form"}, "type": "forms"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Clone a form returns "Not Found" response + Given operation "CloneForm" enabled + And new "CloneForm" request + And request contains "form_id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"name": "Copy of My Form"}, "type": "forms"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Clone a form returns "OK" response + Given operation "CloneForm" enabled + And new "CloneForm" request + And request contains "form_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Copy of My Form"}, "type": "forms"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/app-builder-backend Scenario: Create a form returns "Bad Request" response Given operation "CreateForm" enabled @@ -41,6 +68,34 @@ Feature: Forms When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/app-builder-backend + Scenario: Create or update a form version returns "Bad Request" response + Given operation "UpsertFormVersion" enabled + And new "UpsertFormVersion" request + And request contains "form_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"data_definition": {"description": "Welcome to the Engineering Experience Survey.", "required": [], "title": "Developer Experience Survey", "type": "object"}, "state": "frozen", "ui_definition": {"ui:order": [], "ui:theme": {"primaryColor": "gray"}}, "upsert_params": {"etag": "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d", "insert_only": false, "match_policy": "none"}}, "type": "form_versions"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Create or update a form version returns "Not Found" response + Given operation "UpsertFormVersion" enabled + And new "UpsertFormVersion" request + And request contains "form_id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"data_definition": {"description": "Welcome to the Engineering Experience Survey.", "required": [], "title": "Developer Experience Survey", "type": "object"}, "state": "frozen", "ui_definition": {"ui:order": [], "ui:theme": {"primaryColor": "gray"}}, "upsert_params": {"etag": "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d", "insert_only": false, "match_policy": "none"}}, "type": "form_versions"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Create or update a form version returns "OK" response + Given operation "UpsertFormVersion" enabled + And there is a valid "form" in the system + And new "UpsertFormVersion" request + And request contains "form_id" parameter from "form.data.id" + And body with value {"data": {"attributes": {"data_definition": {"description": "Welcome to the Engineering Experience Survey.", "required": [], "title": "Developer Experience Survey", "type": "object"}, "state": "frozen", "ui_definition": {"ui:order": [], "ui:theme": {"primaryColor": "gray"}}, "upsert_params": {"etag": "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d", "insert_only": false, "match_policy": "none"}}, "type": "form_versions"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/app-builder-backend Scenario: Delete a form returns "Bad Request" response Given operation "DeleteForm" enabled @@ -105,3 +160,87 @@ Feature: Forms And the response "data" has item with field "id" with value "{{ form.data.id }}" And the response "data" has item with field "type" with value "forms" And the response "data" has item with field "attributes.name" with value "{{ unique }}" + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Publish a form version returns "Bad Request" response + Given operation "PublishForm" enabled + And new "PublishForm" request + And request contains "form_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"version": 1}, "type": "form_publications"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Publish a form version returns "Not Found" response + Given operation "PublishForm" enabled + And new "PublishForm" request + And request contains "form_id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"version": 1}, "type": "form_publications"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Publish a form version returns "OK" response + Given operation "PublishForm" enabled + And there is a valid "form" in the system + And new "PublishForm" request + And request contains "form_id" parameter from "form.data.id" + And body with value {"data": {"attributes": {"version": 1}, "type": "form_publications"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Update a form returns "Bad Request" response + Given operation "UpdateForm" enabled + And new "UpdateForm" request + And request contains "form_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"form_update": {"datastore_config": {"datastore_id": "5108ea24-dd83-4696-9caa-f069f73d0fad", "primary_column_name": "id", "primary_key_generation_strategy": "none"}, "description": "An updated description.", "name": "Updated Form Name"}}, "id": "22f6006a-2302-4926-9396-d2dfcf7b0b34", "type": "forms"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Update a form returns "Not Found" response + Given operation "UpdateForm" enabled + And new "UpdateForm" request + And request contains "form_id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"form_update": {"datastore_config": {"datastore_id": "5108ea24-dd83-4696-9caa-f069f73d0fad", "primary_column_name": "id", "primary_key_generation_strategy": "none"}, "description": "An updated description.", "name": "Updated Form Name"}}, "id": "22f6006a-2302-4926-9396-d2dfcf7b0b34", "type": "forms"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Update a form returns "OK" response + Given operation "UpdateForm" enabled + And there is a valid "form" in the system + And new "UpdateForm" request + And request contains "form_id" parameter from "form.data.id" + And body with value {"data": {"attributes": {"form_update": {"datastore_config": {"datastore_id": "5108ea24-dd83-4696-9caa-f069f73d0fad", "primary_column_name": "id", "primary_key_generation_strategy": "none"}, "description": "An updated description.", "name": "Updated Form Name"}}, "id": "22f6006a-2302-4926-9396-d2dfcf7b0b34", "type": "forms"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/app-builder-backend + Scenario: Upsert and publish a form version returns "Bad Request" response + Given operation "UpsertAndPublishFormVersion" enabled + And new "UpsertAndPublishFormVersion" request + And request contains "form_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"data_definition": {"description": "Welcome to the Engineering Experience Survey.", "required": [], "title": "Developer Experience Survey", "type": "object"}, "ui_definition": {"ui:order": [], "ui:theme": {"primaryColor": "gray"}}, "upsert_params": {"etag": "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d"}}, "type": "form_versions"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Upsert and publish a form version returns "Not Found" response + Given operation "UpsertAndPublishFormVersion" enabled + And new "UpsertAndPublishFormVersion" request + And request contains "form_id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"data_definition": {"description": "Welcome to the Engineering Experience Survey.", "required": [], "title": "Developer Experience Survey", "type": "object"}, "ui_definition": {"ui:order": [], "ui:theme": {"primaryColor": "gray"}}, "upsert_params": {"etag": "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d"}}, "type": "form_versions"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/app-builder-backend + Scenario: Upsert and publish a form version returns "OK" response + Given operation "UpsertAndPublishFormVersion" enabled + And there is a valid "form" in the system + And new "UpsertAndPublishFormVersion" request + And request contains "form_id" parameter from "form.data.id" + And body with value {"data": {"attributes": {"data_definition": {"description": "Welcome to the Engineering Experience Survey.", "required": [], "title": "Developer Experience Survey", "type": "object"}, "ui_definition": {"ui:order": [], "ui:theme": {"primaryColor": "gray"}}, "upsert_params": {"etag": "b51f08b698d88d8027a935d9db649774949f5fb41a0c559bfee6a9a13225c72d"}}, "type": "form_versions"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 0118bfb67de0..25fb6bb2dc24 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2713,6 +2713,43 @@ "type": "safe" } }, + "UpdateForm": { + "tag": "Forms", + "undo": { + "type": "idempotent" + } + }, + "CloneForm": { + "tag": "Forms", + "undo": { + "operationId": "DeleteForm", + "parameters": [ + { + "name": "form_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "PublishForm": { + "tag": "Forms", + "undo": { + "type": "idempotent" + } + }, + "UpsertFormVersion": { + "tag": "Forms", + "undo": { + "type": "idempotent" + } + }, + "UpsertAndPublishFormVersion": { + "tag": "Forms", + "undo": { + "type": "idempotent" + } + }, "GetHamrOrgConnection": { "tag": "High Availability MultiRegion", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 05c83b9c8abf..9003ee6ec94d 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -443,11 +443,16 @@ def initialize "v2.trigger_deployment_gates_evaluation": false, "v2.update_deployment_gate": false, "v2.update_deployment_rule": false, + "v2.clone_form": false, "v2.create_and_publish_form": false, "v2.create_form": false, "v2.delete_form": false, "v2.get_form": false, "v2.list_forms": false, + "v2.publish_form": false, + "v2.update_form": false, + "v2.upsert_and_publish_form_version": false, + "v2.upsert_form_version": false, "v2.create_hamr_org_connection": false, "v2.get_hamr_org_connection": false, "v2.delete_entity_integration_config": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index c6eae3783161..395749b86e27 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2072,6 +2072,9 @@ def overrides "v2.clickup_integration" => "ClickupIntegration", "v2.clickup_integration_type" => "ClickupIntegrationType", "v2.clickup_integration_update" => "ClickupIntegrationUpdate", + "v2.clone_form_data" => "CloneFormData", + "v2.clone_form_data_attributes" => "CloneFormDataAttributes", + "v2.clone_form_request" => "CloneFormRequest", "v2.cloud_asset_type" => "CloudAssetType", "v2.cloud_configuration_compliance_rule_options" => "CloudConfigurationComplianceRuleOptions", "v2.cloud_configuration_rego_rule" => "CloudConfigurationRegoRule", @@ -3257,6 +3260,9 @@ def overrides "v2.form_data_definition_type" => "FormDataDefinitionType", "v2.form_datastore_config_attributes" => "FormDatastoreConfigAttributes", "v2.form_publication_attributes" => "FormPublicationAttributes", + "v2.form_publication_data" => "FormPublicationData", + "v2.form_publication_response" => "FormPublicationResponse", + "v2.form_publication_type" => "FormPublicationType", "v2.form_response" => "FormResponse", "v2.forms_response" => "FormsResponse", "v2.form_trigger" => "FormTrigger", @@ -3266,8 +3272,12 @@ def overrides "v2.form_ui_definition_ui_theme" => "FormUiDefinitionUiTheme", "v2.form_ui_definition_ui_theme_primary_color" => "FormUiDefinitionUiThemePrimaryColor", "v2.formula_limit" => "FormulaLimit", + "v2.form_update_attributes" => "FormUpdateAttributes", "v2.form_version_attributes" => "FormVersionAttributes", + "v2.form_version_data" => "FormVersionData", + "v2.form_version_response" => "FormVersionResponse", "v2.form_version_state" => "FormVersionState", + "v2.form_version_type" => "FormVersionType", "v2.framework_handle_and_version_response_data" => "FrameworkHandleAndVersionResponseData", "v2.freshservice_api_key" => "FreshserviceAPIKey", "v2.freshservice_api_key_type" => "FreshserviceAPIKeyType", @@ -3869,6 +3879,7 @@ def overrides "v2.kind_obj" => "KindObj", "v2.kind_response_meta" => "KindResponseMeta", "v2.language" => "Language", + "v2.latest_version_match_policy" => "LatestVersionMatchPolicy", "v2.launch_darkly_api_key" => "LaunchDarklyAPIKey", "v2.launch_darkly_api_key_type" => "LaunchDarklyAPIKeyType", "v2.launch_darkly_api_key_update" => "LaunchDarklyAPIKeyUpdate", @@ -5453,6 +5464,9 @@ def overrides "v2.pruned_trace_response" => "PrunedTraceResponse", "v2.pruned_trace_type" => "PrunedTraceType", "v2.publish_app_response" => "PublishAppResponse", + "v2.publish_form_data" => "PublishFormData", + "v2.publish_form_data_attributes" => "PublishFormDataAttributes", + "v2.publish_form_request" => "PublishFormRequest", "v2.publish_request_type" => "PublishRequestType", "v2.put_apps_datastore_item_response_array" => "PutAppsDatastoreItemResponseArray", "v2.put_apps_datastore_item_response_data" => "PutAppsDatastoreItemResponseData", @@ -7285,6 +7299,9 @@ def overrides "v2.update_flaky_tests_response_data" => "UpdateFlakyTestsResponseData", "v2.update_flaky_tests_response_data_type" => "UpdateFlakyTestsResponseDataType", "v2.update_flaky_tests_response_result" => "UpdateFlakyTestsResponseResult", + "v2.update_form_data" => "UpdateFormData", + "v2.update_form_data_attributes" => "UpdateFormDataAttributes", + "v2.update_form_request" => "UpdateFormRequest", "v2.update_on_call_notification_rule_request" => "UpdateOnCallNotificationRuleRequest", "v2.update_on_call_notification_rule_request_attributes" => "UpdateOnCallNotificationRuleRequestAttributes", "v2.update_on_call_notification_rule_request_data" => "UpdateOnCallNotificationRuleRequestData", @@ -7324,6 +7341,10 @@ def overrides "v2.update_workflow_request" => "UpdateWorkflowRequest", "v2.update_workflow_response" => "UpdateWorkflowResponse", "v2.upsert_allocation_request" => "UpsertAllocationRequest", + "v2.upsert_and_publish_form_version_data" => "UpsertAndPublishFormVersionData", + "v2.upsert_and_publish_form_version_data_attributes" => "UpsertAndPublishFormVersionDataAttributes", + "v2.upsert_and_publish_form_version_request" => "UpsertAndPublishFormVersionRequest", + "v2.upsert_and_publish_form_version_upsert_params" => "UpsertAndPublishFormVersionUpsertParams", "v2.upsert_catalog_entity_request" => "UpsertCatalogEntityRequest", "v2.upsert_catalog_entity_response" => "UpsertCatalogEntityResponse", "v2.upsert_catalog_entity_response_included_item" => "UpsertCatalogEntityResponseIncludedItem", @@ -7332,6 +7353,10 @@ def overrides "v2.upsert_cloud_inventory_sync_config_request" => "UpsertCloudInventorySyncConfigRequest", "v2.upsert_cloud_inventory_sync_config_request_attributes" => "UpsertCloudInventorySyncConfigRequestAttributes", "v2.upsert_cloud_inventory_sync_config_request_data" => "UpsertCloudInventorySyncConfigRequestData", + "v2.upsert_form_version_data" => "UpsertFormVersionData", + "v2.upsert_form_version_data_attributes" => "UpsertFormVersionDataAttributes", + "v2.upsert_form_version_request" => "UpsertFormVersionRequest", + "v2.upsert_form_version_upsert_params" => "UpsertFormVersionUpsertParams", "v2.upsert_o_auth_scopes_restriction_data" => "UpsertOAuthScopesRestrictionData", "v2.upsert_o_auth_scopes_restriction_data_attributes" => "UpsertOAuthScopesRestrictionDataAttributes", "v2.upsert_o_auth_scopes_restriction_request" => "UpsertOAuthScopesRestrictionRequest", diff --git a/lib/datadog_api_client/v2/api/forms_api.rb b/lib/datadog_api_client/v2/api/forms_api.rb index dd0778bbefba..e0a1db29b6d5 100644 --- a/lib/datadog_api_client/v2/api/forms_api.rb +++ b/lib/datadog_api_client/v2/api/forms_api.rb @@ -23,6 +23,84 @@ def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end + # Clone a form. + # + # @see #clone_form_with_http_info + def clone_form(form_id, body, opts = {}) + data, _status_code, _headers = clone_form_with_http_info(form_id, body, opts) + data + end + + # Clone a form. + # + # Clone an existing form. The clone is created in draft mode using the source form's latest version. + # + # @param form_id [UUID] The ID of the form to clone. + # @param body [CloneFormRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(FormResponse, Integer, Hash)>] FormResponse data, response status code and response headers + def clone_form_with_http_info(form_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.clone_form".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.clone_form") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.clone_form")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormsAPI.clone_form ...' + end + # verify the required parameter 'form_id' is set + if @api_client.config.client_side_validation && form_id.nil? + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.clone_form" + 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 FormsAPI.clone_form" + end + # resource path + local_var_path = '/api/v2/forms/{form_id}/clone'.sub('{form_id}', CGI.escape(form_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] || 'FormResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :clone_form, + :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::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormsAPI#clone_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create and publish a form. # # @see #create_and_publish_form_with_http_info @@ -378,5 +456,318 @@ def list_forms_with_http_info(opts = {}) end return data, status_code, headers end + + # Publish a form version. + # + # @see #publish_form_with_http_info + def publish_form(form_id, body, opts = {}) + data, _status_code, _headers = publish_form_with_http_info(form_id, body, opts) + data + end + + # Publish a form version. + # + # Publish a specific version of a form, making it available for submissions. + # + # @param form_id [UUID] The ID of the form. + # @param body [PublishFormRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(FormPublicationResponse, Integer, Hash)>] FormPublicationResponse data, response status code and response headers + def publish_form_with_http_info(form_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.publish_form".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.publish_form") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.publish_form")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormsAPI.publish_form ...' + end + # verify the required parameter 'form_id' is set + if @api_client.config.client_side_validation && form_id.nil? + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.publish_form" + 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 FormsAPI.publish_form" + end + # resource path + local_var_path = '/api/v2/forms/{form_id}/publish'.sub('{form_id}', CGI.escape(form_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] || 'FormPublicationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :publish_form, + :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::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormsAPI#publish_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a form. + # + # @see #update_form_with_http_info + def update_form(form_id, body, opts = {}) + data, _status_code, _headers = update_form_with_http_info(form_id, body, opts) + data + end + + # Update a form. + # + # Update a form's properties such as its name, description, or datastore configuration. + # + # @param form_id [UUID] The ID of the form. + # @param body [UpdateFormRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(FormResponse, Integer, Hash)>] FormResponse data, response status code and response headers + def update_form_with_http_info(form_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_form".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_form") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_form")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormsAPI.update_form ...' + end + # verify the required parameter 'form_id' is set + if @api_client.config.client_side_validation && form_id.nil? + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.update_form" + 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 FormsAPI.update_form" + end + # resource path + local_var_path = '/api/v2/forms/{form_id}'.sub('{form_id}', CGI.escape(form_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] || 'FormResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_form, + :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: FormsAPI#update_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Upsert and publish a form version. + # + # @see #upsert_and_publish_form_version_with_http_info + def upsert_and_publish_form_version(form_id, body, opts = {}) + data, _status_code, _headers = upsert_and_publish_form_version_with_http_info(form_id, body, opts) + data + end + + # Upsert and publish a form version. + # + # Upsert the latest form version and publish it in a single atomic transaction. + # + # @param form_id [UUID] The ID of the form. + # @param body [UpsertAndPublishFormVersionRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(FormResponse, Integer, Hash)>] FormResponse data, response status code and response headers + def upsert_and_publish_form_version_with_http_info(form_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.upsert_and_publish_form_version".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.upsert_and_publish_form_version") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.upsert_and_publish_form_version")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormsAPI.upsert_and_publish_form_version ...' + end + # verify the required parameter 'form_id' is set + if @api_client.config.client_side_validation && form_id.nil? + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.upsert_and_publish_form_version" + 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 FormsAPI.upsert_and_publish_form_version" + end + # resource path + local_var_path = '/api/v2/forms/{form_id}/versions/upsert_and_publish'.sub('{form_id}', CGI.escape(form_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] || 'FormResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :upsert_and_publish_form_version, + :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::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormsAPI#upsert_and_publish_form_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create or update a form version. + # + # @see #upsert_form_version_with_http_info + def upsert_form_version(form_id, body, opts = {}) + data, _status_code, _headers = upsert_form_version_with_http_info(form_id, body, opts) + data + end + + # Create or update a form version. + # + # Create or update the latest draft version of a form. The `upsert_params` field controls + # optimistic concurrency behavior. + # + # @param form_id [UUID] The ID of the form. + # @param body [UpsertFormVersionRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(FormVersionResponse, Integer, Hash)>] FormVersionResponse data, response status code and response headers + def upsert_form_version_with_http_info(form_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.upsert_form_version".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.upsert_form_version") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.upsert_form_version")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormsAPI.upsert_form_version ...' + end + # verify the required parameter 'form_id' is set + if @api_client.config.client_side_validation && form_id.nil? + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormsAPI.upsert_form_version" + 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 FormsAPI.upsert_form_version" + end + # resource path + local_var_path = '/api/v2/forms/{form_id}/versions'.sub('{form_id}', CGI.escape(form_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] || 'FormVersionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :upsert_form_version, + :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::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormsAPI#upsert_form_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/clone_form_data.rb b/lib/datadog_api_client/v2/models/clone_form_data.rb new file mode 100644 index 000000000000..f643b689c444 --- /dev/null +++ b/lib/datadog_api_client/v2/models/clone_form_data.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 data for cloning a form. + class CloneFormData + include BaseGenericModel + + # The attributes for cloning a form. + attr_accessor :attributes + + # The resource type for a form. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CloneFormDataAttributes', + :'type' => :'FormType' + } + 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::CloneFormData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @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 && + 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/clone_form_data_attributes.rb b/lib/datadog_api_client/v2/models/clone_form_data_attributes.rb new file mode 100644 index 000000000000..02c2ff0bde9e --- /dev/null +++ b/lib/datadog_api_client/v2/models/clone_form_data_attributes.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 attributes for cloning a form. + class CloneFormDataAttributes + include BaseGenericModel + + # The name for the cloned form. Defaults to "Copy of (source form name)" if not provided. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'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::CloneFormDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/clone_form_request.rb b/lib/datadog_api_client/v2/models/clone_form_request.rb new file mode 100644 index 000000000000..64375eddd335 --- /dev/null +++ b/lib/datadog_api_client/v2/models/clone_form_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 + # A request to clone a form. + class CloneFormRequest + include BaseGenericModel + + # The data for cloning a form. + 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' => :'CloneFormData' + } + 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::CloneFormRequest` 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/form_publication_data.rb b/lib/datadog_api_client/v2/models/form_publication_data.rb new file mode 100644 index 000000000000..17638b1b0edf --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_publication_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A form publication resource object. + class FormPublicationData + include BaseGenericModel + + # The attributes of a form publication. + attr_reader :attributes + + # The ID of the form publication. + attr_reader :id + + # The resource type for a form publication. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'FormPublicationAttributes', + :'id' => :'String', + :'type' => :'FormPublicationType' + } + 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::FormPublicationData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/form_publication_response.rb b/lib/datadog_api_client/v2/models/form_publication_response.rb new file mode 100644 index 000000000000..3c3a0c0c9ba4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_publication_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A response containing a single form publication. + class FormPublicationResponse + include BaseGenericModel + + # A form publication resource object. + 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' => :'FormPublicationData' + } + 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::FormPublicationResponse` 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/form_publication_type.rb b/lib/datadog_api_client/v2/models/form_publication_type.rb new file mode 100644 index 000000000000..0821e6ae56b8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_publication_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The resource type for a form publication. + class FormPublicationType + include BaseEnumModel + + FORM_PUBLICATIONS = "form_publications".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/form_update_attributes.rb b/lib/datadog_api_client/v2/models/form_update_attributes.rb new file mode 100644 index 000000000000..64be30c964a6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_update_attributes.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 + # The fields to update on a form. At least one field must be provided. + class FormUpdateAttributes + include BaseGenericModel + + # The datastore configuration for a form. + attr_accessor :datastore_config + + # The updated description of the form. + attr_accessor :description + + # The updated name of the form. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'datastore_config' => :'datastore_config', + :'description' => :'description', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'datastore_config' => :'FormDatastoreConfigAttributes', + :'description' => :'String', + :'name' => :'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::FormUpdateAttributes` 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?(:'datastore_config') + self.datastore_config = attributes[:'datastore_config'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + 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 && + datastore_config == o.datastore_config && + description == o.description && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [datastore_config, description, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/form_version_data.rb b/lib/datadog_api_client/v2/models/form_version_data.rb new file mode 100644 index 000000000000..6cb5cffedca0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_version_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A form version resource object. + class FormVersionData + include BaseGenericModel + + # The attributes of a form version. + attr_reader :attributes + + # The ID of the form version. + attr_reader :id + + # The resource type for a form version. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'FormVersionAttributes', + :'id' => :'String', + :'type' => :'FormVersionType' + } + 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::FormVersionData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/form_version_response.rb b/lib/datadog_api_client/v2/models/form_version_response.rb new file mode 100644 index 000000000000..739c07f36c94 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_version_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A response containing a single form version. + class FormVersionResponse + include BaseGenericModel + + # A form version resource object. + 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' => :'FormVersionData' + } + 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::FormVersionResponse` 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/form_version_type.rb b/lib/datadog_api_client/v2/models/form_version_type.rb new file mode 100644 index 000000000000..05f2e2f6d2c8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/form_version_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The resource type for a form version. + class FormVersionType + include BaseEnumModel + + FORM_VERSIONS = "form_versions".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/latest_version_match_policy.rb b/lib/datadog_api_client/v2/models/latest_version_match_policy.rb new file mode 100644 index 000000000000..b5fc2c20fff7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/latest_version_match_policy.rb @@ -0,0 +1,27 @@ +=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 policy for matching the latest form version during an upsert operation. + class LatestVersionMatchPolicy + include BaseEnumModel + + NONE = "none".freeze + IF_ETAG_MATCH = "if_etag_match".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/publish_form_data.rb b/lib/datadog_api_client/v2/models/publish_form_data.rb new file mode 100644 index 000000000000..42ae2c0774f8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/publish_form_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data for publishing a form version. + class PublishFormData + include BaseGenericModel + + # The attributes for publishing a form version. + attr_reader :attributes + + # The resource type for a form publication. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'PublishFormDataAttributes', + :'type' => :'FormPublicationType' + } + 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::PublishFormData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/publish_form_data_attributes.rb b/lib/datadog_api_client/v2/models/publish_form_data_attributes.rb new file mode 100644 index 000000000000..81a97d0c0b67 --- /dev/null +++ b/lib/datadog_api_client/v2/models/publish_form_data_attributes.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 + # The attributes for publishing a form version. + class PublishFormDataAttributes + include BaseGenericModel + + # The version number to publish. + attr_reader :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'version' => :'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::PublishFormDataAttributes` 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?(:'version') + self.version = attributes[:'version'] + 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 @version.nil? + true + end + + # Custom attribute writer method with validation + # @param version [Object] Object to be assigned + # @!visibility private + def version=(version) + if version.nil? + fail ArgumentError, 'invalid value for "version", version cannot be nil.' + end + @version = version + 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 && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/publish_form_request.rb b/lib/datadog_api_client/v2/models/publish_form_request.rb new file mode 100644 index 000000000000..643a1ea2d6b5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/publish_form_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 + # A request to publish a form version. + class PublishFormRequest + include BaseGenericModel + + # The data for publishing a form version. + 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' => :'PublishFormData' + } + 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::PublishFormRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_form_data.rb b/lib/datadog_api_client/v2/models/update_form_data.rb new file mode 100644 index 000000000000..8cf454a92c30 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_form_data.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data for updating a form. + class UpdateFormData + include BaseGenericModel + + # The attributes for updating a form. + attr_reader :attributes + + # The ID of the form. + attr_accessor :id + + # The resource type for a form. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'UpdateFormDataAttributes', + :'id' => :'UUID', + :'type' => :'FormType' + } + 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::UpdateFormData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_form_data_attributes.rb b/lib/datadog_api_client/v2/models/update_form_data_attributes.rb new file mode 100644 index 000000000000..4c2308560b62 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_form_data_attributes.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 + # The attributes for updating a form. + class UpdateFormDataAttributes + include BaseGenericModel + + # The fields to update on a form. At least one field must be provided. + attr_reader :form_update + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'form_update' => :'form_update' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'form_update' => :'FormUpdateAttributes' + } + 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::UpdateFormDataAttributes` 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?(:'form_update') + self.form_update = attributes[:'form_update'] + 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 @form_update.nil? + true + end + + # Custom attribute writer method with validation + # @param form_update [Object] Object to be assigned + # @!visibility private + def form_update=(form_update) + if form_update.nil? + fail ArgumentError, 'invalid value for "form_update", form_update cannot be nil.' + end + @form_update = form_update + 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 && + form_update == o.form_update && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [form_update, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_form_request.rb b/lib/datadog_api_client/v2/models/update_form_request.rb new file mode 100644 index 000000000000..06dc5a756db0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_form_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 + # A request to update a form. + class UpdateFormRequest + include BaseGenericModel + + # The data for updating a form. + 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' => :'UpdateFormData' + } + 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::UpdateFormRequest` 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/upsert_and_publish_form_version_data.rb b/lib/datadog_api_client/v2/models/upsert_and_publish_form_version_data.rb new file mode 100644 index 000000000000..5f73e178bf6f --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_and_publish_form_version_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data for upserting and publishing a form version. + class UpsertAndPublishFormVersionData + include BaseGenericModel + + # The attributes for upserting and publishing a form version. + attr_reader :attributes + + # The resource type for a form version. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'UpsertAndPublishFormVersionDataAttributes', + :'type' => :'FormVersionType' + } + 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::UpsertAndPublishFormVersionData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_and_publish_form_version_data_attributes.rb b/lib/datadog_api_client/v2/models/upsert_and_publish_form_version_data_attributes.rb new file mode 100644 index 000000000000..401a7d576000 --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_and_publish_form_version_data_attributes.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes for upserting and publishing a form version. + class UpsertAndPublishFormVersionDataAttributes + include BaseGenericModel + + # A JSON Schema definition that describes the form's data fields. + attr_reader :data_definition + + # UI configuration for rendering form fields, including widget overrides, field ordering, and themes. + attr_reader :ui_definition + + # Concurrency control parameters for the upsert and publish operation. + attr_reader :upsert_params + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data_definition' => :'data_definition', + :'ui_definition' => :'ui_definition', + :'upsert_params' => :'upsert_params' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data_definition' => :'FormDataDefinition', + :'ui_definition' => :'FormUiDefinition', + :'upsert_params' => :'UpsertAndPublishFormVersionUpsertParams' + } + 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::UpsertAndPublishFormVersionDataAttributes` 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_definition') + self.data_definition = attributes[:'data_definition'] + end + + if attributes.key?(:'ui_definition') + self.ui_definition = attributes[:'ui_definition'] + end + + if attributes.key?(:'upsert_params') + self.upsert_params = attributes[:'upsert_params'] + 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_definition.nil? + return false if @ui_definition.nil? + return false if @upsert_params.nil? + true + end + + # Custom attribute writer method with validation + # @param data_definition [Object] Object to be assigned + # @!visibility private + def data_definition=(data_definition) + if data_definition.nil? + fail ArgumentError, 'invalid value for "data_definition", data_definition cannot be nil.' + end + @data_definition = data_definition + end + + # Custom attribute writer method with validation + # @param ui_definition [Object] Object to be assigned + # @!visibility private + def ui_definition=(ui_definition) + if ui_definition.nil? + fail ArgumentError, 'invalid value for "ui_definition", ui_definition cannot be nil.' + end + @ui_definition = ui_definition + end + + # Custom attribute writer method with validation + # @param upsert_params [Object] Object to be assigned + # @!visibility private + def upsert_params=(upsert_params) + if upsert_params.nil? + fail ArgumentError, 'invalid value for "upsert_params", upsert_params cannot be nil.' + end + @upsert_params = upsert_params + 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_definition == o.data_definition && + ui_definition == o.ui_definition && + upsert_params == o.upsert_params && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data_definition, ui_definition, upsert_params, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_and_publish_form_version_request.rb b/lib/datadog_api_client/v2/models/upsert_and_publish_form_version_request.rb new file mode 100644 index 000000000000..057e68c2f5c9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_and_publish_form_version_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 + # A request to upsert and publish a form version in a single transaction. + class UpsertAndPublishFormVersionRequest + include BaseGenericModel + + # The data for upserting and publishing a form version. + 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' => :'UpsertAndPublishFormVersionData' + } + 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::UpsertAndPublishFormVersionRequest` 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/upsert_and_publish_form_version_upsert_params.rb b/lib/datadog_api_client/v2/models/upsert_and_publish_form_version_upsert_params.rb new file mode 100644 index 000000000000..a075750df2ce --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_and_publish_form_version_upsert_params.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 + # Concurrency control parameters for the upsert and publish operation. + class UpsertAndPublishFormVersionUpsertParams + include BaseGenericModel + + # The ETag of the latest version used for optimistic concurrency control. + attr_reader :etag + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'etag' => :'etag' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'etag' => :'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::UpsertAndPublishFormVersionUpsertParams` 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?(:'etag') + self.etag = attributes[:'etag'] + 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 @etag.nil? + true + end + + # Custom attribute writer method with validation + # @param etag [Object] Object to be assigned + # @!visibility private + def etag=(etag) + if etag.nil? + fail ArgumentError, 'invalid value for "etag", etag cannot be nil.' + end + @etag = etag + 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 && + etag == o.etag && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [etag, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_form_version_data.rb b/lib/datadog_api_client/v2/models/upsert_form_version_data.rb new file mode 100644 index 000000000000..3687b92de0b1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_form_version_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data for creating or updating a form version. + class UpsertFormVersionData + include BaseGenericModel + + # The attributes for creating or updating a form version. + attr_reader :attributes + + # The resource type for a form version. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'UpsertFormVersionDataAttributes', + :'type' => :'FormVersionType' + } + 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::UpsertFormVersionData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_form_version_data_attributes.rb b/lib/datadog_api_client/v2/models/upsert_form_version_data_attributes.rb new file mode 100644 index 000000000000..353117e2dd45 --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_form_version_data_attributes.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 + # The attributes for creating or updating a form version. + class UpsertFormVersionDataAttributes + include BaseGenericModel + + # A JSON Schema definition that describes the form's data fields. + attr_reader :data_definition + + # The state of a form version. + attr_reader :state + + # UI configuration for rendering form fields, including widget overrides, field ordering, and themes. + attr_reader :ui_definition + + # Concurrency control parameters for the form version upsert operation. + attr_reader :upsert_params + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data_definition' => :'data_definition', + :'state' => :'state', + :'ui_definition' => :'ui_definition', + :'upsert_params' => :'upsert_params' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data_definition' => :'FormDataDefinition', + :'state' => :'FormVersionState', + :'ui_definition' => :'FormUiDefinition', + :'upsert_params' => :'UpsertFormVersionUpsertParams' + } + 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::UpsertFormVersionDataAttributes` 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_definition') + self.data_definition = attributes[:'data_definition'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'ui_definition') + self.ui_definition = attributes[:'ui_definition'] + end + + if attributes.key?(:'upsert_params') + self.upsert_params = attributes[:'upsert_params'] + 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_definition.nil? + return false if @state.nil? + return false if @ui_definition.nil? + return false if @upsert_params.nil? + true + end + + # Custom attribute writer method with validation + # @param data_definition [Object] Object to be assigned + # @!visibility private + def data_definition=(data_definition) + if data_definition.nil? + fail ArgumentError, 'invalid value for "data_definition", data_definition cannot be nil.' + end + @data_definition = data_definition + end + + # Custom attribute writer method with validation + # @param state [Object] Object to be assigned + # @!visibility private + def state=(state) + if state.nil? + fail ArgumentError, 'invalid value for "state", state cannot be nil.' + end + @state = state + end + + # Custom attribute writer method with validation + # @param ui_definition [Object] Object to be assigned + # @!visibility private + def ui_definition=(ui_definition) + if ui_definition.nil? + fail ArgumentError, 'invalid value for "ui_definition", ui_definition cannot be nil.' + end + @ui_definition = ui_definition + end + + # Custom attribute writer method with validation + # @param upsert_params [Object] Object to be assigned + # @!visibility private + def upsert_params=(upsert_params) + if upsert_params.nil? + fail ArgumentError, 'invalid value for "upsert_params", upsert_params cannot be nil.' + end + @upsert_params = upsert_params + 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_definition == o.data_definition && + state == o.state && + ui_definition == o.ui_definition && + upsert_params == o.upsert_params && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data_definition, state, ui_definition, upsert_params, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_form_version_request.rb b/lib/datadog_api_client/v2/models/upsert_form_version_request.rb new file mode 100644 index 000000000000..1ba5b8c37bfa --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_form_version_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 + # A request to create or update a form version. + class UpsertFormVersionRequest + include BaseGenericModel + + # The data for creating or updating a form version. + 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' => :'UpsertFormVersionData' + } + 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::UpsertFormVersionRequest` 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/upsert_form_version_upsert_params.rb b/lib/datadog_api_client/v2/models/upsert_form_version_upsert_params.rb new file mode 100644 index 000000000000..1370b1bb985c --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_form_version_upsert_params.rb @@ -0,0 +1,151 @@ +=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 + # Concurrency control parameters for the form version upsert operation. + class UpsertFormVersionUpsertParams + include BaseGenericModel + + # The ETag of the latest version. Required when `match_policy` is `if_etag_match`. + attr_accessor :etag + + # If true, only a new version may be inserted; updating the current draft is not allowed. + attr_accessor :insert_only + + # The policy for matching the latest form version during an upsert operation. + attr_reader :match_policy + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'etag' => :'etag', + :'insert_only' => :'insert_only', + :'match_policy' => :'match_policy' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'etag' => :'String', + :'insert_only' => :'Boolean', + :'match_policy' => :'LatestVersionMatchPolicy' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'etag', + ]) + 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::UpsertFormVersionUpsertParams` 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?(:'etag') + self.etag = attributes[:'etag'] + end + + if attributes.key?(:'insert_only') + self.insert_only = attributes[:'insert_only'] + end + + if attributes.key?(:'match_policy') + self.match_policy = attributes[:'match_policy'] + 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 @match_policy.nil? + true + end + + # Custom attribute writer method with validation + # @param match_policy [Object] Object to be assigned + # @!visibility private + def match_policy=(match_policy) + if match_policy.nil? + fail ArgumentError, 'invalid value for "match_policy", match_policy cannot be nil.' + end + @match_policy = match_policy + 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 && + etag == o.etag && + insert_only == o.insert_only && + match_policy == o.match_policy && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [etag, insert_only, match_policy, additional_properties].hash + end + end +end