Skip to content

Commit b5481f2

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Audit and fix existing CCM endpoint OpenAPI spec for custom costs, aws config, azure config, and gcp config (#3283)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 456dbdb commit b5481f2

37 files changed

Lines changed: 396 additions & 151 deletions

File tree

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "8001cbb",
3-
"generated": "2025-08-13 20:28:47.190"
2+
"spec_repo_commit": "b434599",
3+
"generated": "2025-08-13 22:17:28.678"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ components:
221221
name: cloud_account_id
222222
required: true
223223
schema:
224-
type: string
224+
format: int64
225+
type: integer
225226
CloudWorkloadSecurityAgentRuleID:
226227
description: The ID of the Agent rule
227228
example: 3b5-v82-ns6
@@ -4500,8 +4501,7 @@ components:
45004501
$ref: '#/components/schemas/AwsCURConfigAttributes'
45014502
id:
45024503
description: The ID of the AWS CUR config.
4503-
format: int64
4504-
type: integer
4504+
type: string
45054505
type:
45064506
$ref: '#/components/schemas/AwsCURConfigType'
45074507
required:
@@ -4642,9 +4642,6 @@ components:
46424642
description: The region the bucket is located in.
46434643
example: us-east-1
46444644
type: string
4645-
is_enabled:
4646-
description: Whether or not the Cloud Cost Management account is enabled.
4647-
type: boolean
46484645
months:
46494646
description: The month of the report.
46504647
format: int32
@@ -5136,8 +5133,7 @@ components:
51365133
type: string
51375134
id:
51385135
description: The ID of the Azure config.
5139-
format: int64
5140-
type: integer
5136+
type: string
51415137
months:
51425138
deprecated: true
51435139
description: The number of months the report has been backfilled.
@@ -5187,8 +5183,7 @@ components:
51875183
$ref: '#/components/schemas/AzureUCConfigPairAttributes'
51885184
id:
51895185
description: The ID of Cloud Cost Management account.
5190-
format: int64
5191-
type: integer
5186+
type: string
51925187
type:
51935188
$ref: '#/components/schemas/AzureUCConfigPairType'
51945189
required:
@@ -5205,8 +5200,7 @@ components:
52055200
type: array
52065201
id:
52075202
description: The ID of the Azure config pair.
5208-
format: int64
5209-
type: integer
5203+
type: string
52105204
required:
52115205
- configs
52125206
type: object
@@ -49730,13 +49724,44 @@ paths:
4973049724
get:
4973149725
description: List the Custom Costs files.
4973249726
operationId: ListCustomCostsFiles
49727+
parameters:
49728+
- description: Page number for pagination
49729+
in: query
49730+
name: page[number]
49731+
schema:
49732+
format: int64
49733+
type: integer
49734+
- description: Page size for pagination
49735+
in: query
49736+
name: page[size]
49737+
schema:
49738+
default: 100
49739+
format: int64
49740+
type: integer
49741+
- description: Filter by file status
49742+
in: query
49743+
name: filter[status]
49744+
schema:
49745+
type: string
49746+
- description: Sort key with optional descending prefix
49747+
in: query
49748+
name: sort
49749+
schema:
49750+
default: created_at
49751+
type: string
4973349752
responses:
4973449753
'200':
4973549754
content:
4973649755
application/json:
4973749756
schema:
4973849757
$ref: '#/components/schemas/CustomCostsFileListResponse'
4973949758
description: OK
49759+
'400':
49760+
content:
49761+
application/json:
49762+
schema:
49763+
$ref: '#/components/schemas/APIErrorResponse'
49764+
description: Bad Request
4974049765
'403':
4974149766
content:
4974249767
application/json:
@@ -49769,6 +49794,12 @@ paths:
4976949794
schema:
4977049795
$ref: '#/components/schemas/CustomCostsFileUploadResponse'
4977149796
description: Accepted
49797+
'400':
49798+
content:
49799+
application/json:
49800+
schema:
49801+
$ref: '#/components/schemas/APIErrorResponse'
49802+
description: Bad Request
4977249803
'403':
4977349804
content:
4977449805
application/json:
@@ -49800,6 +49831,12 @@ paths:
4980049831
schema:
4980149832
$ref: '#/components/schemas/APIErrorResponse'
4980249833
description: Forbidden
49834+
'404':
49835+
content:
49836+
application/json:
49837+
schema:
49838+
$ref: '#/components/schemas/APIErrorResponse'
49839+
description: Not Found
4980349840
'429':
4980449841
$ref: '#/components/responses/TooManyRequestsResponse'
4980549842
security:
@@ -49828,6 +49865,12 @@ paths:
4982849865
schema:
4982949866
$ref: '#/components/schemas/APIErrorResponse'
4983049867
description: Forbidden
49868+
'404':
49869+
content:
49870+
application/json:
49871+
schema:
49872+
$ref: '#/components/schemas/APIErrorResponse'
49873+
description: Not Found
4983149874
'429':
4983249875
$ref: '#/components/responses/TooManyRequestsResponse'
4983349876
security:

api/datadogV2/api_cloud_cost_management.go

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func (a *CloudCostManagementApi) DeleteBudget(ctx _context.Context, budgetId str
325325

326326
// DeleteCostAWSCURConfig Delete Cloud Cost Management AWS CUR config.
327327
// Archive a Cloud Cost Management Account.
328-
func (a *CloudCostManagementApi) DeleteCostAWSCURConfig(ctx _context.Context, cloudAccountId string) (*_nethttp.Response, error) {
328+
func (a *CloudCostManagementApi) DeleteCostAWSCURConfig(ctx _context.Context, cloudAccountId int64) (*_nethttp.Response, error) {
329329
var (
330330
localVarHTTPMethod = _nethttp.MethodDelete
331331
localVarPostBody interface{}
@@ -393,7 +393,7 @@ func (a *CloudCostManagementApi) DeleteCostAWSCURConfig(ctx _context.Context, cl
393393

394394
// DeleteCostAzureUCConfig Delete Cloud Cost Management Azure config.
395395
// Archive a Cloud Cost Management Account.
396-
func (a *CloudCostManagementApi) DeleteCostAzureUCConfig(ctx _context.Context, cloudAccountId string) (*_nethttp.Response, error) {
396+
func (a *CloudCostManagementApi) DeleteCostAzureUCConfig(ctx _context.Context, cloudAccountId int64) (*_nethttp.Response, error) {
397397
var (
398398
localVarHTTPMethod = _nethttp.MethodDelete
399399
localVarPostBody interface{}
@@ -461,7 +461,7 @@ func (a *CloudCostManagementApi) DeleteCostAzureUCConfig(ctx _context.Context, c
461461

462462
// DeleteCostGCPUsageCostConfig Delete Cloud Cost Management GCP Usage Cost config.
463463
// Archive a Cloud Cost Management account.
464-
func (a *CloudCostManagementApi) DeleteCostGCPUsageCostConfig(ctx _context.Context, cloudAccountId string) (*_nethttp.Response, error) {
464+
func (a *CloudCostManagementApi) DeleteCostGCPUsageCostConfig(ctx _context.Context, cloudAccountId int64) (*_nethttp.Response, error) {
465465
var (
466466
localVarHTTPMethod = _nethttp.MethodDelete
467467
localVarPostBody interface{}
@@ -581,7 +581,7 @@ func (a *CloudCostManagementApi) DeleteCustomCostsFile(ctx _context.Context, fil
581581
ErrorBody: localVarBody,
582582
ErrorMessage: localVarHTTPResponse.Status,
583583
}
584-
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
584+
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
585585
var v APIErrorResponse
586586
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
587587
if err != nil {
@@ -728,7 +728,7 @@ func (a *CloudCostManagementApi) GetCustomCostsFile(ctx _context.Context, fileId
728728
ErrorBody: localVarBody,
729729
ErrorMessage: localVarHTTPResponse.Status,
730730
}
731-
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
731+
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
732732
var v APIErrorResponse
733733
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
734734
if err != nil {
@@ -1059,15 +1059,61 @@ func (a *CloudCostManagementApi) ListCostGCPUsageCostConfigs(ctx _context.Contex
10591059
return localVarReturnValue, localVarHTTPResponse, nil
10601060
}
10611061

1062+
// ListCustomCostsFilesOptionalParameters holds optional parameters for ListCustomCostsFiles.
1063+
type ListCustomCostsFilesOptionalParameters struct {
1064+
PageNumber *int64
1065+
PageSize *int64
1066+
FilterStatus *string
1067+
Sort *string
1068+
}
1069+
1070+
// NewListCustomCostsFilesOptionalParameters creates an empty struct for parameters.
1071+
func NewListCustomCostsFilesOptionalParameters() *ListCustomCostsFilesOptionalParameters {
1072+
this := ListCustomCostsFilesOptionalParameters{}
1073+
return &this
1074+
}
1075+
1076+
// WithPageNumber sets the corresponding parameter name and returns the struct.
1077+
func (r *ListCustomCostsFilesOptionalParameters) WithPageNumber(pageNumber int64) *ListCustomCostsFilesOptionalParameters {
1078+
r.PageNumber = &pageNumber
1079+
return r
1080+
}
1081+
1082+
// WithPageSize sets the corresponding parameter name and returns the struct.
1083+
func (r *ListCustomCostsFilesOptionalParameters) WithPageSize(pageSize int64) *ListCustomCostsFilesOptionalParameters {
1084+
r.PageSize = &pageSize
1085+
return r
1086+
}
1087+
1088+
// WithFilterStatus sets the corresponding parameter name and returns the struct.
1089+
func (r *ListCustomCostsFilesOptionalParameters) WithFilterStatus(filterStatus string) *ListCustomCostsFilesOptionalParameters {
1090+
r.FilterStatus = &filterStatus
1091+
return r
1092+
}
1093+
1094+
// WithSort sets the corresponding parameter name and returns the struct.
1095+
func (r *ListCustomCostsFilesOptionalParameters) WithSort(sort string) *ListCustomCostsFilesOptionalParameters {
1096+
r.Sort = &sort
1097+
return r
1098+
}
1099+
10621100
// ListCustomCostsFiles List Custom Costs files.
10631101
// List the Custom Costs files.
1064-
func (a *CloudCostManagementApi) ListCustomCostsFiles(ctx _context.Context) (CustomCostsFileListResponse, *_nethttp.Response, error) {
1102+
func (a *CloudCostManagementApi) ListCustomCostsFiles(ctx _context.Context, o ...ListCustomCostsFilesOptionalParameters) (CustomCostsFileListResponse, *_nethttp.Response, error) {
10651103
var (
10661104
localVarHTTPMethod = _nethttp.MethodGet
10671105
localVarPostBody interface{}
10681106
localVarReturnValue CustomCostsFileListResponse
1107+
optionalParams ListCustomCostsFilesOptionalParameters
10691108
)
10701109

1110+
if len(o) > 1 {
1111+
return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListCustomCostsFilesOptionalParameters is allowed")
1112+
}
1113+
if len(o) == 1 {
1114+
optionalParams = o[0]
1115+
}
1116+
10711117
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CloudCostManagementApi.ListCustomCostsFiles")
10721118
if err != nil {
10731119
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
@@ -1078,6 +1124,18 @@ func (a *CloudCostManagementApi) ListCustomCostsFiles(ctx _context.Context) (Cus
10781124
localVarHeaderParams := make(map[string]string)
10791125
localVarQueryParams := _neturl.Values{}
10801126
localVarFormParams := _neturl.Values{}
1127+
if optionalParams.PageNumber != nil {
1128+
localVarQueryParams.Add("page[number]", datadog.ParameterToString(*optionalParams.PageNumber, ""))
1129+
}
1130+
if optionalParams.PageSize != nil {
1131+
localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, ""))
1132+
}
1133+
if optionalParams.FilterStatus != nil {
1134+
localVarQueryParams.Add("filter[status]", datadog.ParameterToString(*optionalParams.FilterStatus, ""))
1135+
}
1136+
if optionalParams.Sort != nil {
1137+
localVarQueryParams.Add("sort", datadog.ParameterToString(*optionalParams.Sort, ""))
1138+
}
10811139
localVarHeaderParams["Accept"] = "application/json"
10821140

10831141
if a.Client.Cfg.DelegatedTokenConfig != nil {
@@ -1113,7 +1171,7 @@ func (a *CloudCostManagementApi) ListCustomCostsFiles(ctx _context.Context) (Cus
11131171
ErrorBody: localVarBody,
11141172
ErrorMessage: localVarHTTPResponse.Status,
11151173
}
1116-
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
1174+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
11171175
var v APIErrorResponse
11181176
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
11191177
if err != nil {
@@ -1138,7 +1196,7 @@ func (a *CloudCostManagementApi) ListCustomCostsFiles(ctx _context.Context) (Cus
11381196

11391197
// UpdateCostAWSCURConfig Update Cloud Cost Management AWS CUR config.
11401198
// Update the status (active/archived) and/or account filtering configuration of an AWS CUR config.
1141-
func (a *CloudCostManagementApi) UpdateCostAWSCURConfig(ctx _context.Context, cloudAccountId string, body AwsCURConfigPatchRequest) (AwsCURConfigsResponse, *_nethttp.Response, error) {
1199+
func (a *CloudCostManagementApi) UpdateCostAWSCURConfig(ctx _context.Context, cloudAccountId int64, body AwsCURConfigPatchRequest) (AwsCURConfigsResponse, *_nethttp.Response, error) {
11421200
var (
11431201
localVarHTTPMethod = _nethttp.MethodPatch
11441202
localVarPostBody interface{}
@@ -1219,7 +1277,7 @@ func (a *CloudCostManagementApi) UpdateCostAWSCURConfig(ctx _context.Context, cl
12191277

12201278
// UpdateCostAzureUCConfigs Update Cloud Cost Management Azure config.
12211279
// Update the status of an Azure config (active/archived).
1222-
func (a *CloudCostManagementApi) UpdateCostAzureUCConfigs(ctx _context.Context, cloudAccountId string, body AzureUCConfigPatchRequest) (AzureUCConfigPairsResponse, *_nethttp.Response, error) {
1280+
func (a *CloudCostManagementApi) UpdateCostAzureUCConfigs(ctx _context.Context, cloudAccountId int64, body AzureUCConfigPatchRequest) (AzureUCConfigPairsResponse, *_nethttp.Response, error) {
12231281
var (
12241282
localVarHTTPMethod = _nethttp.MethodPatch
12251283
localVarPostBody interface{}
@@ -1300,7 +1358,7 @@ func (a *CloudCostManagementApi) UpdateCostAzureUCConfigs(ctx _context.Context,
13001358

13011359
// UpdateCostGCPUsageCostConfig Update Cloud Cost Management GCP Usage Cost config.
13021360
// Update the status of an GCP Usage Cost config (active/archived).
1303-
func (a *CloudCostManagementApi) UpdateCostGCPUsageCostConfig(ctx _context.Context, cloudAccountId string, body GCPUsageCostConfigPatchRequest) (GCPUsageCostConfigResponse, *_nethttp.Response, error) {
1361+
func (a *CloudCostManagementApi) UpdateCostGCPUsageCostConfig(ctx _context.Context, cloudAccountId int64, body GCPUsageCostConfigPatchRequest) (GCPUsageCostConfigResponse, *_nethttp.Response, error) {
13041362
var (
13051363
localVarHTTPMethod = _nethttp.MethodPatch
13061364
localVarPostBody interface{}
@@ -1436,7 +1494,7 @@ func (a *CloudCostManagementApi) UploadCustomCostsFile(ctx _context.Context, bod
14361494
ErrorBody: localVarBody,
14371495
ErrorMessage: localVarHTTPResponse.Status,
14381496
}
1439-
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
1497+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
14401498
var v APIErrorResponse
14411499
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
14421500
if err != nil {

api/datadogV2/model_aws_cur_config.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type AwsCURConfig struct {
1515
// Attributes for An AWS CUR config.
1616
Attributes AwsCURConfigAttributes `json:"attributes"`
1717
// The ID of the AWS CUR config.
18-
Id *int64 `json:"id,omitempty"`
18+
Id *string `json:"id,omitempty"`
1919
// Type of AWS CUR config.
2020
Type AwsCURConfigType `json:"type"`
2121
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
@@ -68,17 +68,17 @@ func (o *AwsCURConfig) SetAttributes(v AwsCURConfigAttributes) {
6868
}
6969

7070
// GetId returns the Id field value if set, zero value otherwise.
71-
func (o *AwsCURConfig) GetId() int64 {
71+
func (o *AwsCURConfig) GetId() string {
7272
if o == nil || o.Id == nil {
73-
var ret int64
73+
var ret string
7474
return ret
7575
}
7676
return *o.Id
7777
}
7878

7979
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
8080
// and a boolean to check if the value has been set.
81-
func (o *AwsCURConfig) GetIdOk() (*int64, bool) {
81+
func (o *AwsCURConfig) GetIdOk() (*string, bool) {
8282
if o == nil || o.Id == nil {
8383
return nil, false
8484
}
@@ -90,8 +90,8 @@ func (o *AwsCURConfig) HasId() bool {
9090
return o != nil && o.Id != nil
9191
}
9292

93-
// SetId gets a reference to the given int64 and assigns it to the Id field.
94-
func (o *AwsCURConfig) SetId(v int64) {
93+
// SetId gets a reference to the given string and assigns it to the Id field.
94+
func (o *AwsCURConfig) SetId(v string) {
9595
o.Id = &v
9696
}
9797

@@ -140,7 +140,7 @@ func (o AwsCURConfig) MarshalJSON() ([]byte, error) {
140140
func (o *AwsCURConfig) UnmarshalJSON(bytes []byte) (err error) {
141141
all := struct {
142142
Attributes *AwsCURConfigAttributes `json:"attributes"`
143-
Id *int64 `json:"id,omitempty"`
143+
Id *string `json:"id,omitempty"`
144144
Type *AwsCURConfigType `json:"type"`
145145
}{}
146146
if err = datadog.Unmarshal(bytes, &all); err != nil {

0 commit comments

Comments
 (0)