diff --git a/.apigentools-info b/.apigentools-info index 379b72c48e36..a9331fd0e526 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.4.1.dev2", - "regenerated": "2021-02-11 20:23:08.669796", - "spec_repo_commit": "e7a07c6" + "regenerated": "2021-02-12 09:26:55.873425", + "spec_repo_commit": "8d710e1" }, "v2": { "apigentools_version": "1.4.1.dev2", - "regenerated": "2021-02-11 20:23:22.050726", - "spec_repo_commit": "e7a07c6" + "regenerated": "2021-02-12 09:27:08.683726", + "spec_repo_commit": "8d710e1" } } } \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 954cea074ac5..6fb58dbfdadf 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -178,6 +178,22 @@ docs/LogsResponseMetadataPage.md docs/LogsSort.md docs/LogsSortOrder.md docs/LogsWarning.md +docs/Metric.md +docs/MetricTagConfiguration.md +docs/MetricTagConfigurationAttributes.md +docs/MetricTagConfigurationCreateAttributes.md +docs/MetricTagConfigurationCreateData.md +docs/MetricTagConfigurationCreateRequest.md +docs/MetricTagConfigurationMetricTypes.md +docs/MetricTagConfigurationResponse.md +docs/MetricTagConfigurationType.md +docs/MetricTagConfigurationUpdateAttributes.md +docs/MetricTagConfigurationUpdateData.md +docs/MetricTagConfigurationUpdateRequest.md +docs/MetricType.md +docs/MetricsAndMetricTagConfigurations.md +docs/MetricsAndMetricTagConfigurationsResponse.md +docs/MetricsApi.md docs/Organization.md docs/OrganizationAttributes.md docs/OrganizationsType.md @@ -294,6 +310,7 @@ lib/datadog_api_client/v2/api/key_management_api.rb lib/datadog_api_client/v2/api/logs_api.rb lib/datadog_api_client/v2/api/logs_archives_api.rb lib/datadog_api_client/v2/api/logs_metrics_api.rb +lib/datadog_api_client/v2/api/metrics_api.rb lib/datadog_api_client/v2/api/processes_api.rb lib/datadog_api_client/v2/api/roles_api.rb lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -471,6 +488,21 @@ lib/datadog_api_client/v2/models/logs_response_metadata_page.rb lib/datadog_api_client/v2/models/logs_sort.rb lib/datadog_api_client/v2/models/logs_sort_order.rb lib/datadog_api_client/v2/models/logs_warning.rb +lib/datadog_api_client/v2/models/metric.rb +lib/datadog_api_client/v2/models/metric_tag_configuration.rb +lib/datadog_api_client/v2/models/metric_tag_configuration_attributes.rb +lib/datadog_api_client/v2/models/metric_tag_configuration_create_attributes.rb +lib/datadog_api_client/v2/models/metric_tag_configuration_create_data.rb +lib/datadog_api_client/v2/models/metric_tag_configuration_create_request.rb +lib/datadog_api_client/v2/models/metric_tag_configuration_metric_types.rb +lib/datadog_api_client/v2/models/metric_tag_configuration_response.rb +lib/datadog_api_client/v2/models/metric_tag_configuration_type.rb +lib/datadog_api_client/v2/models/metric_tag_configuration_update_attributes.rb +lib/datadog_api_client/v2/models/metric_tag_configuration_update_data.rb +lib/datadog_api_client/v2/models/metric_tag_configuration_update_request.rb +lib/datadog_api_client/v2/models/metric_type.rb +lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations.rb +lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb lib/datadog_api_client/v2/models/organization.rb lib/datadog_api_client/v2/models/organization_attributes.rb lib/datadog_api_client/v2/models/organizations_type.rb @@ -583,6 +615,7 @@ spec/api/key_management_api_spec.rb spec/api/logs_api_spec.rb spec/api/logs_archives_api_spec.rb spec/api/logs_metrics_api_spec.rb +spec/api/metrics_api_spec.rb spec/api/processes_api_spec.rb spec/api/roles_api_spec.rb spec/api/security_monitoring_api_spec.rb @@ -758,6 +791,21 @@ spec/models/logs_response_metadata_spec.rb spec/models/logs_sort_order_spec.rb spec/models/logs_sort_spec.rb spec/models/logs_warning_spec.rb +spec/models/metric_spec.rb +spec/models/metric_tag_configuration_attributes_spec.rb +spec/models/metric_tag_configuration_create_attributes_spec.rb +spec/models/metric_tag_configuration_create_data_spec.rb +spec/models/metric_tag_configuration_create_request_spec.rb +spec/models/metric_tag_configuration_metric_types_spec.rb +spec/models/metric_tag_configuration_response_spec.rb +spec/models/metric_tag_configuration_spec.rb +spec/models/metric_tag_configuration_type_spec.rb +spec/models/metric_tag_configuration_update_attributes_spec.rb +spec/models/metric_tag_configuration_update_data_spec.rb +spec/models/metric_tag_configuration_update_request_spec.rb +spec/models/metric_type_spec.rb +spec/models/metrics_and_metric_tag_configurations_response_spec.rb +spec/models/metrics_and_metric_tag_configurations_spec.rb spec/models/organization_attributes_spec.rb spec/models/organization_spec.rb spec/models/organizations_type_spec.rb diff --git a/cassettes/features/v2/metrics/Create-a-Tag-Configuration-returns-Created-response.yml b/cassettes/features/v2/metrics/Create-a-Tag-Configuration-returns-Created-response.yml new file mode 100644 index 000000000000..a3de3e8b6e83 --- /dev/null +++ b/cassettes/features/v2/metrics/Create-a-Tag-Configuration-returns-Created-response.yml @@ -0,0 +1,63 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.datadoghq.com/api/v2/metrics/rubyCreateaTagConfigurationreturnsCreatedresponse1613037330/tags + body: + encoding: UTF-8 + string: '{"data":{"type":"manage_tags","id":"rubyCreateaTagConfigurationreturnsCreatedresponse1613037330","attributes":{"tags":["app","datacenter"],"metric_type":"distribution"}}}' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.1; os darwin19.6.0; arch + x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 11 Feb 2021 09:55:30 GMT + Content-Type: + - application/json + Content-Length: + - '294' + Connection: + - keep-alive + Pragma: + - no-cache + Cache-Control: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 18-Feb-2021 09:55:30 GMT; + secure; HttpOnly + X-Dd-Version: + - '35.3888455' + X-Ratelimit-Limit: + - '50' + X-Ratelimit-Period: + - '60' + X-Ratelimit-Reset: + - '30' + X-Ratelimit-Remaining: + - '49' + X-Dd-Debug: + - l4HFlaRP3QwYSqoGKhzbYfv7zgkK63HIRR7YkyVYZspq0lGjjTBwoK8V/alf+XYt + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '{"data":{"type":"manage_tags","id":"rubyCreateaTagConfigurationreturnsCreatedresponse1613037330","attributes":{"tags":["datacenter","app"],"include_percentiles":false,"created_at":"2021-02-11T09:55:30.607637+00:00","updated_at":"2021-02-11T09:55:30.607637+00:00","metric_type":"distribution"}}}' + recorded_at: Thu, 11 Feb 2021 09:55:30 GMT +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/metrics/Delete-a-Tag-Configuration-returns-No-Content-response.yml b/cassettes/features/v2/metrics/Delete-a-Tag-Configuration-returns-No-Content-response.yml new file mode 100644 index 000000000000..8247c32a0a07 --- /dev/null +++ b/cassettes/features/v2/metrics/Delete-a-Tag-Configuration-returns-No-Content-response.yml @@ -0,0 +1,123 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.datadoghq.com/api/v2/metrics/rubyDeleteaTagConfigurationreturnsNoContentresponse1613037330/tags + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"tags":["app","datacenter","rubyDeleteaTagConfigurationreturnsNoContentresponse1613037330"],"metric_type":"distribution"},"type":"manage_tags","id":"rubyDeleteaTagConfigurationreturnsNoContentresponse1613037330"}}' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.1; os darwin19.6.0; arch + x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 11 Feb 2021 09:55:30 GMT + Content-Type: + - application/json + Content-Length: + - '360' + Connection: + - keep-alive + Pragma: + - no-cache + Cache-Control: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 18-Feb-2021 09:55:30 GMT; + secure; HttpOnly + X-Dd-Version: + - '35.3888455' + X-Ratelimit-Limit: + - '50' + X-Ratelimit-Period: + - '60' + X-Ratelimit-Reset: + - '30' + X-Ratelimit-Remaining: + - '47' + X-Dd-Debug: + - JpIJLwIH2nFlZOC+u71rq7aAOL43MLZN3MUsL+gpYHdZz5QLUOG8Jysf8kVK6tPU + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '{"data":{"type":"manage_tags","id":"rubyDeleteaTagConfigurationreturnsNoContentresponse1613037330","attributes":{"tags":["datacenter","app","rubyDeleteaTagConfigurationreturnsNoContentresponse1613037330"],"include_percentiles":false,"created_at":"2021-02-11T09:55:30.933171+00:00","updated_at":"2021-02-11T09:55:30.933171+00:00","metric_type":"distribution"}}}' + recorded_at: Thu, 11 Feb 2021 09:55:30 GMT +- request: + method: delete + uri: https://api.datadoghq.com/api/v2/metrics/rubyDeleteaTagConfigurationreturnsNoContentresponse1613037330/tags + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.1; os darwin19.6.0; arch + x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 11 Feb 2021 09:55:31 GMT + Content-Type: + - application/json + Content-Length: + - '0' + Connection: + - keep-alive + Pragma: + - no-cache + Cache-Control: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 18-Feb-2021 09:55:31 GMT; + secure; HttpOnly + X-Dd-Version: + - '35.3888455' + X-Ratelimit-Limit: + - '50' + X-Ratelimit-Period: + - '60' + X-Ratelimit-Reset: + - '29' + X-Ratelimit-Remaining: + - '46' + X-Dd-Debug: + - tpRCH6w417YjBovRJ8VmtuXmNONVYiRp2c8d2AxjPdGBn8PCtgG4vAztrx3qUZAN + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 11 Feb 2021 09:55:30 GMT +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/metrics/List-Tag-Configuration-by-Name-returns-Success-response.yml b/cassettes/features/v2/metrics/List-Tag-Configuration-by-Name-returns-Success-response.yml new file mode 100644 index 000000000000..4eef027c8f6a --- /dev/null +++ b/cassettes/features/v2/metrics/List-Tag-Configuration-by-Name-returns-Success-response.yml @@ -0,0 +1,125 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.datadoghq.com/api/v2/metrics/rubyListTagConfigurationbyNamereturnsSuccessresponse1613037331/tags + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"tags":["app","datacenter","rubyListTagConfigurationbyNamereturnsSuccessresponse1613037331"],"metric_type":"distribution"},"type":"manage_tags","id":"rubyListTagConfigurationbyNamereturnsSuccessresponse1613037331"}}' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.1; os darwin19.6.0; arch + x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 11 Feb 2021 09:55:31 GMT + Content-Type: + - application/json + Content-Length: + - '362' + Connection: + - keep-alive + Pragma: + - no-cache + Cache-Control: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 18-Feb-2021 09:55:31 GMT; + secure; HttpOnly + X-Dd-Version: + - '35.3888455' + X-Ratelimit-Limit: + - '50' + X-Ratelimit-Period: + - '60' + X-Ratelimit-Reset: + - '29' + X-Ratelimit-Remaining: + - '44' + X-Dd-Debug: + - F5gm0Rce1/Abr9/0Fw8HAqWfiz0FdiH8er/AXnN6lOn3L6KyGgbsLCwgPlob1No8 + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '{"data":{"type":"manage_tags","id":"rubyListTagConfigurationbyNamereturnsSuccessresponse1613037331","attributes":{"tags":["datacenter","app","rubyListTagConfigurationbyNamereturnsSuccessresponse1613037331"],"include_percentiles":false,"created_at":"2021-02-11T09:55:31.439257+00:00","updated_at":"2021-02-11T09:55:31.439257+00:00","metric_type":"distribution"}}}' + recorded_at: Thu, 11 Feb 2021 09:55:31 GMT +- request: + method: get + uri: https://api.datadoghq.com/api/v2/metrics/rubyListTagConfigurationbyNamereturnsSuccessresponse1613037331/tags + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.1; os darwin19.6.0; arch + x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 11 Feb 2021 09:55:31 GMT + Content-Type: + - application/json + Content-Length: + - '362' + Connection: + - keep-alive + Vary: + - Accept-Encoding + Pragma: + - no-cache + Cache-Control: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 18-Feb-2021 09:55:31 GMT; + secure; HttpOnly + X-Dd-Version: + - '35.3888455' + X-Ratelimit-Limit: + - '50' + X-Ratelimit-Period: + - '60' + X-Ratelimit-Reset: + - '29' + X-Ratelimit-Remaining: + - '43' + X-Dd-Debug: + - dCmL/3rURV6BPeaqeP3Rxigq41m5CAb17XjrRE42uZ01zpr07HVhbL5/3TWMkvgu + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '{"data":{"type":"manage_tags","id":"rubyListTagConfigurationbyNamereturnsSuccessresponse1613037331","attributes":{"tags":["datacenter","app","rubyListTagConfigurationbyNamereturnsSuccessresponse1613037331"],"include_percentiles":false,"created_at":"2021-02-11T09:55:31.439257+00:00","updated_at":"2021-02-11T09:55:31.439257+00:00","metric_type":"distribution"}}}' + recorded_at: Thu, 11 Feb 2021 09:55:31 GMT +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/metrics/List-Tag-Configurations-returns-Success-response.yml b/cassettes/features/v2/metrics/List-Tag-Configurations-returns-Success-response.yml new file mode 100644 index 000000000000..cd8388a52443 --- /dev/null +++ b/cassettes/features/v2/metrics/List-Tag-Configurations-returns-Success-response.yml @@ -0,0 +1,125 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.datadoghq.com/api/v2/metrics/rubyListTagConfigurationsreturnsSuccessresponse1613037331/tags + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"tags":["app","datacenter","rubyListTagConfigurationsreturnsSuccessresponse1613037331"],"metric_type":"distribution"},"type":"manage_tags","id":"rubyListTagConfigurationsreturnsSuccessresponse1613037331"}}' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.1; os darwin19.6.0; arch + x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 11 Feb 2021 09:55:31 GMT + Content-Type: + - application/json + Content-Length: + - '352' + Connection: + - keep-alive + Pragma: + - no-cache + Cache-Control: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 18-Feb-2021 09:55:31 GMT; + secure; HttpOnly + X-Dd-Version: + - '35.3888455' + X-Ratelimit-Limit: + - '50' + X-Ratelimit-Period: + - '60' + X-Ratelimit-Reset: + - '29' + X-Ratelimit-Remaining: + - '41' + X-Dd-Debug: + - PhosSd3Ch1B6B0DXI71steKUi7XhPDttnPiIP1NdXTw0VJNWpoUnYyBmODS5ne3q + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '{"data":{"type":"manage_tags","id":"rubyListTagConfigurationsreturnsSuccessresponse1613037331","attributes":{"tags":["datacenter","app","rubyListTagConfigurationsreturnsSuccessresponse1613037331"],"include_percentiles":false,"created_at":"2021-02-11T09:55:31.933660+00:00","updated_at":"2021-02-11T09:55:31.933660+00:00","metric_type":"distribution"}}}' + recorded_at: Thu, 11 Feb 2021 09:55:31 GMT +- request: + method: get + uri: https://api.datadoghq.com/api/v2/metrics?filter%5Btags_configured%5D=rubyListTagConfigurationsreturnsSuccessresponse1613037331 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.1; os darwin19.6.0; arch + x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 11 Feb 2021 09:55:36 GMT + Content-Type: + - application/json + Content-Length: + - '354' + Connection: + - keep-alive + Vary: + - Accept-Encoding + Pragma: + - no-cache + Cache-Control: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 18-Feb-2021 09:55:32 GMT; + secure; HttpOnly + X-Dd-Version: + - '35.3888455' + X-Ratelimit-Limit: + - '50' + X-Ratelimit-Period: + - '60' + X-Ratelimit-Reset: + - '28' + X-Ratelimit-Remaining: + - '40' + X-Dd-Debug: + - vdJ3/nHEY1ioXQ6pQrBVvsQK1s4yyc+wufBMPSoXql71qZVuP/xMdtNo6DafhOAk + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '{"data":[{"type":"manage_tags","id":"rubyListTagConfigurationsreturnsSuccessresponse1613037331","attributes":{"tags":["datacenter","app","rubyListTagConfigurationsreturnsSuccessresponse1613037331"],"include_percentiles":false,"created_at":"2021-02-11T09:55:31.933660+00:00","updated_at":"2021-02-11T09:55:31.933660+00:00","metric_type":"distribution"}}]}' + recorded_at: Thu, 11 Feb 2021 09:55:31 GMT +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/metrics/Update-a-Tag-Configuration-returns-OK-response.yml b/cassettes/features/v2/metrics/Update-a-Tag-Configuration-returns-OK-response.yml new file mode 100644 index 000000000000..31984f9e3925 --- /dev/null +++ b/cassettes/features/v2/metrics/Update-a-Tag-Configuration-returns-OK-response.yml @@ -0,0 +1,125 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.datadoghq.com/api/v2/metrics/rubyUpdateaTagConfigurationreturnsOKresponse1613037337/tags + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"tags":["app","datacenter","rubyUpdateaTagConfigurationreturnsOKresponse1613037337"],"metric_type":"distribution"},"type":"manage_tags","id":"rubyUpdateaTagConfigurationreturnsOKresponse1613037337"}}' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.1; os darwin19.6.0; arch + x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 11 Feb 2021 09:55:37 GMT + Content-Type: + - application/json + Content-Length: + - '346' + Connection: + - keep-alive + Pragma: + - no-cache + Cache-Control: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 18-Feb-2021 09:55:37 GMT; + secure; HttpOnly + X-Dd-Version: + - '35.3888455' + X-Ratelimit-Limit: + - '50' + X-Ratelimit-Period: + - '60' + X-Ratelimit-Reset: + - '23' + X-Ratelimit-Remaining: + - '38' + X-Dd-Debug: + - fIO2C4qGDheGHy4YbS+r3a3CXbh4cbRo7roILOimQyiHGjQdOat0cIpWCkupM1uX + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '{"data":{"type":"manage_tags","id":"rubyUpdateaTagConfigurationreturnsOKresponse1613037337","attributes":{"tags":["datacenter","app","rubyUpdateaTagConfigurationreturnsOKresponse1613037337"],"include_percentiles":false,"created_at":"2021-02-11T09:55:37.229130+00:00","updated_at":"2021-02-11T09:55:37.229130+00:00","metric_type":"distribution"}}}' + recorded_at: Thu, 11 Feb 2021 09:55:37 GMT +- request: + method: patch + uri: https://api.datadoghq.com/api/v2/metrics/rubyUpdateaTagConfigurationreturnsOKresponse1613037337/tags + body: + encoding: UTF-8 + string: '{"data":{"type":"manage_tags","id":"rubyUpdateaTagConfigurationreturnsOKresponse1613037337","attributes":{"tags":["app"]}}}' + headers: + User-Agent: + - datadog-api-client-ruby/1.0.0.beta.3.dev (ruby 2.7.1; os darwin19.6.0; arch + x86_64) + Content-Type: + - application/json + Accept: + - application/json + Expect: + - '' + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 11 Feb 2021 09:55:37 GMT + Content-Type: + - application/json + Content-Length: + - '276' + Connection: + - keep-alive + Vary: + - Accept-Encoding + Pragma: + - no-cache + Cache-Control: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 18-Feb-2021 09:55:37 GMT; + secure; HttpOnly + X-Dd-Version: + - '35.3888455' + X-Ratelimit-Limit: + - '50' + X-Ratelimit-Period: + - '60' + X-Ratelimit-Reset: + - '23' + X-Ratelimit-Remaining: + - '37' + X-Dd-Debug: + - "/L+SFFO+m1pPY+hRCpk5325fvfrNl0KmiquUNJolBN/5hu3HIwflqjZSbJ6NxDFG" + X-Content-Type-Options: + - nosniff + Strict-Transport-Security: + - max-age=15724800; + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + X-Frame-Options: + - SAMEORIGIN + body: + encoding: UTF-8 + string: '{"data":{"type":"manage_tags","id":"rubyUpdateaTagConfigurationreturnsOKresponse1613037337","attributes":{"tags":["app"],"include_percentiles":false,"created_at":"2021-02-11T09:55:37.229130+00:00","updated_at":"2021-02-11T09:55:37.392804+00:00","metric_type":"distribution"}}}' + recorded_at: Thu, 11 Feb 2021 09:55:37 GMT +recorded_with: VCR 6.0.0 diff --git a/data/v1/openapi.yaml b/data/v1/openapi.yaml index fafaf1681796..016d53f3f945 100644 --- a/data/v1/openapi.yaml +++ b/data/v1/openapi.yaml @@ -17999,11 +17999,13 @@ tags: name: Logs Pipelines - description: "The metrics endpoint allows you to:\n\n- Post metrics data so it can\ \ be graphed on Datadog\u2019s dashboards\n- Query metrics from any time period\n\ - \n**Note**: A graph can only contain a set number of points\nand as the timeframe\ - \ over which a metric is viewed increases,\naggregation between points occurs\ - \ to stay below that set number.\n\nDatadog has a soft limit of 100 timeseries\ - \ per host\nwhere a timeseries is defined as a unique combination of metric name\ - \ and tag." + - Modify tag configurations for metrics\n\n**Note**: A graph can only contain\ + \ a set number of points\nand as the timeframe over which a metric is viewed increases,\n\ + aggregation between points occurs to stay below that set number.\n\nDatadog has\ + \ a soft limit of 100 timeseries per host\nwhere a timeseries is defined as a\ + \ unique combination of metric name and tag.\n\nThe Post, Patch, and Delete `manage_tags`\ + \ API methods can only be performed by\na user who has the `Manage Tags for Metrics`\ + \ permission." name: Metrics - description: '[Monitors](https://docs.datadoghq.com/monitors) allow you to watch a metric or check that you care about, diff --git a/data/v2/openapi.yaml b/data/v2/openapi.yaml index 4a6a8e10954b..43fdf00529f4 100644 --- a/data/v2/openapi.yaml +++ b/data/v2/openapi.yaml @@ -192,6 +192,14 @@ components: required: true schema: type: string + MetricName: + description: The name of the metric. + example: dist.http.endpoint.request + in: path + name: metric_name + required: true + schema: + type: string PageNumber: description: Specific page number to return. in: query @@ -2844,6 +2852,240 @@ components: from the other indexes type: string type: object + Metric: + description: Object for a single metric tag configuration. + example: + id: metric.foo.bar + type: metric + properties: + id: + $ref: '#/components/schemas/MetricName' + type: + $ref: '#/components/schemas/MetricType' + type: object + MetricName: + description: The metric name for this resource. + example: test.metric.latency + type: string + MetricTagConfiguration: + description: Object for a single metric tag configuration. + example: + attributes: + created_at: '2020-03-31T09:48:37.463835Z' + metric_type: gauge + modified_at: '2020-04-31T09:48:37.463835Z' + tags: + - app + - datacenter + id: http.request.latency + type: manage_tags + properties: + attributes: + $ref: '#/components/schemas/MetricTagConfigurationAttributes' + id: + $ref: '#/components/schemas/MetricName' + type: + $ref: '#/components/schemas/MetricTagConfigurationType' + type: object + MetricTagConfigurationAttributes: + description: Object containing the definition of a metric tag configuration + attributes. + properties: + created_at: + description: Timestamp when the tag configuration was created. + example: '2020-03-31T09:48:37.463835Z' + format: date-time + type: string + include_percentiles: + description: 'Toggle to turn on/off percentile aggregations for distribution + metrics. + + Only present when the `metric_type` is `distribution`.' + example: true + type: boolean + metric_type: + $ref: '#/components/schemas/MetricTagConfigurationMetricTypes' + modified_at: + description: Timestamp when the tag configuration was last modified. + example: '2020-03-31T09:48:37.463835Z' + format: date-time + type: string + tags: + description: List of tag keys on which to group. + example: + - app + - datacenter + items: + description: Tag keys to group by. + type: string + type: array + type: object + MetricTagConfigurationCreateAttributes: + description: Object containing the definition of a metric tag configuration + to be created. + properties: + include_percentiles: + default: false + description: 'Toggle to include/exclude percentiles for a distribution metric. + + Defaults to false. Can only be applied to metrics that have a `metric_type` + of `distribution`.' + example: true + type: boolean + metric_type: + $ref: '#/components/schemas/MetricTagConfigurationMetricTypes' + tags: + default: [] + description: A list of tag keys that will be queryable for your metric. + example: + - app + - datacenter + items: + description: Tag keys to group by. + type: string + type: array + required: + - tags + - metric_type + type: object + MetricTagConfigurationCreateData: + description: Object for a single metric to be configure tags on. + example: + attributes: + include_percentiles: false + metric_type: distribution + tags: + - app + - datacenter + id: http.endpoint.request + type: manage_tags + properties: + attributes: + $ref: '#/components/schemas/MetricTagConfigurationCreateAttributes' + id: + $ref: '#/components/schemas/MetricName' + type: + $ref: '#/components/schemas/MetricTagConfigurationType' + required: + - id + - type + type: object + MetricTagConfigurationCreateRequest: + description: Request object that includes the metric that you would like to + configure tags for. + properties: + data: + $ref: '#/components/schemas/MetricTagConfigurationCreateData' + required: + - data + type: object + MetricTagConfigurationMetricTypes: + default: gauge + description: The metric's type. + enum: + - gauge + - count + - distribution + example: count + type: string + x-enum-varnames: + - GAUGE + - COUNT + - DISTRIBUTION + MetricTagConfigurationResponse: + description: Response object which includes a single metric's tag configuration. + properties: + data: + $ref: '#/components/schemas/MetricTagConfiguration' + readOnly: true + type: object + MetricTagConfigurationType: + default: manage_tags + description: The metric tag configuration resource type. + enum: + - manage_tags + example: manage_tags + type: string + x-enum-varnames: + - MANAGE_TAGS + MetricTagConfigurationUpdateAttributes: + description: Object containing the definition of a metric tag configuration + to be updated. + properties: + include_percentiles: + default: false + description: 'Toggle to include/exclude percentiles for a distribution metric. + + Defaults to false. Can only be applied to metrics that have a `metric_type` + of `distribution`.' + example: true + type: boolean + tags: + default: [] + description: A list of tag keys that will be queryable for your metric. + example: + - app + - datacenter + items: + description: Tag keys to group by. + type: string + type: array + type: object + MetricTagConfigurationUpdateData: + description: Object for a single tag configuration to be edited. + example: + attributes: + group_by: + - app + - datacenter + include_percentiles: false + id: http.endpoint.request + type: manage_tags + properties: + attributes: + $ref: '#/components/schemas/MetricTagConfigurationUpdateAttributes' + id: + $ref: '#/components/schemas/MetricName' + type: + $ref: '#/components/schemas/MetricTagConfigurationType' + required: + - id + - type + type: object + MetricTagConfigurationUpdateRequest: + description: Request object that includes the metric that you would like to + edit the tag configuration on. + properties: + data: + $ref: '#/components/schemas/MetricTagConfigurationUpdateData' + required: + - data + type: object + MetricType: + default: metrics + description: The metric resource type. + enum: + - metrics + example: metrics + type: string + x-enum-varnames: + - METRICS + MetricsAndMetricTagConfigurations: + description: Object for a metrics and metric tag configurations. + oneOf: + - $ref: '#/components/schemas/Metric' + - $ref: '#/components/schemas/MetricTagConfiguration' + type: object + MetricsAndMetricTagConfigurationsResponse: + description: Response object that includes metrics and metric tag configurations. + properties: + data: + description: Array of metrics and metric tag configurations. + items: + $ref: '#/components/schemas/MetricsAndMetricTagConfigurations' + type: array + readOnly: true + type: object Organization: description: Organization object. properties: @@ -5864,6 +6106,274 @@ paths: x-codegen-request-body-name: body x-undo: type: safe + /api/v2/metrics: + get: + description: 'Returns all configured count/gauge/rate/distribution metric names + + (with additional filters if specified).' + operationId: ListTagConfigurations + parameters: + - description: Filter metrics that have configured tags. + example: true + in: query + name: filter[configured] + required: false + schema: + type: boolean + - description: Filter tag configurations by configured tags. + example: app + in: query + name: filter[tags_configured] + required: false + schema: + description: Tag keys to filter by. + type: string + - description: Filter tag configurations by metric type. + in: query + name: filter[metric_type] + required: false + schema: + $ref: '#/components/schemas/MetricTagConfigurationMetricTypes' + - description: 'Filter distributions with additional percentile + + aggregations enabled or disabled.' + example: true + in: query + name: filter[include_percentiles] + required: false + schema: + type: boolean + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MetricsAndMetricTagConfigurationsResponse' + description: Success + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too Many Requests + summary: List Tag Configurations + tags: + - Metrics + x-undo: + type: safe + x-unstable: "**Note: This endpoint is in public beta and is only accessible\ + \ for customers who have Metrics Without Limits™.\nIf you\u2019re interested\ + \ in this feature, please contact your Customer Support Manager.**" + /api/v2/metrics/{metric_name}/tags: + delete: + description: 'Deletes a metric''s tag configuration. Can only be used with application + + keys from users with the `Manage Tags for Metrics` permission.' + operationId: DeleteTagConfiguration + parameters: + - $ref: '#/components/parameters/MetricName' + responses: + '204': + description: No Content + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too Many Requests + summary: Delete a Tag Configuration + tags: + - Metrics + x-undo: + type: idempotent + x-unstable: "**Note: This endpoint is in public beta and is only accessible\ + \ for customers who have Metrics Without Limits™.\nIf you\u2019re interested\ + \ in this feature, please contact your Customer Support Manager.**" + get: + description: Returns the tag configuration for the given metric name. + operationId: ListTagConfigurationByName + parameters: + - $ref: '#/components/parameters/MetricName' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MetricTagConfigurationResponse' + description: Success + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too Many Requests + summary: List Tag Configuration by Name + tags: + - Metrics + x-undo: + type: safe + x-unstable: "**Note: This endpoint is in public beta and is only accessible\ + \ for customers who have Metrics Without Limits™.\nIf you\u2019re interested\ + \ in this feature, please contact your Customer Support Manager.**" + patch: + description: 'Update the tag configuration of a metric. Can only be used with + + application keys from users with the `Manage Tags for Metrics` permission.' + operationId: UpdateTagConfiguration + parameters: + - $ref: '#/components/parameters/MetricName' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MetricTagConfigurationUpdateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MetricTagConfigurationResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Unprocessable Entity + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too Many Requests + summary: Update a Tag Configuration + tags: + - Metrics + x-codegen-request-body-name: body + x-undo: + type: idempotent + x-unstable: "**Note: This endpoint is in public beta and is only accessible\ + \ for customers who have Metrics Without Limits™.\nIf you\u2019re interested\ + \ in this feature, please contact your Customer Support Manager.**" + post: + description: 'Create and define a list of queryable tag keys for a count/gauge/rate/distribution + metric. + + Can only be used with application keys of users with the `Manage Tags for + Metrics` permission.' + operationId: CreateTagConfiguration + parameters: + - $ref: '#/components/parameters/MetricName' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MetricTagConfigurationCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/MetricTagConfigurationResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Conflict + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too Many Requests + summary: Create a Tag Configuration + tags: + - Metrics + x-codegen-request-body-name: body + x-given: + metric_tag_configuration: + parameters: + - name: metric_name + value: '"{{ unique_alnum }}"' + - name: body + value: "{\n \"data\": {\n \"attributes\": {\n \"tags\":[\"app\"\ + , \"datacenter\", \"{{ unique_alnum }}\"],\n \"metric_type\":\"\ + distribution\"\n },\n \"type\": \"manage_tags\",\n \"id\"\ + : \"{{ unique_alnum }}\"\n }\n}" + step: there is a valid "metric_tag_configuration" in the system + x-undo: + operationId: DeleteTagConfiguration + parameters: + - name: metric_name + source: data.id + type: unsafe + x-unstable: "**Note: This endpoint is in public beta and is only accessible\ + \ for customers who have Metrics Without Limits™.\nIf you\u2019re interested\ + \ in this feature, please contact your Customer Support Manager.**" /api/v2/permissions: get: description: Returns a list of all permissions, including name, description, @@ -7467,6 +7977,16 @@ tags: description: Find out more at url: https://docs.datadoghq.com/logs/logs_to_metrics/ name: Logs Metrics +- description: "The metrics endpoint allows you to:\n\n- Post metrics data so it can\ + \ be graphed on Datadog\u2019s dashboards\n- Query metrics from any time period\n\ + - Modify tag configurations for metrics\n\n**Note**: A graph can only contain\ + \ a set number of points\nand as the timeframe over which a metric is viewed increases,\n\ + aggregation between points occurs to stay below that set number.\n\nDatadog has\ + \ a soft limit of 100 timeseries per host\nwhere a timeseries is defined as a\ + \ unique combination of metric name and tag.\n\nThe Post, Patch, and Delete `manage_tags`\ + \ API methods can only be performed by\na user who has the `Manage Tags for Metrics`\ + \ permission." + name: Metrics - description: The processes API allows you to query processes data for your organization. name: Processes - description: 'The Roles API is used to create and manage Datadog roles, what diff --git a/docs/v2/Metric.md b/docs/v2/Metric.md new file mode 100644 index 000000000000..898b8a86a14b --- /dev/null +++ b/docs/v2/Metric.md @@ -0,0 +1,20 @@ +# DatadogAPIClient::V2::Metric + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | The metric name for this resource. | [optional] | +| **type** | [**MetricType**](MetricType.md) | | [optional][default to 'metrics'] | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::Metric.new( + id: test.metric.latency, + type: null +) +``` + diff --git a/docs/v2/MetricTagConfiguration.md b/docs/v2/MetricTagConfiguration.md new file mode 100644 index 000000000000..fda472c2b67f --- /dev/null +++ b/docs/v2/MetricTagConfiguration.md @@ -0,0 +1,22 @@ +# DatadogAPIClient::V2::MetricTagConfiguration + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **attributes** | [**MetricTagConfigurationAttributes**](MetricTagConfigurationAttributes.md) | | [optional] | +| **id** | **String** | The metric name for this resource. | [optional] | +| **type** | [**MetricTagConfigurationType**](MetricTagConfigurationType.md) | | [optional][default to 'manage_tags'] | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricTagConfiguration.new( + attributes: null, + id: test.metric.latency, + type: null +) +``` + diff --git a/docs/v2/MetricTagConfigurationAttributes.md b/docs/v2/MetricTagConfigurationAttributes.md new file mode 100644 index 000000000000..f1f934ef6a7c --- /dev/null +++ b/docs/v2/MetricTagConfigurationAttributes.md @@ -0,0 +1,26 @@ +# DatadogAPIClient::V2::MetricTagConfigurationAttributes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **created_at** | **Time** | Timestamp when the tag configuration was created. | [optional] | +| **include_percentiles** | **Boolean** | Toggle to turn on/off percentile aggregations for distribution metrics. Only present when the `metric_type` is `distribution`. | [optional] | +| **metric_type** | [**MetricTagConfigurationMetricTypes**](MetricTagConfigurationMetricTypes.md) | | [optional][default to 'gauge'] | +| **modified_at** | **Time** | Timestamp when the tag configuration was last modified. | [optional] | +| **tags** | **Array<String>** | List of tag keys on which to group. | [optional] | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricTagConfigurationAttributes.new( + created_at: 2020-03-31T09:48:37.463835Z, + include_percentiles: true, + metric_type: null, + modified_at: 2020-03-31T09:48:37.463835Z, + tags: ["app","datacenter"] +) +``` + diff --git a/docs/v2/MetricTagConfigurationCreateAttributes.md b/docs/v2/MetricTagConfigurationCreateAttributes.md new file mode 100644 index 000000000000..053760e434de --- /dev/null +++ b/docs/v2/MetricTagConfigurationCreateAttributes.md @@ -0,0 +1,22 @@ +# DatadogAPIClient::V2::MetricTagConfigurationCreateAttributes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **include_percentiles** | **Boolean** | Toggle to include/exclude percentiles for a distribution metric. Defaults to false. Can only be applied to metrics that have a `metric_type` of `distribution`. | [optional][default to false] | +| **metric_type** | [**MetricTagConfigurationMetricTypes**](MetricTagConfigurationMetricTypes.md) | | [default to 'gauge'] | +| **tags** | **Array<String>** | A list of tag keys that will be queryable for your metric. | | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricTagConfigurationCreateAttributes.new( + include_percentiles: true, + metric_type: null, + tags: ["app","datacenter"] +) +``` + diff --git a/docs/v2/MetricTagConfigurationCreateData.md b/docs/v2/MetricTagConfigurationCreateData.md new file mode 100644 index 000000000000..61932a8e072b --- /dev/null +++ b/docs/v2/MetricTagConfigurationCreateData.md @@ -0,0 +1,22 @@ +# DatadogAPIClient::V2::MetricTagConfigurationCreateData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **attributes** | [**MetricTagConfigurationCreateAttributes**](MetricTagConfigurationCreateAttributes.md) | | [optional] | +| **id** | **String** | The metric name for this resource. | | +| **type** | [**MetricTagConfigurationType**](MetricTagConfigurationType.md) | | [default to 'manage_tags'] | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricTagConfigurationCreateData.new( + attributes: null, + id: test.metric.latency, + type: null +) +``` + diff --git a/docs/v2/MetricTagConfigurationCreateRequest.md b/docs/v2/MetricTagConfigurationCreateRequest.md new file mode 100644 index 000000000000..61c7011ded94 --- /dev/null +++ b/docs/v2/MetricTagConfigurationCreateRequest.md @@ -0,0 +1,18 @@ +# DatadogAPIClient::V2::MetricTagConfigurationCreateRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**MetricTagConfigurationCreateData**](MetricTagConfigurationCreateData.md) | | | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricTagConfigurationCreateRequest.new( + data: null +) +``` + diff --git a/docs/v2/MetricTagConfigurationMetricTypes.md b/docs/v2/MetricTagConfigurationMetricTypes.md new file mode 100644 index 000000000000..25557e626b60 --- /dev/null +++ b/docs/v2/MetricTagConfigurationMetricTypes.md @@ -0,0 +1,15 @@ +# DatadogAPIClient::V2::MetricTagConfigurationMetricTypes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricTagConfigurationMetricTypes.new() +``` + diff --git a/docs/v2/MetricTagConfigurationResponse.md b/docs/v2/MetricTagConfigurationResponse.md new file mode 100644 index 000000000000..62919b23b8a6 --- /dev/null +++ b/docs/v2/MetricTagConfigurationResponse.md @@ -0,0 +1,18 @@ +# DatadogAPIClient::V2::MetricTagConfigurationResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**MetricTagConfiguration**](MetricTagConfiguration.md) | | [optional] | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricTagConfigurationResponse.new( + data: null +) +``` + diff --git a/docs/v2/MetricTagConfigurationType.md b/docs/v2/MetricTagConfigurationType.md new file mode 100644 index 000000000000..7927a793bc3f --- /dev/null +++ b/docs/v2/MetricTagConfigurationType.md @@ -0,0 +1,15 @@ +# DatadogAPIClient::V2::MetricTagConfigurationType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricTagConfigurationType.new() +``` + diff --git a/docs/v2/MetricTagConfigurationUpdateAttributes.md b/docs/v2/MetricTagConfigurationUpdateAttributes.md new file mode 100644 index 000000000000..0596220ada58 --- /dev/null +++ b/docs/v2/MetricTagConfigurationUpdateAttributes.md @@ -0,0 +1,20 @@ +# DatadogAPIClient::V2::MetricTagConfigurationUpdateAttributes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **include_percentiles** | **Boolean** | Toggle to include/exclude percentiles for a distribution metric. Defaults to false. Can only be applied to metrics that have a `metric_type` of `distribution`. | [optional][default to false] | +| **tags** | **Array<String>** | A list of tag keys that will be queryable for your metric. | [optional] | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricTagConfigurationUpdateAttributes.new( + include_percentiles: true, + tags: ["app","datacenter"] +) +``` + diff --git a/docs/v2/MetricTagConfigurationUpdateData.md b/docs/v2/MetricTagConfigurationUpdateData.md new file mode 100644 index 000000000000..342d8c7e0431 --- /dev/null +++ b/docs/v2/MetricTagConfigurationUpdateData.md @@ -0,0 +1,22 @@ +# DatadogAPIClient::V2::MetricTagConfigurationUpdateData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **attributes** | [**MetricTagConfigurationUpdateAttributes**](MetricTagConfigurationUpdateAttributes.md) | | [optional] | +| **id** | **String** | The metric name for this resource. | | +| **type** | [**MetricTagConfigurationType**](MetricTagConfigurationType.md) | | [default to 'manage_tags'] | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricTagConfigurationUpdateData.new( + attributes: null, + id: test.metric.latency, + type: null +) +``` + diff --git a/docs/v2/MetricTagConfigurationUpdateRequest.md b/docs/v2/MetricTagConfigurationUpdateRequest.md new file mode 100644 index 000000000000..82fe210cdb13 --- /dev/null +++ b/docs/v2/MetricTagConfigurationUpdateRequest.md @@ -0,0 +1,18 @@ +# DatadogAPIClient::V2::MetricTagConfigurationUpdateRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**MetricTagConfigurationUpdateData**](MetricTagConfigurationUpdateData.md) | | | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricTagConfigurationUpdateRequest.new( + data: null +) +``` + diff --git a/docs/v2/MetricType.md b/docs/v2/MetricType.md new file mode 100644 index 000000000000..d0d9327c062f --- /dev/null +++ b/docs/v2/MetricType.md @@ -0,0 +1,15 @@ +# DatadogAPIClient::V2::MetricType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricType.new() +``` + diff --git a/docs/v2/MetricsAndMetricTagConfigurations.md b/docs/v2/MetricsAndMetricTagConfigurations.md new file mode 100644 index 000000000000..ef69545b5243 --- /dev/null +++ b/docs/v2/MetricsAndMetricTagConfigurations.md @@ -0,0 +1,49 @@ +# DatadogAPIClient::V2::MetricsAndMetricTagConfigurations + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'datadog_api_client/v2' + +DatadogAPIClient::V2::MetricsAndMetricTagConfigurations.openapi_one_of +# => +# [ +# :'Metric', +# :'MetricTagConfiguration' +# ] +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'datadog_api_client/v2' + +DatadogAPIClient::V2::MetricsAndMetricTagConfigurations.build(data) +# => # + +DatadogAPIClient::V2::MetricsAndMetricTagConfigurations.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `Metric` +- `MetricTagConfiguration` +- `nil` (if no type matches) + diff --git a/docs/v2/MetricsAndMetricTagConfigurationsResponse.md b/docs/v2/MetricsAndMetricTagConfigurationsResponse.md new file mode 100644 index 000000000000..45bc94679375 --- /dev/null +++ b/docs/v2/MetricsAndMetricTagConfigurationsResponse.md @@ -0,0 +1,18 @@ +# DatadogAPIClient::V2::MetricsAndMetricTagConfigurationsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<MetricsAndMetricTagConfigurations>**](MetricsAndMetricTagConfigurations.md) | Array of metrics and metric tag configurations. | [optional] | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::MetricsAndMetricTagConfigurationsResponse.new( + data: null +) +``` + diff --git a/docs/v2/MetricsApi.md b/docs/v2/MetricsApi.md new file mode 100644 index 000000000000..9511a9cf8e81 --- /dev/null +++ b/docs/v2/MetricsApi.md @@ -0,0 +1,413 @@ +# DatadogAPIClient::V2::MetricsApi + +All URIs are relative to *https://api.datadoghq.com* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**create_tag_configuration**](MetricsApi.md#create_tag_configuration) | **POST** /api/v2/metrics/{metric_name}/tags | Create a Tag Configuration | +| [**delete_tag_configuration**](MetricsApi.md#delete_tag_configuration) | **DELETE** /api/v2/metrics/{metric_name}/tags | Delete a Tag Configuration | +| [**list_tag_configuration_by_name**](MetricsApi.md#list_tag_configuration_by_name) | **GET** /api/v2/metrics/{metric_name}/tags | List Tag Configuration by Name | +| [**list_tag_configurations**](MetricsApi.md#list_tag_configurations) | **GET** /api/v2/metrics | List Tag Configurations | +| [**update_tag_configuration**](MetricsApi.md#update_tag_configuration) | **PATCH** /api/v2/metrics/{metric_name}/tags | Update a Tag Configuration | + + +## create_tag_configuration + +> create_tag_configuration(metric_name, body) + +Create a Tag Configuration + +Create and define a list of queryable tag keys for a count/gauge/rate/distribution metric. Can only be used with application keys of users with the `Manage Tags for Metrics` permission. + +### Examples + +```ruby +require 'time' +require 'datadog_api_client/v2' + +DatadogAPIClient::V2.configure do |config| + # Defining the site is optional and defaults to datadoghq.com + config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE' + + # setup authorization + # Configure API key authorization: apiKeyAuth + config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"] + + # Configure API key authorization: appKeyAuth + config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"] + + config.unstable_operations[:create_tag_configuration] = true +end + +api_instance = DatadogAPIClient::V2::MetricsApi.new +metric_name = 'dist.http.endpoint.request' # String | The name of the metric. +body = DatadogAPIClient::V2::MetricTagConfigurationCreateRequest.new({data: DatadogAPIClient::V2::MetricTagConfigurationCreateData.new({id: 'test.metric.latency', type: DatadogAPIClient::V2::MetricTagConfigurationType::MANAGE_TAGS})}) # MetricTagConfigurationCreateRequest | + +begin + # Create a Tag Configuration + result = api_instance.create_tag_configuration(metric_name, body) + p result +rescue DatadogAPIClient::V2::ApiError => e + puts "Error when calling MetricsApi->create_tag_configuration: #{e}" +end +``` + +#### Using the create_tag_configuration_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_tag_configuration_with_http_info(metric_name, body) + +```ruby +begin + # Create a Tag Configuration + data, status_code, headers = api_instance.create_tag_configuration_with_http_info(metric_name, body) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue DatadogAPIClient::V2::ApiError => e + puts "Error when calling MetricsApi->create_tag_configuration_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metric_name** | **String** | The name of the metric. | | +| **body** | [**MetricTagConfigurationCreateRequest**](MetricTagConfigurationCreateRequest.md) | | | + +### Return type + +[**MetricTagConfigurationResponse**](MetricTagConfigurationResponse.md) + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## delete_tag_configuration + +> delete_tag_configuration(metric_name) + +Delete a Tag Configuration + +Deletes a metric's tag configuration. Can only be used with application keys from users with the `Manage Tags for Metrics` permission. + +### Examples + +```ruby +require 'time' +require 'datadog_api_client/v2' + +DatadogAPIClient::V2.configure do |config| + # Defining the site is optional and defaults to datadoghq.com + config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE' + + # setup authorization + # Configure API key authorization: apiKeyAuth + config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"] + + # Configure API key authorization: appKeyAuth + config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"] + + config.unstable_operations[:delete_tag_configuration] = true +end + +api_instance = DatadogAPIClient::V2::MetricsApi.new +metric_name = 'dist.http.endpoint.request' # String | The name of the metric. + +begin + # Delete a Tag Configuration + api_instance.delete_tag_configuration(metric_name) +rescue DatadogAPIClient::V2::ApiError => e + puts "Error when calling MetricsApi->delete_tag_configuration: #{e}" +end +``` + +#### Using the delete_tag_configuration_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> delete_tag_configuration_with_http_info(metric_name) + +```ruby +begin + # Delete a Tag Configuration + data, status_code, headers = api_instance.delete_tag_configuration_with_http_info(metric_name) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue DatadogAPIClient::V2::ApiError => e + puts "Error when calling MetricsApi->delete_tag_configuration_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metric_name** | **String** | The name of the metric. | | + +### Return type + +nil (empty response body) + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## list_tag_configuration_by_name + +> list_tag_configuration_by_name(metric_name) + +List Tag Configuration by Name + +Returns the tag configuration for the given metric name. + +### Examples + +```ruby +require 'time' +require 'datadog_api_client/v2' + +DatadogAPIClient::V2.configure do |config| + # Defining the site is optional and defaults to datadoghq.com + config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE' + + # setup authorization + # Configure API key authorization: apiKeyAuth + config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"] + + # Configure API key authorization: appKeyAuth + config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"] + + config.unstable_operations[:list_tag_configuration_by_name] = true +end + +api_instance = DatadogAPIClient::V2::MetricsApi.new +metric_name = 'dist.http.endpoint.request' # String | The name of the metric. + +begin + # List Tag Configuration by Name + result = api_instance.list_tag_configuration_by_name(metric_name) + p result +rescue DatadogAPIClient::V2::ApiError => e + puts "Error when calling MetricsApi->list_tag_configuration_by_name: #{e}" +end +``` + +#### Using the list_tag_configuration_by_name_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> list_tag_configuration_by_name_with_http_info(metric_name) + +```ruby +begin + # List Tag Configuration by Name + data, status_code, headers = api_instance.list_tag_configuration_by_name_with_http_info(metric_name) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue DatadogAPIClient::V2::ApiError => e + puts "Error when calling MetricsApi->list_tag_configuration_by_name_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metric_name** | **String** | The name of the metric. | | + +### Return type + +[**MetricTagConfigurationResponse**](MetricTagConfigurationResponse.md) + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## list_tag_configurations + +> list_tag_configurations(opts) + +List Tag Configurations + +Returns all configured count/gauge/rate/distribution metric names (with additional filters if specified). + +### Examples + +```ruby +require 'time' +require 'datadog_api_client/v2' + +DatadogAPIClient::V2.configure do |config| + # Defining the site is optional and defaults to datadoghq.com + config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE' + + # setup authorization + # Configure API key authorization: apiKeyAuth + config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"] + + # Configure API key authorization: appKeyAuth + config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"] + + config.unstable_operations[:list_tag_configurations] = true +end + +api_instance = DatadogAPIClient::V2::MetricsApi.new +opts = { + filter_configured: true, # Boolean | Filter metrics that have configured tags. + filter_tags_configured: 'app', # String | Filter tag configurations by configured tags. + filter_metric_type: DatadogAPIClient::V2::MetricTagConfigurationMetricTypes::GAUGE, # MetricTagConfigurationMetricTypes | Filter tag configurations by metric type. + filter_include_percentiles: true # Boolean | Filter distributions with additional percentile aggregations enabled or disabled. +} + +begin + # List Tag Configurations + result = api_instance.list_tag_configurations(opts) + p result +rescue DatadogAPIClient::V2::ApiError => e + puts "Error when calling MetricsApi->list_tag_configurations: #{e}" +end +``` + +#### Using the list_tag_configurations_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> list_tag_configurations_with_http_info(opts) + +```ruby +begin + # List Tag Configurations + data, status_code, headers = api_instance.list_tag_configurations_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue DatadogAPIClient::V2::ApiError => e + puts "Error when calling MetricsApi->list_tag_configurations_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **filter_configured** | **Boolean** | Filter metrics that have configured tags. | [optional] | +| **filter_tags_configured** | **String** | Filter tag configurations by configured tags. | [optional] | +| **filter_metric_type** | **MetricTagConfigurationMetricTypes** | Filter tag configurations by metric type. | [optional][default to 'gauge'] | +| **filter_include_percentiles** | **Boolean** | Filter distributions with additional percentile aggregations enabled or disabled. | [optional] | + +### Return type + +[**MetricsAndMetricTagConfigurationsResponse**](MetricsAndMetricTagConfigurationsResponse.md) + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## update_tag_configuration + +> update_tag_configuration(metric_name, body) + +Update a Tag Configuration + +Update the tag configuration of a metric. Can only be used with application keys from users with the `Manage Tags for Metrics` permission. + +### Examples + +```ruby +require 'time' +require 'datadog_api_client/v2' + +DatadogAPIClient::V2.configure do |config| + # Defining the site is optional and defaults to datadoghq.com + config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE' + + # setup authorization + # Configure API key authorization: apiKeyAuth + config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"] + + # Configure API key authorization: appKeyAuth + config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"] + + config.unstable_operations[:update_tag_configuration] = true +end + +api_instance = DatadogAPIClient::V2::MetricsApi.new +metric_name = 'dist.http.endpoint.request' # String | The name of the metric. +body = DatadogAPIClient::V2::MetricTagConfigurationUpdateRequest.new({data: DatadogAPIClient::V2::MetricTagConfigurationUpdateData.new({id: 'test.metric.latency', type: DatadogAPIClient::V2::MetricTagConfigurationType::MANAGE_TAGS})}) # MetricTagConfigurationUpdateRequest | + +begin + # Update a Tag Configuration + result = api_instance.update_tag_configuration(metric_name, body) + p result +rescue DatadogAPIClient::V2::ApiError => e + puts "Error when calling MetricsApi->update_tag_configuration: #{e}" +end +``` + +#### Using the update_tag_configuration_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_tag_configuration_with_http_info(metric_name, body) + +```ruby +begin + # Update a Tag Configuration + data, status_code, headers = api_instance.update_tag_configuration_with_http_info(metric_name, body) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue DatadogAPIClient::V2::ApiError => e + puts "Error when calling MetricsApi->update_tag_configuration_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metric_name** | **String** | The name of the metric. | | +| **body** | [**MetricTagConfigurationUpdateRequest**](MetricTagConfigurationUpdateRequest.md) | | | + +### Return type + +[**MetricTagConfigurationResponse**](MetricTagConfigurationResponse.md) + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/v2/README.md b/docs/v2/README.md index b4117b3f57bb..864fff314cc8 100644 --- a/docs/v2/README.md +++ b/docs/v2/README.md @@ -136,6 +136,11 @@ Class | Method | HTTP request | Description *DatadogAPIClient::V2::LogsMetricsApi* | [**get_logs_metric**](LogsMetricsApi.md#get_logs_metric) | **GET** /api/v2/logs/config/metrics/{metric_id} | Get a log-based metric *DatadogAPIClient::V2::LogsMetricsApi* | [**list_logs_metrics**](LogsMetricsApi.md#list_logs_metrics) | **GET** /api/v2/logs/config/metrics | Get all log-based metrics *DatadogAPIClient::V2::LogsMetricsApi* | [**update_logs_metric**](LogsMetricsApi.md#update_logs_metric) | **PATCH** /api/v2/logs/config/metrics/{metric_id} | Update a log-based metric +*DatadogAPIClient::V2::MetricsApi* | [**create_tag_configuration**](MetricsApi.md#create_tag_configuration) | **POST** /api/v2/metrics/{metric_name}/tags | Create a Tag Configuration +*DatadogAPIClient::V2::MetricsApi* | [**delete_tag_configuration**](MetricsApi.md#delete_tag_configuration) | **DELETE** /api/v2/metrics/{metric_name}/tags | Delete a Tag Configuration +*DatadogAPIClient::V2::MetricsApi* | [**list_tag_configuration_by_name**](MetricsApi.md#list_tag_configuration_by_name) | **GET** /api/v2/metrics/{metric_name}/tags | List Tag Configuration by Name +*DatadogAPIClient::V2::MetricsApi* | [**list_tag_configurations**](MetricsApi.md#list_tag_configurations) | **GET** /api/v2/metrics | List Tag Configurations +*DatadogAPIClient::V2::MetricsApi* | [**update_tag_configuration**](MetricsApi.md#update_tag_configuration) | **PATCH** /api/v2/metrics/{metric_name}/tags | Update a Tag Configuration *DatadogAPIClient::V2::ProcessesApi* | [**list_processes**](ProcessesApi.md#list_processes) | **GET** /api/v2/processes | Get all processes *DatadogAPIClient::V2::RolesApi* | [**add_permission_to_role**](RolesApi.md#add_permission_to_role) | **POST** /api/v2/roles/{role_id}/permissions | Grant permission to a role *DatadogAPIClient::V2::RolesApi* | [**add_user_to_role**](RolesApi.md#add_user_to_role) | **POST** /api/v2/roles/{role_id}/users | Add a user to a role @@ -338,6 +343,21 @@ Class | Method | HTTP request | Description - [DatadogAPIClient::V2::LogsSort](LogsSort.md) - [DatadogAPIClient::V2::LogsSortOrder](LogsSortOrder.md) - [DatadogAPIClient::V2::LogsWarning](LogsWarning.md) + - [DatadogAPIClient::V2::Metric](Metric.md) + - [DatadogAPIClient::V2::MetricTagConfiguration](MetricTagConfiguration.md) + - [DatadogAPIClient::V2::MetricTagConfigurationAttributes](MetricTagConfigurationAttributes.md) + - [DatadogAPIClient::V2::MetricTagConfigurationCreateAttributes](MetricTagConfigurationCreateAttributes.md) + - [DatadogAPIClient::V2::MetricTagConfigurationCreateData](MetricTagConfigurationCreateData.md) + - [DatadogAPIClient::V2::MetricTagConfigurationCreateRequest](MetricTagConfigurationCreateRequest.md) + - [DatadogAPIClient::V2::MetricTagConfigurationMetricTypes](MetricTagConfigurationMetricTypes.md) + - [DatadogAPIClient::V2::MetricTagConfigurationResponse](MetricTagConfigurationResponse.md) + - [DatadogAPIClient::V2::MetricTagConfigurationType](MetricTagConfigurationType.md) + - [DatadogAPIClient::V2::MetricTagConfigurationUpdateAttributes](MetricTagConfigurationUpdateAttributes.md) + - [DatadogAPIClient::V2::MetricTagConfigurationUpdateData](MetricTagConfigurationUpdateData.md) + - [DatadogAPIClient::V2::MetricTagConfigurationUpdateRequest](MetricTagConfigurationUpdateRequest.md) + - [DatadogAPIClient::V2::MetricType](MetricType.md) + - [DatadogAPIClient::V2::MetricsAndMetricTagConfigurations](MetricsAndMetricTagConfigurations.md) + - [DatadogAPIClient::V2::MetricsAndMetricTagConfigurationsResponse](MetricsAndMetricTagConfigurationsResponse.md) - [DatadogAPIClient::V2::Organization](Organization.md) - [DatadogAPIClient::V2::OrganizationAttributes](OrganizationAttributes.md) - [DatadogAPIClient::V2::OrganizationsType](OrganizationsType.md) diff --git a/features/step_definitions/request.rb b/features/step_definitions/request.rb index f55d2673b142..cbb001d3fdec 100644 --- a/features/step_definitions/request.rb +++ b/features/step_definitions/request.rb @@ -24,9 +24,11 @@ def unique end def fixtures + u = unique @fixtures ||= { - "unique": unique, - "unique_lower": unique.downcase, + "unique": u, + "unique_lower": u.downcase, + "unique_alnum": u.gsub(/[^A-Za-z0-9]+/, ''), "now_ts": Time.now.to_i, "now_iso": Time.now.iso8601, "hour_later_ts": (Time.now + 3600).to_i, diff --git a/features/v1/metrics.feature b/features/v1/metrics.feature index 8da7bdb117da..f827d588e7cc 100644 --- a/features/v1/metrics.feature +++ b/features/v1/metrics.feature @@ -1,12 +1,14 @@ @endpoint(metrics) Feature: Metrics The metrics endpoint allows you to: - Post metrics data so it can be - graphed on Datadog’s dashboards - Query metrics from any time period - **Note**: A graph can only contain a set number of points and as the - timeframe over which a metric is viewed increases, aggregation between - points occurs to stay below that set number. Datadog has a soft limit of - 100 timeseries per host where a timeseries is defined as a unique - combination of metric name and tag. + graphed on Datadog’s dashboards - Query metrics from any time period - + Modify tag configurations for metrics **Note**: A graph can only contain + a set number of points and as the timeframe over which a metric is viewed + increases, aggregation between points occurs to stay below that set + number. Datadog has a soft limit of 100 timeseries per host where a + timeseries is defined as a unique combination of metric name and tag. The + Post, Patch, and Delete `manage_tags` API methods can only be performed by + a user who has the `Manage Tags for Metrics` permission. Background: Given a valid "apiKeyAuth" key in the system diff --git a/features/v2/given.json b/features/v2/given.json index 5b9766f7dde8..2bad55c3f6a9 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -47,6 +47,22 @@ "tag": "Logs Metrics", "operationId": "CreateLogsMetric" }, + { + "parameters": [ + { + "name": "metric_name", + "value": "\"{{ unique_alnum }}\"" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"tags\":[\"app\", \"datacenter\", \"{{ unique_alnum }}\"],\n \"metric_type\":\"distribution\"\n },\n \"type\": \"manage_tags\",\n \"id\": \"{{ unique_alnum }}\"\n }\n}" + } + ], + "step": "there is a valid \"metric_tag_configuration\" in the system", + "key": "metric_tag_configuration", + "tag": "Metrics", + "operationId": "CreateTagConfiguration" + }, { "source": "data[0]", "step": "there is a valid \"permission\" in the system", diff --git a/features/v2/metrics.feature b/features/v2/metrics.feature new file mode 100644 index 000000000000..4e7df680ab0b --- /dev/null +++ b/features/v2/metrics.feature @@ -0,0 +1,160 @@ +@endpoint(metrics) +Feature: Metrics + The metrics endpoint allows you to: - Post metrics data so it can be + graphed on Datadog’s dashboards - Query metrics from any time period - + Modify tag configurations for metrics **Note**: A graph can only contain + a set number of points and as the timeframe over which a metric is viewed + increases, aggregation between points occurs to stay below that set + number. Datadog has a soft limit of 100 timeseries per host where a + timeseries is defined as a unique combination of metric name and tag. The + Post, Patch, and Delete `manage_tags` API methods can only be performed by + a user who has the `Manage Tags for Metrics` permission. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Metrics" API + + @generated @skip + Scenario: Create a Tag Configuration returns "Bad Request" response + Given operation "CreateTagConfiguration" enabled + And new "CreateTagConfiguration" request + And request contains "metric_name" parameter from "" + And body {} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip + Scenario: Create a Tag Configuration returns "Conflict" response + Given operation "CreateTagConfiguration" enabled + And new "CreateTagConfiguration" request + And request contains "metric_name" parameter from "" + And body {} + When the request is sent + Then the response status is 409 Conflict + + Scenario: Create a Tag Configuration returns "Created" response + Given operation "CreateTagConfiguration" enabled + And new "CreateTagConfiguration" request + And request contains "metric_name" parameter with value "{{ unique_alnum }}" + And body {"data": {"type": "manage_tags", "id": "{{ unique_alnum }}", "attributes": {"tags": ["app","datacenter"], "metric_type": "distribution"}}} + When the request is sent + Then the response status is 201 Created + + @generated @skip + Scenario: Create a Tag Configuration returns "Too Many Requests" response + Given operation "CreateTagConfiguration" enabled + And new "CreateTagConfiguration" request + And request contains "metric_name" parameter from "" + And body {} + When the request is sent + Then the response status is 429 Too Many Requests + + Scenario: Delete a Tag Configuration returns "No Content" response + Given there is a valid "metric_tag_configuration" in the system + And operation "DeleteTagConfiguration" enabled + And new "DeleteTagConfiguration" request + And request contains "metric_name" parameter from "metric_tag_configuration.data.id" + When the request is sent + Then the response status is 204 No Content + + @generated @skip + Scenario: Delete a Tag Configuration returns "Not found" response + Given operation "DeleteTagConfiguration" enabled + And new "DeleteTagConfiguration" request + And request contains "metric_name" parameter from "" + When the request is sent + Then the response status is 404 Not found + + @generated @skip + Scenario: Delete a Tag Configuration returns "Too Many Requests" response + Given operation "DeleteTagConfiguration" enabled + And new "DeleteTagConfiguration" request + And request contains "metric_name" parameter from "" + When the request is sent + Then the response status is 429 Too Many Requests + + @generated @skip + Scenario: List Tag Configuration by Name returns "Not Found" response + Given operation "ListTagConfigurationByName" enabled + And new "ListTagConfigurationByName" request + And request contains "metric_name" parameter from "" + When the request is sent + Then the response status is 404 Not Found + + Scenario: List Tag Configuration by Name returns "Success" response + Given there is a valid "metric_tag_configuration" in the system + And operation "ListTagConfigurationByName" enabled + And new "ListTagConfigurationByName" request + And request contains "metric_name" parameter from "metric_tag_configuration.data.id" + When the request is sent + Then the response status is 200 Success + And the response "data.id" has the same value as "metric_tag_configuration.data.id" + + @generated @skip + Scenario: List Tag Configuration by Name returns "Too Many Requests" response + Given operation "ListTagConfigurationByName" enabled + And new "ListTagConfigurationByName" request + And request contains "metric_name" parameter from "" + When the request is sent + Then the response status is 429 Too Many Requests + + @generated @skip + Scenario: List Tag Configurations returns "Bad Request" response + Given operation "ListTagConfigurations" enabled + And new "ListTagConfigurations" request + When the request is sent + Then the response status is 400 Bad Request + + Scenario: List Tag Configurations returns "Success" response + Given there is a valid "metric_tag_configuration" in the system + And operation "ListTagConfigurations" enabled + And new "ListTagConfigurations" request + And request contains "filter[tags_configured]" parameter with value "{{ unique_alnum }}" + When the request is sent + Then the response status is 200 Success + And the response "data[0].id" has the same value as "metric_tag_configuration.data.id" + + @generated @skip + Scenario: List Tag Configurations returns "Too Many Requests" response + Given operation "ListTagConfigurations" enabled + And new "ListTagConfigurations" request + When the request is sent + Then the response status is 429 Too Many Requests + + @generated @skip + Scenario: Update a Tag Configuration returns "Bad Request" response + Given operation "UpdateTagConfiguration" enabled + And new "UpdateTagConfiguration" request + And request contains "metric_name" parameter from "" + And body {} + When the request is sent + Then the response status is 400 Bad Request + + Scenario: Update a Tag Configuration returns "OK" response + Given operation "UpdateTagConfiguration" enabled + And there is a valid "metric_tag_configuration" in the system + And new "UpdateTagConfiguration" request + And request contains "metric_name" parameter from "metric_tag_configuration.data.id" + And body {"data": {"type": "manage_tags", "id": "{{ metric_tag_configuration.data.id }}", "attributes": {"tags": ["app"]}}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.tags[0]" is equal to "app" + + @generated @skip + Scenario: Update a Tag Configuration returns "Too Many Requests" response + Given operation "UpdateTagConfiguration" enabled + And new "UpdateTagConfiguration" request + And request contains "metric_name" parameter from "" + And body {} + When the request is sent + Then the response status is 429 Too Many Requests + + @generated @skip + Scenario: Update a Tag Configuration returns "Unprocessable Entity" response + Given operation "UpdateTagConfiguration" enabled + And new "UpdateTagConfiguration" request + And request contains "metric_name" parameter from "" + And body {} + When the request is sent + Then the response status is 422 Unprocessable Entity diff --git a/features/v2/undo.json b/features/v2/undo.json index 20953e38a402..a9e69cb2da56 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -274,6 +274,43 @@ "type": "safe" } }, + "ListTagConfigurations": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, + "DeleteTagConfiguration": { + "tag": "Metrics", + "undo": { + "type": "idempotent" + } + }, + "ListTagConfigurationByName": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, + "UpdateTagConfiguration": { + "tag": "Metrics", + "undo": { + "type": "idempotent" + } + }, + "CreateTagConfiguration": { + "tag": "Metrics", + "undo": { + "operationId": "DeleteTagConfiguration", + "parameters": [ + { + "name": "metric_name", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, "ListPermissions": { "tag": "Roles", "undo": { diff --git a/lib/datadog_api_client/v2.rb b/lib/datadog_api_client/v2.rb index 9395e2517a06..bb510d43db99 100644 --- a/lib/datadog_api_client/v2.rb +++ b/lib/datadog_api_client/v2.rb @@ -189,6 +189,21 @@ require 'datadog_api_client/v2/models/logs_sort' require 'datadog_api_client/v2/models/logs_sort_order' require 'datadog_api_client/v2/models/logs_warning' +require 'datadog_api_client/v2/models/metric' +require 'datadog_api_client/v2/models/metric_tag_configuration' +require 'datadog_api_client/v2/models/metric_tag_configuration_attributes' +require 'datadog_api_client/v2/models/metric_tag_configuration_create_attributes' +require 'datadog_api_client/v2/models/metric_tag_configuration_create_data' +require 'datadog_api_client/v2/models/metric_tag_configuration_create_request' +require 'datadog_api_client/v2/models/metric_tag_configuration_metric_types' +require 'datadog_api_client/v2/models/metric_tag_configuration_response' +require 'datadog_api_client/v2/models/metric_tag_configuration_type' +require 'datadog_api_client/v2/models/metric_tag_configuration_update_attributes' +require 'datadog_api_client/v2/models/metric_tag_configuration_update_data' +require 'datadog_api_client/v2/models/metric_tag_configuration_update_request' +require 'datadog_api_client/v2/models/metric_type' +require 'datadog_api_client/v2/models/metrics_and_metric_tag_configurations' +require 'datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response' require 'datadog_api_client/v2/models/organization' require 'datadog_api_client/v2/models/organization_attributes' require 'datadog_api_client/v2/models/organizations_type' @@ -302,6 +317,7 @@ require 'datadog_api_client/v2/api/logs_api' require 'datadog_api_client/v2/api/logs_archives_api' require 'datadog_api_client/v2/api/logs_metrics_api' +require 'datadog_api_client/v2/api/metrics_api' require 'datadog_api_client/v2/api/processes_api' require 'datadog_api_client/v2/api/roles_api' require 'datadog_api_client/v2/api/security_monitoring_api' diff --git a/lib/datadog_api_client/v2/api/metrics_api.rb b/lib/datadog_api_client/v2/api/metrics_api.rb new file mode 100644 index 000000000000..9f441a1ff845 --- /dev/null +++ b/lib/datadog_api_client/v2/api/metrics_api.rb @@ -0,0 +1,412 @@ +=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://openapi-generator.tech + + 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 MetricsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a Tag Configuration + # Create and define a list of queryable tag keys for a count/gauge/rate/distribution metric. Can only be used with application keys of users with the `Manage Tags for Metrics` permission. + # @param metric_name [String] The name of the metric. + # @param body [MetricTagConfigurationCreateRequest] + # @param [Hash] opts the optional parameters + # @return [MetricTagConfigurationResponse] + def create_tag_configuration(metric_name, body, opts = {}) + data, _status_code, _headers = create_tag_configuration_with_http_info(metric_name, body, opts) + data + end + + # Create a Tag Configuration + # Create and define a list of queryable tag keys for a count/gauge/rate/distribution metric. Can only be used with application keys of users with the `Manage Tags for Metrics` permission. + # @param metric_name [String] The name of the metric. + # @param body [MetricTagConfigurationCreateRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(MetricTagConfigurationResponse, Integer, Hash)>] MetricTagConfigurationResponse data, response status code and response headers + def create_tag_configuration_with_http_info(metric_name, body, opts = {}) + + if @api_client.config.unstable_operations.has_key?(:create_tag_configuration) + unstable_enabled = @api_client.config.unstable_operations[:create_tag_configuration] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "create_tag_configuration") + else + raise ApiError.new(message: format("Unstable operation '%s' is disabled", "create_tag_configuration")) + end + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsApi.create_tag_configuration ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsApi.create_tag_configuration" + 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 MetricsApi.create_tag_configuration" + end + # resource path + local_var_path = '/api/v2/metrics/{metric_name}/tags'.sub('{' + 'metric_name' + '}', CGI.escape(metric_name.to_s)) + + # 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] || 'MetricTagConfigurationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['apiKeyAuth', 'appKeyAuth'] + + new_options = opts.merge( + :operation => :"MetricsApi.create_tag_configuration", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsApi#create_tag_configuration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a Tag Configuration + # Deletes a metric's tag configuration. Can only be used with application keys from users with the `Manage Tags for Metrics` permission. + # @param metric_name [String] The name of the metric. + # @param [Hash] opts the optional parameters + # @return [nil] + def delete_tag_configuration(metric_name, opts = {}) + delete_tag_configuration_with_http_info(metric_name, opts) + nil + end + + # Delete a Tag Configuration + # Deletes a metric's tag configuration. Can only be used with application keys from users with the `Manage Tags for Metrics` permission. + # @param metric_name [String] The name of the metric. + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_tag_configuration_with_http_info(metric_name, opts = {}) + + if @api_client.config.unstable_operations.has_key?(:delete_tag_configuration) + unstable_enabled = @api_client.config.unstable_operations[:delete_tag_configuration] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "delete_tag_configuration") + else + raise ApiError.new(message: format("Unstable operation '%s' is disabled", "delete_tag_configuration")) + end + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsApi.delete_tag_configuration ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsApi.delete_tag_configuration" + end + # resource path + local_var_path = '/api/v2/metrics/{metric_name}/tags'.sub('{' + 'metric_name' + '}', CGI.escape(metric_name.to_s)) + + # 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']) + + # 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 => :"MetricsApi.delete_tag_configuration", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsApi#delete_tag_configuration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Tag Configuration by Name + # Returns the tag configuration for the given metric name. + # @param metric_name [String] The name of the metric. + # @param [Hash] opts the optional parameters + # @return [MetricTagConfigurationResponse] + def list_tag_configuration_by_name(metric_name, opts = {}) + data, _status_code, _headers = list_tag_configuration_by_name_with_http_info(metric_name, opts) + data + end + + # List Tag Configuration by Name + # Returns the tag configuration for the given metric name. + # @param metric_name [String] The name of the metric. + # @param [Hash] opts the optional parameters + # @return [Array<(MetricTagConfigurationResponse, Integer, Hash)>] MetricTagConfigurationResponse data, response status code and response headers + def list_tag_configuration_by_name_with_http_info(metric_name, opts = {}) + + if @api_client.config.unstable_operations.has_key?(:list_tag_configuration_by_name) + unstable_enabled = @api_client.config.unstable_operations[:list_tag_configuration_by_name] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "list_tag_configuration_by_name") + else + raise ApiError.new(message: format("Unstable operation '%s' is disabled", "list_tag_configuration_by_name")) + end + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsApi.list_tag_configuration_by_name ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsApi.list_tag_configuration_by_name" + end + # resource path + local_var_path = '/api/v2/metrics/{metric_name}/tags'.sub('{' + 'metric_name' + '}', CGI.escape(metric_name.to_s)) + + # 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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MetricTagConfigurationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['apiKeyAuth', 'appKeyAuth'] + + new_options = opts.merge( + :operation => :"MetricsApi.list_tag_configuration_by_name", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsApi#list_tag_configuration_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Tag Configurations + # Returns all configured count/gauge/rate/distribution metric names (with additional filters if specified). + # @param [Hash] opts the optional parameters + # @option opts [Boolean] :filter_configured Filter metrics that have configured tags. + # @option opts [String] :filter_tags_configured Filter tag configurations by configured tags. + # @option opts [MetricTagConfigurationMetricTypes] :filter_metric_type Filter tag configurations by metric type. (default to 'gauge') + # @option opts [Boolean] :filter_include_percentiles Filter distributions with additional percentile aggregations enabled or disabled. + # @return [MetricsAndMetricTagConfigurationsResponse] + def list_tag_configurations(opts = {}) + data, _status_code, _headers = list_tag_configurations_with_http_info(opts) + data + end + + # List Tag Configurations + # Returns all configured count/gauge/rate/distribution metric names (with additional filters if specified). + # @param [Hash] opts the optional parameters + # @option opts [Boolean] :filter_configured Filter metrics that have configured tags. + # @option opts [String] :filter_tags_configured Filter tag configurations by configured tags. + # @option opts [MetricTagConfigurationMetricTypes] :filter_metric_type Filter tag configurations by metric type. + # @option opts [Boolean] :filter_include_percentiles Filter distributions with additional percentile aggregations enabled or disabled. + # @return [Array<(MetricsAndMetricTagConfigurationsResponse, Integer, Hash)>] MetricsAndMetricTagConfigurationsResponse data, response status code and response headers + def list_tag_configurations_with_http_info(opts = {}) + + if @api_client.config.unstable_operations.has_key?(:list_tag_configurations) + unstable_enabled = @api_client.config.unstable_operations[:list_tag_configurations] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "list_tag_configurations") + else + raise ApiError.new(message: format("Unstable operation '%s' is disabled", "list_tag_configurations")) + end + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsApi.list_tag_configurations ...' + end + # resource path + local_var_path = '/api/v2/metrics' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'filter[configured]'] = opts[:'filter_configured'] if !opts[:'filter_configured'].nil? + query_params[:'filter[tags_configured]'] = opts[:'filter_tags_configured'] if !opts[:'filter_tags_configured'].nil? + query_params[:'filter[metric_type]'] = opts[:'filter_metric_type'] if !opts[:'filter_metric_type'].nil? + query_params[:'filter[include_percentiles]'] = opts[:'filter_include_percentiles'] if !opts[:'filter_include_percentiles'].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] || 'MetricsAndMetricTagConfigurationsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['apiKeyAuth', 'appKeyAuth'] + + new_options = opts.merge( + :operation => :"MetricsApi.list_tag_configurations", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsApi#list_tag_configurations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a Tag Configuration + # Update the tag configuration of a metric. Can only be used with application keys from users with the `Manage Tags for Metrics` permission. + # @param metric_name [String] The name of the metric. + # @param body [MetricTagConfigurationUpdateRequest] + # @param [Hash] opts the optional parameters + # @return [MetricTagConfigurationResponse] + def update_tag_configuration(metric_name, body, opts = {}) + data, _status_code, _headers = update_tag_configuration_with_http_info(metric_name, body, opts) + data + end + + # Update a Tag Configuration + # Update the tag configuration of a metric. Can only be used with application keys from users with the `Manage Tags for Metrics` permission. + # @param metric_name [String] The name of the metric. + # @param body [MetricTagConfigurationUpdateRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(MetricTagConfigurationResponse, Integer, Hash)>] MetricTagConfigurationResponse data, response status code and response headers + def update_tag_configuration_with_http_info(metric_name, body, opts = {}) + + if @api_client.config.unstable_operations.has_key?(:update_tag_configuration) + unstable_enabled = @api_client.config.unstable_operations[:update_tag_configuration] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "update_tag_configuration") + else + raise ApiError.new(message: format("Unstable operation '%s' is disabled", "update_tag_configuration")) + end + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsApi.update_tag_configuration ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsApi.update_tag_configuration" + 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 MetricsApi.update_tag_configuration" + end + # resource path + local_var_path = '/api/v2/metrics/{metric_name}/tags'.sub('{' + 'metric_name' + '}', CGI.escape(metric_name.to_s)) + + # 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] || 'MetricTagConfigurationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['apiKeyAuth', 'appKeyAuth'] + + new_options = opts.merge( + :operation => :"MetricsApi.update_tag_configuration", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsApi#update_tag_configuration\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/configuration.rb b/lib/datadog_api_client/v2/configuration.rb index aeb4f67910a1..58dac59399d9 100644 --- a/lib/datadog_api_client/v2/configuration.rb +++ b/lib/datadog_api_client/v2/configuration.rb @@ -180,6 +180,11 @@ def initialize get_incident: false, list_incidents: false, update_incident: false, + create_tag_configuration: false, + delete_tag_configuration: false, + list_tag_configuration_by_name: false, + list_tag_configurations: false, + update_tag_configuration: false, list_security_monitoring_signals: false, search_security_monitoring_signals: false, } diff --git a/lib/datadog_api_client/v2/models/metric.rb b/lib/datadog_api_client/v2/models/metric.rb new file mode 100644 index 000000000000..6f5bdf843298 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric.rb @@ -0,0 +1,234 @@ +=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://openapi-generator.tech + + 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 a single metric tag configuration. + class Metric + # The metric name for this resource. + attr_accessor :id + + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'type' => :'MetricType' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::Metric` 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::Metric`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'metrics' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_configuration.rb b/lib/datadog_api_client/v2/models/metric_tag_configuration.rb new file mode 100644 index 000000000000..501347d241cf --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_configuration.rb @@ -0,0 +1,243 @@ +=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://openapi-generator.tech + + 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 a single metric tag configuration. + class MetricTagConfiguration + attr_accessor :attributes + + # The metric name for this resource. + attr_accessor :id + + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'attributes' => :'MetricTagConfigurationAttributes', + :'id' => :'String', + :'type' => :'MetricTagConfigurationType' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MetricTagConfiguration` 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::MetricTagConfiguration`. 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 + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'manage_tags' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [attributes, id, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_configuration_attributes.rb b/lib/datadog_api_client/v2/models/metric_tag_configuration_attributes.rb new file mode 100644 index 000000000000..1a083739dccb --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_configuration_attributes.rb @@ -0,0 +1,266 @@ +=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://openapi-generator.tech + + 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 containing the definition of a metric tag configuration attributes. + class MetricTagConfigurationAttributes + # Timestamp when the tag configuration was created. + attr_accessor :created_at + + # Toggle to turn on/off percentile aggregations for distribution metrics. Only present when the `metric_type` is `distribution`. + attr_accessor :include_percentiles + + attr_accessor :metric_type + + # Timestamp when the tag configuration was last modified. + attr_accessor :modified_at + + # List of tag keys on which to group. + attr_accessor :tags + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'created_at' => :'created_at', + :'include_percentiles' => :'include_percentiles', + :'metric_type' => :'metric_type', + :'modified_at' => :'modified_at', + :'tags' => :'tags' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'created_at' => :'Time', + :'include_percentiles' => :'Boolean', + :'metric_type' => :'MetricTagConfigurationMetricTypes', + :'modified_at' => :'Time', + :'tags' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MetricTagConfigurationAttributes` 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::MetricTagConfigurationAttributes`. 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?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'include_percentiles') + self.include_percentiles = attributes[:'include_percentiles'] + end + + if attributes.key?(:'metric_type') + self.metric_type = attributes[:'metric_type'] + else + self.metric_type = 'gauge' + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + include_percentiles == o.include_percentiles && + metric_type == o.metric_type && + modified_at == o.modified_at && + tags == o.tags + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [created_at, include_percentiles, metric_type, modified_at, tags].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_configuration_create_attributes.rb b/lib/datadog_api_client/v2/models/metric_tag_configuration_create_attributes.rb new file mode 100644 index 000000000000..c8221e8feba5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_configuration_create_attributes.rb @@ -0,0 +1,258 @@ +=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://openapi-generator.tech + + 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 containing the definition of a metric tag configuration to be created. + class MetricTagConfigurationCreateAttributes + # Toggle to include/exclude percentiles for a distribution metric. Defaults to false. Can only be applied to metrics that have a `metric_type` of `distribution`. + attr_accessor :include_percentiles + + attr_accessor :metric_type + + # A list of tag keys that will be queryable for your metric. + attr_accessor :tags + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'include_percentiles' => :'include_percentiles', + :'metric_type' => :'metric_type', + :'tags' => :'tags' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'include_percentiles' => :'Boolean', + :'metric_type' => :'MetricTagConfigurationMetricTypes', + :'tags' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MetricTagConfigurationCreateAttributes` 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::MetricTagConfigurationCreateAttributes`. 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?(:'include_percentiles') + self.include_percentiles = attributes[:'include_percentiles'] + else + self.include_percentiles = false + end + + if attributes.key?(:'metric_type') + self.metric_type = attributes[:'metric_type'] + else + self.metric_type = 'gauge' + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @metric_type.nil? + invalid_properties.push('invalid value for "metric_type", metric_type cannot be nil.') + end + + if @tags.nil? + invalid_properties.push('invalid value for "tags", tags cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @metric_type.nil? + return false if @tags.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + include_percentiles == o.include_percentiles && + metric_type == o.metric_type && + tags == o.tags + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [include_percentiles, metric_type, tags].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_configuration_create_data.rb b/lib/datadog_api_client/v2/models/metric_tag_configuration_create_data.rb new file mode 100644 index 000000000000..5dcbbb3f445a --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_configuration_create_data.rb @@ -0,0 +1,253 @@ +=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://openapi-generator.tech + + 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 a single metric to be configure tags on. + class MetricTagConfigurationCreateData + attr_accessor :attributes + + # The metric name for this resource. + attr_accessor :id + + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'attributes' => :'MetricTagConfigurationCreateAttributes', + :'id' => :'String', + :'type' => :'MetricTagConfigurationType' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MetricTagConfigurationCreateData` 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::MetricTagConfigurationCreateData`. 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 + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'manage_tags' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [attributes, id, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_configuration_create_request.rb b/lib/datadog_api_client/v2/models/metric_tag_configuration_create_request.rb new file mode 100644 index 000000000000..2b796c48587f --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_configuration_create_request.rb @@ -0,0 +1,227 @@ +=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://openapi-generator.tech + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request object that includes the metric that you would like to configure tags for. + class MetricTagConfigurationCreateRequest + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'MetricTagConfigurationCreateData' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MetricTagConfigurationCreateRequest` 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::MetricTagConfigurationCreateRequest`. 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 + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push('invalid value for "data", data cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_configuration_metric_types.rb b/lib/datadog_api_client/v2/models/metric_tag_configuration_metric_types.rb new file mode 100644 index 000000000000..e938f9179be3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_configuration_metric_types.rb @@ -0,0 +1,41 @@ +=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://openapi-generator.tech + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + class MetricTagConfigurationMetricTypes + GAUGE = "gauge".freeze + COUNT = "count".freeze + DISTRIBUTION = "distribution".freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = MetricTagConfigurationMetricTypes.constants.select { |c| MetricTagConfigurationMetricTypes::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #MetricTagConfigurationMetricTypes" if constantValues.empty? + value + end + end +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_configuration_response.rb b/lib/datadog_api_client/v2/models/metric_tag_configuration_response.rb new file mode 100644 index 000000000000..bd9f7cd66993 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_configuration_response.rb @@ -0,0 +1,222 @@ +=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://openapi-generator.tech + + 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 object which includes a single metric's tag configuration. + class MetricTagConfigurationResponse + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'MetricTagConfiguration' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MetricTagConfigurationResponse` 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::MetricTagConfigurationResponse`. 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 + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_configuration_type.rb b/lib/datadog_api_client/v2/models/metric_tag_configuration_type.rb new file mode 100644 index 000000000000..cacab207e23f --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_configuration_type.rb @@ -0,0 +1,39 @@ +=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://openapi-generator.tech + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + class MetricTagConfigurationType + MANAGE_TAGS = "manage_tags".freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = MetricTagConfigurationType.constants.select { |c| MetricTagConfigurationType::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #MetricTagConfigurationType" if constantValues.empty? + value + end + end +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_configuration_update_attributes.rb b/lib/datadog_api_client/v2/models/metric_tag_configuration_update_attributes.rb new file mode 100644 index 000000000000..a08317214a4a --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_configuration_update_attributes.rb @@ -0,0 +1,237 @@ +=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://openapi-generator.tech + + 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 containing the definition of a metric tag configuration to be updated. + class MetricTagConfigurationUpdateAttributes + # Toggle to include/exclude percentiles for a distribution metric. Defaults to false. Can only be applied to metrics that have a `metric_type` of `distribution`. + attr_accessor :include_percentiles + + # A list of tag keys that will be queryable for your metric. + attr_accessor :tags + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'include_percentiles' => :'include_percentiles', + :'tags' => :'tags' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'include_percentiles' => :'Boolean', + :'tags' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MetricTagConfigurationUpdateAttributes` 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::MetricTagConfigurationUpdateAttributes`. 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?(:'include_percentiles') + self.include_percentiles = attributes[:'include_percentiles'] + else + self.include_percentiles = false + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + include_percentiles == o.include_percentiles && + tags == o.tags + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [include_percentiles, tags].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_configuration_update_data.rb b/lib/datadog_api_client/v2/models/metric_tag_configuration_update_data.rb new file mode 100644 index 000000000000..a1155e3c9b4b --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_configuration_update_data.rb @@ -0,0 +1,253 @@ +=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://openapi-generator.tech + + 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 a single tag configuration to be edited. + class MetricTagConfigurationUpdateData + attr_accessor :attributes + + # The metric name for this resource. + attr_accessor :id + + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'attributes' => :'MetricTagConfigurationUpdateAttributes', + :'id' => :'String', + :'type' => :'MetricTagConfigurationType' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MetricTagConfigurationUpdateData` 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::MetricTagConfigurationUpdateData`. 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 + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'manage_tags' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [attributes, id, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_configuration_update_request.rb b/lib/datadog_api_client/v2/models/metric_tag_configuration_update_request.rb new file mode 100644 index 000000000000..02e9d2ff2129 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_configuration_update_request.rb @@ -0,0 +1,227 @@ +=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://openapi-generator.tech + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request object that includes the metric that you would like to edit the tag configuration on. + class MetricTagConfigurationUpdateRequest + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'MetricTagConfigurationUpdateData' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MetricTagConfigurationUpdateRequest` 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::MetricTagConfigurationUpdateRequest`. 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 + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push('invalid value for "data", data cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v2/models/metric_type.rb b/lib/datadog_api_client/v2/models/metric_type.rb new file mode 100644 index 000000000000..c466aaca4af6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_type.rb @@ -0,0 +1,39 @@ +=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://openapi-generator.tech + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + class MetricType + METRICS = "metrics".freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = MetricType.constants.select { |c| MetricType::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #MetricType" if constantValues.empty? + value + end + end +end diff --git a/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations.rb b/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations.rb new file mode 100644 index 000000000000..6cd2bd927c19 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations.rb @@ -0,0 +1,109 @@ +=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://openapi-generator.tech + + 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 a metrics and metric tag configurations. + module MetricsAndMetricTagConfigurations + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Metric', + :'MetricTagConfiguration' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are defacto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = DatadogAPIClient::V2.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model && model.valid? + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb b/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb new file mode 100644 index 000000000000..bdedcac6ca85 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb @@ -0,0 +1,225 @@ +=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://openapi-generator.tech + + 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 object that includes metrics and metric tag configurations. + class MetricsAndMetricTagConfigurationsResponse + # Array of metrics and metric tag configurations. + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MetricsAndMetricTagConfigurationsResponse` 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::MetricsAndMetricTagConfigurationsResponse`. 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') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/spec/v2/api/metrics_api_spec.rb b/spec/v2/api/metrics_api_spec.rb new file mode 100644 index 000000000000..a95a4383c0a0 --- /dev/null +++ b/spec/v2/api/metrics_api_spec.rb @@ -0,0 +1,103 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' + +# Unit tests for DatadogAPIClient::V2::MetricsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'MetricsApi' do + before do + # run before each test + @api_instance = DatadogAPIClient::V2::MetricsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of MetricsApi' do + it 'should create an instance of MetricsApi' do + expect(@api_instance).to be_instance_of(DatadogAPIClient::V2::MetricsApi) + end + end + + # unit tests for create_tag_configuration + # Create a Tag Configuration + # Create and define a list of queryable tag keys for a count/gauge/rate/distribution metric. Can only be used with application keys of users with the `Manage Tags for Metrics` permission. + # @param metric_name The name of the metric. + # @param body + # @param [Hash] opts the optional parameters + # @return [MetricTagConfigurationResponse] + describe 'create_tag_configuration test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for delete_tag_configuration + # Delete a Tag Configuration + # Deletes a metric's tag configuration. Can only be used with application keys from users with the `Manage Tags for Metrics` permission. + # @param metric_name The name of the metric. + # @param [Hash] opts the optional parameters + # @return [nil] + describe 'delete_tag_configuration test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for list_tag_configuration_by_name + # List Tag Configuration by Name + # Returns the tag configuration for the given metric name. + # @param metric_name The name of the metric. + # @param [Hash] opts the optional parameters + # @return [MetricTagConfigurationResponse] + describe 'list_tag_configuration_by_name test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for list_tag_configurations + # List Tag Configurations + # Returns all configured count/gauge/rate/distribution metric names (with additional filters if specified). + # @param [Hash] opts the optional parameters + # @option opts [Boolean] :filter_configured Filter metrics that have configured tags. + # @option opts [String] :filter_tags_configured Filter tag configurations by configured tags. + # @option opts [MetricTagConfigurationMetricTypes] :filter_metric_type Filter tag configurations by metric type. + # @option opts [Boolean] :filter_include_percentiles Filter distributions with additional percentile aggregations enabled or disabled. + # @return [MetricsAndMetricTagConfigurationsResponse] + describe 'list_tag_configurations test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for update_tag_configuration + # Update a Tag Configuration + # Update the tag configuration of a metric. Can only be used with application keys from users with the `Manage Tags for Metrics` permission. + # @param metric_name The name of the metric. + # @param body + # @param [Hash] opts the optional parameters + # @return [MetricTagConfigurationResponse] + describe 'update_tag_configuration test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metric_spec.rb b/spec/v2/models/metric_spec.rb new file mode 100644 index 000000000000..28c09f6f0df1 --- /dev/null +++ b/spec/v2/models/metric_spec.rb @@ -0,0 +1,43 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::Metric +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::Metric do + let(:instance) { DatadogAPIClient::V2::Metric.new } + + describe 'test an instance of Metric' do + it 'should create an instance of Metric' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::Metric) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metric_tag_configuration_attributes_spec.rb b/spec/v2/models/metric_tag_configuration_attributes_spec.rb new file mode 100644 index 000000000000..08de41c4fbff --- /dev/null +++ b/spec/v2/models/metric_tag_configuration_attributes_spec.rb @@ -0,0 +1,61 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricTagConfigurationAttributes +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricTagConfigurationAttributes do + let(:instance) { DatadogAPIClient::V2::MetricTagConfigurationAttributes.new } + + describe 'test an instance of MetricTagConfigurationAttributes' do + it 'should create an instance of MetricTagConfigurationAttributes' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricTagConfigurationAttributes) + end + end + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "include_percentiles"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "metric_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "modified_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metric_tag_configuration_create_attributes_spec.rb b/spec/v2/models/metric_tag_configuration_create_attributes_spec.rb new file mode 100644 index 000000000000..c80d8d371488 --- /dev/null +++ b/spec/v2/models/metric_tag_configuration_create_attributes_spec.rb @@ -0,0 +1,49 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricTagConfigurationCreateAttributes +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricTagConfigurationCreateAttributes do + let(:instance) { DatadogAPIClient::V2::MetricTagConfigurationCreateAttributes.new } + + describe 'test an instance of MetricTagConfigurationCreateAttributes' do + it 'should create an instance of MetricTagConfigurationCreateAttributes' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricTagConfigurationCreateAttributes) + end + end + describe 'test attribute "include_percentiles"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "metric_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metric_tag_configuration_create_data_spec.rb b/spec/v2/models/metric_tag_configuration_create_data_spec.rb new file mode 100644 index 000000000000..90862d49e495 --- /dev/null +++ b/spec/v2/models/metric_tag_configuration_create_data_spec.rb @@ -0,0 +1,49 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricTagConfigurationCreateData +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricTagConfigurationCreateData do + let(:instance) { DatadogAPIClient::V2::MetricTagConfigurationCreateData.new } + + describe 'test an instance of MetricTagConfigurationCreateData' do + it 'should create an instance of MetricTagConfigurationCreateData' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricTagConfigurationCreateData) + end + end + describe 'test attribute "attributes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metric_tag_configuration_create_request_spec.rb b/spec/v2/models/metric_tag_configuration_create_request_spec.rb new file mode 100644 index 000000000000..3c1eef5c1041 --- /dev/null +++ b/spec/v2/models/metric_tag_configuration_create_request_spec.rb @@ -0,0 +1,37 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricTagConfigurationCreateRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricTagConfigurationCreateRequest do + let(:instance) { DatadogAPIClient::V2::MetricTagConfigurationCreateRequest.new } + + describe 'test an instance of MetricTagConfigurationCreateRequest' do + it 'should create an instance of MetricTagConfigurationCreateRequest' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricTagConfigurationCreateRequest) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metric_tag_configuration_metric_types_spec.rb b/spec/v2/models/metric_tag_configuration_metric_types_spec.rb new file mode 100644 index 000000000000..bed84ac89e31 --- /dev/null +++ b/spec/v2/models/metric_tag_configuration_metric_types_spec.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricTagConfigurationMetricTypes +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricTagConfigurationMetricTypes do + let(:instance) { DatadogAPIClient::V2::MetricTagConfigurationMetricTypes.new } + + describe 'test an instance of MetricTagConfigurationMetricTypes' do + it 'should create an instance of MetricTagConfigurationMetricTypes' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricTagConfigurationMetricTypes) + end + end +end diff --git a/spec/v2/models/metric_tag_configuration_response_spec.rb b/spec/v2/models/metric_tag_configuration_response_spec.rb new file mode 100644 index 000000000000..712b3f33905f --- /dev/null +++ b/spec/v2/models/metric_tag_configuration_response_spec.rb @@ -0,0 +1,37 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricTagConfigurationResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricTagConfigurationResponse do + let(:instance) { DatadogAPIClient::V2::MetricTagConfigurationResponse.new } + + describe 'test an instance of MetricTagConfigurationResponse' do + it 'should create an instance of MetricTagConfigurationResponse' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricTagConfigurationResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metric_tag_configuration_spec.rb b/spec/v2/models/metric_tag_configuration_spec.rb new file mode 100644 index 000000000000..d6b6b92461c8 --- /dev/null +++ b/spec/v2/models/metric_tag_configuration_spec.rb @@ -0,0 +1,49 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricTagConfiguration +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricTagConfiguration do + let(:instance) { DatadogAPIClient::V2::MetricTagConfiguration.new } + + describe 'test an instance of MetricTagConfiguration' do + it 'should create an instance of MetricTagConfiguration' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricTagConfiguration) + end + end + describe 'test attribute "attributes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metric_tag_configuration_type_spec.rb b/spec/v2/models/metric_tag_configuration_type_spec.rb new file mode 100644 index 000000000000..05f9457463d9 --- /dev/null +++ b/spec/v2/models/metric_tag_configuration_type_spec.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricTagConfigurationType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricTagConfigurationType do + let(:instance) { DatadogAPIClient::V2::MetricTagConfigurationType.new } + + describe 'test an instance of MetricTagConfigurationType' do + it 'should create an instance of MetricTagConfigurationType' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricTagConfigurationType) + end + end +end diff --git a/spec/v2/models/metric_tag_configuration_update_attributes_spec.rb b/spec/v2/models/metric_tag_configuration_update_attributes_spec.rb new file mode 100644 index 000000000000..04e92f8bfc70 --- /dev/null +++ b/spec/v2/models/metric_tag_configuration_update_attributes_spec.rb @@ -0,0 +1,43 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricTagConfigurationUpdateAttributes +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricTagConfigurationUpdateAttributes do + let(:instance) { DatadogAPIClient::V2::MetricTagConfigurationUpdateAttributes.new } + + describe 'test an instance of MetricTagConfigurationUpdateAttributes' do + it 'should create an instance of MetricTagConfigurationUpdateAttributes' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricTagConfigurationUpdateAttributes) + end + end + describe 'test attribute "include_percentiles"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metric_tag_configuration_update_data_spec.rb b/spec/v2/models/metric_tag_configuration_update_data_spec.rb new file mode 100644 index 000000000000..f6c24a21aebd --- /dev/null +++ b/spec/v2/models/metric_tag_configuration_update_data_spec.rb @@ -0,0 +1,49 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricTagConfigurationUpdateData +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricTagConfigurationUpdateData do + let(:instance) { DatadogAPIClient::V2::MetricTagConfigurationUpdateData.new } + + describe 'test an instance of MetricTagConfigurationUpdateData' do + it 'should create an instance of MetricTagConfigurationUpdateData' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricTagConfigurationUpdateData) + end + end + describe 'test attribute "attributes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metric_tag_configuration_update_request_spec.rb b/spec/v2/models/metric_tag_configuration_update_request_spec.rb new file mode 100644 index 000000000000..42b632d5fbea --- /dev/null +++ b/spec/v2/models/metric_tag_configuration_update_request_spec.rb @@ -0,0 +1,37 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricTagConfigurationUpdateRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricTagConfigurationUpdateRequest do + let(:instance) { DatadogAPIClient::V2::MetricTagConfigurationUpdateRequest.new } + + describe 'test an instance of MetricTagConfigurationUpdateRequest' do + it 'should create an instance of MetricTagConfigurationUpdateRequest' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricTagConfigurationUpdateRequest) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metric_type_spec.rb b/spec/v2/models/metric_type_spec.rb new file mode 100644 index 000000000000..6bd334b0136d --- /dev/null +++ b/spec/v2/models/metric_type_spec.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricType do + let(:instance) { DatadogAPIClient::V2::MetricType.new } + + describe 'test an instance of MetricType' do + it 'should create an instance of MetricType' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricType) + end + end +end diff --git a/spec/v2/models/metrics_and_metric_tag_configurations_response_spec.rb b/spec/v2/models/metrics_and_metric_tag_configurations_response_spec.rb new file mode 100644 index 000000000000..ee2ab204191e --- /dev/null +++ b/spec/v2/models/metrics_and_metric_tag_configurations_response_spec.rb @@ -0,0 +1,37 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricsAndMetricTagConfigurationsResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricsAndMetricTagConfigurationsResponse do + let(:instance) { DatadogAPIClient::V2::MetricsAndMetricTagConfigurationsResponse.new } + + describe 'test an instance of MetricsAndMetricTagConfigurationsResponse' do + it 'should create an instance of MetricsAndMetricTagConfigurationsResponse' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::MetricsAndMetricTagConfigurationsResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/v2/models/metrics_and_metric_tag_configurations_spec.rb b/spec/v2/models/metrics_and_metric_tag_configurations_spec.rb new file mode 100644 index 000000000000..9c167048d3ef --- /dev/null +++ b/spec/v2/models/metrics_and_metric_tag_configurations_spec.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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::MetricsAndMetricTagConfigurations +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::MetricsAndMetricTagConfigurations do + describe '.openapi_one_of' do + it 'lists the items referenced in the oneOf array' do + expect(described_class.openapi_one_of).to_not be_empty + end + end + + describe '.build' do + it 'returns the correct model' do + end + end +end