Skip to content

Commit d5e3ae3

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Mark Cost Attribution end_month parameter as not required (#2027)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 17306bb commit d5e3ae3

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-10-10 19:46:04.854996",
8-
"spec_repo_commit": "049920eb"
7+
"regenerated": "2024-10-16 20:07:14.122500",
8+
"spec_repo_commit": "86072741"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-10 19:46:04.873453",
13-
"spec_repo_commit": "049920eb"
12+
"regenerated": "2024-10-16 20:07:14.140655",
13+
"spec_repo_commit": "86072741"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28730,7 +28730,7 @@ paths:
2873028730
for cost ending this month.'
2873128731
in: query
2873228732
name: end_month
28733-
required: true
28733+
required: false
2873428734
schema:
2873528735
format: date-time
2873628736
type: string

examples/v2/usage-metering/GetMonthlyCostAttribution.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
config.unstable_operations["v2.get_monthly_cost_attribution".to_sym] = true
66
end
77
api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new
8-
p api_instance.get_monthly_cost_attribution((Time.now + -5 * 86400), (Time.now + -3 * 86400), "infra_host_total_cost")
8+
opts = {
9+
end_month: (Time.now + -3 * 86400),
10+
}
11+
p api_instance.get_monthly_cost_attribution((Time.now + -5 * 86400), "infra_host_total_cost", opts)

features/v2/usage_metering.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Feature: Usage Metering
1919
Given operation "GetMonthlyCostAttribution" enabled
2020
And new "GetMonthlyCostAttribution" request
2121
And request contains "start_month" parameter with value "{{ timeISO('now - 5d') }}"
22-
And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}"
2322
And request contains "fields" parameter with value "not_a_product"
23+
And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}"
2424
When the request is sent
2525
Then the response status is 400 Bad Request
2626

@@ -29,8 +29,8 @@ Feature: Usage Metering
2929
Given operation "GetMonthlyCostAttribution" enabled
3030
And new "GetMonthlyCostAttribution" request
3131
And request contains "start_month" parameter with value "{{ timeISO('now - 5d') }}"
32-
And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}"
3332
And request contains "fields" parameter with value "infra_host_total_cost"
33+
And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}"
3434
When the request is sent
3535
Then the response status is 200 OK
3636

lib/datadog_api_client/v2/api/usage_metering_api.rb

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ def get_hourly_usage_with_http_info(filter_timestamp_start, filter_product_famil
413413
# Get Monthly Cost Attribution.
414414
#
415415
# @see #get_monthly_cost_attribution_with_http_info
416-
def get_monthly_cost_attribution(start_month, end_month, fields, opts = {})
417-
data, _status_code, _headers = get_monthly_cost_attribution_with_http_info(start_month, end_month, fields, opts)
416+
def get_monthly_cost_attribution(start_month, fields, opts = {})
417+
data, _status_code, _headers = get_monthly_cost_attribution_with_http_info(start_month, fields, opts)
418418
data
419419
end
420420

@@ -438,16 +438,16 @@ def get_monthly_cost_attribution(start_month, end_month, fields, opts = {})
438438
# This endpoint is only accessible for [parent-level organizations](https://docs.datadoghq.com/account_management/multi_organization/).
439439
#
440440
# @param start_month [Time] Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost beginning in this month.
441-
# @param end_month [Time] Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost ending this month.
442441
# @param fields [String] Comma-separated list specifying cost types (e.g., `<billing_dimension>_on_demand_cost`, `<billing_dimension>_committed_cost`, `<billing_dimension>_total_cost`) and the proportions (`<billing_dimension>_percentage_in_org`, `<billing_dimension>_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 `<billing_dimension>` 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).
443442
# @param opts [Hash] the optional parameters
443+
# @option opts [Time] :end_month Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost ending this month.
444444
# @option opts [SortDirection] :sort_direction The direction to sort by: `[desc, asc]`.
445445
# @option opts [String] :sort_name The billing dimension to sort by. Always sorted by total cost. Example: `infra_host`.
446446
# @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.
447447
# @option opts [String] :next_record_id List following results with a next_record_id provided in the previous query.
448448
# @option opts [Boolean] :include_descendants Include child org cost in the response. Defaults to `true`.
449449
# @return [Array<(MonthlyCostAttributionResponse, Integer, Hash)>] MonthlyCostAttributionResponse data, response status code and response headers
450-
def get_monthly_cost_attribution_with_http_info(start_month, end_month, fields, opts = {})
450+
def get_monthly_cost_attribution_with_http_info(start_month, fields, opts = {})
451451
unstable_enabled = @api_client.config.unstable_operations["v2.get_monthly_cost_attribution".to_sym]
452452
if unstable_enabled
453453
@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,
462462
if @api_client.config.client_side_validation && start_month.nil?
463463
fail ArgumentError, "Missing the required parameter 'start_month' when calling UsageMeteringAPI.get_monthly_cost_attribution"
464464
end
465-
# verify the required parameter 'end_month' is set
466-
if @api_client.config.client_side_validation && end_month.nil?
467-
fail ArgumentError, "Missing the required parameter 'end_month' when calling UsageMeteringAPI.get_monthly_cost_attribution"
468-
end
469465
# verify the required parameter 'fields' is set
470466
if @api_client.config.client_side_validation && fields.nil?
471467
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,
480476
# query parameters
481477
query_params = opts[:query_params] || {}
482478
query_params[:'start_month'] = start_month
483-
query_params[:'end_month'] = end_month
484479
query_params[:'fields'] = fields
480+
query_params[:'end_month'] = opts[:'end_month'] if !opts[:'end_month'].nil?
485481
query_params[:'sort_direction'] = opts[:'sort_direction'] if !opts[:'sort_direction'].nil?
486482
query_params[:'sort_name'] = opts[:'sort_name'] if !opts[:'sort_name'].nil?
487483
query_params[:'tag_breakdown_keys'] = opts[:'tag_breakdown_keys'] if !opts[:'tag_breakdown_keys'].nil?

0 commit comments

Comments
 (0)