From e3e69534c33d48c9b14bd861c457469d48f3c121 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 9 Jul 2026 15:48:40 +0000 Subject: [PATCH] Regenerate client from commit 60cde6d of spec repo --- .generator/schemas/v2/openapi.yaml | 323 ++++++++++++++++++ .../GetAWSMetricNameFilterPreview.rb | 8 + .../PreviewAWSMetricNameFilter.rb | 24 ++ features/scenarios_model_mapping.rb | 7 + features/v2/aws_integration.feature | 43 +++ features/v2/undo.json | 12 + lib/datadog_api_client/configuration.rb | 2 + lib/datadog_api_client/inflector.rb | 14 + .../v2/api/aws_integration_api.rb | 150 ++++++++ .../aws_metric_name_filter_preview_dd_name.rb | 144 ++++++++ ...metric_name_filter_preview_filter_match.rb | 144 ++++++++ .../aws_metric_name_filter_preview_metric.rb | 146 ++++++++ ...ws_metric_name_filter_preview_namespace.rb | 170 +++++++++ .../aws_metric_name_filter_preview_request.rb | 123 +++++++ ..._name_filter_preview_request_attributes.rb | 125 +++++++ ...metric_name_filter_preview_request_data.rb | 144 ++++++++ ...aws_metric_name_filter_preview_response.rb | 123 +++++++ ...name_filter_preview_response_attributes.rb | 125 +++++++ ...etric_name_filter_preview_response_data.rb | 168 +++++++++ .../aws_metric_name_filter_preview_type.rb | 26 ++ .../v2/models/aws_metric_name_filters.rb | 64 ++++ .../aws_metric_name_filters_exclude_only.rb | 146 ++++++++ .../aws_metric_name_filters_include_only.rb | 146 ++++++++ .../v2/models/aws_metrics_config.rb | 15 +- 24 files changed, 2391 insertions(+), 1 deletion(-) create mode 100644 examples/v2/aws-integration/GetAWSMetricNameFilterPreview.rb create mode 100644 examples/v2/aws-integration/PreviewAWSMetricNameFilter.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_dd_name.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_filter_match.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_metric.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_namespace.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_type.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filters.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filters_exclude_only.rb create mode 100644 lib/datadog_api_client/v2/models/aws_metric_name_filters_include_only.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c2aa6fb6864f..6ff3d3ebfe06 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3555,6 +3555,196 @@ components: type: string x-enum-varnames: - LOGS_SERVICES + AWSMetricNameFilterPreviewDDName: + description: A Datadog metric name and whether it is filtered. + properties: + filtered: + description: Whether this Datadog metric name is filtered out. + example: true + type: boolean + name: + description: The Datadog metric name. + example: "aws.ec2.network_in" + type: string + required: + - name + - filtered + type: object + AWSMetricNameFilterPreviewFilterMatch: + description: A metric name filter pattern and how many metrics it matched. + properties: + match_count: + description: The number of Datadog metric names matched by this pattern. + example: 1 + format: int64 + type: integer + pattern: + description: The metric name filter pattern. + example: "aws.ec2.network_in" + type: string + required: + - pattern + - match_count + type: object + AWSMetricNameFilterPreviewMetric: + description: A CloudWatch metric and the Datadog metric names it produces. + properties: + cw_name: + description: The CloudWatch metric name. + example: "NetworkIn" + type: string + dd_names: + description: The Datadog metric names produced from this CloudWatch metric. + items: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewDDName" + type: array + required: + - cw_name + - dd_names + type: object + AWSMetricNameFilterPreviewNamespace: + description: The metric name filter preview for a single namespace. + properties: + filters: + description: The metric name filter patterns evaluated for this namespace and how many metrics they matched. + items: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewFilterMatch" + type: array + metrics: + description: |- + The CloudWatch metrics collected for this namespace and whether each resulting + Datadog metric is filtered. + items: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewMetric" + type: array + namespace: + description: The AWS CloudWatch namespace. + example: "AWS/EC2" + type: string + required: + - namespace + - filters + - metrics + type: object + AWSMetricNameFilterPreviewRequest: + description: AWS metric name filter preview request body. + properties: + data: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewRequestData" + required: + - data + type: object + AWSMetricNameFilterPreviewRequestAttributes: + description: AWS metric name filter preview request attributes. + properties: + metric_name_filters: + description: The metric name filters to preview. + items: + $ref: "#/components/schemas/AWSMetricNameFilters" + type: array + required: + - metric_name_filters + type: object + AWSMetricNameFilterPreviewRequestData: + description: AWS metric name filter preview request data. + properties: + attributes: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewRequestAttributes" + type: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewType" + required: + - type + - attributes + type: object + AWSMetricNameFilterPreviewResponse: + description: AWS metric name filter preview response body. + properties: + data: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewResponseData" + required: + - data + type: object + AWSMetricNameFilterPreviewResponseAttributes: + description: AWS metric name filter preview response attributes. + properties: + namespaces: + description: The list of namespaces affected by the previewed metric name filters. + items: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewNamespace" + type: array + required: + - namespaces + type: object + AWSMetricNameFilterPreviewResponseData: + description: AWS metric name filter preview response data. + properties: + attributes: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewResponseAttributes" + id: + $ref: "#/components/schemas/AWSAccountConfigID" + type: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewType" + required: + - id + - type + - attributes + type: object + AWSMetricNameFilterPreviewType: + default: "metric_name_filter_preview" + description: The `AWSMetricNameFilterPreviewResponseData` `type`. + enum: + - metric_name_filter_preview + example: "metric_name_filter_preview" + type: string + x-enum-varnames: + - METRIC_NAME_FILTER_PREVIEW + AWSMetricNameFilters: + description: |- + AWS CloudWatch metric name filter for a single namespace. + Exactly one of `include_only` or `exclude_only` must be set. + oneOf: + - $ref: "#/components/schemas/AWSMetricNameFiltersIncludeOnly" + - $ref: "#/components/schemas/AWSMetricNameFiltersExcludeOnly" + AWSMetricNameFiltersExcludeOnly: + description: Exclude metric names matching one of these patterns for a single namespace. + properties: + exclude_only: + description: Exclude metric names matching one of these patterns. + example: + - "aws.ec2.network_in" + items: + description: A metric name pattern to exclude. + example: "aws.ec2.network_in" + type: string + type: array + namespace: + description: The AWS CloudWatch namespace to which this metric name filter applies. + example: "AWS/EC2" + type: string + required: + - namespace + - exclude_only + type: object + AWSMetricNameFiltersIncludeOnly: + description: Include only metric names matching one of these patterns for a single namespace. + properties: + include_only: + description: Include only metric names matching one of these patterns. + example: + - "aws.ec2.network_in" + items: + description: A metric name pattern to include. + example: "aws.ec2.network_in" + type: string + type: array + namespace: + description: The AWS CloudWatch namespace to which this metric name filter applies. + example: "AWS/EC2" + type: string + required: + - namespace + - include_only + type: object AWSMetricsConfig: description: AWS Metrics Collection config. properties: @@ -3574,6 +3764,13 @@ components: description: Enable AWS metrics collection. Defaults to `true`. example: true type: boolean + metric_name_filters: + description: |- + AWS CloudWatch metric name filters. Each filter applies to a single namespace. + Exactly one of `include_only` or `exclude_only` must be set on each filter. + items: + $ref: "#/components/schemas/AWSMetricNameFilters" + type: array namespace_filters: $ref: "#/components/schemas/AWSNamespaceFilters" tag_filters: @@ -141429,6 +141626,10 @@ paths: collect_cloudwatch_alarms: false collect_custom_metrics: false enabled: true + metric_name_filters: + - include_only: + - aws.ec2.network_in + namespace: AWS/EC2 tag_filters: - namespace: AWS/EC2 resources_config: @@ -141567,6 +141768,10 @@ paths: collect_cloudwatch_alarms: false collect_custom_metrics: false enabled: true + metric_name_filters: + - include_only: + - aws.ec2.network_in + namespace: AWS/EC2 tag_filters: - namespace: AWS/EC2 resources_config: @@ -141811,6 +142016,124 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and may be subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview: + get: + description: |- + Preview which collected CloudWatch metrics would be filtered by the account's saved metric name filters. + operationId: GetAWSMetricNameFilterPreview + parameters: + - $ref: "#/components/parameters/AWSAccountConfigIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + namespaces: + - filters: + - match_count: 1 + pattern: "aws.ec2.network_in" + metrics: + - cw_name: "NetworkIn" + dd_names: + - filtered: true + name: "aws.ec2.network_in" + namespace: "AWS/EC2" + id: "00000000-0000-0000-0000-000000000001" + type: metric_name_filter_preview + schema: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewResponse" + description: AWS metric name filter preview result + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get AWS metric name filter preview + tags: + - AWS Integration + "x-permission": + operator: OR + permissions: + - aws_configuration_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: |- + Preview which collected CloudWatch metrics would be filtered by the supplied metric name filters. + The filters are not persisted. + operationId: PreviewAWSMetricNameFilter + parameters: + - $ref: "#/components/parameters/AWSAccountConfigIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + metric_name_filters: + - exclude_only: + - "aws.ec2.network_in" + namespace: "AWS/EC2" + type: metric_name_filter_preview + schema: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewRequest" + description: The metric name filters to preview. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + namespaces: + - filters: + - match_count: 1 + pattern: "aws.ec2.network_in" + metrics: + - cw_name: "NetworkIn" + dd_names: + - filtered: true + name: "aws.ec2.network_in" + namespace: "AWS/EC2" + id: "00000000-0000-0000-0000-000000000001" + type: metric_name_filter_preview + schema: + $ref: "#/components/schemas/AWSMetricNameFilterPreviewResponse" + description: AWS metric name filter preview result + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Preview AWS metric name filter + tags: + - AWS Integration + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - aws_configuration_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/integration/aws/available_namespaces: get: description: Get a list of available AWS CloudWatch namespaces that can send metrics to Datadog. diff --git a/examples/v2/aws-integration/GetAWSMetricNameFilterPreview.rb b/examples/v2/aws-integration/GetAWSMetricNameFilterPreview.rb new file mode 100644 index 000000000000..f9e31c87a762 --- /dev/null +++ b/examples/v2/aws-integration/GetAWSMetricNameFilterPreview.rb @@ -0,0 +1,8 @@ +# Get AWS metric name filter preview returns "AWS metric name filter preview result" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_aws_metric_name_filter_preview".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AWSIntegrationAPI.new +p api_instance.get_aws_metric_name_filter_preview("aws_account_config_id") diff --git a/examples/v2/aws-integration/PreviewAWSMetricNameFilter.rb b/examples/v2/aws-integration/PreviewAWSMetricNameFilter.rb new file mode 100644 index 000000000000..cf9cdedc6895 --- /dev/null +++ b/examples/v2/aws-integration/PreviewAWSMetricNameFilter.rb @@ -0,0 +1,24 @@ +# Preview AWS metric name filter returns "AWS metric name filter preview result" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.preview_aws_metric_name_filter".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AWSIntegrationAPI.new + +body = DatadogAPIClient::V2::AWSMetricNameFilterPreviewRequest.new({ + data: DatadogAPIClient::V2::AWSMetricNameFilterPreviewRequestData.new({ + attributes: DatadogAPIClient::V2::AWSMetricNameFilterPreviewRequestAttributes.new({ + metric_name_filters: [ + DatadogAPIClient::V2::AWSMetricNameFiltersIncludeOnly.new({ + include_only: [ + "aws.ec2.network_in", + ], + namespace: "AWS/EC2", + }), + ], + }), + type: DatadogAPIClient::V2::AWSMetricNameFilterPreviewType::METRIC_NAME_FILTER_PREVIEW, + }), +}) +p api_instance.preview_aws_metric_name_filter("aws_account_config_id", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index f4cb633ab3a6..8726846681a9 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3680,6 +3680,13 @@ "aws_account_config_id" => "String", "body" => "AWSCcmConfigRequest", }, + "v2.GetAWSMetricNameFilterPreview" => { + "aws_account_config_id" => "String", + }, + "v2.PreviewAWSMetricNameFilter" => { + "aws_account_config_id" => "String", + "body" => "AWSMetricNameFilterPreviewRequest", + }, "v2.DeleteAWSEventBridgeSource" => { "body" => "AWSEventBridgeDeleteRequest", }, diff --git a/features/v2/aws_integration.feature b/features/v2/aws_integration.feature index dac51bb7449c..8d91676e64bb 100644 --- a/features/v2/aws_integration.feature +++ b/features/v2/aws_integration.feature @@ -185,6 +185,22 @@ Feature: AWS Integration When the request is sent Then the response status is 200 AWS integration standard IAM permissions. + @generated @skip @team:DataDog/aws-integrations + Scenario: Get AWS metric name filter preview returns "AWS metric name filter preview result" response + Given operation "GetAWSMetricNameFilterPreview" enabled + And new "GetAWSMetricNameFilterPreview" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 AWS metric name filter preview result + + @generated @skip @team:DataDog/aws-integrations + Scenario: Get AWS metric name filter preview returns "Not Found" response + Given operation "GetAWSMetricNameFilterPreview" enabled + And new "GetAWSMetricNameFilterPreview" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/aws-integrations Scenario: Get all Amazon EventBridge sources returns "Amazon EventBridge sources list." response Given new "ListAWSEventBridgeSources" request @@ -249,6 +265,33 @@ Feature: AWS Integration When the request is sent Then the response status is 200 AWS Namespaces List object + @generated @skip @team:DataDog/aws-integrations + Scenario: Preview AWS metric name filter returns "AWS metric name filter preview result" response + Given operation "PreviewAWSMetricNameFilter" enabled + And new "PreviewAWSMetricNameFilter" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"metric_name_filters": [{"include_only": ["aws.ec2.network_in"], "namespace": "AWS/EC2"}]}, "type": "metric_name_filter_preview"}} + When the request is sent + Then the response status is 200 AWS metric name filter preview result + + @generated @skip @team:DataDog/aws-integrations + Scenario: Preview AWS metric name filter returns "Bad Request" response + Given operation "PreviewAWSMetricNameFilter" enabled + And new "PreviewAWSMetricNameFilter" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"metric_name_filters": [{"include_only": ["aws.ec2.network_in"], "namespace": "AWS/EC2"}]}, "type": "metric_name_filter_preview"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aws-integrations + Scenario: Preview AWS metric name filter returns "Not Found" response + Given operation "PreviewAWSMetricNameFilter" enabled + And new "PreviewAWSMetricNameFilter" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"metric_name_filters": [{"include_only": ["aws.ec2.network_in"], "namespace": "AWS/EC2"}]}, "type": "metric_name_filter_preview"}} + When the request is sent + Then the response status is 404 Not Found + @skip @team:DataDog/aws-integrations Scenario: Update AWS CCM config returns "AWS CCM Config object" response Given operation "UpdateAWSAccountCCMConfig" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index 1eaba52ee9bf..22089f0ecea4 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -3363,6 +3363,18 @@ "type": "unsafe" } }, + "GetAWSMetricNameFilterPreview": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "PreviewAWSMetricNameFilter": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, "ListAWSNamespaces": { "tag": "AWS Integration", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 5b2130e9913c..d01dd48cae74 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -557,6 +557,8 @@ def initialize "v2.create_aws_account_ccm_config": false, "v2.delete_aws_account_ccm_config": false, "v2.get_aws_account_ccm_config": false, + "v2.get_aws_metric_name_filter_preview": false, + "v2.preview_aws_metric_name_filter": false, "v2.update_aws_account_ccm_config": false, "v2.validate_awsccm_config": false, "v2.create_jira_issue_template": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index bb489f2e6b16..26d9c514205b 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1701,6 +1701,20 @@ def overrides "v2.aws_logs_services_response_attributes" => "AWSLogsServicesResponseAttributes", "v2.aws_logs_services_response_data" => "AWSLogsServicesResponseData", "v2.aws_logs_services_response_data_type" => "AWSLogsServicesResponseDataType", + "v2.aws_metric_name_filter_preview_dd_name" => "AWSMetricNameFilterPreviewDDName", + "v2.aws_metric_name_filter_preview_filter_match" => "AWSMetricNameFilterPreviewFilterMatch", + "v2.aws_metric_name_filter_preview_metric" => "AWSMetricNameFilterPreviewMetric", + "v2.aws_metric_name_filter_preview_namespace" => "AWSMetricNameFilterPreviewNamespace", + "v2.aws_metric_name_filter_preview_request" => "AWSMetricNameFilterPreviewRequest", + "v2.aws_metric_name_filter_preview_request_attributes" => "AWSMetricNameFilterPreviewRequestAttributes", + "v2.aws_metric_name_filter_preview_request_data" => "AWSMetricNameFilterPreviewRequestData", + "v2.aws_metric_name_filter_preview_response" => "AWSMetricNameFilterPreviewResponse", + "v2.aws_metric_name_filter_preview_response_attributes" => "AWSMetricNameFilterPreviewResponseAttributes", + "v2.aws_metric_name_filter_preview_response_data" => "AWSMetricNameFilterPreviewResponseData", + "v2.aws_metric_name_filter_preview_type" => "AWSMetricNameFilterPreviewType", + "v2.aws_metric_name_filters" => "AWSMetricNameFilters", + "v2.aws_metric_name_filters_exclude_only" => "AWSMetricNameFiltersExcludeOnly", + "v2.aws_metric_name_filters_include_only" => "AWSMetricNameFiltersIncludeOnly", "v2.aws_metrics_config" => "AWSMetricsConfig", "v2.aws_namespace_filters" => "AWSNamespaceFilters", "v2.aws_namespace_filters_exclude_only" => "AWSNamespaceFiltersExcludeOnly", diff --git a/lib/datadog_api_client/v2/api/aws_integration_api.rb b/lib/datadog_api_client/v2/api/aws_integration_api.rb index f61a84388f84..02a15f9149ac 100644 --- a/lib/datadog_api_client/v2/api/aws_integration_api.rb +++ b/lib/datadog_api_client/v2/api/aws_integration_api.rb @@ -817,6 +817,77 @@ def get_aws_integration_iam_permissions_standard_with_http_info(opts = {}) return data, status_code, headers end + # Get AWS metric name filter preview. + # + # @see #get_aws_metric_name_filter_preview_with_http_info + def get_aws_metric_name_filter_preview(aws_account_config_id, opts = {}) + data, _status_code, _headers = get_aws_metric_name_filter_preview_with_http_info(aws_account_config_id, opts) + data + end + + # Get AWS metric name filter preview. + # + # Preview which collected CloudWatch metrics would be filtered by the account's saved metric name filters. + # + # @param aws_account_config_id [String] Unique Datadog ID of the AWS Account Integration Config. To get the config ID for an account, use the [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration/#list-all-aws-integrations) endpoint and query by AWS Account ID. + # @param opts [Hash] the optional parameters + # @return [Array<(AWSMetricNameFilterPreviewResponse, Integer, Hash)>] AWSMetricNameFilterPreviewResponse data, response status code and response headers + def get_aws_metric_name_filter_preview_with_http_info(aws_account_config_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_aws_metric_name_filter_preview".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_aws_metric_name_filter_preview") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_aws_metric_name_filter_preview")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.get_aws_metric_name_filter_preview ...' + end + # verify the required parameter 'aws_account_config_id' is set + if @api_client.config.client_side_validation && aws_account_config_id.nil? + fail ArgumentError, "Missing the required parameter 'aws_account_config_id' when calling AWSIntegrationAPI.get_aws_metric_name_filter_preview" + end + # resource path + local_var_path = '/api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview'.sub('{aws_account_config_id}', CGI.escape(aws_account_config_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AWSMetricNameFilterPreviewResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_aws_metric_name_filter_preview, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AWSIntegrationAPI#get_aws_metric_name_filter_preview\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List all AWS integrations. # # @see #list_aws_accounts_with_http_info @@ -999,6 +1070,85 @@ def list_aws_namespaces_with_http_info(opts = {}) return data, status_code, headers end + # Preview AWS metric name filter. + # + # @see #preview_aws_metric_name_filter_with_http_info + def preview_aws_metric_name_filter(aws_account_config_id, body, opts = {}) + data, _status_code, _headers = preview_aws_metric_name_filter_with_http_info(aws_account_config_id, body, opts) + data + end + + # Preview AWS metric name filter. + # + # Preview which collected CloudWatch metrics would be filtered by the supplied metric name filters. + # The filters are not persisted. + # + # @param aws_account_config_id [String] Unique Datadog ID of the AWS Account Integration Config. To get the config ID for an account, use the [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration/#list-all-aws-integrations) endpoint and query by AWS Account ID. + # @param body [AWSMetricNameFilterPreviewRequest] The metric name filters to preview. + # @param opts [Hash] the optional parameters + # @return [Array<(AWSMetricNameFilterPreviewResponse, Integer, Hash)>] AWSMetricNameFilterPreviewResponse data, response status code and response headers + def preview_aws_metric_name_filter_with_http_info(aws_account_config_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.preview_aws_metric_name_filter".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.preview_aws_metric_name_filter") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.preview_aws_metric_name_filter")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.preview_aws_metric_name_filter ...' + end + # verify the required parameter 'aws_account_config_id' is set + if @api_client.config.client_side_validation && aws_account_config_id.nil? + fail ArgumentError, "Missing the required parameter 'aws_account_config_id' when calling AWSIntegrationAPI.preview_aws_metric_name_filter" + 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 AWSIntegrationAPI.preview_aws_metric_name_filter" + end + # resource path + local_var_path = '/api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview'.sub('{aws_account_config_id}', CGI.escape(aws_account_config_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'AWSMetricNameFilterPreviewResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :preview_aws_metric_name_filter, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AWSIntegrationAPI#preview_aws_metric_name_filter\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update an AWS integration. # # @see #update_aws_account_with_http_info diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_dd_name.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_dd_name.rb new file mode 100644 index 000000000000..5edfc4e09a9a --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_dd_name.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A Datadog metric name and whether it is filtered. + class AWSMetricNameFilterPreviewDDName + include BaseGenericModel + + # Whether this Datadog metric name is filtered out. + attr_reader :filtered + + # The Datadog metric name. + attr_reader :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'filtered' => :'filtered', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'filtered' => :'Boolean', + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFilterPreviewDDName` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'filtered') + self.filtered = attributes[:'filtered'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @filtered.nil? + return false if @name.nil? + true + end + + # Custom attribute writer method with validation + # @param filtered [Object] Object to be assigned + # @!visibility private + def filtered=(filtered) + if filtered.nil? + fail ArgumentError, 'invalid value for "filtered", filtered cannot be nil.' + end + @filtered = filtered + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + filtered == o.filtered && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [filtered, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_filter_match.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_filter_match.rb new file mode 100644 index 000000000000..8b5ac510686e --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_filter_match.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A metric name filter pattern and how many metrics it matched. + class AWSMetricNameFilterPreviewFilterMatch + include BaseGenericModel + + # The number of Datadog metric names matched by this pattern. + attr_reader :match_count + + # The metric name filter pattern. + attr_reader :pattern + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'match_count' => :'match_count', + :'pattern' => :'pattern' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'match_count' => :'Integer', + :'pattern' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFilterPreviewFilterMatch` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'match_count') + self.match_count = attributes[:'match_count'] + end + + if attributes.key?(:'pattern') + self.pattern = attributes[:'pattern'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @match_count.nil? + return false if @pattern.nil? + true + end + + # Custom attribute writer method with validation + # @param match_count [Object] Object to be assigned + # @!visibility private + def match_count=(match_count) + if match_count.nil? + fail ArgumentError, 'invalid value for "match_count", match_count cannot be nil.' + end + @match_count = match_count + end + + # Custom attribute writer method with validation + # @param pattern [Object] Object to be assigned + # @!visibility private + def pattern=(pattern) + if pattern.nil? + fail ArgumentError, 'invalid value for "pattern", pattern cannot be nil.' + end + @pattern = pattern + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + match_count == o.match_count && + pattern == o.pattern && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [match_count, pattern, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_metric.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_metric.rb new file mode 100644 index 000000000000..2dd63f5a468c --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_metric.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A CloudWatch metric and the Datadog metric names it produces. + class AWSMetricNameFilterPreviewMetric + include BaseGenericModel + + # The CloudWatch metric name. + attr_reader :cw_name + + # The Datadog metric names produced from this CloudWatch metric. + attr_reader :dd_names + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'cw_name' => :'cw_name', + :'dd_names' => :'dd_names' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'cw_name' => :'String', + :'dd_names' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFilterPreviewMetric` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'cw_name') + self.cw_name = attributes[:'cw_name'] + end + + if attributes.key?(:'dd_names') + if (value = attributes[:'dd_names']).is_a?(Array) + self.dd_names = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @cw_name.nil? + return false if @dd_names.nil? + true + end + + # Custom attribute writer method with validation + # @param cw_name [Object] Object to be assigned + # @!visibility private + def cw_name=(cw_name) + if cw_name.nil? + fail ArgumentError, 'invalid value for "cw_name", cw_name cannot be nil.' + end + @cw_name = cw_name + end + + # Custom attribute writer method with validation + # @param dd_names [Object] Object to be assigned + # @!visibility private + def dd_names=(dd_names) + if dd_names.nil? + fail ArgumentError, 'invalid value for "dd_names", dd_names cannot be nil.' + end + @dd_names = dd_names + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + cw_name == o.cw_name && + dd_names == o.dd_names && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [cw_name, dd_names, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_namespace.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_namespace.rb new file mode 100644 index 000000000000..b2cc5b810728 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_namespace.rb @@ -0,0 +1,170 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The metric name filter preview for a single namespace. + class AWSMetricNameFilterPreviewNamespace + include BaseGenericModel + + # The metric name filter patterns evaluated for this namespace and how many metrics they matched. + attr_reader :filters + + # The CloudWatch metrics collected for this namespace and whether each resulting + # Datadog metric is filtered. + attr_reader :metrics + + # The AWS CloudWatch namespace. + attr_reader :namespace + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'filters' => :'filters', + :'metrics' => :'metrics', + :'namespace' => :'namespace' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'filters' => :'Array', + :'metrics' => :'Array', + :'namespace' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFilterPreviewNamespace` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'filters') + if (value = attributes[:'filters']).is_a?(Array) + self.filters = value + end + end + + if attributes.key?(:'metrics') + if (value = attributes[:'metrics']).is_a?(Array) + self.metrics = value + end + end + + if attributes.key?(:'namespace') + self.namespace = attributes[:'namespace'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @filters.nil? + return false if @metrics.nil? + return false if @namespace.nil? + true + end + + # Custom attribute writer method with validation + # @param filters [Object] Object to be assigned + # @!visibility private + def filters=(filters) + if filters.nil? + fail ArgumentError, 'invalid value for "filters", filters cannot be nil.' + end + @filters = filters + end + + # Custom attribute writer method with validation + # @param metrics [Object] Object to be assigned + # @!visibility private + def metrics=(metrics) + if metrics.nil? + fail ArgumentError, 'invalid value for "metrics", metrics cannot be nil.' + end + @metrics = metrics + end + + # Custom attribute writer method with validation + # @param namespace [Object] Object to be assigned + # @!visibility private + def namespace=(namespace) + if namespace.nil? + fail ArgumentError, 'invalid value for "namespace", namespace cannot be nil.' + end + @namespace = namespace + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + filters == o.filters && + metrics == o.metrics && + namespace == o.namespace && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [filters, metrics, namespace, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request.rb new file mode 100644 index 000000000000..9d6f0b65ac0b --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # AWS metric name filter preview request body. + class AWSMetricNameFilterPreviewRequest + include BaseGenericModel + + # AWS metric name filter preview request data. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AWSMetricNameFilterPreviewRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFilterPreviewRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request_attributes.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request_attributes.rb new file mode 100644 index 000000000000..ca2b6f216668 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request_attributes.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # AWS metric name filter preview request attributes. + class AWSMetricNameFilterPreviewRequestAttributes + include BaseGenericModel + + # The metric name filters to preview. + attr_reader :metric_name_filters + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'metric_name_filters' => :'metric_name_filters' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'metric_name_filters' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFilterPreviewRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'metric_name_filters') + if (value = attributes[:'metric_name_filters']).is_a?(Array) + self.metric_name_filters = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @metric_name_filters.nil? + true + end + + # Custom attribute writer method with validation + # @param metric_name_filters [Object] Object to be assigned + # @!visibility private + def metric_name_filters=(metric_name_filters) + if metric_name_filters.nil? + fail ArgumentError, 'invalid value for "metric_name_filters", metric_name_filters cannot be nil.' + end + @metric_name_filters = metric_name_filters + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metric_name_filters == o.metric_name_filters && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [metric_name_filters, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request_data.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request_data.rb new file mode 100644 index 000000000000..5b72bab39928 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # AWS metric name filter preview request data. + class AWSMetricNameFilterPreviewRequestData + include BaseGenericModel + + # AWS metric name filter preview request attributes. + attr_reader :attributes + + # The `AWSMetricNameFilterPreviewResponseData` `type`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AWSMetricNameFilterPreviewRequestAttributes', + :'type' => :'AWSMetricNameFilterPreviewType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFilterPreviewRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response.rb new file mode 100644 index 000000000000..acecaf87ff34 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # AWS metric name filter preview response body. + class AWSMetricNameFilterPreviewResponse + include BaseGenericModel + + # AWS metric name filter preview response data. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AWSMetricNameFilterPreviewResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFilterPreviewResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response_attributes.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response_attributes.rb new file mode 100644 index 000000000000..e4ae5d40519f --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response_attributes.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # AWS metric name filter preview response attributes. + class AWSMetricNameFilterPreviewResponseAttributes + include BaseGenericModel + + # The list of namespaces affected by the previewed metric name filters. + attr_reader :namespaces + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'namespaces' => :'namespaces' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'namespaces' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFilterPreviewResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'namespaces') + if (value = attributes[:'namespaces']).is_a?(Array) + self.namespaces = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @namespaces.nil? + true + end + + # Custom attribute writer method with validation + # @param namespaces [Object] Object to be assigned + # @!visibility private + def namespaces=(namespaces) + if namespaces.nil? + fail ArgumentError, 'invalid value for "namespaces", namespaces cannot be nil.' + end + @namespaces = namespaces + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + namespaces == o.namespaces && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [namespaces, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response_data.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response_data.rb new file mode 100644 index 000000000000..6246c87c12d5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_response_data.rb @@ -0,0 +1,168 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # AWS metric name filter preview response data. + class AWSMetricNameFilterPreviewResponseData + include BaseGenericModel + + # AWS metric name filter preview response attributes. + attr_reader :attributes + + # Unique Datadog ID of the AWS Account Integration Config. + # To get the config ID for an account, use the + # [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration/#list-all-aws-integrations) + # endpoint and query by AWS Account ID. + attr_reader :id + + # The `AWSMetricNameFilterPreviewResponseData` `type`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AWSMetricNameFilterPreviewResponseAttributes', + :'id' => :'String', + :'type' => :'AWSMetricNameFilterPreviewType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFilterPreviewResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_type.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_type.rb new file mode 100644 index 000000000000..5f0a68500bb0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filter_preview_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The `AWSMetricNameFilterPreviewResponseData` `type`. + class AWSMetricNameFilterPreviewType + include BaseEnumModel + + METRIC_NAME_FILTER_PREVIEW = "metric_name_filter_preview".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filters.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filters.rb new file mode 100644 index 000000000000..9116279bcb83 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filters.rb @@ -0,0 +1,64 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # AWS CloudWatch metric name filter for a single namespace. + # Exactly one of `include_only` or `exclude_only` must be set. + module AWSMetricNameFilters + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'AWSMetricNameFiltersIncludeOnly', + :'AWSMetricNameFiltersExcludeOnly' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filters_exclude_only.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filters_exclude_only.rb new file mode 100644 index 000000000000..196adc766120 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filters_exclude_only.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Exclude metric names matching one of these patterns for a single namespace. + class AWSMetricNameFiltersExcludeOnly + include BaseGenericModel + + # Exclude metric names matching one of these patterns. + attr_reader :exclude_only + + # The AWS CloudWatch namespace to which this metric name filter applies. + attr_reader :namespace + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'exclude_only' => :'exclude_only', + :'namespace' => :'namespace' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'exclude_only' => :'Array', + :'namespace' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFiltersExcludeOnly` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'exclude_only') + if (value = attributes[:'exclude_only']).is_a?(Array) + self.exclude_only = value + end + end + + if attributes.key?(:'namespace') + self.namespace = attributes[:'namespace'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @exclude_only.nil? + return false if @namespace.nil? + true + end + + # Custom attribute writer method with validation + # @param exclude_only [Object] Object to be assigned + # @!visibility private + def exclude_only=(exclude_only) + if exclude_only.nil? + fail ArgumentError, 'invalid value for "exclude_only", exclude_only cannot be nil.' + end + @exclude_only = exclude_only + end + + # Custom attribute writer method with validation + # @param namespace [Object] Object to be assigned + # @!visibility private + def namespace=(namespace) + if namespace.nil? + fail ArgumentError, 'invalid value for "namespace", namespace cannot be nil.' + end + @namespace = namespace + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + exclude_only == o.exclude_only && + namespace == o.namespace && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [exclude_only, namespace, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metric_name_filters_include_only.rb b/lib/datadog_api_client/v2/models/aws_metric_name_filters_include_only.rb new file mode 100644 index 000000000000..9183c4c37aea --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_metric_name_filters_include_only.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Include only metric names matching one of these patterns for a single namespace. + class AWSMetricNameFiltersIncludeOnly + include BaseGenericModel + + # Include only metric names matching one of these patterns. + attr_reader :include_only + + # The AWS CloudWatch namespace to which this metric name filter applies. + attr_reader :namespace + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'include_only' => :'include_only', + :'namespace' => :'namespace' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'include_only' => :'Array', + :'namespace' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AWSMetricNameFiltersIncludeOnly` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'include_only') + if (value = attributes[:'include_only']).is_a?(Array) + self.include_only = value + end + end + + if attributes.key?(:'namespace') + self.namespace = attributes[:'namespace'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @include_only.nil? + return false if @namespace.nil? + true + end + + # Custom attribute writer method with validation + # @param include_only [Object] Object to be assigned + # @!visibility private + def include_only=(include_only) + if include_only.nil? + fail ArgumentError, 'invalid value for "include_only", include_only cannot be nil.' + end + @include_only = include_only + end + + # Custom attribute writer method with validation + # @param namespace [Object] Object to be assigned + # @!visibility private + def namespace=(namespace) + if namespace.nil? + fail ArgumentError, 'invalid value for "namespace", namespace cannot be nil.' + end + @namespace = namespace + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + include_only == o.include_only && + namespace == o.namespace && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [include_only, namespace, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_metrics_config.rb b/lib/datadog_api_client/v2/models/aws_metrics_config.rb index bc319fa2b4b4..abbeacecfed5 100644 --- a/lib/datadog_api_client/v2/models/aws_metrics_config.rb +++ b/lib/datadog_api_client/v2/models/aws_metrics_config.rb @@ -33,6 +33,10 @@ class AWSMetricsConfig # Enable AWS metrics collection. Defaults to `true`. attr_accessor :enabled + # AWS CloudWatch metric name filters. Each filter applies to a single namespace. + # Exactly one of `include_only` or `exclude_only` must be set on each filter. + attr_accessor :metric_name_filters + # AWS Metrics namespace filters. Defaults to `exclude_only`. attr_accessor :namespace_filters @@ -49,6 +53,7 @@ def self.attribute_map :'collect_cloudwatch_alarms' => :'collect_cloudwatch_alarms', :'collect_custom_metrics' => :'collect_custom_metrics', :'enabled' => :'enabled', + :'metric_name_filters' => :'metric_name_filters', :'namespace_filters' => :'namespace_filters', :'tag_filters' => :'tag_filters' } @@ -62,6 +67,7 @@ def self.openapi_types :'collect_cloudwatch_alarms' => :'Boolean', :'collect_custom_metrics' => :'Boolean', :'enabled' => :'Boolean', + :'metric_name_filters' => :'Array', :'namespace_filters' => :'AWSNamespaceFilters', :'tag_filters' => :'Array' } @@ -101,6 +107,12 @@ def initialize(attributes = {}) self.enabled = attributes[:'enabled'] end + if attributes.key?(:'metric_name_filters') + if (value = attributes[:'metric_name_filters']).is_a?(Array) + self.metric_name_filters = value + end + end + if attributes.key?(:'namespace_filters') self.namespace_filters = attributes[:'namespace_filters'] end @@ -142,6 +154,7 @@ def ==(o) collect_cloudwatch_alarms == o.collect_cloudwatch_alarms && collect_custom_metrics == o.collect_custom_metrics && enabled == o.enabled && + metric_name_filters == o.metric_name_filters && namespace_filters == o.namespace_filters && tag_filters == o.tag_filters && additional_properties == o.additional_properties @@ -151,7 +164,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [automute_enabled, collect_cloudwatch_alarms, collect_custom_metrics, enabled, namespace_filters, tag_filters, additional_properties].hash + [automute_enabled, collect_cloudwatch_alarms, collect_custom_metrics, enabled, metric_name_filters, namespace_filters, tag_filters, additional_properties].hash end end end