Skip to content

Commit 120e2d3

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add Cloud Cost Management tag_metadata endpoints (#4089)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 1ce8c5f commit 120e2d3

29 files changed

Lines changed: 3643 additions & 1 deletion

.generator/schemas/v2/openapi.yaml

Lines changed: 653 additions & 1 deletion
Large diffs are not rendered by default.

api/datadog/configuration.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,12 @@ func NewConfiguration() *Configuration {
768768
"v2.GetCommitmentsUtilizationScalar": false,
769769
"v2.GetCommitmentsUtilizationTimeseries": false,
770770
"v2.GetCostAnomaly": false,
771+
"v2.GetCostTagMetadataCurrency": false,
771772
"v2.ListCostAnomalies": false,
773+
"v2.ListCostTagKeySources": false,
774+
"v2.ListCostTagMetadata": false,
775+
"v2.ListCostTagMetadataMetrics": false,
776+
"v2.ListCostTagMetadataOrchestrators": false,
772777
"v2.CreateDashboardSecureEmbed": false,
773778
"v2.DeleteDashboardSecureEmbed": false,
774779
"v2.GetDashboardSecureEmbed": false,

api/datadogV2/api_cloud_cost_management.go

Lines changed: 605 additions & 0 deletions
Large diffs are not rendered by default.

api/datadogV2/doc.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@
209209
// - [CloudCostManagementApi.GetCostAzureUCConfig]
210210
// - [CloudCostManagementApi.GetCostGCPUsageCostConfig]
211211
// - [CloudCostManagementApi.GetCostTagKey]
212+
// - [CloudCostManagementApi.GetCostTagMetadataCurrency]
212213
// - [CloudCostManagementApi.GetCustomAllocationRule]
213214
// - [CloudCostManagementApi.GetCustomCostsFile]
214215
// - [CloudCostManagementApi.GetTagPipelinesRuleset]
@@ -219,7 +220,11 @@
219220
// - [CloudCostManagementApi.ListCostGCPUsageCostConfigs]
220221
// - [CloudCostManagementApi.ListCostOCIConfigs]
221222
// - [CloudCostManagementApi.ListCostTagDescriptions]
223+
// - [CloudCostManagementApi.ListCostTagKeySources]
222224
// - [CloudCostManagementApi.ListCostTagKeys]
225+
// - [CloudCostManagementApi.ListCostTagMetadata]
226+
// - [CloudCostManagementApi.ListCostTagMetadataMetrics]
227+
// - [CloudCostManagementApi.ListCostTagMetadataOrchestrators]
223228
// - [CloudCostManagementApi.ListCostTags]
224229
// - [CloudCostManagementApi.ListCustomAllocationRules]
225230
// - [CloudCostManagementApi.ListCustomAllocationRulesStatus]
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
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+
// CostCurrency A Cloud Cost Management billing currency entry.
14+
type CostCurrency struct {
15+
// The currency code (for example, `USD`).
16+
Id string `json:"id"`
17+
// Type of the Cloud Cost Management billing currency resource.
18+
Type CostCurrencyType `json:"type"`
19+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
20+
UnparsedObject map[string]interface{} `json:"-"`
21+
AdditionalProperties map[string]interface{} `json:"-"`
22+
}
23+
24+
// NewCostCurrency instantiates a new CostCurrency object.
25+
// This constructor will assign default values to properties that have it defined,
26+
// and makes sure properties required by API are set, but the set of arguments
27+
// will change when the set of required properties is changed.
28+
func NewCostCurrency(id string, typeVar CostCurrencyType) *CostCurrency {
29+
this := CostCurrency{}
30+
this.Id = id
31+
this.Type = typeVar
32+
return &this
33+
}
34+
35+
// NewCostCurrencyWithDefaults instantiates a new CostCurrency object.
36+
// This constructor will only assign default values to properties that have it defined,
37+
// but it doesn't guarantee that properties required by API are set.
38+
func NewCostCurrencyWithDefaults() *CostCurrency {
39+
this := CostCurrency{}
40+
var typeVar CostCurrencyType = COSTCURRENCYTYPE_COST_CURRENCY
41+
this.Type = typeVar
42+
return &this
43+
}
44+
45+
// GetId returns the Id field value.
46+
func (o *CostCurrency) GetId() string {
47+
if o == nil {
48+
var ret string
49+
return ret
50+
}
51+
return o.Id
52+
}
53+
54+
// GetIdOk returns a tuple with the Id field value
55+
// and a boolean to check if the value has been set.
56+
func (o *CostCurrency) GetIdOk() (*string, bool) {
57+
if o == nil {
58+
return nil, false
59+
}
60+
return &o.Id, true
61+
}
62+
63+
// SetId sets field value.
64+
func (o *CostCurrency) SetId(v string) {
65+
o.Id = v
66+
}
67+
68+
// GetType returns the Type field value.
69+
func (o *CostCurrency) GetType() CostCurrencyType {
70+
if o == nil {
71+
var ret CostCurrencyType
72+
return ret
73+
}
74+
return o.Type
75+
}
76+
77+
// GetTypeOk returns a tuple with the Type field value
78+
// and a boolean to check if the value has been set.
79+
func (o *CostCurrency) GetTypeOk() (*CostCurrencyType, bool) {
80+
if o == nil {
81+
return nil, false
82+
}
83+
return &o.Type, true
84+
}
85+
86+
// SetType sets field value.
87+
func (o *CostCurrency) SetType(v CostCurrencyType) {
88+
o.Type = v
89+
}
90+
91+
// MarshalJSON serializes the struct using spec logic.
92+
func (o CostCurrency) MarshalJSON() ([]byte, error) {
93+
toSerialize := map[string]interface{}{}
94+
if o.UnparsedObject != nil {
95+
return datadog.Marshal(o.UnparsedObject)
96+
}
97+
toSerialize["id"] = o.Id
98+
toSerialize["type"] = o.Type
99+
100+
for key, value := range o.AdditionalProperties {
101+
toSerialize[key] = value
102+
}
103+
return datadog.Marshal(toSerialize)
104+
}
105+
106+
// UnmarshalJSON deserializes the given payload.
107+
func (o *CostCurrency) UnmarshalJSON(bytes []byte) (err error) {
108+
all := struct {
109+
Id *string `json:"id"`
110+
Type *CostCurrencyType `json:"type"`
111+
}{}
112+
if err = datadog.Unmarshal(bytes, &all); err != nil {
113+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
114+
}
115+
if all.Id == nil {
116+
return fmt.Errorf("required field id missing")
117+
}
118+
if all.Type == nil {
119+
return fmt.Errorf("required field type missing")
120+
}
121+
additionalProperties := make(map[string]interface{})
122+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
123+
datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"})
124+
} else {
125+
return err
126+
}
127+
128+
hasInvalidField := false
129+
o.Id = *all.Id
130+
if !all.Type.IsValid() {
131+
hasInvalidField = true
132+
} else {
133+
o.Type = *all.Type
134+
}
135+
136+
if len(additionalProperties) > 0 {
137+
o.AdditionalProperties = additionalProperties
138+
}
139+
140+
if hasInvalidField {
141+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
142+
}
143+
144+
return nil
145+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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+
// CostCurrencyResponse The dominant Cloud Cost Management billing currency for the requested period. The `data` array contains at most one entry, and is empty when no currency data is available.
14+
type CostCurrencyResponse struct {
15+
// The dominant billing currency. Empty when no data is available, or a single entry otherwise.
16+
Data []CostCurrency `json:"data"`
17+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
18+
UnparsedObject map[string]interface{} `json:"-"`
19+
AdditionalProperties map[string]interface{} `json:"-"`
20+
}
21+
22+
// NewCostCurrencyResponse instantiates a new CostCurrencyResponse object.
23+
// This constructor will assign default values to properties that have it defined,
24+
// and makes sure properties required by API are set, but the set of arguments
25+
// will change when the set of required properties is changed.
26+
func NewCostCurrencyResponse(data []CostCurrency) *CostCurrencyResponse {
27+
this := CostCurrencyResponse{}
28+
this.Data = data
29+
return &this
30+
}
31+
32+
// NewCostCurrencyResponseWithDefaults instantiates a new CostCurrencyResponse object.
33+
// This constructor will only assign default values to properties that have it defined,
34+
// but it doesn't guarantee that properties required by API are set.
35+
func NewCostCurrencyResponseWithDefaults() *CostCurrencyResponse {
36+
this := CostCurrencyResponse{}
37+
return &this
38+
}
39+
40+
// GetData returns the Data field value.
41+
func (o *CostCurrencyResponse) GetData() []CostCurrency {
42+
if o == nil {
43+
var ret []CostCurrency
44+
return ret
45+
}
46+
return o.Data
47+
}
48+
49+
// GetDataOk returns a tuple with the Data field value
50+
// and a boolean to check if the value has been set.
51+
func (o *CostCurrencyResponse) GetDataOk() (*[]CostCurrency, bool) {
52+
if o == nil {
53+
return nil, false
54+
}
55+
return &o.Data, true
56+
}
57+
58+
// SetData sets field value.
59+
func (o *CostCurrencyResponse) SetData(v []CostCurrency) {
60+
o.Data = v
61+
}
62+
63+
// MarshalJSON serializes the struct using spec logic.
64+
func (o CostCurrencyResponse) MarshalJSON() ([]byte, error) {
65+
toSerialize := map[string]interface{}{}
66+
if o.UnparsedObject != nil {
67+
return datadog.Marshal(o.UnparsedObject)
68+
}
69+
toSerialize["data"] = o.Data
70+
71+
for key, value := range o.AdditionalProperties {
72+
toSerialize[key] = value
73+
}
74+
return datadog.Marshal(toSerialize)
75+
}
76+
77+
// UnmarshalJSON deserializes the given payload.
78+
func (o *CostCurrencyResponse) UnmarshalJSON(bytes []byte) (err error) {
79+
all := struct {
80+
Data *[]CostCurrency `json:"data"`
81+
}{}
82+
if err = datadog.Unmarshal(bytes, &all); err != nil {
83+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
84+
}
85+
if all.Data == nil {
86+
return fmt.Errorf("required field data missing")
87+
}
88+
additionalProperties := make(map[string]interface{})
89+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
90+
datadog.DeleteKeys(additionalProperties, &[]string{"data"})
91+
} else {
92+
return err
93+
}
94+
o.Data = *all.Data
95+
96+
if len(additionalProperties) > 0 {
97+
o.AdditionalProperties = additionalProperties
98+
}
99+
100+
return nil
101+
}
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+
// CostCurrencyType Type of the Cloud Cost Management billing currency resource.
14+
type CostCurrencyType string
15+
16+
// List of CostCurrencyType.
17+
const (
18+
COSTCURRENCYTYPE_COST_CURRENCY CostCurrencyType = "cost_currency"
19+
)
20+
21+
var allowedCostCurrencyTypeEnumValues = []CostCurrencyType{
22+
COSTCURRENCYTYPE_COST_CURRENCY,
23+
}
24+
25+
// GetAllowedValues reeturns the list of possible values.
26+
func (v *CostCurrencyType) GetAllowedValues() []CostCurrencyType {
27+
return allowedCostCurrencyTypeEnumValues
28+
}
29+
30+
// UnmarshalJSON deserializes the given payload.
31+
func (v *CostCurrencyType) UnmarshalJSON(src []byte) error {
32+
var value string
33+
err := datadog.Unmarshal(src, &value)
34+
if err != nil {
35+
return err
36+
}
37+
*v = CostCurrencyType(value)
38+
return nil
39+
}
40+
41+
// NewCostCurrencyTypeFromValue returns a pointer to a valid CostCurrencyType
42+
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
43+
func NewCostCurrencyTypeFromValue(v string) (*CostCurrencyType, error) {
44+
ev := CostCurrencyType(v)
45+
if ev.IsValid() {
46+
return &ev, nil
47+
}
48+
return nil, fmt.Errorf("invalid value '%v' for CostCurrencyType: valid values are %v", v, allowedCostCurrencyTypeEnumValues)
49+
}
50+
51+
// IsValid return true if the value is valid for the enum, false otherwise.
52+
func (v CostCurrencyType) IsValid() bool {
53+
for _, existing := range allowedCostCurrencyTypeEnumValues {
54+
if existing == v {
55+
return true
56+
}
57+
}
58+
return false
59+
}
60+
61+
// Ptr returns reference to CostCurrencyType value.
62+
func (v CostCurrencyType) Ptr() *CostCurrencyType {
63+
return &v
64+
}

0 commit comments

Comments
 (0)