Skip to content

Commit

Permalink
Mark Cost Attribution end_month parameter as not required (#2027)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Oct 17, 2024
1 parent 17306bb commit d5e3ae3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
2 changes: 1 addition & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion examples/v2/usage-metering/GetMonthlyCostAttribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions features/v2/usage_metering.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
14 changes: 5 additions & 9 deletions lib/datadog_api_client/v2/api/usage_metering_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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., `<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).
# @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")
Expand All @@ -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"
Expand All @@ -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?
Expand Down

0 comments on commit d5e3ae3

Please sign in to comment.