Skip to content

Commit e2cd1ce

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit fc7fef8 of spec repo
1 parent 37d4bfc commit e2cd1ce

18 files changed

Lines changed: 2214 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

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

api/datadogV2/api_cloud_cost_management.go

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

api/datadogV2/doc.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
// - [CloudCostManagementApi.GetCostAWSCURConfig]
192192
// - [CloudCostManagementApi.GetCostAzureUCConfig]
193193
// - [CloudCostManagementApi.GetCostGCPUsageCostConfig]
194+
// - [CloudCostManagementApi.GetCostTagKey]
194195
// - [CloudCostManagementApi.GetCustomAllocationRule]
195196
// - [CloudCostManagementApi.GetCustomCostsFile]
196197
// - [CloudCostManagementApi.GetTagPipelinesRuleset]
@@ -200,6 +201,8 @@
200201
// - [CloudCostManagementApi.ListCostGCPUsageCostConfigs]
201202
// - [CloudCostManagementApi.ListCostOCIConfigs]
202203
// - [CloudCostManagementApi.ListCostTagDescriptions]
204+
// - [CloudCostManagementApi.ListCostTagKeys]
205+
// - [CloudCostManagementApi.ListCostTags]
203206
// - [CloudCostManagementApi.ListCustomAllocationRules]
204207
// - [CloudCostManagementApi.ListCustomAllocationRulesStatus]
205208
// - [CloudCostManagementApi.ListCustomCostsFiles]

