Skip to content

Commit 7690fdc

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add cost_aggregation parameter to GetEstimatedCostByOrg (#3862)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 9ad09ed commit 7690fdc

3 files changed

Lines changed: 87 additions & 0 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13902,6 +13902,13 @@ components:
1390213902
data:
1390313903
$ref: "#/components/schemas/ConvertJobResultsToSignalsData"
1390413904
type: object
13905+
CostAggregationType:
13906+
description: "Controls how costs are aggregated when using `start_date`. The `cumulative` option returns month-to-date running totals."
13907+
enum:
13908+
- cumulative
13909+
type: string
13910+
x-enum-varnames:
13911+
- CUMULATIVE
1390513912
CostAttributionAggregates:
1390613913
description: An array of available aggregates.
1390713914
items:
@@ -108698,6 +108705,12 @@ paths:
108698108705
schema:
108699108706
format: date-time
108700108707
type: string
108708+
- description: "Controls how costs are aggregated when using `start_date`. The `cumulative` option returns month-to-date running totals."
108709+
in: query
108710+
name: cost_aggregation
108711+
required: false
108712+
schema:
108713+
$ref: "#/components/schemas/CostAggregationType"
108701108714
- description: "Boolean to specify whether to include accounts connected to the current account as partner customers in the Datadog partner network program. Defaults to `false`."
108702108715
in: query
108703108716
name: include_connected_accounts

api/datadogV2/api_usage_metering.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ type GetEstimatedCostByOrgOptionalParameters struct {
332332
EndMonth *time.Time
333333
StartDate *time.Time
334334
EndDate *time.Time
335+
CostAggregation *CostAggregationType
335336
IncludeConnectedAccounts *bool
336337
}
337338

@@ -371,6 +372,12 @@ func (r *GetEstimatedCostByOrgOptionalParameters) WithEndDate(endDate time.Time)
371372
return r
372373
}
373374

375+
// WithCostAggregation sets the corresponding parameter name and returns the struct.
376+
func (r *GetEstimatedCostByOrgOptionalParameters) WithCostAggregation(costAggregation CostAggregationType) *GetEstimatedCostByOrgOptionalParameters {
377+
r.CostAggregation = &costAggregation
378+
return r
379+
}
380+
374381
// WithIncludeConnectedAccounts sets the corresponding parameter name and returns the struct.
375382
func (r *GetEstimatedCostByOrgOptionalParameters) WithIncludeConnectedAccounts(includeConnectedAccounts bool) *GetEstimatedCostByOrgOptionalParameters {
376383
r.IncludeConnectedAccounts = &includeConnectedAccounts
@@ -424,6 +431,9 @@ func (a *UsageMeteringApi) GetEstimatedCostByOrg(ctx _context.Context, o ...GetE
424431
if optionalParams.EndDate != nil {
425432
localVarQueryParams.Add("end_date", datadog.ParameterToString(*optionalParams.EndDate, ""))
426433
}
434+
if optionalParams.CostAggregation != nil {
435+
localVarQueryParams.Add("cost_aggregation", datadog.ParameterToString(*optionalParams.CostAggregation, ""))
436+
}
427437
if optionalParams.IncludeConnectedAccounts != nil {
428438
localVarQueryParams.Add("include_connected_accounts", datadog.ParameterToString(*optionalParams.IncludeConnectedAccounts, ""))
429439
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// CostAggregationType Controls how costs are aggregated when using `start_date`. The `cumulative` option returns month-to-date running totals.
14+
type CostAggregationType string
15+
16+
// List of CostAggregationType.
17+
const (
18+
COSTAGGREGATIONTYPE_CUMULATIVE CostAggregationType = "cumulative"
19+
)
20+
21+
var allowedCostAggregationTypeEnumValues = []CostAggregationType{
22+
COSTAGGREGATIONTYPE_CUMULATIVE,
23+
}
24+
25+
// GetAllowedValues reeturns the list of possible values.
26+
func (v *CostAggregationType) GetAllowedValues() []CostAggregationType {
27+
return allowedCostAggregationTypeEnumValues
28+
}
29+
30+
// UnmarshalJSON deserializes the given payload.
31+
func (v *CostAggregationType) UnmarshalJSON(src []byte) error {
32+
var value string
33+
err := datadog.Unmarshal(src, &value)
34+
if err != nil {
35+
return err
36+
}
37+
*v = CostAggregationType(value)
38+
return nil
39+
}
40+
41+
// NewCostAggregationTypeFromValue returns a pointer to a valid CostAggregationType
42+
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
43+
func NewCostAggregationTypeFromValue(v string) (*CostAggregationType, error) {
44+
ev := CostAggregationType(v)
45+
if ev.IsValid() {
46+
return &ev, nil
47+
}
48+
return nil, fmt.Errorf("invalid value '%v' for CostAggregationType: valid values are %v", v, allowedCostAggregationTypeEnumValues)
49+
}
50+
51+
// IsValid return true if the value is valid for the enum, false otherwise.
52+
func (v CostAggregationType) IsValid() bool {
53+
for _, existing := range allowedCostAggregationTypeEnumValues {
54+
if existing == v {
55+
return true
56+
}
57+
}
58+
return false
59+
}
60+
61+
// Ptr returns reference to CostAggregationType value.
62+
func (v CostAggregationType) Ptr() *CostAggregationType {
63+
return &v
64+
}

0 commit comments

Comments
 (0)