From ad8c943c553294cfcd265dcbfdc457c2a421dce6 Mon Sep 17 00:00:00 2001 From: Kevin Zou Date: Thu, 25 Jan 2024 11:44:52 -0500 Subject: [PATCH 1/2] handle files in build_given --- features/step_definitions/request.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/features/step_definitions/request.rb b/features/step_definitions/request.rb index 5e2931f70fb6..c7a2e0380be5 100644 --- a/features/step_definitions/request.rb +++ b/features/step_definitions/request.rb @@ -194,6 +194,10 @@ def build_given(api_version, operation) args = operation["parameters"].map do |p| result = JSON.parse(p["value"].templated fixtures) if p.key? "value" result = fixtures.lookup(p["source"]) if p.key? "source" + model = ScenariosModelMappings["v#{api_version}.#{operation["operationId"]}"][p["name"]] + if model == 'File' + result = {p["name"].to_sym => File.open(File.join(__dir__, "..", "v" + api_version, result))} + end result end if operation["parameters"] From e279e59bc3dfee34549cc199098ee30b7c058a63 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 26 Jan 2024 14:50:19 +0000 Subject: [PATCH 2/2] Regenerate client from commit a9a258a4 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 260 ++++++++++++++ examples/v2/api-management/CreateOpenAPI.rb | 11 + examples/v2/api-management/DeleteOpenAPI.rb | 11 + examples/v2/api-management/GetOpenAPI.rb | 11 + examples/v2/api-management/UpdateOpenAPI.rb | 14 + features/scenarios_model_mapping.rb | 13 + features/v2/api_management.feature | 101 ++++++ features/v2/given.json | 12 + features/v2/openapi-spec.yaml | 10 + features/v2/undo.json | 31 ++ lib/datadog_api_client/configuration.rb | 4 + lib/datadog_api_client/inflector.rb | 9 + .../v2/api/api_management_api.rb | 319 ++++++++++++++++++ .../v2/models/create_open_api_response.rb | 80 +++++ .../create_open_api_response_attributes.rb | 82 +++++ .../models/create_open_api_response_data.rb | 90 +++++ .../v2/models/open_api_endpoint.rb | 90 +++++ .../v2/models/open_api_file.rb | 80 +++++ .../v2/models/update_open_api_response.rb | 80 +++++ .../update_open_api_response_attributes.rb | 82 +++++ .../models/update_open_api_response_data.rb | 90 +++++ 22 files changed, 1484 insertions(+), 4 deletions(-) create mode 100644 examples/v2/api-management/CreateOpenAPI.rb create mode 100644 examples/v2/api-management/DeleteOpenAPI.rb create mode 100644 examples/v2/api-management/GetOpenAPI.rb create mode 100644 examples/v2/api-management/UpdateOpenAPI.rb create mode 100644 features/v2/api_management.feature create mode 100644 features/v2/openapi-spec.yaml create mode 100644 lib/datadog_api_client/v2/api/api_management_api.rb create mode 100644 lib/datadog_api_client/v2/models/create_open_api_response.rb create mode 100644 lib/datadog_api_client/v2/models/create_open_api_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/create_open_api_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/open_api_endpoint.rb create mode 100644 lib/datadog_api_client/v2/models/open_api_file.rb create mode 100644 lib/datadog_api_client/v2/models/update_open_api_response.rb create mode 100644 lib/datadog_api_client/v2/models/update_open_api_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/update_open_api_response_data.rb diff --git a/.apigentools-info b/.apigentools-info index 103f7340bf51..40cc73d9c278 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-01-25 20:06:16.533092", - "spec_repo_commit": "29ecc007" + "regenerated": "2024-01-26 14:49:50.933084", + "spec_repo_commit": "a9a258a4" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-01-25 20:06:16.551632", - "spec_repo_commit": "29ecc007" + "regenerated": "2024-01-26 14:49:50.947768", + "spec_repo_commit": "a9a258a4" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 1435ae14cb46..61c44d794551 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -839,6 +839,11 @@ components: type: string x-enum-varnames: - BILLING_DIMENSIONS + ApiID: + description: API identifier. + example: 90646597-5fdb-4a17-a240-647003f8c028 + format: uuid + type: string ApmRetentionFilterType: default: apm_retention_filter description: The type of the resource. @@ -4873,6 +4878,29 @@ components: type: string x-enum-varnames: - COST_BY_ORG + CreateOpenAPIResponse: + description: Response for `CreateOpenAPI` operation. + properties: + data: + $ref: '#/components/schemas/CreateOpenAPIResponseData' + type: object + CreateOpenAPIResponseAttributes: + description: Attributes for `CreateOpenAPI`. + properties: + failed_endpoints: + description: List of endpoints which couldn't be parsed. + items: + $ref: '#/components/schemas/OpenAPIEndpoint' + type: array + type: object + CreateOpenAPIResponseData: + description: Data envelope for `CreateOpenAPIResponse`. + properties: + attributes: + $ref: '#/components/schemas/CreateOpenAPIResponseAttributes' + id: + $ref: '#/components/schemas/ApiID' + type: object CreateRuleRequest: description: Scorecard create rule request. properties: @@ -12079,6 +12107,24 @@ components: type: string x-enum-varnames: - ON_DEMAND_CONCURRENCY_CAP + OpenAPIEndpoint: + description: Endpoint info extracted from an `OpenAPI` specification. + properties: + method: + description: The endpoint method. + type: string + path: + description: The endpoint path. + type: string + type: object + OpenAPIFile: + description: Object for API data in an `OpenAPI` format as a file. + properties: + openapi_spec_file: + description: Binary `OpenAPI` spec file + format: binary + type: string + type: object OpsgenieServiceCreateAttributes: description: The Opsgenie service attributes for a create request. properties: @@ -20284,6 +20330,29 @@ components: example: min type: string type: object + UpdateOpenAPIResponse: + description: Response for `UpdateOpenAPI`. + properties: + data: + $ref: '#/components/schemas/UpdateOpenAPIResponseData' + type: object + UpdateOpenAPIResponseAttributes: + description: Attributes for `UpdateOpenAPI`. + properties: + failed_endpoints: + description: List of endpoints which couldn't be parsed. + items: + $ref: '#/components/schemas/OpenAPIEndpoint' + type: array + type: object + UpdateOpenAPIResponseData: + description: Data envelope for `UpdateOpenAPIResponse`. + properties: + attributes: + $ref: '#/components/schemas/UpdateOpenAPIResponseAttributes' + id: + $ref: '#/components/schemas/ApiID' + type: object UsageApplicationSecurityMonitoringResponse: description: Application Security Monitoring usage response. properties: @@ -21110,6 +21179,195 @@ paths: tags: - Key Management x-codegen-request-body-name: body + /api/v2/apicatalog/api/{id}: + delete: + description: Delete a specific API by ID. + operationId: DeleteOpenAPI + parameters: + - description: ID of the API to delete + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/ApiID' + responses: + '204': + description: API deleted successfully + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: API not found error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete an API + tags: + - API Management + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/apicatalog/api/{id}/openapi: + get: + description: Retrieve information about a specific API in [OpenAPI](https://spec.openapis.org/oas/latest.html) + format file. + operationId: GetOpenAPI + parameters: + - description: ID of the API to retrieve + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/ApiID' + responses: + '200': + content: + multipart/form-data: + schema: + format: binary + type: string + 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 + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: API not found error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get an API + tags: + - API Management + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + put: + description: 'Update information about a specific API. The given content will + replace all API content of the given ID. + + The ID is returned by the create API, or can be found in the URL in the API + catalog UI. + + ' + operationId: UpdateOpenAPI + parameters: + - description: ID of the API to modify + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/ApiID' + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/OpenAPIFile' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateOpenAPIResponse' + description: API updated successfully + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: API not found error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update an API + tags: + - API Management + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/apicatalog/openapi: + post: + description: 'Create a new API from the [OpenAPI](https://spec.openapis.org/oas/latest.html) + specification given. + + It supports version `2.0`, `3.0` and `3.1` of the specification. A specific + extension section, `x-datadog`, + + let you specify the `teamHandle` for your team responsible for the API in + Datadog. + + It returns the created API ID. + + ' + operationId: CreateOpenAPI + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/OpenAPIFile' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/CreateOpenAPIResponse' + description: API created successfully + '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' + summary: Create a new API + tags: + - API Management + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/apm/config/metrics: get: description: Get the list of configured span-based metrics with their definitions. @@ -33173,6 +33431,8 @@ servers: default: api description: The subdomain where the API is deployed. tags: +- description: Configure your API endpoints through the Datadog API. + name: API Management - description: Manage configuration of [APM retention filters](https://app.datadoghq.com/apm/traces/retention-filters) for your organization. You need an API and application key with Admin rights to interact with this endpoint. See [retention filters](https://docs.datadoghq.com/tracing/trace_pipeline/trace_retention/#retention-filters) diff --git a/examples/v2/api-management/CreateOpenAPI.rb b/examples/v2/api-management/CreateOpenAPI.rb new file mode 100644 index 000000000000..f5cda3d70fa4 --- /dev/null +++ b/examples/v2/api-management/CreateOpenAPI.rb @@ -0,0 +1,11 @@ +# Create a new API returns "API created successfully" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_open_api".to_sym] = true +end +api_instance = DatadogAPIClient::V2::APIManagementAPI.new +opts = { + openapi_spec_file: File.open("openapi-spec.yaml", "r"), +} +p api_instance.create_open_api(opts) diff --git a/examples/v2/api-management/DeleteOpenAPI.rb b/examples/v2/api-management/DeleteOpenAPI.rb new file mode 100644 index 000000000000..aa79708063e8 --- /dev/null +++ b/examples/v2/api-management/DeleteOpenAPI.rb @@ -0,0 +1,11 @@ +# Delete an API returns "API deleted successfully" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_open_api".to_sym] = true +end +api_instance = DatadogAPIClient::V2::APIManagementAPI.new + +# there is a valid "managed_api" in the system +MANAGED_API_DATA_ID = ENV["MANAGED_API_DATA_ID"] +api_instance.delete_open_api(MANAGED_API_DATA_ID) diff --git a/examples/v2/api-management/GetOpenAPI.rb b/examples/v2/api-management/GetOpenAPI.rb new file mode 100644 index 000000000000..dd3d5b890ead --- /dev/null +++ b/examples/v2/api-management/GetOpenAPI.rb @@ -0,0 +1,11 @@ +# Get an API returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_open_api".to_sym] = true +end +api_instance = DatadogAPIClient::V2::APIManagementAPI.new + +# there is a valid "managed_api" in the system +MANAGED_API_DATA_ID = ENV["MANAGED_API_DATA_ID"] +p api_instance.get_open_api(MANAGED_API_DATA_ID) diff --git a/examples/v2/api-management/UpdateOpenAPI.rb b/examples/v2/api-management/UpdateOpenAPI.rb new file mode 100644 index 000000000000..322034d4b3a2 --- /dev/null +++ b/examples/v2/api-management/UpdateOpenAPI.rb @@ -0,0 +1,14 @@ +# Update an API returns "API updated successfully" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_open_api".to_sym] = true +end +api_instance = DatadogAPIClient::V2::APIManagementAPI.new + +# there is a valid "managed_api" in the system +MANAGED_API_DATA_ID = ENV["MANAGED_API_DATA_ID"] +opts = { + openapi_spec_file: File.open("openapi-spec.yaml", "r"), +} +p api_instance.update_open_api(MANAGED_API_DATA_ID, opts) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index d1102ddab277..329f786d5359 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -891,6 +891,19 @@ "app_key_id" => "String", "body" => "ApplicationKeyUpdateRequest", }, + "v2.DeleteOpenAPI" => { + "id" => "UUID", + }, + "v2.GetOpenAPI" => { + "id" => "UUID", + }, + "v2.UpdateOpenAPI" => { + "id" => "UUID", + "openapi_spec_file" => "File", + }, + "v2.CreateOpenAPI" => { + "openapi_spec_file" => "File", + }, "v2.CreateSpansMetric" => { "body" => "SpansMetricCreateRequest", }, diff --git a/features/v2/api_management.feature b/features/v2/api_management.feature new file mode 100644 index 000000000000..b010e6e81f29 --- /dev/null +++ b/features/v2/api_management.feature @@ -0,0 +1,101 @@ +@endpoint(api-management) @endpoint(api-management-v2) +Feature: API Management + Configure your API endpoints through the Datadog API. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "APIManagement" API + + @integration-only @skip-terraform-config @skip-validation @team:DataDog/api-management + Scenario: Create a new API returns "API created successfully" response + Given operation "CreateOpenAPI" enabled + And new "CreateOpenAPI" request + And request contains "openapi_spec_file" parameter with value "openapi-spec.yaml" + When the request is sent + Then the response status is 201 API created successfully + And the response "data.attributes.failed_endpoints" has length 0 + + @generated @skip @team:DataDog/api-management + Scenario: Create a new API returns "Bad request" response + Given operation "CreateOpenAPI" enabled + And new "CreateOpenAPI" request + When the request is sent + Then the response status is 400 Bad request + + @integration-only @skip-terraform-config @skip-validation @team:DataDog/api-management + Scenario: Delete an API returns "API deleted successfully" response + Given operation "DeleteOpenAPI" enabled + And there is a valid "managed_api" in the system + And new "DeleteOpenAPI" request + And request contains "id" parameter from "managed_api.data.id" + When the request is sent + Then the response status is 204 API deleted successfully + + @generated @skip @team:DataDog/api-management + Scenario: Delete an API returns "API not found error" response + Given operation "DeleteOpenAPI" enabled + And new "DeleteOpenAPI" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API not found error + + @generated @skip @team:DataDog/api-management + Scenario: Delete an API returns "Bad request" response + Given operation "DeleteOpenAPI" enabled + And new "DeleteOpenAPI" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request + + @generated @skip @team:DataDog/api-management + Scenario: Get an API returns "API not found error" response + Given operation "GetOpenAPI" enabled + And new "GetOpenAPI" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API not found error + + @generated @skip @team:DataDog/api-management + Scenario: Get an API returns "Bad request" response + Given operation "GetOpenAPI" enabled + And new "GetOpenAPI" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request + + @integration-only @skip-terraform-config @skip-validation @team:DataDog/api-management + Scenario: Get an API returns "OK" response + Given operation "GetOpenAPI" enabled + And there is a valid "managed_api" in the system + And new "GetOpenAPI" request + And request contains "id" parameter from "managed_api.data.id" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/api-management + Scenario: Update an API returns "API not found error" response + Given operation "UpdateOpenAPI" enabled + And new "UpdateOpenAPI" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API not found error + + @integration-only @skip-terraform-config @skip-validation @team:DataDog/api-management + Scenario: Update an API returns "API updated successfully" response + Given operation "UpdateOpenAPI" enabled + And there is a valid "managed_api" in the system + And new "UpdateOpenAPI" request + And request contains "id" parameter from "managed_api.data.id" + And request contains "openapi_spec_file" parameter with value "openapi-spec.yaml" + When the request is sent + Then the response status is 200 API updated successfully + And the response "data.attributes.failed_endpoints" has length 0 + + @generated @skip @team:DataDog/api-management + Scenario: Update an API returns "Bad request" response + Given operation "UpdateOpenAPI" enabled + And new "UpdateOpenAPI" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request diff --git a/features/v2/given.json b/features/v2/given.json index 5baa4e01925f..da22a5fc35d6 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -11,6 +11,18 @@ "tag": "Key Management", "operationId": "CreateAPIKey" }, + { + "parameters": [ + { + "name": "openapi_spec_file", + "value": "\"openapi-spec.yaml\"" + } + ], + "step": "there is a valid \"managed_api\" in the system", + "key": "managed_api", + "tag": "API Management", + "operationId": "CreateOpenAPI" + }, { "parameters": [ { diff --git a/features/v2/openapi-spec.yaml b/features/v2/openapi-spec.yaml new file mode 100644 index 000000000000..83047f617d91 --- /dev/null +++ b/features/v2/openapi-spec.yaml @@ -0,0 +1,10 @@ +info: + description: My API description. + title: My API +x-datadog: + teamHandle: API team +openapi: 3.0.0 +paths: + /api/my-api: + get: + description: An endpoint diff --git a/features/v2/undo.json b/features/v2/undo.json index ecf9568a3317..61d85e0fcad2 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -36,6 +36,37 @@ "type": "idempotent" } }, + "DeleteOpenAPI": { + "tag": "API Management", + "undo": { + "type": "idempotent" + } + }, + "GetOpenAPI": { + "tag": "API Management", + "undo": { + "type": "safe" + } + }, + "UpdateOpenAPI": { + "tag": "API Management", + "undo": { + "type": "idempotent" + } + }, + "CreateOpenAPI": { + "tag": "API Management", + "undo": { + "operationId": "DeleteOpenAPI", + "parameters": [ + { + "name": "id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, "ListSpansMetrics": { "tag": "Spans Metrics", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 4b3316c2ec20..1fc265a0f704 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -189,6 +189,10 @@ def initialize @http_proxypass = nil @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @unstable_operations = { + "v2.create_open_api": false, + "v2.delete_open_api": false, + "v2.get_open_api": false, + "v2.update_open_api": false, "v2.get_active_billing_dimensions": false, "v2.get_monthly_cost_attribution": false, "v2.create_dora_deployment": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 708109332307..c0387771661e 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1115,6 +1115,9 @@ def overrides "v2.cost_by_org_attributes" => "CostByOrgAttributes", "v2.cost_by_org_response" => "CostByOrgResponse", "v2.cost_by_org_type" => "CostByOrgType", + "v2.create_open_api_response" => "CreateOpenAPIResponse", + "v2.create_open_api_response_attributes" => "CreateOpenAPIResponseAttributes", + "v2.create_open_api_response_data" => "CreateOpenAPIResponseData", "v2.create_rule_request" => "CreateRuleRequest", "v2.create_rule_request_data" => "CreateRuleRequestData", "v2.create_rule_response" => "CreateRuleResponse", @@ -1592,6 +1595,8 @@ def overrides "v2.on_demand_concurrency_cap_attributes" => "OnDemandConcurrencyCapAttributes", "v2.on_demand_concurrency_cap_response" => "OnDemandConcurrencyCapResponse", "v2.on_demand_concurrency_cap_type" => "OnDemandConcurrencyCapType", + "v2.open_api_endpoint" => "OpenAPIEndpoint", + "v2.open_api_file" => "OpenAPIFile", "v2.opsgenie_service_create_attributes" => "OpsgenieServiceCreateAttributes", "v2.opsgenie_service_create_data" => "OpsgenieServiceCreateData", "v2.opsgenie_service_create_request" => "OpsgenieServiceCreateRequest", @@ -2124,6 +2129,9 @@ def overrides "v2.timeseries_response_attributes" => "TimeseriesResponseAttributes", "v2.timeseries_response_series" => "TimeseriesResponseSeries", "v2.unit" => "Unit", + "v2.update_open_api_response" => "UpdateOpenAPIResponse", + "v2.update_open_api_response_attributes" => "UpdateOpenAPIResponseAttributes", + "v2.update_open_api_response_data" => "UpdateOpenAPIResponseData", "v2.usage_application_security_monitoring_response" => "UsageApplicationSecurityMonitoringResponse", "v2.usage_attributes_object" => "UsageAttributesObject", "v2.usage_data_object" => "UsageDataObject", @@ -2202,6 +2210,7 @@ def overrides "v1.usage_metering_api" => "UsageMeteringAPI", "v1.users_api" => "UsersAPI", "v1.webhooks_integration_api" => "WebhooksIntegrationAPI", + "v2.api_management_api" => "APIManagementAPI", "v2.apm_retention_filters_api" => "APMRetentionFiltersAPI", "v2.audit_api" => "AuditAPI", "v2.authn_mappings_api" => "AuthNMappingsAPI", diff --git a/lib/datadog_api_client/v2/api/api_management_api.rb b/lib/datadog_api_client/v2/api/api_management_api.rb new file mode 100644 index 000000000000..c4ed48288922 --- /dev/null +++ b/lib/datadog_api_client/v2/api/api_management_api.rb @@ -0,0 +1,319 @@ +=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 APIManagementAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create a new API. + # + # @see #create_open_api_with_http_info + def create_open_api(opts = {}) + data, _status_code, _headers = create_open_api_with_http_info(opts) + data + end + + # Create a new API. + # + # Create a new API from the [OpenAPI](https://spec.openapis.org/oas/latest.html) specification given. + # It supports version `2.0`, `3.0` and `3.1` of the specification. A specific extension section, `x-datadog`, + # let you specify the `teamHandle` for your team responsible for the API in Datadog. + # It returns the created API ID. + # + # + # @param opts [Hash] the optional parameters + # @option opts [File] :openapi_spec_file Binary `OpenAPI` spec file + # @return [Array<(CreateOpenAPIResponse, Integer, Hash)>] CreateOpenAPIResponse data, response status code and response headers + def create_open_api_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_open_api".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_open_api") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_open_api")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: APIManagementAPI.create_open_api ...' + end + # resource path + local_var_path = '/api/v2/apicatalog/openapi' + + # 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(['multipart/form-data']) + + # form parameters + form_params = opts[:form_params] || {} + form_params['openapi_spec_file'] = opts[:'openapi_spec_file'] if !opts[:'openapi_spec_file'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CreateOpenAPIResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_open_api, + :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: APIManagementAPI#create_open_api\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete an API. + # + # @see #delete_open_api_with_http_info + def delete_open_api(id, opts = {}) + delete_open_api_with_http_info(id, opts) + nil + end + + # Delete an API. + # + # Delete a specific API by ID. + # + # @param id [UUID] ID of the API to delete + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_open_api_with_http_info(id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_open_api".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_open_api") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_open_api")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: APIManagementAPI.delete_open_api ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling APIManagementAPI.delete_open_api" + end + # resource path + local_var_path = '/api/v2/apicatalog/api/{id}'.sub('{id}', CGI.escape(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(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_open_api, + :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::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: APIManagementAPI#delete_open_api\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get an API. + # + # @see #get_open_api_with_http_info + def get_open_api(id, opts = {}) + data, _status_code, _headers = get_open_api_with_http_info(id, opts) + data + end + + # Get an API. + # + # Retrieve information about a specific API in [OpenAPI](https://spec.openapis.org/oas/latest.html) format file. + # + # @param id [UUID] ID of the API to retrieve + # @param opts [Hash] the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def get_open_api_with_http_info(id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_open_api".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_open_api") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_open_api")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: APIManagementAPI.get_open_api ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling APIManagementAPI.get_open_api" + end + # resource path + local_var_path = '/api/v2/apicatalog/api/{id}/openapi'.sub('{id}', CGI.escape(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(['multipart/form-data', '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] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_open_api, + :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: APIManagementAPI#get_open_api\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update an API. + # + # @see #update_open_api_with_http_info + def update_open_api(id, opts = {}) + data, _status_code, _headers = update_open_api_with_http_info(id, opts) + data + end + + # Update an API. + # + # Update information about a specific API. The given content will replace all API content of the given ID. + # The ID is returned by the create API, or can be found in the URL in the API catalog UI. + # + # + # @param id [UUID] ID of the API to modify + # @param opts [Hash] the optional parameters + # @option opts [File] :openapi_spec_file Binary `OpenAPI` spec file + # @return [Array<(UpdateOpenAPIResponse, Integer, Hash)>] UpdateOpenAPIResponse data, response status code and response headers + def update_open_api_with_http_info(id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_open_api".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_open_api") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_open_api")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: APIManagementAPI.update_open_api ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling APIManagementAPI.update_open_api" + end + # resource path + local_var_path = '/api/v2/apicatalog/api/{id}/openapi'.sub('{id}', CGI.escape(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(['multipart/form-data']) + + # form parameters + form_params = opts[:form_params] || {} + form_params['openapi_spec_file'] = opts[:'openapi_spec_file'] if !opts[:'openapi_spec_file'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'UpdateOpenAPIResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_open_api, + :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::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: APIManagementAPI#update_open_api\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/create_open_api_response.rb b/lib/datadog_api_client/v2/models/create_open_api_response.rb new file mode 100644 index 000000000000..97a6b189c930 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_open_api_response.rb @@ -0,0 +1,80 @@ +=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 for `CreateOpenAPI` operation. + class CreateOpenAPIResponse + include BaseGenericModel + + # Data envelope for `CreateOpenAPIResponse`. + attr_accessor :data + + # 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' => :'CreateOpenAPIResponseData' + } + 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::CreateOpenAPIResponse` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CreateOpenAPIResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + 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 + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_open_api_response_attributes.rb b/lib/datadog_api_client/v2/models/create_open_api_response_attributes.rb new file mode 100644 index 000000000000..0210cea496fd --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_open_api_response_attributes.rb @@ -0,0 +1,82 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for `CreateOpenAPI`. + class CreateOpenAPIResponseAttributes + include BaseGenericModel + + # List of endpoints which couldn't be parsed. + attr_accessor :failed_endpoints + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'failed_endpoints' => :'failed_endpoints' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'failed_endpoints' => :'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::CreateOpenAPIResponseAttributes` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CreateOpenAPIResponseAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'failed_endpoints') + if (value = attributes[:'failed_endpoints']).is_a?(Array) + self.failed_endpoints = value + end + end + 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 && + failed_endpoints == o.failed_endpoints + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [failed_endpoints].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_open_api_response_data.rb b/lib/datadog_api_client/v2/models/create_open_api_response_data.rb new file mode 100644 index 000000000000..c3a0228650d7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_open_api_response_data.rb @@ -0,0 +1,90 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data envelope for `CreateOpenAPIResponse`. + class CreateOpenAPIResponseData + include BaseGenericModel + + # Attributes for `CreateOpenAPI`. + attr_accessor :attributes + + # API identifier. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CreateOpenAPIResponseAttributes', + :'id' => :'UUID' + } + 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::CreateOpenAPIResponseData` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CreateOpenAPIResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + 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 + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/open_api_endpoint.rb b/lib/datadog_api_client/v2/models/open_api_endpoint.rb new file mode 100644 index 000000000000..6fc8e94f10ad --- /dev/null +++ b/lib/datadog_api_client/v2/models/open_api_endpoint.rb @@ -0,0 +1,90 @@ +=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 + # Endpoint info extracted from an `OpenAPI` specification. + class OpenAPIEndpoint + include BaseGenericModel + + # The endpoint method. + attr_accessor :method + + # The endpoint path. + attr_accessor :path + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'method' => :'method', + :'path' => :'path' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'method' => :'String', + :'path' => :'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::OpenAPIEndpoint` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::OpenAPIEndpoint`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'method') + self.method = attributes[:'method'] + end + + if attributes.key?(:'path') + self.path = attributes[:'path'] + end + 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 && + method == o.method && + path == o.path + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [method, path].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/open_api_file.rb b/lib/datadog_api_client/v2/models/open_api_file.rb new file mode 100644 index 000000000000..90352108207d --- /dev/null +++ b/lib/datadog_api_client/v2/models/open_api_file.rb @@ -0,0 +1,80 @@ +=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 + # Object for API data in an `OpenAPI` format as a file. + class OpenAPIFile + include BaseGenericModel + + # Binary `OpenAPI` spec file + attr_accessor :openapi_spec_file + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'openapi_spec_file' => :'openapi_spec_file' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'openapi_spec_file' => :'File' + } + 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::OpenAPIFile` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::OpenAPIFile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'openapi_spec_file') + self.openapi_spec_file = attributes[:'openapi_spec_file'] + end + 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 && + openapi_spec_file == o.openapi_spec_file + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [openapi_spec_file].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_open_api_response.rb b/lib/datadog_api_client/v2/models/update_open_api_response.rb new file mode 100644 index 000000000000..20e0e7ead141 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_open_api_response.rb @@ -0,0 +1,80 @@ +=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 for `UpdateOpenAPI`. + class UpdateOpenAPIResponse + include BaseGenericModel + + # Data envelope for `UpdateOpenAPIResponse`. + attr_accessor :data + + # 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' => :'UpdateOpenAPIResponseData' + } + 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::UpdateOpenAPIResponse` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::UpdateOpenAPIResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + 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 + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_open_api_response_attributes.rb b/lib/datadog_api_client/v2/models/update_open_api_response_attributes.rb new file mode 100644 index 000000000000..7bfcd0127dd7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_open_api_response_attributes.rb @@ -0,0 +1,82 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for `UpdateOpenAPI`. + class UpdateOpenAPIResponseAttributes + include BaseGenericModel + + # List of endpoints which couldn't be parsed. + attr_accessor :failed_endpoints + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'failed_endpoints' => :'failed_endpoints' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'failed_endpoints' => :'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::UpdateOpenAPIResponseAttributes` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::UpdateOpenAPIResponseAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'failed_endpoints') + if (value = attributes[:'failed_endpoints']).is_a?(Array) + self.failed_endpoints = value + end + end + 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 && + failed_endpoints == o.failed_endpoints + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [failed_endpoints].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_open_api_response_data.rb b/lib/datadog_api_client/v2/models/update_open_api_response_data.rb new file mode 100644 index 000000000000..0179ae6dd147 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_open_api_response_data.rb @@ -0,0 +1,90 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data envelope for `UpdateOpenAPIResponse`. + class UpdateOpenAPIResponseData + include BaseGenericModel + + # Attributes for `UpdateOpenAPI`. + attr_accessor :attributes + + # API identifier. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'UpdateOpenAPIResponseAttributes', + :'id' => :'UUID' + } + 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::UpdateOpenAPIResponseData` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::UpdateOpenAPIResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + 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 + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id].hash + end + end +end