From d5e3ae3ec46f5861e6f2b830f7d0ee825d4a3bd6 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:56:53 +0000 Subject: [PATCH] Mark Cost Attribution end_month parameter as not required (#2027) Co-authored-by: ci.datadog-api-spec --- .apigentools-info | 8 ++++---- .generator/schemas/v2/openapi.yaml | 2 +- .../v2/usage-metering/GetMonthlyCostAttribution.rb | 5 ++++- features/v2/usage_metering.feature | 4 ++-- .../v2/api/usage_metering_api.rb | 14 +++++--------- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index 4f3e3f0ea5e2..b02cfcb3623b 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-10 19:46:04.854996", - "spec_repo_commit": "049920eb" + "regenerated": "2024-10-16 20:07:14.122500", + "spec_repo_commit": "86072741" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-10 19:46:04.873453", - "spec_repo_commit": "049920eb" + "regenerated": "2024-10-16 20:07:14.140655", + "spec_repo_commit": "86072741" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c592c7ff2864..6efc200303cb 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -28730,7 +28730,7 @@ paths: for cost ending this month.' in: query name: end_month - required: true + required: false schema: format: date-time type: string diff --git a/examples/v2/usage-metering/GetMonthlyCostAttribution.rb b/examples/v2/usage-metering/GetMonthlyCostAttribution.rb index e5d51a86709d..0003ce04e25e 100644 --- a/examples/v2/usage-metering/GetMonthlyCostAttribution.rb +++ b/examples/v2/usage-metering/GetMonthlyCostAttribution.rb @@ -5,4 +5,7 @@ config.unstable_operations["v2.get_monthly_cost_attribution".to_sym] = true end api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new -p api_instance.get_monthly_cost_attribution((Time.now + -5 * 86400), (Time.now + -3 * 86400), "infra_host_total_cost") +opts = { + end_month: (Time.now + -3 * 86400), +} +p api_instance.get_monthly_cost_attribution((Time.now + -5 * 86400), "infra_host_total_cost", opts) diff --git a/features/v2/usage_metering.feature b/features/v2/usage_metering.feature index b4c81950a912..4773ad013388 100644 --- a/features/v2/usage_metering.feature +++ b/features/v2/usage_metering.feature @@ -19,8 +19,8 @@ Feature: Usage Metering Given operation "GetMonthlyCostAttribution" enabled And new "GetMonthlyCostAttribution" request And request contains "start_month" parameter with value "{{ timeISO('now - 5d') }}" - And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}" And request contains "fields" parameter with value "not_a_product" + And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}" When the request is sent Then the response status is 400 Bad Request @@ -29,8 +29,8 @@ Feature: Usage Metering Given operation "GetMonthlyCostAttribution" enabled And new "GetMonthlyCostAttribution" request And request contains "start_month" parameter with value "{{ timeISO('now - 5d') }}" - And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}" And request contains "fields" parameter with value "infra_host_total_cost" + And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}" When the request is sent Then the response status is 200 OK diff --git a/lib/datadog_api_client/v2/api/usage_metering_api.rb b/lib/datadog_api_client/v2/api/usage_metering_api.rb index 32f0e189774a..5a7b359b9baa 100644 --- a/lib/datadog_api_client/v2/api/usage_metering_api.rb +++ b/lib/datadog_api_client/v2/api/usage_metering_api.rb @@ -413,8 +413,8 @@ def get_hourly_usage_with_http_info(filter_timestamp_start, filter_product_famil # Get Monthly Cost Attribution. # # @see #get_monthly_cost_attribution_with_http_info - def get_monthly_cost_attribution(start_month, end_month, fields, opts = {}) - data, _status_code, _headers = get_monthly_cost_attribution_with_http_info(start_month, end_month, fields, opts) + def get_monthly_cost_attribution(start_month, fields, opts = {}) + data, _status_code, _headers = get_monthly_cost_attribution_with_http_info(start_month, fields, opts) data end @@ -438,16 +438,16 @@ def get_monthly_cost_attribution(start_month, end_month, fields, opts = {}) # This endpoint is only accessible for [parent-level organizations](https://docs.datadoghq.com/account_management/multi_organization/). # # @param start_month [Time] Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost beginning in this month. - # @param end_month [Time] Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost ending this month. # @param fields [String] Comma-separated list specifying cost types (e.g., `_on_demand_cost`, `_committed_cost`, `_total_cost`) and the proportions (`_percentage_in_org`, `_percentage_in_account`). Use `*` to retrieve all fields. Example: `infra_host_on_demand_cost,infra_host_percentage_in_account` To obtain the complete list of active billing dimensions that can be used to replace `` in the field names, make a request to the [Get active billing dimensions API](https://docs.datadoghq.com/api/latest/usage-metering/#get-active-billing-dimensions-for-cost-attribution). # @param opts [Hash] the optional parameters + # @option opts [Time] :end_month Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost ending this month. # @option opts [SortDirection] :sort_direction The direction to sort by: `[desc, asc]`. # @option opts [String] :sort_name The billing dimension to sort by. Always sorted by total cost. Example: `infra_host`. # @option opts [String] :tag_breakdown_keys Comma separated list of tag keys used to group cost. If no value is provided the cost will not be broken down by tags. To see which tags are available, look for the value of `tag_config_source` in the API response. # @option opts [String] :next_record_id List following results with a next_record_id provided in the previous query. # @option opts [Boolean] :include_descendants Include child org cost in the response. Defaults to `true`. # @return [Array<(MonthlyCostAttributionResponse, Integer, Hash)>] MonthlyCostAttributionResponse data, response status code and response headers - def get_monthly_cost_attribution_with_http_info(start_month, end_month, fields, opts = {}) + def get_monthly_cost_attribution_with_http_info(start_month, fields, opts = {}) unstable_enabled = @api_client.config.unstable_operations["v2.get_monthly_cost_attribution".to_sym] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_monthly_cost_attribution") @@ -462,10 +462,6 @@ def get_monthly_cost_attribution_with_http_info(start_month, end_month, fields, if @api_client.config.client_side_validation && start_month.nil? fail ArgumentError, "Missing the required parameter 'start_month' when calling UsageMeteringAPI.get_monthly_cost_attribution" end - # verify the required parameter 'end_month' is set - if @api_client.config.client_side_validation && end_month.nil? - fail ArgumentError, "Missing the required parameter 'end_month' when calling UsageMeteringAPI.get_monthly_cost_attribution" - end # verify the required parameter 'fields' is set if @api_client.config.client_side_validation && fields.nil? fail ArgumentError, "Missing the required parameter 'fields' when calling UsageMeteringAPI.get_monthly_cost_attribution" @@ -480,8 +476,8 @@ def get_monthly_cost_attribution_with_http_info(start_month, end_month, fields, # query parameters query_params = opts[:query_params] || {} query_params[:'start_month'] = start_month - query_params[:'end_month'] = end_month query_params[:'fields'] = fields + query_params[:'end_month'] = opts[:'end_month'] if !opts[:'end_month'].nil? query_params[:'sort_direction'] = opts[:'sort_direction'] if !opts[:'sort_direction'].nil? query_params[:'sort_name'] = opts[:'sort_name'] if !opts[:'sort_name'].nil? query_params[:'tag_breakdown_keys'] = opts[:'tag_breakdown_keys'] if !opts[:'tag_breakdown_keys'].nil?