From 69c04c599901a290ed60da6cf47970c81dc240ec Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:46:54 +0000 Subject: [PATCH] Add custom cost endpoints to public API documentation (#2595) Co-authored-by: ci.datadog-api-spec Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 347 +++++++++++++++ api/datadogV2/api_cloud_cost_management.go | 275 ++++++++++++ api/datadogV2/doc.go | 4 + .../model_custom_cost_get_response_meta.go | 102 +++++ .../model_custom_cost_list_response_meta.go | 137 ++++++ .../model_custom_cost_upload_response_meta.go | 102 +++++ .../model_custom_costs_file_get_response.go | 149 +++++++ .../model_custom_costs_file_line_item.go | 312 ++++++++++++++ .../model_custom_costs_file_list_response.go | 146 +++++++ .../model_custom_costs_file_metadata.go | 359 ++++++++++++++++ ...l_custom_costs_file_metadata_high_level.go | 181 ++++++++ ...custom_costs_file_metadata_with_content.go | 394 ++++++++++++++++++ ...s_file_metadata_with_content_high_level.go | 181 ++++++++ ...model_custom_costs_file_upload_response.go | 149 +++++++ ...l_custom_costs_file_usage_charge_period.go | 137 ++++++ api/datadogV2/model_custom_costs_user.go | 172 ++++++++ .../DeleteCustomCostsFile.go | 25 ++ .../DeleteCustomCostsFile_372970393.go | 25 ++ .../GetCustomCostsFile.go | 29 ++ .../GetCustomCostsFile_1307381576.go | 29 ++ .../ListCustomCostsFiles.go | 29 ++ .../ListCustomCostsFiles_1968771127.go | 29 ++ .../UploadCustomCostsFile.go | 38 ++ .../UploadCustomCostsFile_4125168396.go | 42 ++ ...ts_File_returns_No_Content_response.freeze | 1 + ...osts_File_returns_No_Content_response.yaml | 19 + ...stom_Costs_File_returns_OK_response.freeze | 1 + ...Custom_Costs_File_returns_OK_response.yaml | 20 + ...tom_Costs_Files_returns_OK_response.freeze | 1 + ...ustom_Costs_Files_returns_OK_response.yaml | 20 + ...osts_File_returns_Accepted_response.freeze | 1 + ..._Costs_File_returns_Accepted_response.yaml | 23 + .../features/v2/cloud_cost_management.feature | 58 +++ tests/scenarios/features/v2/undo.json | 24 ++ 35 files changed, 3565 insertions(+), 4 deletions(-) create mode 100644 api/datadogV2/model_custom_cost_get_response_meta.go create mode 100644 api/datadogV2/model_custom_cost_list_response_meta.go create mode 100644 api/datadogV2/model_custom_cost_upload_response_meta.go create mode 100644 api/datadogV2/model_custom_costs_file_get_response.go create mode 100644 api/datadogV2/model_custom_costs_file_line_item.go create mode 100644 api/datadogV2/model_custom_costs_file_list_response.go create mode 100644 api/datadogV2/model_custom_costs_file_metadata.go create mode 100644 api/datadogV2/model_custom_costs_file_metadata_high_level.go create mode 100644 api/datadogV2/model_custom_costs_file_metadata_with_content.go create mode 100644 api/datadogV2/model_custom_costs_file_metadata_with_content_high_level.go create mode 100644 api/datadogV2/model_custom_costs_file_upload_response.go create mode 100644 api/datadogV2/model_custom_costs_file_usage_charge_period.go create mode 100644 api/datadogV2/model_custom_costs_user.go create mode 100644 examples/v2/cloud-cost-management/DeleteCustomCostsFile.go create mode 100644 examples/v2/cloud-cost-management/DeleteCustomCostsFile_372970393.go create mode 100644 examples/v2/cloud-cost-management/GetCustomCostsFile.go create mode 100644 examples/v2/cloud-cost-management/GetCustomCostsFile_1307381576.go create mode 100644 examples/v2/cloud-cost-management/ListCustomCostsFiles.go create mode 100644 examples/v2/cloud-cost-management/ListCustomCostsFiles_1968771127.go create mode 100644 examples/v2/cloud-cost-management/UploadCustomCostsFile.go create mode 100644 examples/v2/cloud-cost-management/UploadCustomCostsFile_4125168396.go create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Delete_Custom_Costs_File_returns_No_Content_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Delete_Custom_Costs_File_returns_No_Content_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Get_Custom_Costs_File_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Get_Custom_Costs_File_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_List_Custom_Costs_Files_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_List_Custom_Costs_Files_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Upload_Custom_Costs_File_returns_Accepted_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Upload_Custom_Costs_File_returns_Accepted_response.yaml diff --git a/.apigentools-info b/.apigentools-info index 9682a7f5cfa..a9a1e68dc48 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-07-25 18:59:27.218959", - "spec_repo_commit": "ccf15bee" + "regenerated": "2024-07-26 15:05:45.922448", + "spec_repo_commit": "bdcf730e" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-07-25 18:59:27.236772", - "spec_repo_commit": "ccf15bee" + "regenerated": "2024-07-26 15:05:45.941135", + "spec_repo_commit": "bdcf730e" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d921feb3775..69457eb4771 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -216,6 +216,13 @@ components: required: true schema: type: string + FileID: + description: File ID. + in: path + name: file_id + required: true + schema: + type: string GCPSTSServiceAccountID: description: Your GCP STS enabled service account's unique ID. in: path @@ -5516,6 +5523,234 @@ components: nullable: true type: string type: object + CustomCostGetResponseMeta: + description: Meta for the response from the Get Custom Costs endpoints. + properties: + version: + description: Version of Custom Costs file + type: string + type: object + CustomCostListResponseMeta: + description: Meta for the response from the List Custom Costs endpoints. + properties: + total_filtered_count: + description: Number of Custom Costs files returned by the List Custom Costs + endpoint + format: int64 + type: integer + version: + description: Version of Custom Costs file + type: string + type: object + CustomCostUploadResponseMeta: + description: Meta for the response from the Upload Custom Costs endpoints. + properties: + version: + description: Version of Custom Costs file + type: string + type: object + CustomCostsFileGetResponse: + description: Response for Get Custom Costs files. + properties: + data: + $ref: '#/components/schemas/CustomCostsFileMetadataWithContentHighLevel' + meta: + $ref: '#/components/schemas/CustomCostGetResponseMeta' + type: object + CustomCostsFileLineItem: + description: Line item details from a Custom Costs file. + properties: + BilledCost: + description: Total cost in the cost file. + example: 100.5 + format: double + type: number + BillingCurrency: + description: Currency used in the Custom Costs file. + example: USD + type: string + ChargeDescription: + description: Description for the line item cost. + example: Monthly usage charge for my service + type: string + ChargePeriodEnd: + description: End date of the usage charge. + example: '2023-02-28' + pattern: ^\d{4}-\d{2}-\d{2}$ + type: string + ChargePeriodStart: + description: Start date of the usage charge. + example: '2023-02-01' + pattern: ^\d{4}-\d{2}-\d{2}$ + type: string + ProviderName: + description: Name of the provider for the line item. + type: string + Tags: + additionalProperties: + type: string + description: Additional tags for the line item. + type: object + type: object + CustomCostsFileListResponse: + description: Response for List Custom Costs files. + properties: + data: + description: List of Custom Costs files. + items: + $ref: '#/components/schemas/CustomCostsFileMetadataHighLevel' + type: array + meta: + $ref: '#/components/schemas/CustomCostListResponseMeta' + type: object + CustomCostsFileMetadata: + description: Schema of a Custom Costs metadata. + properties: + billed_cost: + description: Total cost in the cost file. + example: 100.5 + format: double + type: number + billing_currency: + description: Currency used in the Custom Costs file. + example: USD + type: string + charge_period: + $ref: '#/components/schemas/CustomCostsFileUsageChargePeriod' + name: + description: Name of the Custom Costs file. + example: my_file.json + type: string + provider_names: + description: Providers contained in the Custom Costs file. + items: + description: Name of the provider. + example: my_provider + type: string + type: array + status: + description: Status of the Custom Costs file. + example: active + type: string + uploaded_at: + description: Timestamp, in millisecond, of the upload time of the Custom + Costs file. + example: 1704067200000 + format: double + type: number + uploaded_by: + $ref: '#/components/schemas/CustomCostsUser' + type: object + CustomCostsFileMetadataHighLevel: + description: JSON API format for a Custom Costs file. + properties: + attributes: + $ref: '#/components/schemas/CustomCostsFileMetadata' + id: + description: ID of the Custom Costs metadata. + type: string + type: + description: Type of the Custom Costs file metadata. + type: string + type: object + CustomCostsFileMetadataWithContent: + description: Schema of a cost file's metadata. + properties: + billed_cost: + description: Total cost in the cost file. + example: 100.5 + format: double + type: number + billing_currency: + description: Currency used in the Custom Costs file. + example: USD + type: string + charge_period: + $ref: '#/components/schemas/CustomCostsFileUsageChargePeriod' + content: + description: Detail of the line items from the Custom Costs file. + items: + $ref: '#/components/schemas/CustomCostsFileLineItem' + type: array + name: + description: Name of the Custom Costs file. + example: my_file.json + type: string + provider_names: + description: Providers contained in the Custom Costs file. + items: + description: Name of a provider. + example: my_provider + type: string + type: array + status: + description: Status of the Custom Costs file. + example: active + type: string + uploaded_at: + description: Timestamp in millisecond of the upload time of the Custom Costs + file. + example: 1704067200000 + format: double + type: number + uploaded_by: + $ref: '#/components/schemas/CustomCostsUser' + type: object + CustomCostsFileMetadataWithContentHighLevel: + description: JSON API format of for a Custom Costs file with content. + properties: + attributes: + $ref: '#/components/schemas/CustomCostsFileMetadataWithContent' + id: + description: ID of the Custom Costs metadata. + type: string + type: + description: Type of the Custom Costs file metadata. + type: string + type: object + CustomCostsFileUploadRequest: + description: Request for uploading a Custom Costs file. + items: + $ref: '#/components/schemas/CustomCostsFileLineItem' + type: array + CustomCostsFileUploadResponse: + description: Response for Uploaded Custom Costs files. + properties: + data: + $ref: '#/components/schemas/CustomCostsFileMetadataHighLevel' + meta: + $ref: '#/components/schemas/CustomCostUploadResponseMeta' + type: object + CustomCostsFileUsageChargePeriod: + description: Usage charge period of a Custom Costs file. + properties: + end: + description: End of the usage of the Custom Costs file. + example: 1706745600000 + format: double + type: number + start: + description: Start of the usage of the Custom Costs file. + example: 1704067200000 + format: double + type: number + type: object + CustomCostsUser: + description: Metadata of the user that has uploaded the Custom Costs file. + properties: + email: + description: The name of the Custom Costs file. + example: email.test@datadohq.com + type: string + icon: + description: The name of the Custom Costs file. + example: icon.png + type: string + name: + description: Name of the user. + example: Test User + type: string + type: object CustomDestinationAttributeTagsRestrictionListType: default: ALLOW_LIST description: 'How `forward_tags_restriction_list` parameter should be interpreted. @@ -26224,6 +26459,118 @@ paths: summary: Update Cloud Cost Management Azure config tags: - Cloud Cost Management + /api/v2/cost/custom_costs: + get: + description: List the Custom Costs files. + operationId: ListCustomCostsFiles + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileListResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: List Custom Costs files + tags: + - Cloud Cost Management + put: + description: Upload a Custom Costs file. + operationId: UploadCustomCostsFile + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileUploadRequest' + required: true + responses: + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileUploadResponse' + description: Accepted + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Upload Custom Costs file + tags: + - Cloud Cost Management + /api/v2/cost/custom_costs/{file_id}: + delete: + description: Delete the specified Custom Costs file. + operationId: DeleteCustomCostsFile + parameters: + - $ref: '#/components/parameters/FileID' + responses: + '204': + description: No Content + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Delete Custom Costs file + tags: + - Cloud Cost Management + get: + description: Fetch the specified Custom Costs file. + operationId: GetCustomCostsFile + parameters: + - $ref: '#/components/parameters/FileID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileGetResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: Get Custom Costs file + tags: + - Cloud Cost Management /api/v2/cost/enabled: get: description: Get the Cloud Cost Management activity. diff --git a/api/datadogV2/api_cloud_cost_management.go b/api/datadogV2/api_cloud_cost_management.go index e22d4e5bc6c..d3710604f4d 100644 --- a/api/datadogV2/api_cloud_cost_management.go +++ b/api/datadogV2/api_cloud_cost_management.go @@ -284,6 +284,67 @@ func (a *CloudCostManagementApi) DeleteCostAzureUCConfig(ctx _context.Context, c return localVarHTTPResponse, nil } +// DeleteCustomCostsFile Delete Custom Costs file. +// Delete the specified Custom Costs file. +func (a *CloudCostManagementApi) DeleteCustomCostsFile(ctx _context.Context, fileId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CloudCostManagementApi.DeleteCustomCostsFile") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/cost/custom_costs/{file_id}" + localVarPath = strings.Replace(localVarPath, "{"+"file_id"+"}", _neturl.PathEscape(datadog.ParameterToString(fileId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + // GetCloudCostActivity Cloud Cost Enabled. // Get the Cloud Cost Management activity. func (a *CloudCostManagementApi) GetCloudCostActivity(ctx _context.Context) (CloudCostActivityResponse, *_nethttp.Response, error) { @@ -354,6 +415,77 @@ func (a *CloudCostManagementApi) GetCloudCostActivity(ctx _context.Context) (Clo return localVarReturnValue, localVarHTTPResponse, nil } +// GetCustomCostsFile Get Custom Costs file. +// Fetch the specified Custom Costs file. +func (a *CloudCostManagementApi) GetCustomCostsFile(ctx _context.Context, fileId string) (CustomCostsFileGetResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CustomCostsFileGetResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CloudCostManagementApi.GetCustomCostsFile") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/cost/custom_costs/{file_id}" + localVarPath = strings.Replace(localVarPath, "{"+"file_id"+"}", _neturl.PathEscape(datadog.ParameterToString(fileId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // ListAWSRelatedAccounts List related AWS accounts. // List the AWS accounts in an organization by calling 'organizations:ListAccounts' from the specified management account. // @@ -567,6 +699,76 @@ func (a *CloudCostManagementApi) ListCostAzureUCConfigs(ctx _context.Context) (A return localVarReturnValue, localVarHTTPResponse, nil } +// ListCustomCostsFiles List Custom Costs files. +// List the Custom Costs files. +func (a *CloudCostManagementApi) ListCustomCostsFiles(ctx _context.Context) (CustomCostsFileListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CustomCostsFileListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CloudCostManagementApi.ListCustomCostsFiles") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/cost/custom_costs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // UpdateCostAWSCURConfig Update Cloud Cost Management AWS CUR config. // Update the status of an AWS CUR config (active/archived). func (a *CloudCostManagementApi) UpdateCostAWSCURConfig(ctx _context.Context, cloudAccountId string, body AwsCURConfigPatchRequest) (AwsCURConfigsResponse, *_nethttp.Response, error) { @@ -715,6 +917,79 @@ func (a *CloudCostManagementApi) UpdateCostAzureUCConfigs(ctx _context.Context, return localVarReturnValue, localVarHTTPResponse, nil } +// UploadCustomCostsFile Upload Custom Costs file. +// Upload a Custom Costs file. +func (a *CloudCostManagementApi) UploadCustomCostsFile(ctx _context.Context, body []CustomCostsFileLineItem) (CustomCostsFileUploadResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue CustomCostsFileUploadResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CloudCostManagementApi.UploadCustomCostsFile") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/cost/custom_costs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // NewCloudCostManagementApi Returns NewCloudCostManagementApi. func NewCloudCostManagementApi(client *datadog.APIClient) *CloudCostManagementApi { return &CloudCostManagementApi{ diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 29bf482d5ad..091793f47e7 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -57,12 +57,16 @@ // - [CloudCostManagementApi.CreateCostAzureUCConfigs] // - [CloudCostManagementApi.DeleteCostAWSCURConfig] // - [CloudCostManagementApi.DeleteCostAzureUCConfig] +// - [CloudCostManagementApi.DeleteCustomCostsFile] // - [CloudCostManagementApi.GetCloudCostActivity] +// - [CloudCostManagementApi.GetCustomCostsFile] // - [CloudCostManagementApi.ListAWSRelatedAccounts] // - [CloudCostManagementApi.ListCostAWSCURConfigs] // - [CloudCostManagementApi.ListCostAzureUCConfigs] +// - [CloudCostManagementApi.ListCustomCostsFiles] // - [CloudCostManagementApi.UpdateCostAWSCURConfig] // - [CloudCostManagementApi.UpdateCostAzureUCConfigs] +// - [CloudCostManagementApi.UploadCustomCostsFile] // - [CloudflareIntegrationApi.CreateCloudflareAccount] // - [CloudflareIntegrationApi.DeleteCloudflareAccount] // - [CloudflareIntegrationApi.GetCloudflareAccount] diff --git a/api/datadogV2/model_custom_cost_get_response_meta.go b/api/datadogV2/model_custom_cost_get_response_meta.go new file mode 100644 index 00000000000..a3214e89564 --- /dev/null +++ b/api/datadogV2/model_custom_cost_get_response_meta.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostGetResponseMeta Meta for the response from the Get Custom Costs endpoints. +type CustomCostGetResponseMeta struct { + // Version of Custom Costs file + Version *string `json:"version,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostGetResponseMeta instantiates a new CustomCostGetResponseMeta object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostGetResponseMeta() *CustomCostGetResponseMeta { + this := CustomCostGetResponseMeta{} + return &this +} + +// NewCustomCostGetResponseMetaWithDefaults instantiates a new CustomCostGetResponseMeta object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostGetResponseMetaWithDefaults() *CustomCostGetResponseMeta { + this := CustomCostGetResponseMeta{} + return &this +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *CustomCostGetResponseMeta) GetVersion() string { + if o == nil || o.Version == nil { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostGetResponseMeta) GetVersionOk() (*string, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *CustomCostGetResponseMeta) HasVersion() bool { + return o != nil && o.Version != nil +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *CustomCostGetResponseMeta) SetVersion(v string) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostGetResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostGetResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Version *string `json:"version,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"version"}) + } else { + return err + } + o.Version = all.Version + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_custom_cost_list_response_meta.go b/api/datadogV2/model_custom_cost_list_response_meta.go new file mode 100644 index 00000000000..d07d1db07ff --- /dev/null +++ b/api/datadogV2/model_custom_cost_list_response_meta.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostListResponseMeta Meta for the response from the List Custom Costs endpoints. +type CustomCostListResponseMeta struct { + // Number of Custom Costs files returned by the List Custom Costs endpoint + TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` + // Version of Custom Costs file + Version *string `json:"version,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostListResponseMeta instantiates a new CustomCostListResponseMeta object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostListResponseMeta() *CustomCostListResponseMeta { + this := CustomCostListResponseMeta{} + return &this +} + +// NewCustomCostListResponseMetaWithDefaults instantiates a new CustomCostListResponseMeta object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostListResponseMetaWithDefaults() *CustomCostListResponseMeta { + this := CustomCostListResponseMeta{} + return &this +} + +// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. +func (o *CustomCostListResponseMeta) GetTotalFilteredCount() int64 { + if o == nil || o.TotalFilteredCount == nil { + var ret int64 + return ret + } + return *o.TotalFilteredCount +} + +// GetTotalFilteredCountOk returns a tuple with the TotalFilteredCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostListResponseMeta) GetTotalFilteredCountOk() (*int64, bool) { + if o == nil || o.TotalFilteredCount == nil { + return nil, false + } + return o.TotalFilteredCount, true +} + +// HasTotalFilteredCount returns a boolean if a field has been set. +func (o *CustomCostListResponseMeta) HasTotalFilteredCount() bool { + return o != nil && o.TotalFilteredCount != nil +} + +// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. +func (o *CustomCostListResponseMeta) SetTotalFilteredCount(v int64) { + o.TotalFilteredCount = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *CustomCostListResponseMeta) GetVersion() string { + if o == nil || o.Version == nil { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostListResponseMeta) GetVersionOk() (*string, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *CustomCostListResponseMeta) HasVersion() bool { + return o != nil && o.Version != nil +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *CustomCostListResponseMeta) SetVersion(v string) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostListResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.TotalFilteredCount != nil { + toSerialize["total_filtered_count"] = o.TotalFilteredCount + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostListResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` + Version *string `json:"version,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"total_filtered_count", "version"}) + } else { + return err + } + o.TotalFilteredCount = all.TotalFilteredCount + o.Version = all.Version + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_custom_cost_upload_response_meta.go b/api/datadogV2/model_custom_cost_upload_response_meta.go new file mode 100644 index 00000000000..e61b7ebc21e --- /dev/null +++ b/api/datadogV2/model_custom_cost_upload_response_meta.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostUploadResponseMeta Meta for the response from the Upload Custom Costs endpoints. +type CustomCostUploadResponseMeta struct { + // Version of Custom Costs file + Version *string `json:"version,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostUploadResponseMeta instantiates a new CustomCostUploadResponseMeta object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostUploadResponseMeta() *CustomCostUploadResponseMeta { + this := CustomCostUploadResponseMeta{} + return &this +} + +// NewCustomCostUploadResponseMetaWithDefaults instantiates a new CustomCostUploadResponseMeta object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostUploadResponseMetaWithDefaults() *CustomCostUploadResponseMeta { + this := CustomCostUploadResponseMeta{} + return &this +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *CustomCostUploadResponseMeta) GetVersion() string { + if o == nil || o.Version == nil { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostUploadResponseMeta) GetVersionOk() (*string, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *CustomCostUploadResponseMeta) HasVersion() bool { + return o != nil && o.Version != nil +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *CustomCostUploadResponseMeta) SetVersion(v string) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostUploadResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostUploadResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Version *string `json:"version,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"version"}) + } else { + return err + } + o.Version = all.Version + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_custom_costs_file_get_response.go b/api/datadogV2/model_custom_costs_file_get_response.go new file mode 100644 index 00000000000..45cf0b1bc15 --- /dev/null +++ b/api/datadogV2/model_custom_costs_file_get_response.go @@ -0,0 +1,149 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostsFileGetResponse Response for Get Custom Costs files. +type CustomCostsFileGetResponse struct { + // JSON API format of for a Custom Costs file with content. + Data *CustomCostsFileMetadataWithContentHighLevel `json:"data,omitempty"` + // Meta for the response from the Get Custom Costs endpoints. + Meta *CustomCostGetResponseMeta `json:"meta,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostsFileGetResponse instantiates a new CustomCostsFileGetResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostsFileGetResponse() *CustomCostsFileGetResponse { + this := CustomCostsFileGetResponse{} + return &this +} + +// NewCustomCostsFileGetResponseWithDefaults instantiates a new CustomCostsFileGetResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostsFileGetResponseWithDefaults() *CustomCostsFileGetResponse { + this := CustomCostsFileGetResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CustomCostsFileGetResponse) GetData() CustomCostsFileMetadataWithContentHighLevel { + if o == nil || o.Data == nil { + var ret CustomCostsFileMetadataWithContentHighLevel + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileGetResponse) GetDataOk() (*CustomCostsFileMetadataWithContentHighLevel, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CustomCostsFileGetResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given CustomCostsFileMetadataWithContentHighLevel and assigns it to the Data field. +func (o *CustomCostsFileGetResponse) SetData(v CustomCostsFileMetadataWithContentHighLevel) { + o.Data = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *CustomCostsFileGetResponse) GetMeta() CustomCostGetResponseMeta { + if o == nil || o.Meta == nil { + var ret CustomCostGetResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileGetResponse) GetMetaOk() (*CustomCostGetResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *CustomCostsFileGetResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given CustomCostGetResponseMeta and assigns it to the Meta field. +func (o *CustomCostsFileGetResponse) SetMeta(v CustomCostGetResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostsFileGetResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostsFileGetResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CustomCostsFileMetadataWithContentHighLevel `json:"data,omitempty"` + Meta *CustomCostGetResponseMeta `json:"meta,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_custom_costs_file_line_item.go b/api/datadogV2/model_custom_costs_file_line_item.go new file mode 100644 index 00000000000..74d639d1315 --- /dev/null +++ b/api/datadogV2/model_custom_costs_file_line_item.go @@ -0,0 +1,312 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostsFileLineItem Line item details from a Custom Costs file. +type CustomCostsFileLineItem struct { + // Total cost in the cost file. + BilledCost *float64 `json:"BilledCost,omitempty"` + // Currency used in the Custom Costs file. + BillingCurrency *string `json:"BillingCurrency,omitempty"` + // Description for the line item cost. + ChargeDescription *string `json:"ChargeDescription,omitempty"` + // End date of the usage charge. + ChargePeriodEnd *string `json:"ChargePeriodEnd,omitempty"` + // Start date of the usage charge. + ChargePeriodStart *string `json:"ChargePeriodStart,omitempty"` + // Name of the provider for the line item. + ProviderName *string `json:"ProviderName,omitempty"` + // Additional tags for the line item. + Tags map[string]string `json:"Tags,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostsFileLineItem instantiates a new CustomCostsFileLineItem object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostsFileLineItem() *CustomCostsFileLineItem { + this := CustomCostsFileLineItem{} + return &this +} + +// NewCustomCostsFileLineItemWithDefaults instantiates a new CustomCostsFileLineItem object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostsFileLineItemWithDefaults() *CustomCostsFileLineItem { + this := CustomCostsFileLineItem{} + return &this +} + +// GetBilledCost returns the BilledCost field value if set, zero value otherwise. +func (o *CustomCostsFileLineItem) GetBilledCost() float64 { + if o == nil || o.BilledCost == nil { + var ret float64 + return ret + } + return *o.BilledCost +} + +// GetBilledCostOk returns a tuple with the BilledCost field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileLineItem) GetBilledCostOk() (*float64, bool) { + if o == nil || o.BilledCost == nil { + return nil, false + } + return o.BilledCost, true +} + +// HasBilledCost returns a boolean if a field has been set. +func (o *CustomCostsFileLineItem) HasBilledCost() bool { + return o != nil && o.BilledCost != nil +} + +// SetBilledCost gets a reference to the given float64 and assigns it to the BilledCost field. +func (o *CustomCostsFileLineItem) SetBilledCost(v float64) { + o.BilledCost = &v +} + +// GetBillingCurrency returns the BillingCurrency field value if set, zero value otherwise. +func (o *CustomCostsFileLineItem) GetBillingCurrency() string { + if o == nil || o.BillingCurrency == nil { + var ret string + return ret + } + return *o.BillingCurrency +} + +// GetBillingCurrencyOk returns a tuple with the BillingCurrency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileLineItem) GetBillingCurrencyOk() (*string, bool) { + if o == nil || o.BillingCurrency == nil { + return nil, false + } + return o.BillingCurrency, true +} + +// HasBillingCurrency returns a boolean if a field has been set. +func (o *CustomCostsFileLineItem) HasBillingCurrency() bool { + return o != nil && o.BillingCurrency != nil +} + +// SetBillingCurrency gets a reference to the given string and assigns it to the BillingCurrency field. +func (o *CustomCostsFileLineItem) SetBillingCurrency(v string) { + o.BillingCurrency = &v +} + +// GetChargeDescription returns the ChargeDescription field value if set, zero value otherwise. +func (o *CustomCostsFileLineItem) GetChargeDescription() string { + if o == nil || o.ChargeDescription == nil { + var ret string + return ret + } + return *o.ChargeDescription +} + +// GetChargeDescriptionOk returns a tuple with the ChargeDescription field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileLineItem) GetChargeDescriptionOk() (*string, bool) { + if o == nil || o.ChargeDescription == nil { + return nil, false + } + return o.ChargeDescription, true +} + +// HasChargeDescription returns a boolean if a field has been set. +func (o *CustomCostsFileLineItem) HasChargeDescription() bool { + return o != nil && o.ChargeDescription != nil +} + +// SetChargeDescription gets a reference to the given string and assigns it to the ChargeDescription field. +func (o *CustomCostsFileLineItem) SetChargeDescription(v string) { + o.ChargeDescription = &v +} + +// GetChargePeriodEnd returns the ChargePeriodEnd field value if set, zero value otherwise. +func (o *CustomCostsFileLineItem) GetChargePeriodEnd() string { + if o == nil || o.ChargePeriodEnd == nil { + var ret string + return ret + } + return *o.ChargePeriodEnd +} + +// GetChargePeriodEndOk returns a tuple with the ChargePeriodEnd field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileLineItem) GetChargePeriodEndOk() (*string, bool) { + if o == nil || o.ChargePeriodEnd == nil { + return nil, false + } + return o.ChargePeriodEnd, true +} + +// HasChargePeriodEnd returns a boolean if a field has been set. +func (o *CustomCostsFileLineItem) HasChargePeriodEnd() bool { + return o != nil && o.ChargePeriodEnd != nil +} + +// SetChargePeriodEnd gets a reference to the given string and assigns it to the ChargePeriodEnd field. +func (o *CustomCostsFileLineItem) SetChargePeriodEnd(v string) { + o.ChargePeriodEnd = &v +} + +// GetChargePeriodStart returns the ChargePeriodStart field value if set, zero value otherwise. +func (o *CustomCostsFileLineItem) GetChargePeriodStart() string { + if o == nil || o.ChargePeriodStart == nil { + var ret string + return ret + } + return *o.ChargePeriodStart +} + +// GetChargePeriodStartOk returns a tuple with the ChargePeriodStart field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileLineItem) GetChargePeriodStartOk() (*string, bool) { + if o == nil || o.ChargePeriodStart == nil { + return nil, false + } + return o.ChargePeriodStart, true +} + +// HasChargePeriodStart returns a boolean if a field has been set. +func (o *CustomCostsFileLineItem) HasChargePeriodStart() bool { + return o != nil && o.ChargePeriodStart != nil +} + +// SetChargePeriodStart gets a reference to the given string and assigns it to the ChargePeriodStart field. +func (o *CustomCostsFileLineItem) SetChargePeriodStart(v string) { + o.ChargePeriodStart = &v +} + +// GetProviderName returns the ProviderName field value if set, zero value otherwise. +func (o *CustomCostsFileLineItem) GetProviderName() string { + if o == nil || o.ProviderName == nil { + var ret string + return ret + } + return *o.ProviderName +} + +// GetProviderNameOk returns a tuple with the ProviderName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileLineItem) GetProviderNameOk() (*string, bool) { + if o == nil || o.ProviderName == nil { + return nil, false + } + return o.ProviderName, true +} + +// HasProviderName returns a boolean if a field has been set. +func (o *CustomCostsFileLineItem) HasProviderName() bool { + return o != nil && o.ProviderName != nil +} + +// SetProviderName gets a reference to the given string and assigns it to the ProviderName field. +func (o *CustomCostsFileLineItem) SetProviderName(v string) { + o.ProviderName = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *CustomCostsFileLineItem) GetTags() map[string]string { + if o == nil || o.Tags == nil { + var ret map[string]string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileLineItem) GetTagsOk() (*map[string]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return &o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *CustomCostsFileLineItem) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given map[string]string and assigns it to the Tags field. +func (o *CustomCostsFileLineItem) SetTags(v map[string]string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostsFileLineItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.BilledCost != nil { + toSerialize["BilledCost"] = o.BilledCost + } + if o.BillingCurrency != nil { + toSerialize["BillingCurrency"] = o.BillingCurrency + } + if o.ChargeDescription != nil { + toSerialize["ChargeDescription"] = o.ChargeDescription + } + if o.ChargePeriodEnd != nil { + toSerialize["ChargePeriodEnd"] = o.ChargePeriodEnd + } + if o.ChargePeriodStart != nil { + toSerialize["ChargePeriodStart"] = o.ChargePeriodStart + } + if o.ProviderName != nil { + toSerialize["ProviderName"] = o.ProviderName + } + if o.Tags != nil { + toSerialize["Tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostsFileLineItem) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + BilledCost *float64 `json:"BilledCost,omitempty"` + BillingCurrency *string `json:"BillingCurrency,omitempty"` + ChargeDescription *string `json:"ChargeDescription,omitempty"` + ChargePeriodEnd *string `json:"ChargePeriodEnd,omitempty"` + ChargePeriodStart *string `json:"ChargePeriodStart,omitempty"` + ProviderName *string `json:"ProviderName,omitempty"` + Tags map[string]string `json:"Tags,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"BilledCost", "BillingCurrency", "ChargeDescription", "ChargePeriodEnd", "ChargePeriodStart", "ProviderName", "Tags"}) + } else { + return err + } + o.BilledCost = all.BilledCost + o.BillingCurrency = all.BillingCurrency + o.ChargeDescription = all.ChargeDescription + o.ChargePeriodEnd = all.ChargePeriodEnd + o.ChargePeriodStart = all.ChargePeriodStart + o.ProviderName = all.ProviderName + o.Tags = all.Tags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_custom_costs_file_list_response.go b/api/datadogV2/model_custom_costs_file_list_response.go new file mode 100644 index 00000000000..c3f75a2d369 --- /dev/null +++ b/api/datadogV2/model_custom_costs_file_list_response.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostsFileListResponse Response for List Custom Costs files. +type CustomCostsFileListResponse struct { + // List of Custom Costs files. + Data []CustomCostsFileMetadataHighLevel `json:"data,omitempty"` + // Meta for the response from the List Custom Costs endpoints. + Meta *CustomCostListResponseMeta `json:"meta,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostsFileListResponse instantiates a new CustomCostsFileListResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostsFileListResponse() *CustomCostsFileListResponse { + this := CustomCostsFileListResponse{} + return &this +} + +// NewCustomCostsFileListResponseWithDefaults instantiates a new CustomCostsFileListResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostsFileListResponseWithDefaults() *CustomCostsFileListResponse { + this := CustomCostsFileListResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CustomCostsFileListResponse) GetData() []CustomCostsFileMetadataHighLevel { + if o == nil || o.Data == nil { + var ret []CustomCostsFileMetadataHighLevel + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileListResponse) GetDataOk() (*[]CustomCostsFileMetadataHighLevel, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CustomCostsFileListResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []CustomCostsFileMetadataHighLevel and assigns it to the Data field. +func (o *CustomCostsFileListResponse) SetData(v []CustomCostsFileMetadataHighLevel) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *CustomCostsFileListResponse) GetMeta() CustomCostListResponseMeta { + if o == nil || o.Meta == nil { + var ret CustomCostListResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileListResponse) GetMetaOk() (*CustomCostListResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *CustomCostsFileListResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given CustomCostListResponseMeta and assigns it to the Meta field. +func (o *CustomCostsFileListResponse) SetMeta(v CustomCostListResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostsFileListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostsFileListResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []CustomCostsFileMetadataHighLevel `json:"data,omitempty"` + Meta *CustomCostListResponseMeta `json:"meta,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) + } else { + return err + } + + hasInvalidField := false + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_custom_costs_file_metadata.go b/api/datadogV2/model_custom_costs_file_metadata.go new file mode 100644 index 00000000000..9e226f82c46 --- /dev/null +++ b/api/datadogV2/model_custom_costs_file_metadata.go @@ -0,0 +1,359 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostsFileMetadata Schema of a Custom Costs metadata. +type CustomCostsFileMetadata struct { + // Total cost in the cost file. + BilledCost *float64 `json:"billed_cost,omitempty"` + // Currency used in the Custom Costs file. + BillingCurrency *string `json:"billing_currency,omitempty"` + // Usage charge period of a Custom Costs file. + ChargePeriod *CustomCostsFileUsageChargePeriod `json:"charge_period,omitempty"` + // Name of the Custom Costs file. + Name *string `json:"name,omitempty"` + // Providers contained in the Custom Costs file. + ProviderNames []string `json:"provider_names,omitempty"` + // Status of the Custom Costs file. + Status *string `json:"status,omitempty"` + // Timestamp, in millisecond, of the upload time of the Custom Costs file. + UploadedAt *float64 `json:"uploaded_at,omitempty"` + // Metadata of the user that has uploaded the Custom Costs file. + UploadedBy *CustomCostsUser `json:"uploaded_by,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostsFileMetadata instantiates a new CustomCostsFileMetadata object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostsFileMetadata() *CustomCostsFileMetadata { + this := CustomCostsFileMetadata{} + return &this +} + +// NewCustomCostsFileMetadataWithDefaults instantiates a new CustomCostsFileMetadata object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostsFileMetadataWithDefaults() *CustomCostsFileMetadata { + this := CustomCostsFileMetadata{} + return &this +} + +// GetBilledCost returns the BilledCost field value if set, zero value otherwise. +func (o *CustomCostsFileMetadata) GetBilledCost() float64 { + if o == nil || o.BilledCost == nil { + var ret float64 + return ret + } + return *o.BilledCost +} + +// GetBilledCostOk returns a tuple with the BilledCost field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadata) GetBilledCostOk() (*float64, bool) { + if o == nil || o.BilledCost == nil { + return nil, false + } + return o.BilledCost, true +} + +// HasBilledCost returns a boolean if a field has been set. +func (o *CustomCostsFileMetadata) HasBilledCost() bool { + return o != nil && o.BilledCost != nil +} + +// SetBilledCost gets a reference to the given float64 and assigns it to the BilledCost field. +func (o *CustomCostsFileMetadata) SetBilledCost(v float64) { + o.BilledCost = &v +} + +// GetBillingCurrency returns the BillingCurrency field value if set, zero value otherwise. +func (o *CustomCostsFileMetadata) GetBillingCurrency() string { + if o == nil || o.BillingCurrency == nil { + var ret string + return ret + } + return *o.BillingCurrency +} + +// GetBillingCurrencyOk returns a tuple with the BillingCurrency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadata) GetBillingCurrencyOk() (*string, bool) { + if o == nil || o.BillingCurrency == nil { + return nil, false + } + return o.BillingCurrency, true +} + +// HasBillingCurrency returns a boolean if a field has been set. +func (o *CustomCostsFileMetadata) HasBillingCurrency() bool { + return o != nil && o.BillingCurrency != nil +} + +// SetBillingCurrency gets a reference to the given string and assigns it to the BillingCurrency field. +func (o *CustomCostsFileMetadata) SetBillingCurrency(v string) { + o.BillingCurrency = &v +} + +// GetChargePeriod returns the ChargePeriod field value if set, zero value otherwise. +func (o *CustomCostsFileMetadata) GetChargePeriod() CustomCostsFileUsageChargePeriod { + if o == nil || o.ChargePeriod == nil { + var ret CustomCostsFileUsageChargePeriod + return ret + } + return *o.ChargePeriod +} + +// GetChargePeriodOk returns a tuple with the ChargePeriod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadata) GetChargePeriodOk() (*CustomCostsFileUsageChargePeriod, bool) { + if o == nil || o.ChargePeriod == nil { + return nil, false + } + return o.ChargePeriod, true +} + +// HasChargePeriod returns a boolean if a field has been set. +func (o *CustomCostsFileMetadata) HasChargePeriod() bool { + return o != nil && o.ChargePeriod != nil +} + +// SetChargePeriod gets a reference to the given CustomCostsFileUsageChargePeriod and assigns it to the ChargePeriod field. +func (o *CustomCostsFileMetadata) SetChargePeriod(v CustomCostsFileUsageChargePeriod) { + o.ChargePeriod = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CustomCostsFileMetadata) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadata) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CustomCostsFileMetadata) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CustomCostsFileMetadata) SetName(v string) { + o.Name = &v +} + +// GetProviderNames returns the ProviderNames field value if set, zero value otherwise. +func (o *CustomCostsFileMetadata) GetProviderNames() []string { + if o == nil || o.ProviderNames == nil { + var ret []string + return ret + } + return o.ProviderNames +} + +// GetProviderNamesOk returns a tuple with the ProviderNames field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadata) GetProviderNamesOk() (*[]string, bool) { + if o == nil || o.ProviderNames == nil { + return nil, false + } + return &o.ProviderNames, true +} + +// HasProviderNames returns a boolean if a field has been set. +func (o *CustomCostsFileMetadata) HasProviderNames() bool { + return o != nil && o.ProviderNames != nil +} + +// SetProviderNames gets a reference to the given []string and assigns it to the ProviderNames field. +func (o *CustomCostsFileMetadata) SetProviderNames(v []string) { + o.ProviderNames = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CustomCostsFileMetadata) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadata) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *CustomCostsFileMetadata) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CustomCostsFileMetadata) SetStatus(v string) { + o.Status = &v +} + +// GetUploadedAt returns the UploadedAt field value if set, zero value otherwise. +func (o *CustomCostsFileMetadata) GetUploadedAt() float64 { + if o == nil || o.UploadedAt == nil { + var ret float64 + return ret + } + return *o.UploadedAt +} + +// GetUploadedAtOk returns a tuple with the UploadedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadata) GetUploadedAtOk() (*float64, bool) { + if o == nil || o.UploadedAt == nil { + return nil, false + } + return o.UploadedAt, true +} + +// HasUploadedAt returns a boolean if a field has been set. +func (o *CustomCostsFileMetadata) HasUploadedAt() bool { + return o != nil && o.UploadedAt != nil +} + +// SetUploadedAt gets a reference to the given float64 and assigns it to the UploadedAt field. +func (o *CustomCostsFileMetadata) SetUploadedAt(v float64) { + o.UploadedAt = &v +} + +// GetUploadedBy returns the UploadedBy field value if set, zero value otherwise. +func (o *CustomCostsFileMetadata) GetUploadedBy() CustomCostsUser { + if o == nil || o.UploadedBy == nil { + var ret CustomCostsUser + return ret + } + return *o.UploadedBy +} + +// GetUploadedByOk returns a tuple with the UploadedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadata) GetUploadedByOk() (*CustomCostsUser, bool) { + if o == nil || o.UploadedBy == nil { + return nil, false + } + return o.UploadedBy, true +} + +// HasUploadedBy returns a boolean if a field has been set. +func (o *CustomCostsFileMetadata) HasUploadedBy() bool { + return o != nil && o.UploadedBy != nil +} + +// SetUploadedBy gets a reference to the given CustomCostsUser and assigns it to the UploadedBy field. +func (o *CustomCostsFileMetadata) SetUploadedBy(v CustomCostsUser) { + o.UploadedBy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostsFileMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.BilledCost != nil { + toSerialize["billed_cost"] = o.BilledCost + } + if o.BillingCurrency != nil { + toSerialize["billing_currency"] = o.BillingCurrency + } + if o.ChargePeriod != nil { + toSerialize["charge_period"] = o.ChargePeriod + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.ProviderNames != nil { + toSerialize["provider_names"] = o.ProviderNames + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.UploadedAt != nil { + toSerialize["uploaded_at"] = o.UploadedAt + } + if o.UploadedBy != nil { + toSerialize["uploaded_by"] = o.UploadedBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostsFileMetadata) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + BilledCost *float64 `json:"billed_cost,omitempty"` + BillingCurrency *string `json:"billing_currency,omitempty"` + ChargePeriod *CustomCostsFileUsageChargePeriod `json:"charge_period,omitempty"` + Name *string `json:"name,omitempty"` + ProviderNames []string `json:"provider_names,omitempty"` + Status *string `json:"status,omitempty"` + UploadedAt *float64 `json:"uploaded_at,omitempty"` + UploadedBy *CustomCostsUser `json:"uploaded_by,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"billed_cost", "billing_currency", "charge_period", "name", "provider_names", "status", "uploaded_at", "uploaded_by"}) + } else { + return err + } + + hasInvalidField := false + o.BilledCost = all.BilledCost + o.BillingCurrency = all.BillingCurrency + if all.ChargePeriod != nil && all.ChargePeriod.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ChargePeriod = all.ChargePeriod + o.Name = all.Name + o.ProviderNames = all.ProviderNames + o.Status = all.Status + o.UploadedAt = all.UploadedAt + if all.UploadedBy != nil && all.UploadedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.UploadedBy = all.UploadedBy + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_custom_costs_file_metadata_high_level.go b/api/datadogV2/model_custom_costs_file_metadata_high_level.go new file mode 100644 index 00000000000..57e9d953ecb --- /dev/null +++ b/api/datadogV2/model_custom_costs_file_metadata_high_level.go @@ -0,0 +1,181 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostsFileMetadataHighLevel JSON API format for a Custom Costs file. +type CustomCostsFileMetadataHighLevel struct { + // Schema of a Custom Costs metadata. + Attributes *CustomCostsFileMetadata `json:"attributes,omitempty"` + // ID of the Custom Costs metadata. + Id *string `json:"id,omitempty"` + // Type of the Custom Costs file metadata. + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostsFileMetadataHighLevel instantiates a new CustomCostsFileMetadataHighLevel object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostsFileMetadataHighLevel() *CustomCostsFileMetadataHighLevel { + this := CustomCostsFileMetadataHighLevel{} + return &this +} + +// NewCustomCostsFileMetadataHighLevelWithDefaults instantiates a new CustomCostsFileMetadataHighLevel object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostsFileMetadataHighLevelWithDefaults() *CustomCostsFileMetadataHighLevel { + this := CustomCostsFileMetadataHighLevel{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataHighLevel) GetAttributes() CustomCostsFileMetadata { + if o == nil || o.Attributes == nil { + var ret CustomCostsFileMetadata + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataHighLevel) GetAttributesOk() (*CustomCostsFileMetadata, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataHighLevel) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given CustomCostsFileMetadata and assigns it to the Attributes field. +func (o *CustomCostsFileMetadataHighLevel) SetAttributes(v CustomCostsFileMetadata) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataHighLevel) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataHighLevel) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataHighLevel) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CustomCostsFileMetadataHighLevel) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataHighLevel) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataHighLevel) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataHighLevel) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CustomCostsFileMetadataHighLevel) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostsFileMetadataHighLevel) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostsFileMetadataHighLevel) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CustomCostsFileMetadata `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_custom_costs_file_metadata_with_content.go b/api/datadogV2/model_custom_costs_file_metadata_with_content.go new file mode 100644 index 00000000000..f8c0b8c5721 --- /dev/null +++ b/api/datadogV2/model_custom_costs_file_metadata_with_content.go @@ -0,0 +1,394 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostsFileMetadataWithContent Schema of a cost file's metadata. +type CustomCostsFileMetadataWithContent struct { + // Total cost in the cost file. + BilledCost *float64 `json:"billed_cost,omitempty"` + // Currency used in the Custom Costs file. + BillingCurrency *string `json:"billing_currency,omitempty"` + // Usage charge period of a Custom Costs file. + ChargePeriod *CustomCostsFileUsageChargePeriod `json:"charge_period,omitempty"` + // Detail of the line items from the Custom Costs file. + Content []CustomCostsFileLineItem `json:"content,omitempty"` + // Name of the Custom Costs file. + Name *string `json:"name,omitempty"` + // Providers contained in the Custom Costs file. + ProviderNames []string `json:"provider_names,omitempty"` + // Status of the Custom Costs file. + Status *string `json:"status,omitempty"` + // Timestamp in millisecond of the upload time of the Custom Costs file. + UploadedAt *float64 `json:"uploaded_at,omitempty"` + // Metadata of the user that has uploaded the Custom Costs file. + UploadedBy *CustomCostsUser `json:"uploaded_by,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostsFileMetadataWithContent instantiates a new CustomCostsFileMetadataWithContent object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostsFileMetadataWithContent() *CustomCostsFileMetadataWithContent { + this := CustomCostsFileMetadataWithContent{} + return &this +} + +// NewCustomCostsFileMetadataWithContentWithDefaults instantiates a new CustomCostsFileMetadataWithContent object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostsFileMetadataWithContentWithDefaults() *CustomCostsFileMetadataWithContent { + this := CustomCostsFileMetadataWithContent{} + return &this +} + +// GetBilledCost returns the BilledCost field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContent) GetBilledCost() float64 { + if o == nil || o.BilledCost == nil { + var ret float64 + return ret + } + return *o.BilledCost +} + +// GetBilledCostOk returns a tuple with the BilledCost field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContent) GetBilledCostOk() (*float64, bool) { + if o == nil || o.BilledCost == nil { + return nil, false + } + return o.BilledCost, true +} + +// HasBilledCost returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContent) HasBilledCost() bool { + return o != nil && o.BilledCost != nil +} + +// SetBilledCost gets a reference to the given float64 and assigns it to the BilledCost field. +func (o *CustomCostsFileMetadataWithContent) SetBilledCost(v float64) { + o.BilledCost = &v +} + +// GetBillingCurrency returns the BillingCurrency field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContent) GetBillingCurrency() string { + if o == nil || o.BillingCurrency == nil { + var ret string + return ret + } + return *o.BillingCurrency +} + +// GetBillingCurrencyOk returns a tuple with the BillingCurrency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContent) GetBillingCurrencyOk() (*string, bool) { + if o == nil || o.BillingCurrency == nil { + return nil, false + } + return o.BillingCurrency, true +} + +// HasBillingCurrency returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContent) HasBillingCurrency() bool { + return o != nil && o.BillingCurrency != nil +} + +// SetBillingCurrency gets a reference to the given string and assigns it to the BillingCurrency field. +func (o *CustomCostsFileMetadataWithContent) SetBillingCurrency(v string) { + o.BillingCurrency = &v +} + +// GetChargePeriod returns the ChargePeriod field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContent) GetChargePeriod() CustomCostsFileUsageChargePeriod { + if o == nil || o.ChargePeriod == nil { + var ret CustomCostsFileUsageChargePeriod + return ret + } + return *o.ChargePeriod +} + +// GetChargePeriodOk returns a tuple with the ChargePeriod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContent) GetChargePeriodOk() (*CustomCostsFileUsageChargePeriod, bool) { + if o == nil || o.ChargePeriod == nil { + return nil, false + } + return o.ChargePeriod, true +} + +// HasChargePeriod returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContent) HasChargePeriod() bool { + return o != nil && o.ChargePeriod != nil +} + +// SetChargePeriod gets a reference to the given CustomCostsFileUsageChargePeriod and assigns it to the ChargePeriod field. +func (o *CustomCostsFileMetadataWithContent) SetChargePeriod(v CustomCostsFileUsageChargePeriod) { + o.ChargePeriod = &v +} + +// GetContent returns the Content field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContent) GetContent() []CustomCostsFileLineItem { + if o == nil || o.Content == nil { + var ret []CustomCostsFileLineItem + return ret + } + return o.Content +} + +// GetContentOk returns a tuple with the Content field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContent) GetContentOk() (*[]CustomCostsFileLineItem, bool) { + if o == nil || o.Content == nil { + return nil, false + } + return &o.Content, true +} + +// HasContent returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContent) HasContent() bool { + return o != nil && o.Content != nil +} + +// SetContent gets a reference to the given []CustomCostsFileLineItem and assigns it to the Content field. +func (o *CustomCostsFileMetadataWithContent) SetContent(v []CustomCostsFileLineItem) { + o.Content = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContent) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContent) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContent) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CustomCostsFileMetadataWithContent) SetName(v string) { + o.Name = &v +} + +// GetProviderNames returns the ProviderNames field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContent) GetProviderNames() []string { + if o == nil || o.ProviderNames == nil { + var ret []string + return ret + } + return o.ProviderNames +} + +// GetProviderNamesOk returns a tuple with the ProviderNames field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContent) GetProviderNamesOk() (*[]string, bool) { + if o == nil || o.ProviderNames == nil { + return nil, false + } + return &o.ProviderNames, true +} + +// HasProviderNames returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContent) HasProviderNames() bool { + return o != nil && o.ProviderNames != nil +} + +// SetProviderNames gets a reference to the given []string and assigns it to the ProviderNames field. +func (o *CustomCostsFileMetadataWithContent) SetProviderNames(v []string) { + o.ProviderNames = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContent) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContent) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContent) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CustomCostsFileMetadataWithContent) SetStatus(v string) { + o.Status = &v +} + +// GetUploadedAt returns the UploadedAt field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContent) GetUploadedAt() float64 { + if o == nil || o.UploadedAt == nil { + var ret float64 + return ret + } + return *o.UploadedAt +} + +// GetUploadedAtOk returns a tuple with the UploadedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContent) GetUploadedAtOk() (*float64, bool) { + if o == nil || o.UploadedAt == nil { + return nil, false + } + return o.UploadedAt, true +} + +// HasUploadedAt returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContent) HasUploadedAt() bool { + return o != nil && o.UploadedAt != nil +} + +// SetUploadedAt gets a reference to the given float64 and assigns it to the UploadedAt field. +func (o *CustomCostsFileMetadataWithContent) SetUploadedAt(v float64) { + o.UploadedAt = &v +} + +// GetUploadedBy returns the UploadedBy field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContent) GetUploadedBy() CustomCostsUser { + if o == nil || o.UploadedBy == nil { + var ret CustomCostsUser + return ret + } + return *o.UploadedBy +} + +// GetUploadedByOk returns a tuple with the UploadedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContent) GetUploadedByOk() (*CustomCostsUser, bool) { + if o == nil || o.UploadedBy == nil { + return nil, false + } + return o.UploadedBy, true +} + +// HasUploadedBy returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContent) HasUploadedBy() bool { + return o != nil && o.UploadedBy != nil +} + +// SetUploadedBy gets a reference to the given CustomCostsUser and assigns it to the UploadedBy field. +func (o *CustomCostsFileMetadataWithContent) SetUploadedBy(v CustomCostsUser) { + o.UploadedBy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostsFileMetadataWithContent) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.BilledCost != nil { + toSerialize["billed_cost"] = o.BilledCost + } + if o.BillingCurrency != nil { + toSerialize["billing_currency"] = o.BillingCurrency + } + if o.ChargePeriod != nil { + toSerialize["charge_period"] = o.ChargePeriod + } + if o.Content != nil { + toSerialize["content"] = o.Content + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.ProviderNames != nil { + toSerialize["provider_names"] = o.ProviderNames + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.UploadedAt != nil { + toSerialize["uploaded_at"] = o.UploadedAt + } + if o.UploadedBy != nil { + toSerialize["uploaded_by"] = o.UploadedBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostsFileMetadataWithContent) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + BilledCost *float64 `json:"billed_cost,omitempty"` + BillingCurrency *string `json:"billing_currency,omitempty"` + ChargePeriod *CustomCostsFileUsageChargePeriod `json:"charge_period,omitempty"` + Content []CustomCostsFileLineItem `json:"content,omitempty"` + Name *string `json:"name,omitempty"` + ProviderNames []string `json:"provider_names,omitempty"` + Status *string `json:"status,omitempty"` + UploadedAt *float64 `json:"uploaded_at,omitempty"` + UploadedBy *CustomCostsUser `json:"uploaded_by,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"billed_cost", "billing_currency", "charge_period", "content", "name", "provider_names", "status", "uploaded_at", "uploaded_by"}) + } else { + return err + } + + hasInvalidField := false + o.BilledCost = all.BilledCost + o.BillingCurrency = all.BillingCurrency + if all.ChargePeriod != nil && all.ChargePeriod.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ChargePeriod = all.ChargePeriod + o.Content = all.Content + o.Name = all.Name + o.ProviderNames = all.ProviderNames + o.Status = all.Status + o.UploadedAt = all.UploadedAt + if all.UploadedBy != nil && all.UploadedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.UploadedBy = all.UploadedBy + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_custom_costs_file_metadata_with_content_high_level.go b/api/datadogV2/model_custom_costs_file_metadata_with_content_high_level.go new file mode 100644 index 00000000000..e23c38135ec --- /dev/null +++ b/api/datadogV2/model_custom_costs_file_metadata_with_content_high_level.go @@ -0,0 +1,181 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostsFileMetadataWithContentHighLevel JSON API format of for a Custom Costs file with content. +type CustomCostsFileMetadataWithContentHighLevel struct { + // Schema of a cost file's metadata. + Attributes *CustomCostsFileMetadataWithContent `json:"attributes,omitempty"` + // ID of the Custom Costs metadata. + Id *string `json:"id,omitempty"` + // Type of the Custom Costs file metadata. + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostsFileMetadataWithContentHighLevel instantiates a new CustomCostsFileMetadataWithContentHighLevel object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostsFileMetadataWithContentHighLevel() *CustomCostsFileMetadataWithContentHighLevel { + this := CustomCostsFileMetadataWithContentHighLevel{} + return &this +} + +// NewCustomCostsFileMetadataWithContentHighLevelWithDefaults instantiates a new CustomCostsFileMetadataWithContentHighLevel object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostsFileMetadataWithContentHighLevelWithDefaults() *CustomCostsFileMetadataWithContentHighLevel { + this := CustomCostsFileMetadataWithContentHighLevel{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContentHighLevel) GetAttributes() CustomCostsFileMetadataWithContent { + if o == nil || o.Attributes == nil { + var ret CustomCostsFileMetadataWithContent + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContentHighLevel) GetAttributesOk() (*CustomCostsFileMetadataWithContent, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContentHighLevel) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given CustomCostsFileMetadataWithContent and assigns it to the Attributes field. +func (o *CustomCostsFileMetadataWithContentHighLevel) SetAttributes(v CustomCostsFileMetadataWithContent) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContentHighLevel) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContentHighLevel) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContentHighLevel) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CustomCostsFileMetadataWithContentHighLevel) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CustomCostsFileMetadataWithContentHighLevel) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileMetadataWithContentHighLevel) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CustomCostsFileMetadataWithContentHighLevel) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CustomCostsFileMetadataWithContentHighLevel) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostsFileMetadataWithContentHighLevel) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostsFileMetadataWithContentHighLevel) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CustomCostsFileMetadataWithContent `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_custom_costs_file_upload_response.go b/api/datadogV2/model_custom_costs_file_upload_response.go new file mode 100644 index 00000000000..2209a8c1da6 --- /dev/null +++ b/api/datadogV2/model_custom_costs_file_upload_response.go @@ -0,0 +1,149 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostsFileUploadResponse Response for Uploaded Custom Costs files. +type CustomCostsFileUploadResponse struct { + // JSON API format for a Custom Costs file. + Data *CustomCostsFileMetadataHighLevel `json:"data,omitempty"` + // Meta for the response from the Upload Custom Costs endpoints. + Meta *CustomCostUploadResponseMeta `json:"meta,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostsFileUploadResponse instantiates a new CustomCostsFileUploadResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostsFileUploadResponse() *CustomCostsFileUploadResponse { + this := CustomCostsFileUploadResponse{} + return &this +} + +// NewCustomCostsFileUploadResponseWithDefaults instantiates a new CustomCostsFileUploadResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostsFileUploadResponseWithDefaults() *CustomCostsFileUploadResponse { + this := CustomCostsFileUploadResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CustomCostsFileUploadResponse) GetData() CustomCostsFileMetadataHighLevel { + if o == nil || o.Data == nil { + var ret CustomCostsFileMetadataHighLevel + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileUploadResponse) GetDataOk() (*CustomCostsFileMetadataHighLevel, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CustomCostsFileUploadResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given CustomCostsFileMetadataHighLevel and assigns it to the Data field. +func (o *CustomCostsFileUploadResponse) SetData(v CustomCostsFileMetadataHighLevel) { + o.Data = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *CustomCostsFileUploadResponse) GetMeta() CustomCostUploadResponseMeta { + if o == nil || o.Meta == nil { + var ret CustomCostUploadResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileUploadResponse) GetMetaOk() (*CustomCostUploadResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *CustomCostsFileUploadResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given CustomCostUploadResponseMeta and assigns it to the Meta field. +func (o *CustomCostsFileUploadResponse) SetMeta(v CustomCostUploadResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostsFileUploadResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostsFileUploadResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CustomCostsFileMetadataHighLevel `json:"data,omitempty"` + Meta *CustomCostUploadResponseMeta `json:"meta,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_custom_costs_file_usage_charge_period.go b/api/datadogV2/model_custom_costs_file_usage_charge_period.go new file mode 100644 index 00000000000..473489ee2c1 --- /dev/null +++ b/api/datadogV2/model_custom_costs_file_usage_charge_period.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostsFileUsageChargePeriod Usage charge period of a Custom Costs file. +type CustomCostsFileUsageChargePeriod struct { + // End of the usage of the Custom Costs file. + End *float64 `json:"end,omitempty"` + // Start of the usage of the Custom Costs file. + Start *float64 `json:"start,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostsFileUsageChargePeriod instantiates a new CustomCostsFileUsageChargePeriod object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostsFileUsageChargePeriod() *CustomCostsFileUsageChargePeriod { + this := CustomCostsFileUsageChargePeriod{} + return &this +} + +// NewCustomCostsFileUsageChargePeriodWithDefaults instantiates a new CustomCostsFileUsageChargePeriod object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostsFileUsageChargePeriodWithDefaults() *CustomCostsFileUsageChargePeriod { + this := CustomCostsFileUsageChargePeriod{} + return &this +} + +// GetEnd returns the End field value if set, zero value otherwise. +func (o *CustomCostsFileUsageChargePeriod) GetEnd() float64 { + if o == nil || o.End == nil { + var ret float64 + return ret + } + return *o.End +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileUsageChargePeriod) GetEndOk() (*float64, bool) { + if o == nil || o.End == nil { + return nil, false + } + return o.End, true +} + +// HasEnd returns a boolean if a field has been set. +func (o *CustomCostsFileUsageChargePeriod) HasEnd() bool { + return o != nil && o.End != nil +} + +// SetEnd gets a reference to the given float64 and assigns it to the End field. +func (o *CustomCostsFileUsageChargePeriod) SetEnd(v float64) { + o.End = &v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *CustomCostsFileUsageChargePeriod) GetStart() float64 { + if o == nil || o.Start == nil { + var ret float64 + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsFileUsageChargePeriod) GetStartOk() (*float64, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *CustomCostsFileUsageChargePeriod) HasStart() bool { + return o != nil && o.Start != nil +} + +// SetStart gets a reference to the given float64 and assigns it to the Start field. +func (o *CustomCostsFileUsageChargePeriod) SetStart(v float64) { + o.Start = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostsFileUsageChargePeriod) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.End != nil { + toSerialize["end"] = o.End + } + if o.Start != nil { + toSerialize["start"] = o.Start + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostsFileUsageChargePeriod) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + End *float64 `json:"end,omitempty"` + Start *float64 `json:"start,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"end", "start"}) + } else { + return err + } + o.End = all.End + o.Start = all.Start + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_custom_costs_user.go b/api/datadogV2/model_custom_costs_user.go new file mode 100644 index 00000000000..d89b7ab2277 --- /dev/null +++ b/api/datadogV2/model_custom_costs_user.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CustomCostsUser Metadata of the user that has uploaded the Custom Costs file. +type CustomCostsUser struct { + // The name of the Custom Costs file. + Email *string `json:"email,omitempty"` + // The name of the Custom Costs file. + Icon *string `json:"icon,omitempty"` + // Name of the user. + Name *string `json:"name,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCustomCostsUser instantiates a new CustomCostsUser object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCustomCostsUser() *CustomCostsUser { + this := CustomCostsUser{} + return &this +} + +// NewCustomCostsUserWithDefaults instantiates a new CustomCostsUser object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCustomCostsUserWithDefaults() *CustomCostsUser { + this := CustomCostsUser{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *CustomCostsUser) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsUser) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *CustomCostsUser) HasEmail() bool { + return o != nil && o.Email != nil +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *CustomCostsUser) SetEmail(v string) { + o.Email = &v +} + +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *CustomCostsUser) GetIcon() string { + if o == nil || o.Icon == nil { + var ret string + return ret + } + return *o.Icon +} + +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsUser) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { + return nil, false + } + return o.Icon, true +} + +// HasIcon returns a boolean if a field has been set. +func (o *CustomCostsUser) HasIcon() bool { + return o != nil && o.Icon != nil +} + +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *CustomCostsUser) SetIcon(v string) { + o.Icon = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CustomCostsUser) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomCostsUser) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CustomCostsUser) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CustomCostsUser) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CustomCostsUser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Icon != nil { + toSerialize["icon"] = o.Icon + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CustomCostsUser) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Email *string `json:"email,omitempty"` + Icon *string `json:"icon,omitempty"` + Name *string `json:"name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"email", "icon", "name"}) + } else { + return err + } + o.Email = all.Email + o.Icon = all.Icon + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/cloud-cost-management/DeleteCustomCostsFile.go b/examples/v2/cloud-cost-management/DeleteCustomCostsFile.go new file mode 100644 index 00000000000..00d3392b0f6 --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteCustomCostsFile.go @@ -0,0 +1,25 @@ +// Delete Custom Costs file returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + r, err := api.DeleteCustomCostsFile(ctx, "file_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.DeleteCustomCostsFile`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/cloud-cost-management/DeleteCustomCostsFile_372970393.go b/examples/v2/cloud-cost-management/DeleteCustomCostsFile_372970393.go new file mode 100644 index 00000000000..0a16129f2f1 --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteCustomCostsFile_372970393.go @@ -0,0 +1,25 @@ +// Delete Custom Costs File returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + r, err := api.DeleteCustomCostsFile(ctx, "9d055d22-a838-4e9f-bc34-a4f9ab66280c") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.DeleteCustomCostsFile`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/cloud-cost-management/GetCustomCostsFile.go b/examples/v2/cloud-cost-management/GetCustomCostsFile.go new file mode 100644 index 00000000000..8b463d0ed6b --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCustomCostsFile.go @@ -0,0 +1,29 @@ +// Get Custom Costs file returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.GetCustomCostsFile(ctx, "file_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.GetCustomCostsFile`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.GetCustomCostsFile`:\n%s\n", responseContent) +} diff --git a/examples/v2/cloud-cost-management/GetCustomCostsFile_1307381576.go b/examples/v2/cloud-cost-management/GetCustomCostsFile_1307381576.go new file mode 100644 index 00000000000..baee022c1a5 --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCustomCostsFile_1307381576.go @@ -0,0 +1,29 @@ +// Get Custom Costs File returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.GetCustomCostsFile(ctx, "9d055d22-a838-4e9f-bc34-a4f9ab66280c") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.GetCustomCostsFile`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.GetCustomCostsFile`:\n%s\n", responseContent) +} diff --git a/examples/v2/cloud-cost-management/ListCustomCostsFiles.go b/examples/v2/cloud-cost-management/ListCustomCostsFiles.go new file mode 100644 index 00000000000..0894386d32d --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCustomCostsFiles.go @@ -0,0 +1,29 @@ +// List Custom Costs files returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.ListCustomCostsFiles(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCustomCostsFiles`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCustomCostsFiles`:\n%s\n", responseContent) +} diff --git a/examples/v2/cloud-cost-management/ListCustomCostsFiles_1968771127.go b/examples/v2/cloud-cost-management/ListCustomCostsFiles_1968771127.go new file mode 100644 index 00000000000..6c58581311d --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCustomCostsFiles_1968771127.go @@ -0,0 +1,29 @@ +// List Custom Costs Files returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.ListCustomCostsFiles(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCustomCostsFiles`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCustomCostsFiles`:\n%s\n", responseContent) +} diff --git a/examples/v2/cloud-cost-management/UploadCustomCostsFile.go b/examples/v2/cloud-cost-management/UploadCustomCostsFile.go new file mode 100644 index 00000000000..815116c310f --- /dev/null +++ b/examples/v2/cloud-cost-management/UploadCustomCostsFile.go @@ -0,0 +1,38 @@ +// Upload Custom Costs file returns "Accepted" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := []datadogV2.CustomCostsFileLineItem{ + { + BilledCost: datadog.PtrFloat64(100.5), + BillingCurrency: datadog.PtrString("USD"), + ChargeDescription: datadog.PtrString("Monthly usage charge for my service"), + ChargePeriodEnd: datadog.PtrString("2023-02-28"), + ChargePeriodStart: datadog.PtrString("2023-02-01"), + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.UploadCustomCostsFile(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UploadCustomCostsFile`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UploadCustomCostsFile`:\n%s\n", responseContent) +} diff --git a/examples/v2/cloud-cost-management/UploadCustomCostsFile_4125168396.go b/examples/v2/cloud-cost-management/UploadCustomCostsFile_4125168396.go new file mode 100644 index 00000000000..17375f55842 --- /dev/null +++ b/examples/v2/cloud-cost-management/UploadCustomCostsFile_4125168396.go @@ -0,0 +1,42 @@ +// Upload Custom Costs File returns "Accepted" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := []datadogV2.CustomCostsFileLineItem{ + { + ProviderName: datadog.PtrString("my_provider"), + ChargePeriodStart: datadog.PtrString("2023-05-06"), + ChargePeriodEnd: datadog.PtrString("2023-06-06"), + ChargeDescription: datadog.PtrString("my_description"), + BilledCost: datadog.PtrFloat64(250), + BillingCurrency: datadog.PtrString("USD"), + Tags: map[string]string{ + "key": "value", + }, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.UploadCustomCostsFile(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UploadCustomCostsFile`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UploadCustomCostsFile`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Delete_Custom_Costs_File_returns_No_Content_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Delete_Custom_Costs_File_returns_No_Content_response.freeze new file mode 100644 index 00000000000..0d8912bb1dd --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Delete_Custom_Costs_File_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2024-07-22T12:40:43.508Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Delete_Custom_Costs_File_returns_No_Content_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Delete_Custom_Costs_File_returns_No_Content_response.yaml new file mode 100644 index 00000000000..652e809064f --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Delete_Custom_Costs_File_returns_No_Content_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/cost/custom_costs/9d055d22-a838-4e9f-bc34-a4f9ab66280c + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Get_Custom_Costs_File_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Get_Custom_Costs_File_returns_OK_response.freeze new file mode 100644 index 00000000000..198bbdbc3d8 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Get_Custom_Costs_File_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-07-22T12:06:05.860Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Get_Custom_Costs_File_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Get_Custom_Costs_File_returns_OK_response.yaml new file mode 100644 index 00000000000..1c5b5e35525 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Get_Custom_Costs_File_returns_OK_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/cost/custom_costs/9d055d22-a838-4e9f-bc34-a4f9ab66280c + response: + body: '{"data":{"id":"9d055d22-a838-4e9f-bc34-a4f9ab66280c","type":"cost_metadata","attributes":{"billed_cost":250,"billing_currency":"USD","charge_period":{"start":1683331200000,"end":1686009600000},"content":[{"BilledCost":250,"BillingCurrency":"USD","ChargeDescription":"my_description","Tags":{"key":"value"},"ProviderName":"my_provider","ChargePeriodStart":"2023-05-06","ChargePeriodEnd":"2023-06-06"}],"name":"data.json","provider_names":["my_provider"],"status":"ACTIVE","uploaded_at":1721322924169,"uploaded_by":{"name":"Julien + Hemery","icon":"https://secure.gravatar.com/avatar/f12684c6ebe1bdd70c36789c5270aac0?d=retro\u0026s=48","email":"julien.hemery@datadoghq.com"}}},"meta":{"version":"1.0"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_List_Custom_Costs_Files_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_List_Custom_Costs_Files_returns_OK_response.freeze new file mode 100644 index 00000000000..14e85f57fe0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_List_Custom_Costs_Files_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-07-22T12:06:38.368Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_List_Custom_Costs_Files_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_List_Custom_Costs_Files_returns_OK_response.yaml new file mode 100644 index 00000000000..1dffbb70b62 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_List_Custom_Costs_Files_returns_OK_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/cost/custom_costs + response: + body: '{"data":[{"id":"9d055d22-a838-4e9f-bc34-a4f9ab66280c","type":"cost_metadata","attributes":{"billed_cost":250,"billing_currency":"USD","charge_period":{"start":1683331200000,"end":1686009600000},"name":"data.json","provider_names":["my_provider"],"status":"ACTIVE","uploaded_at":1721322924169,"uploaded_by":{"name":"Julien + Hemery","icon":"https://secure.gravatar.com/avatar/f12684c6ebe1bdd70c36789c5270aac0?d=retro\u0026s=48","email":"julien.hemery@datadoghq.com"}}}],"meta":{"version":"1.0","total_filtered_count":766}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Upload_Custom_Costs_File_returns_Accepted_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Upload_Custom_Costs_File_returns_Accepted_response.freeze new file mode 100644 index 00000000000..1a10998b748 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Upload_Custom_Costs_File_returns_Accepted_response.freeze @@ -0,0 +1 @@ +2024-07-18T17:15:23.344Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Upload_Custom_Costs_File_returns_Accepted_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Upload_Custom_Costs_File_returns_Accepted_response.yaml new file mode 100644 index 00000000000..ee0f929f4d2 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Cloud_Cost_Management/Scenario_Upload_Custom_Costs_File_returns_Accepted_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + [{"BilledCost":250,"BillingCurrency":"USD","ChargeDescription":"my_description","ChargePeriodEnd":"2023-06-06","ChargePeriodStart":"2023-05-06","ProviderName":"my_provider","Tags":{"key":"value"}}] + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PUT + url: https://api.datadoghq.com/api/v2/cost/custom_costs + response: + body: '{"data":{"id":"9d055d22-a838-4e9f-bc34-a4f9ab66280c","type":"cost_metadata","attributes":{"billed_cost":250,"billing_currency":"USD","charge_period":{"start":1683331200000,"end":1686009600000},"name":"data.json","provider_names":["my_provider"],"status":"UPLOADING","uploaded_at":1721322923888,"uploaded_by":{"name":"Julien + Hemery","icon":"https://secure.gravatar.com/avatar/f12684c6ebe1bdd70c36789c5270aac0?d=retro\u0026s=48","email":"julien.hemery@datadoghq.com"}}},"meta":{"version":"1.0"}}' + code: 202 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 202 Accepted +version: 2 diff --git a/tests/scenarios/features/v2/cloud_cost_management.feature b/tests/scenarios/features/v2/cloud_cost_management.feature index 867531c0a9f..e72eaddea8d 100644 --- a/tests/scenarios/features/v2/cloud_cost_management.feature +++ b/tests/scenarios/features/v2/cloud_cost_management.feature @@ -88,6 +88,36 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 404 Not Found + @replay-only @team:Datadog/cloud-cost-management + Scenario: Delete Custom Costs File returns "No Content" response + Given new "DeleteCustomCostsFile" request + And request contains "file_id" parameter with value "9d055d22-a838-4e9f-bc34-a4f9ab66280c" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Delete Custom Costs file returns "No Content" response + Given new "DeleteCustomCostsFile" request + And request contains "file_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @replay-only @team:Datadog/cloud-cost-management + Scenario: Get Custom Costs File returns "OK" response + Given new "GetCustomCostsFile" request + And request contains "file_id" parameter with value "9d055d22-a838-4e9f-bc34-a4f9ab66280c" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" is equal to "data.json" + And the response "data.attributes.content[0].ChargeDescription" is equal to "my_description" + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Get Custom Costs file returns "OK" response + Given new "GetCustomCostsFile" request + And request contains "file_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @replay-only @team:Datadog/cloud-cost-management Scenario: List Cloud Cost Management AWS CUR configs returns "OK" response Given new "ListCostAWSCURConfigs" request @@ -102,6 +132,19 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data[0].attributes.configs[0].export_name" is equal to "test_export_name" + @replay-only @team:Datadog/cloud-cost-management + Scenario: List Custom Costs Files returns "OK" response + Given new "ListCustomCostsFiles" request + When the request is sent + Then the response status is 200 OK + And the response "data[0].attributes.name" is equal to "data.json" + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: List Custom Costs files returns "OK" response + Given new "ListCustomCostsFiles" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:Datadog/cloud-cost-management Scenario: List related AWS accounts returns "Bad Request" response Given new "ListAWSRelatedAccounts" request @@ -142,3 +185,18 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK And the response "data.type" is equal to "azure_uc_configs" + + @replay-only @team:Datadog/cloud-cost-management + Scenario: Upload Custom Costs File returns "Accepted" response + Given new "UploadCustomCostsFile" request + And body with value [{ "ProviderName": "my_provider", "ChargePeriodStart": "2023-05-06", "ChargePeriodEnd": "2023-06-06","ChargeDescription": "my_description","BilledCost": 250,"BillingCurrency": "USD","Tags": {"key": "value"}}] + When the request is sent + Then the response status is 202 Accepted + And the response "data.attributes.name" is equal to "data.json" + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Upload Custom Costs file returns "Accepted" response + Given new "UploadCustomCostsFile" request + And body with value [{"BilledCost": 100.5, "BillingCurrency": "USD", "ChargeDescription": "Monthly usage charge for my service", "ChargePeriodEnd": "2023-02-28", "ChargePeriodStart": "2023-02-01"}] + When the request is sent + Then the response status is 202 Accepted diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 170f9c4e65a..c97bab6f784 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -419,6 +419,30 @@ "type": "idempotent" } }, + "ListCustomCostsFiles": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "UploadCustomCostsFile": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "DeleteCustomCostsFile": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "GetCustomCostsFile": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "GetCloudCostActivity": { "tag": "Cloud Cost Management", "undo": {