Skip to content

Mark Cost Attribution end_month parameter as not required #1834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:03.896755",
"spec_repo_commit": "049920eb"
"regenerated": "2024-10-16 20:07:12.083214",
"spec_repo_commit": "86072741"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-10 19:46:04.041839",
"spec_repo_commit": "049920eb"
"regenerated": "2024-10-16 20:07:12.101717",
"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
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
19 changes: 7 additions & 12 deletions packages/datadog-api-client-v2/apis/UsageMeteringApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ export class UsageMeteringApiRequestFactory extends BaseAPIRequestFactory {

public async getMonthlyCostAttribution(
startMonth: Date,
endMonth: Date,
fields: string,
endMonth?: Date,
sortDirection?: SortDirection,
sortName?: string,
tagBreakdownKeys?: string,
Expand All @@ -379,11 +379,6 @@ export class UsageMeteringApiRequestFactory extends BaseAPIRequestFactory {
throw new RequiredError("startMonth", "getMonthlyCostAttribution");
}

// verify required parameter 'endMonth' is not null or undefined
if (endMonth === null || endMonth === undefined) {
throw new RequiredError("endMonth", "getMonthlyCostAttribution");
}

// verify required parameter 'fields' is not null or undefined
if (fields === null || fields === undefined) {
throw new RequiredError("fields", "getMonthlyCostAttribution");
Expand Down Expand Up @@ -1420,11 +1415,6 @@ export interface UsageMeteringApiGetMonthlyCostAttributionRequest {
* @type Date
*/
startMonth: Date;
/**
* Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost ending this month.
* @type Date
*/
endMonth: Date;
/**
* 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.
Expand All @@ -1434,6 +1424,11 @@ export interface UsageMeteringApiGetMonthlyCostAttributionRequest {
* @type string
*/
fields: string;
/**
* Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost ending this month.
* @type Date
*/
endMonth?: Date;
/**
* The direction to sort by: `[desc, asc]`.
* @type SortDirection
Expand Down Expand Up @@ -1694,8 +1689,8 @@ export class UsageMeteringApi {
): Promise<MonthlyCostAttributionResponse> {
const requestContextPromise = this.requestFactory.getMonthlyCostAttribution(
param.startMonth,
param.endMonth,
param.fields,
param.endMonth,
param.sortDirection,
param.sortName,
param.tagBreakdownKeys,
Expand Down
Loading