api/datadogV2/model_cost_tag.go

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
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+
// CostTag A Cloud Cost Management tag.
14+
type CostTag struct {
15+
// Attributes of a Cloud Cost Management tag.
16+
Attributes CostTagAttributes `json:"attributes"`
17+
// The tag identifier, equal to its `key:value` representation.
18+
Id string `json:"id"`
19+
// Type of the Cloud Cost Management tag resource.
20+
Type CostTagType `json:"type"`
21+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
22+
UnparsedObject map[string]interface{} `json:"-"`
23+
AdditionalProperties map[string]interface{} `json:"-"`
24+
}
25+
26+
// NewCostTag instantiates a new CostTag object.
27+
// This constructor will assign default values to properties that have it defined,
28+
// and makes sure properties required by API are set, but the set of arguments
29+
// will change when the set of required properties is changed.
30+
func NewCostTag(attributes CostTagAttributes, id string, typeVar CostTagType) *CostTag {
31+
this := CostTag{}
32+
this.Attributes = attributes
33+
this.Id = id
34+
this.Type = typeVar
35+
return &this
36+
}
37+
38+
// NewCostTagWithDefaults instantiates a new CostTag object.
39+
// This constructor will only assign default values to properties that have it defined,
40+
// but it doesn't guarantee that properties required by API are set.
41+
func NewCostTagWithDefaults() *CostTag {
42+
this := CostTag{}
43+
var typeVar CostTagType = COSTTAGTYPE_COST_TAG
44+
this.Type = typeVar
45+
return &this
46+
}
47+
48+
// GetAttributes returns the Attributes field value.
49+
func (o *CostTag) GetAttributes() CostTagAttributes {
50+
if o == nil {
51+
var ret CostTagAttributes
52+
return ret
53+
}
54+
return o.Attributes
55+
}
56+
57+
// GetAttributesOk returns a tuple with the Attributes field value
58+
// and a boolean to check if the value has been set.
59+
func (o *CostTag) GetAttributesOk() (*CostTagAttributes, bool) {
60+
if o == nil {
61+
return nil, false
62+
}
63+
return &o.Attributes, true
64+
}
65+
66+
// SetAttributes sets field value.
67+
func (o *CostTag) SetAttributes(v CostTagAttributes) {
68+
o.Attributes = v
69+
}
70+
71+
// GetId returns the Id field value.
72+
func (o *CostTag) GetId() string {
73+
if o == nil {
74+
var ret string
75+
return ret
76+
}
77+
return o.Id
78+
}
79+
80+
// GetIdOk returns a tuple with the Id field value
81+
// and a boolean to check if the value has been set.
82+
func (o *CostTag) GetIdOk() (*string, bool) {
83+
if o == nil {
84+
return nil, false
85+
}
86+
return &o.Id, true
87+
}
88+
89+
// SetId sets field value.
90+
func (o *CostTag) SetId(v string) {
91+
o.Id = v
92+
}
93+
94+
// GetType returns the Type field value.
95+
func (o *CostTag) GetType() CostTagType {
96+
if o == nil {
97+
var ret CostTagType
98+
return ret
99+
}
100+
return o.Type
101+
}
102+
103+
// GetTypeOk returns a tuple with the Type field value
104+
// and a boolean to check if the value has been set.
105+
func (o *CostTag) GetTypeOk() (*CostTagType, bool) {
106+
if o == nil {
107+
return nil, false
108+
}
109+
return &o.Type, true
110+
}
111+
112+
// SetType sets field value.
113+
func (o *CostTag) SetType(v CostTagType) {
114+
o.Type = v
115+
}
116+
117+
// MarshalJSON serializes the struct using spec logic.
118+
func (o CostTag) MarshalJSON() ([]byte, error) {
119+
toSerialize := map[string]interface{}{}
120+
if o.UnparsedObject != nil {
121+
return datadog.Marshal(o.UnparsedObject)
122+
}
123+
toSerialize["attributes"] = o.Attributes
124+
toSerialize["id"] = o.Id
125+
toSerialize["type"] = o.Type
126+
127+
for key, value := range o.AdditionalProperties {
128+
toSerialize[key] = value
129+
}
130+
return datadog.Marshal(toSerialize)
131+
}
132+
133+
// UnmarshalJSON deserializes the given payload.
134+
func (o *CostTag) UnmarshalJSON(bytes []byte) (err error) {
135+
all := struct {
136+
Attributes *CostTagAttributes `json:"attributes"`
137+
Id *string `json:"id"`
138+
Type *CostTagType `json:"type"`
139+
}{}
140+
if err = datadog.Unmarshal(bytes, &all); err != nil {
141+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
142+
}
143+
if all.Attributes == nil {
144+
return fmt.Errorf("required field attributes missing")
145+
}
146+
if all.Id == nil {
147+
return fmt.Errorf("required field id missing")
148+
}
149+
if all.Type == nil {
150+
return fmt.Errorf("required field type missing")
151+
}
152+
additionalProperties := make(map[string]interface{})
153+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
154+
datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"})
155+
} else {
156+
return err
157+
}
158+
159+
hasInvalidField := false
160+
if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
161+
hasInvalidField = true
162+
}
163+
o.Attributes = *all.Attributes
164+
o.Id = *all.Id
165+
if !all.Type.IsValid() {
166+
hasInvalidField = true
167+
} else {
168+
o.Type = *all.Type
169+
}
170+
171+
if len(additionalProperties) > 0 {
172+
o.AdditionalProperties = additionalProperties
173+
}
174+
175+
if hasInvalidField {
176+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
177+
}
178+
179+
return nil
180+
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
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+
// CostTagAttributes Attributes of a Cloud Cost Management tag.
14+
type CostTagAttributes struct {
15+
// List of sources that define this tag.
16+
Sources []string `json:"sources"`
17+
// The tag value in `key:value` format.
18+
Value string `json:"value"`
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+
// NewCostTagAttributes instantiates a new CostTagAttributes 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 NewCostTagAttributes(sources []string, value string) *CostTagAttributes {
29+
this := CostTagAttributes{}
30+
this.Sources = sources
31+
this.Value = value
32+
return &this
33+
}
34+
35+
// NewCostTagAttributesWithDefaults instantiates a new CostTagAttributes 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 NewCostTagAttributesWithDefaults() *CostTagAttributes {
39+
this := CostTagAttributes{}
40+
return &this
41+
}
42+
43+
// GetSources returns the Sources field value.
44+
func (o *CostTagAttributes) GetSources() []string {
45+
if o == nil {
46+
var ret []string
47+
return ret
48+
}
49+
return o.Sources
50+
}
51+
52+
// GetSourcesOk returns a tuple with the Sources field value
53+
// and a boolean to check if the value has been set.
54+
func (o *CostTagAttributes) GetSourcesOk() (*[]string, bool) {
55+
if o == nil {
56+
return nil, false
57+
}
58+
return &o.Sources, true
59+
}
60+
61+
// SetSources sets field value.
62+
func (o *CostTagAttributes) SetSources(v []string) {
63+
o.Sources = v
64+
}
65+
66+
// GetValue returns the Value field value.
67+
func (o *CostTagAttributes) GetValue() string {
68+
if o == nil {
69+
var ret string
70+
return ret
71+
}
72+
return o.Value
73+
}
74+
75+
// GetValueOk returns a tuple with the Value field value
76+
// and a boolean to check if the value has been set.
77+
func (o *CostTagAttributes) GetValueOk() (*string, bool) {
78+
if o == nil {
79+
return nil, false
80+
}
81+
return &o.Value, true
82+
}
83+
84+
// SetValue sets field value.
85+
func (o *CostTagAttributes) SetValue(v string) {
86+
o.Value = v
87+
}
88+
89+
// MarshalJSON serializes the struct using spec logic.
90+
func (o CostTagAttributes) MarshalJSON() ([]byte, error) {
91+
toSerialize := map[string]interface{}{}
92+
if o.UnparsedObject != nil {
93+
return datadog.Marshal(o.UnparsedObject)
94+
}
95+
toSerialize["sources"] = o.Sources
96+
toSerialize["value"] = o.Value
97+
98+
for key, value := range o.AdditionalProperties {
99+
toSerialize[key] = value
100+
}
101+
return datadog.Marshal(toSerialize)
102+
}
103+
104+
// UnmarshalJSON deserializes the given payload.
105+
func (o *CostTagAttributes) UnmarshalJSON(bytes []byte) (err error) {
106+
all := struct {
107+
Sources *[]string `json:"sources"`
108+
Value *string `json:"value"`
109+
}{}
110+
if err = datadog.Unmarshal(bytes, &all); err != nil {
111+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
112+
}
113+
if all.Sources == nil {
114+
return fmt.Errorf("required field sources missing")
115+
}
116+
if all.Value == nil {
117+
return fmt.Errorf("required field value missing")
118+
}
119+
additionalProperties := make(map[string]interface{})
120+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
121+
datadog.DeleteKeys(additionalProperties, &[]string{"sources", "value"})
122+
} else {
123+
return err
124+
}
125+
o.Sources = *all.Sources
126+
o.Value = *all.Value
127+
128+
if len(additionalProperties) > 0 {
129+
o.AdditionalProperties = additionalProperties
130+
}
131+
132+
return nil
133+
}

0 commit comments

Comments
 (0)