From 0fbb968ac1d35da3d36e5b32688c058cbc1e3ec0 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 6 Oct 2026 17:18:20 +0000 Subject: [PATCH] Regenerate client from commit b330a66 of spec repo --- .generator/schemas/v2/openapi.yaml | 158 +++++++++- api/datadogV2/api_cloud_cost_management.go | 125 +++++++- api/datadogV2/doc.go | 1 + api/datadogV2/model_cloud_cost_account.go | 180 +++++++++++ .../model_cloud_cost_account_attributes.go | 293 ++++++++++++++++++ .../model_cloud_cost_account_type.go | 64 ++++ .../model_cloud_cost_accounts_response.go | 101 ++++++ .../ListCostCloudAccountsV2.go | 30 ++ .../ListCostCloudAccountsV2_1125785160.go | 30 ++ .../ListCostCloudAccountsV2_1976704126.go | 30 ++ .../ListCostCloudAccountsV2_3127976520.go | 30 ++ .../ListCostCloudAccountsV2_3442024574.go | 30 ++ .../ListCostCloudAccountsV2_420814529.go | 30 ++ .../features/v2/cloud_cost_management.feature | 50 +++ tests/scenarios/features/v2/undo.json | 6 + .../test-runner-data/manifest.json | 49 +++ ...accounts-returns-bad-request-response.json | 35 +++ ...nt-cloud-accounts-returns-ok-response.json | 18 ++ ...h-an-empty-filter-returns-ok-response.json | 35 +++ ...ws-cur-2-0-filter-returns-ok-response.json | 35 +++ ...ws-cur-2-0-filter-returns-ok-response.json | 35 +++ ...d-case-oci-filter-returns-ok-response.json | 35 +++ ...s-with-oci-filter-returns-ok-response.json | 35 +++ .../v2/cloud-cost-management.json | 247 +++++++++++++++ 24 files changed, 1680 insertions(+), 2 deletions(-) create mode 100644 api/datadogV2/model_cloud_cost_account.go create mode 100644 api/datadogV2/model_cloud_cost_account_attributes.go create mode 100644 api/datadogV2/model_cloud_cost_account_type.go create mode 100644 api/datadogV2/model_cloud_cost_accounts_response.go create mode 100644 examples/v2/cloud-cost-management/ListCostCloudAccountsV2.go create mode 100644 examples/v2/cloud-cost-management/ListCostCloudAccountsV2_1125785160.go create mode 100644 examples/v2/cloud-cost-management/ListCostCloudAccountsV2_1976704126.go create mode 100644 examples/v2/cloud-cost-management/ListCostCloudAccountsV2_3127976520.go create mode 100644 examples/v2/cloud-cost-management/ListCostCloudAccountsV2_3442024574.go create mode 100644 examples/v2/cloud-cost-management/ListCostCloudAccountsV2_420814529.go create mode 100644 tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-returns-bad-request-response.json create mode 100644 tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-returns-ok-response.json create mode 100644 tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-an-empty-filter-returns-ok-response.json create mode 100644 tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-aws-cur-2-0-filter-returns-ok-response.json create mode 100644 tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-mixed-case-aws-cur-2-0-filter-returns-ok-response.json create mode 100644 tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-mixed-case-oci-filter-returns-ok-response.json create mode 100644 tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-oci-filter-returns-ok-response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 615b42d5e76..eaad7eae2c4 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -19023,6 +19023,85 @@ components: type: string x-enum-varnames: - CLOUD_CONFIGURATION + CloudCostAccount: + description: A Cloud Cost Management account. + properties: + attributes: + $ref: "#/components/schemas/CloudCostAccountAttributes" + id: + description: The Datadog cloud account ID used by the account filters API. + example: "534" + type: string + type: + $ref: "#/components/schemas/CloudCostAccountType" + required: + - attributes + - id + - type + type: object + CloudCostAccountAttributes: + description: Read-only status and identifiers for a cloud cost account. + properties: + account_id: + description: The cloud provider account identifier, such as an OCI tenancy OCID or AWS account ID. + example: "ocid1.tenancy.oc1..example" + type: string + cloud: + description: The cloud provider and cost report type. Currently supports `oci` and `aws_cur2`. + example: "oci" + type: string + created_at: + description: The timestamp when the cloud account was created. + example: "2026-01-01T12:00:00Z" + type: string + error_messages: + description: Validation errors for the cloud account. Empty when there are no errors. + example: [] + items: + description: An error message. + type: string + type: array + status: + description: The cloud account status, one of `active`, `warn`, `error`, or `disabled`. + example: "active" + type: string + status_updated_at: + description: The timestamp when the cloud account status was last updated. + example: "2026-01-01T12:00:00Z" + type: string + updated_at: + description: The timestamp when the cloud account was last updated. + example: "2026-01-01T12:00:00Z" + type: string + required: + - account_id + - cloud + - created_at + - error_messages + - status + - status_updated_at + - updated_at + type: object + CloudCostAccountType: + default: cloud_account + description: Type of a cloud cost account. + enum: + - cloud_account + example: cloud_account + type: string + x-enum-varnames: + - CLOUD_ACCOUNT + CloudCostAccountsResponse: + description: List of cloud cost accounts. + properties: + data: + description: The cloud cost accounts matching the filter. + items: + $ref: "#/components/schemas/CloudCostAccount" + type: array + required: + - data + type: object CloudInventoryCloudProviderId: description: |- Cloud provider for this sync configuration (`aws`, `gcp`, or `azure`). For requests, must match the provider block supplied under `attributes`. @@ -153944,6 +154023,81 @@ paths: summary: List budgets tags: - Cloud Cost Management + /api/v2/cost/cloud_accounts: + get: + description: |- + List the OCI and AWS CUR 2.0 cloud accounts for your organization, including account IDs, status, and validation errors. + Use `filter[cloud]=oci` or `filter[cloud]=aws_cur2` to return a single cloud. When omitted or empty, both clouds are returned. + AWS CUR 1.0, Azure, and GCP accounts are available through their dedicated configuration endpoints. + Archived accounts are excluded. The response contains all matching accounts and is not paginated. + + This endpoint replaces `GET /api/v2/cost/oci_config`. To migrate, use `filter[cloud]=oci` and update clients to accept + the `cloud_account` resource type instead of `oci_config`. Account IDs and the existing attributes are preserved; + each account also includes the `cloud` attribute. + operationId: ListCostCloudAccountsV2 + parameters: + - description: Filter by cloud, either `oci` or `aws_cur2` (case insensitive). Omit or leave empty to return both. + example: oci + in: query + name: filter[cloud] + required: false + schema: + pattern: ^([oO][cC][iI]|[aA][wW][sS]_[cC][uU][rR]2)?(?![\s\S]) + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + account_id: "ocid1.tenancy.oc1..example" + cloud: oci + created_at: "2026-01-01T12:00:00Z" + error_messages: [] + status: active + status_updated_at: "2026-01-01T12:00:00Z" + updated_at: "2026-01-01T12:00:00Z" + id: "534" + type: cloud_account + schema: + $ref: "#/components/schemas/CloudCostAccountsResponse" + description: OK + "400": + content: + application/json: + examples: + invalid_cloud: + value: + errors: + - detail: 'attribute "filter[cloud]" must be one of: oci, aws_cur2' + status: "400" + title: Bad Request + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "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 Cloud Cost Management cloud accounts + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read /api/v2/cost/commitments/commitment-list: get: description: Get a list of individual cloud commitments (Reserved Instances or Savings Plans) with their utilization details. The response schema varies based on the provider, product, and commitment type. @@ -155025,7 +155179,9 @@ paths: get: deprecated: true description: |- - **Note**: This endpoint is deprecated. View OCI accounts in Cloud Cost Settings in the Datadog web application instead. + **Note**: This endpoint is deprecated. Use [List Cloud Cost Management cloud accounts](https://docs.datadoghq.com/api/latest/cloud-cost-management/#list-cloud-cost-management-cloud-accounts) + with `filter[cloud]=oci` instead. Update clients to accept the `cloud_account` resource type instead of `oci_config`. + Account IDs and the existing attributes are preserved; each account also includes the `cloud` attribute. List the OCI configs. operationId: ListCostOCIConfigs diff --git a/api/datadogV2/api_cloud_cost_management.go b/api/datadogV2/api_cloud_cost_management.go index d3776a00c1e..148a7aeebbd 100644 --- a/api/datadogV2/api_cloud_cost_management.go +++ b/api/datadogV2/api_cloud_cost_management.go @@ -4121,6 +4121,127 @@ func (a *CloudCostManagementApi) ListCostAzureUCConfigs(ctx _context.Context) (A return localVarReturnValue, localVarHTTPResponse, nil } +// ListCostCloudAccountsV2OptionalParameters holds optional parameters for ListCostCloudAccountsV2. +type ListCostCloudAccountsV2OptionalParameters struct { + FilterCloud *string +} + +// NewListCostCloudAccountsV2OptionalParameters creates an empty struct for parameters. +func NewListCostCloudAccountsV2OptionalParameters() *ListCostCloudAccountsV2OptionalParameters { + this := ListCostCloudAccountsV2OptionalParameters{} + return &this +} + +// WithFilterCloud sets the corresponding parameter name and returns the struct. +func (r *ListCostCloudAccountsV2OptionalParameters) WithFilterCloud(filterCloud string) *ListCostCloudAccountsV2OptionalParameters { + r.FilterCloud = &filterCloud + return r +} + +// ListCostCloudAccountsV2 List Cloud Cost Management cloud accounts. +// List the OCI and AWS CUR 2.0 cloud accounts for your organization, including account IDs, status, and validation errors. +// Use `filter[cloud]=oci` or `filter[cloud]=aws_cur2` to return a single cloud. When omitted or empty, both clouds are returned. +// AWS CUR 1.0, Azure, and GCP accounts are available through their dedicated configuration endpoints. +// Archived accounts are excluded. The response contains all matching accounts and is not paginated. +// +// This endpoint replaces `GET /api/v2/cost/oci_config`. To migrate, use `filter[cloud]=oci` and update clients to accept +// the `cloud_account` resource type instead of `oci_config`. Account IDs and the existing attributes are preserved; +// each account also includes the `cloud` attribute. +func (a *CloudCostManagementApi) ListCostCloudAccountsV2(ctx _context.Context, o ...ListCostCloudAccountsV2OptionalParameters) (CloudCostAccountsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CloudCostAccountsResponse + optionalParams ListCostCloudAccountsV2OptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListCostCloudAccountsV2OptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CloudCostManagementApi.ListCostCloudAccountsV2") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/cost/cloud_accounts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.FilterCloud != nil { + localVarQueryParams.Add("filter[cloud]", datadog.ParameterToString(*optionalParams.FilterCloud, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + 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 == 400 { + var v JSONAPIErrorResponse + 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 + } + 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 +} + // ListCostGCPUsageCostConfigs List Google Cloud Usage Cost configs. // List the Google Cloud Usage Cost configs. func (a *CloudCostManagementApi) ListCostGCPUsageCostConfigs(ctx _context.Context) (GCPUsageCostConfigsResponse, *_nethttp.Response, error) { @@ -4199,7 +4320,9 @@ func (a *CloudCostManagementApi) ListCostGCPUsageCostConfigs(ctx _context.Contex } // ListCostOCIConfigs List Cloud Cost Management OCI configs. -// **Note**: This endpoint is deprecated. View OCI accounts in Cloud Cost Settings in the Datadog web application instead. +// **Note**: This endpoint is deprecated. Use [List Cloud Cost Management cloud accounts](https://docs.datadoghq.com/api/latest/cloud-cost-management/#list-cloud-cost-management-cloud-accounts) +// with `filter[cloud]=oci` instead. Update clients to accept the `cloud_account` resource type instead of `oci_config`. +// Account IDs and the existing attributes are preserved; each account also includes the `cloud` attribute. // // List the OCI configs. // diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 09367a61317..8f948baedb6 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -374,6 +374,7 @@ // - [CloudCostManagementApi.ListCostAWSCURConfigs] // - [CloudCostManagementApi.ListCostAnomalies] // - [CloudCostManagementApi.ListCostAzureUCConfigs] +// - [CloudCostManagementApi.ListCostCloudAccountsV2] // - [CloudCostManagementApi.ListCostGCPUsageCostConfigs] // - [CloudCostManagementApi.ListCostOCIConfigs] // - [CloudCostManagementApi.ListCostTagDescriptions] diff --git a/api/datadogV2/model_cloud_cost_account.go b/api/datadogV2/model_cloud_cost_account.go new file mode 100644 index 00000000000..010e6fd925b --- /dev/null +++ b/api/datadogV2/model_cloud_cost_account.go @@ -0,0 +1,180 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CloudCostAccount A Cloud Cost Management account. +type CloudCostAccount struct { + // Read-only status and identifiers for a cloud cost account. + Attributes CloudCostAccountAttributes `json:"attributes"` + // The Datadog cloud account ID used by the account filters API. + Id string `json:"id"` + // Type of a cloud cost account. + Type CloudCostAccountType `json:"type"` + // 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{} `json:"-"` +} + +// NewCloudCostAccount instantiates a new CloudCostAccount 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 NewCloudCostAccount(attributes CloudCostAccountAttributes, id string, typeVar CloudCostAccountType) *CloudCostAccount { + this := CloudCostAccount{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewCloudCostAccountWithDefaults instantiates a new CloudCostAccount 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 NewCloudCostAccountWithDefaults() *CloudCostAccount { + this := CloudCostAccount{} + var typeVar CloudCostAccountType = CLOUDCOSTACCOUNTTYPE_CLOUD_ACCOUNT + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *CloudCostAccount) GetAttributes() CloudCostAccountAttributes { + if o == nil { + var ret CloudCostAccountAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *CloudCostAccount) GetAttributesOk() (*CloudCostAccountAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *CloudCostAccount) SetAttributes(v CloudCostAccountAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *CloudCostAccount) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *CloudCostAccount) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *CloudCostAccount) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *CloudCostAccount) GetType() CloudCostAccountType { + if o == nil { + var ret CloudCostAccountType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *CloudCostAccount) GetTypeOk() (*CloudCostAccountType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CloudCostAccount) SetType(v CloudCostAccountType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudCostAccount) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudCostAccount) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CloudCostAccountAttributes `json:"attributes"` + Id *string `json:"id"` + Type *CloudCostAccountType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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_cloud_cost_account_attributes.go b/api/datadogV2/model_cloud_cost_account_attributes.go new file mode 100644 index 00000000000..78a9c200b47 --- /dev/null +++ b/api/datadogV2/model_cloud_cost_account_attributes.go @@ -0,0 +1,293 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CloudCostAccountAttributes Read-only status and identifiers for a cloud cost account. +type CloudCostAccountAttributes struct { + // The cloud provider account identifier, such as an OCI tenancy OCID or AWS account ID. + AccountId string `json:"account_id"` + // The cloud provider and cost report type. Currently supports `oci` and `aws_cur2`. + Cloud string `json:"cloud"` + // The timestamp when the cloud account was created. + CreatedAt string `json:"created_at"` + // Validation errors for the cloud account. Empty when there are no errors. + ErrorMessages []string `json:"error_messages"` + // The cloud account status, one of `active`, `warn`, `error`, or `disabled`. + Status string `json:"status"` + // The timestamp when the cloud account status was last updated. + StatusUpdatedAt string `json:"status_updated_at"` + // The timestamp when the cloud account was last updated. + UpdatedAt string `json:"updated_at"` + // 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{} `json:"-"` +} + +// NewCloudCostAccountAttributes instantiates a new CloudCostAccountAttributes 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 NewCloudCostAccountAttributes(accountId string, cloud string, createdAt string, errorMessages []string, status string, statusUpdatedAt string, updatedAt string) *CloudCostAccountAttributes { + this := CloudCostAccountAttributes{} + this.AccountId = accountId + this.Cloud = cloud + this.CreatedAt = createdAt + this.ErrorMessages = errorMessages + this.Status = status + this.StatusUpdatedAt = statusUpdatedAt + this.UpdatedAt = updatedAt + return &this +} + +// NewCloudCostAccountAttributesWithDefaults instantiates a new CloudCostAccountAttributes 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 NewCloudCostAccountAttributesWithDefaults() *CloudCostAccountAttributes { + this := CloudCostAccountAttributes{} + return &this +} + +// GetAccountId returns the AccountId field value. +func (o *CloudCostAccountAttributes) GetAccountId() string { + if o == nil { + var ret string + return ret + } + return o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value +// and a boolean to check if the value has been set. +func (o *CloudCostAccountAttributes) GetAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccountId, true +} + +// SetAccountId sets field value. +func (o *CloudCostAccountAttributes) SetAccountId(v string) { + o.AccountId = v +} + +// GetCloud returns the Cloud field value. +func (o *CloudCostAccountAttributes) GetCloud() string { + if o == nil { + var ret string + return ret + } + return o.Cloud +} + +// GetCloudOk returns a tuple with the Cloud field value +// and a boolean to check if the value has been set. +func (o *CloudCostAccountAttributes) GetCloudOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Cloud, true +} + +// SetCloud sets field value. +func (o *CloudCostAccountAttributes) SetCloud(v string) { + o.Cloud = v +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *CloudCostAccountAttributes) GetCreatedAt() string { + if o == nil { + var ret string + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *CloudCostAccountAttributes) GetCreatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *CloudCostAccountAttributes) SetCreatedAt(v string) { + o.CreatedAt = v +} + +// GetErrorMessages returns the ErrorMessages field value. +func (o *CloudCostAccountAttributes) GetErrorMessages() []string { + if o == nil { + var ret []string + return ret + } + return o.ErrorMessages +} + +// GetErrorMessagesOk returns a tuple with the ErrorMessages field value +// and a boolean to check if the value has been set. +func (o *CloudCostAccountAttributes) GetErrorMessagesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.ErrorMessages, true +} + +// SetErrorMessages sets field value. +func (o *CloudCostAccountAttributes) SetErrorMessages(v []string) { + o.ErrorMessages = v +} + +// GetStatus returns the Status field value. +func (o *CloudCostAccountAttributes) GetStatus() string { + if o == nil { + var ret string + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *CloudCostAccountAttributes) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value. +func (o *CloudCostAccountAttributes) SetStatus(v string) { + o.Status = v +} + +// GetStatusUpdatedAt returns the StatusUpdatedAt field value. +func (o *CloudCostAccountAttributes) GetStatusUpdatedAt() string { + if o == nil { + var ret string + return ret + } + return o.StatusUpdatedAt +} + +// GetStatusUpdatedAtOk returns a tuple with the StatusUpdatedAt field value +// and a boolean to check if the value has been set. +func (o *CloudCostAccountAttributes) GetStatusUpdatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.StatusUpdatedAt, true +} + +// SetStatusUpdatedAt sets field value. +func (o *CloudCostAccountAttributes) SetStatusUpdatedAt(v string) { + o.StatusUpdatedAt = v +} + +// GetUpdatedAt returns the UpdatedAt field value. +func (o *CloudCostAccountAttributes) GetUpdatedAt() string { + if o == nil { + var ret string + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *CloudCostAccountAttributes) GetUpdatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.UpdatedAt, true +} + +// SetUpdatedAt sets field value. +func (o *CloudCostAccountAttributes) SetUpdatedAt(v string) { + o.UpdatedAt = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudCostAccountAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["account_id"] = o.AccountId + toSerialize["cloud"] = o.Cloud + toSerialize["created_at"] = o.CreatedAt + toSerialize["error_messages"] = o.ErrorMessages + toSerialize["status"] = o.Status + toSerialize["status_updated_at"] = o.StatusUpdatedAt + toSerialize["updated_at"] = o.UpdatedAt + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudCostAccountAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccountId *string `json:"account_id"` + Cloud *string `json:"cloud"` + CreatedAt *string `json:"created_at"` + ErrorMessages *[]string `json:"error_messages"` + Status *string `json:"status"` + StatusUpdatedAt *string `json:"status_updated_at"` + UpdatedAt *string `json:"updated_at"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AccountId == nil { + return fmt.Errorf("required field account_id missing") + } + if all.Cloud == nil { + return fmt.Errorf("required field cloud missing") + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.ErrorMessages == nil { + return fmt.Errorf("required field error_messages missing") + } + if all.Status == nil { + return fmt.Errorf("required field status missing") + } + if all.StatusUpdatedAt == nil { + return fmt.Errorf("required field status_updated_at missing") + } + if all.UpdatedAt == nil { + return fmt.Errorf("required field updated_at missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"account_id", "cloud", "created_at", "error_messages", "status", "status_updated_at", "updated_at"}) + } else { + return err + } + o.AccountId = *all.AccountId + o.Cloud = *all.Cloud + o.CreatedAt = *all.CreatedAt + o.ErrorMessages = *all.ErrorMessages + o.Status = *all.Status + o.StatusUpdatedAt = *all.StatusUpdatedAt + o.UpdatedAt = *all.UpdatedAt + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_cloud_cost_account_type.go b/api/datadogV2/model_cloud_cost_account_type.go new file mode 100644 index 00000000000..b801ae67cbd --- /dev/null +++ b/api/datadogV2/model_cloud_cost_account_type.go @@ -0,0 +1,64 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CloudCostAccountType Type of a cloud cost account. +type CloudCostAccountType string + +// List of CloudCostAccountType. +const ( + CLOUDCOSTACCOUNTTYPE_CLOUD_ACCOUNT CloudCostAccountType = "cloud_account" +) + +var allowedCloudCostAccountTypeEnumValues = []CloudCostAccountType{ + CLOUDCOSTACCOUNTTYPE_CLOUD_ACCOUNT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *CloudCostAccountType) GetAllowedValues() []CloudCostAccountType { + return allowedCloudCostAccountTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *CloudCostAccountType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = CloudCostAccountType(value) + return nil +} + +// NewCloudCostAccountTypeFromValue returns a pointer to a valid CloudCostAccountType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewCloudCostAccountTypeFromValue(v string) (*CloudCostAccountType, error) { + ev := CloudCostAccountType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for CloudCostAccountType: valid values are %v", v, allowedCloudCostAccountTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v CloudCostAccountType) IsValid() bool { + for _, existing := range allowedCloudCostAccountTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CloudCostAccountType value. +func (v CloudCostAccountType) Ptr() *CloudCostAccountType { + return &v +} diff --git a/api/datadogV2/model_cloud_cost_accounts_response.go b/api/datadogV2/model_cloud_cost_accounts_response.go new file mode 100644 index 00000000000..b48a46eedbb --- /dev/null +++ b/api/datadogV2/model_cloud_cost_accounts_response.go @@ -0,0 +1,101 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CloudCostAccountsResponse List of cloud cost accounts. +type CloudCostAccountsResponse struct { + // The cloud cost accounts matching the filter. + Data []CloudCostAccount `json:"data"` + // 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{} `json:"-"` +} + +// NewCloudCostAccountsResponse instantiates a new CloudCostAccountsResponse 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 NewCloudCostAccountsResponse(data []CloudCostAccount) *CloudCostAccountsResponse { + this := CloudCostAccountsResponse{} + this.Data = data + return &this +} + +// NewCloudCostAccountsResponseWithDefaults instantiates a new CloudCostAccountsResponse 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 NewCloudCostAccountsResponseWithDefaults() *CloudCostAccountsResponse { + this := CloudCostAccountsResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *CloudCostAccountsResponse) GetData() []CloudCostAccount { + if o == nil { + var ret []CloudCostAccount + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *CloudCostAccountsResponse) GetDataOk() (*[]CloudCostAccount, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CloudCostAccountsResponse) SetData(v []CloudCostAccount) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudCostAccountsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudCostAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]CloudCostAccount `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/cloud-cost-management/ListCostCloudAccountsV2.go b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2.go new file mode 100644 index 00000000000..674a154ca11 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2.go @@ -0,0 +1,30 @@ +// List Cloud Cost Management cloud accounts 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()) + ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN")) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.ListCostCloudAccountsV2(ctx, *datadogV2.NewListCostCloudAccountsV2OptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCostCloudAccountsV2`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCostCloudAccountsV2`:\n%s\n", responseContent) +} diff --git a/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_1125785160.go b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_1125785160.go new file mode 100644 index 00000000000..465b6f8318f --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_1125785160.go @@ -0,0 +1,30 @@ +// List Cloud Cost Management cloud accounts with AWS CUR 2.0 filter 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()) + ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN")) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.ListCostCloudAccountsV2(ctx, *datadogV2.NewListCostCloudAccountsV2OptionalParameters().WithFilterCloud("aws_cur2")) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCostCloudAccountsV2`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCostCloudAccountsV2`:\n%s\n", responseContent) +} diff --git a/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_1976704126.go b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_1976704126.go new file mode 100644 index 00000000000..22357a43615 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_1976704126.go @@ -0,0 +1,30 @@ +// List Cloud Cost Management cloud accounts with OCI filter 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()) + ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN")) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.ListCostCloudAccountsV2(ctx, *datadogV2.NewListCostCloudAccountsV2OptionalParameters().WithFilterCloud("oci")) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCostCloudAccountsV2`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCostCloudAccountsV2`:\n%s\n", responseContent) +} diff --git a/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_3127976520.go b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_3127976520.go new file mode 100644 index 00000000000..dd19a743148 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_3127976520.go @@ -0,0 +1,30 @@ +// List Cloud Cost Management cloud accounts with mixed-case AWS CUR 2.0 filter 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()) + ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN")) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.ListCostCloudAccountsV2(ctx, *datadogV2.NewListCostCloudAccountsV2OptionalParameters().WithFilterCloud("Aws_Cur2")) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCostCloudAccountsV2`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCostCloudAccountsV2`:\n%s\n", responseContent) +} diff --git a/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_3442024574.go b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_3442024574.go new file mode 100644 index 00000000000..a5d923f3523 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_3442024574.go @@ -0,0 +1,30 @@ +// List Cloud Cost Management cloud accounts with mixed-case OCI filter 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()) + ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN")) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.ListCostCloudAccountsV2(ctx, *datadogV2.NewListCostCloudAccountsV2OptionalParameters().WithFilterCloud("OcI")) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCostCloudAccountsV2`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCostCloudAccountsV2`:\n%s\n", responseContent) +} diff --git a/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_420814529.go b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_420814529.go new file mode 100644 index 00000000000..da84f1ba15b --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostCloudAccountsV2_420814529.go @@ -0,0 +1,30 @@ +// List Cloud Cost Management cloud accounts with an empty filter 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()) + ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN")) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCloudCostManagementApi(apiClient) + resp, r, err := api.ListCostCloudAccountsV2(ctx, *datadogV2.NewListCostCloudAccountsV2OptionalParameters().WithFilterCloud("")) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCostCloudAccountsV2`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCostCloudAccountsV2`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/features/v2/cloud_cost_management.feature b/tests/scenarios/features/v2/cloud_cost_management.feature index 40e14ef053a..1fe10076a24 100644 --- a/tests/scenarios/features/v2/cloud_cost_management.feature +++ b/tests/scenarios/features/v2/cloud_cost_management.feature @@ -767,6 +767,56 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK + @team:ddoghq/cloud-cost-management + Scenario: List Cloud Cost Management cloud accounts returns "Bad Request" response + Given new "ListCostCloudAccountsV2" request + And request contains "filter[cloud]" parameter with value "gcp" + When the request is sent + Then the response status is 400 Bad Request + And the response "errors[0].status" is equal to "400" + And the response "errors[0].detail" is equal to "attribute \"filter[cloud]\" must be one of: oci, aws_cur2" + + @team:ddoghq/cloud-cost-management + Scenario: List Cloud Cost Management cloud accounts returns "OK" response + Given new "ListCostCloudAccountsV2" request + When the request is sent + Then the response status is 200 OK + + @team:ddoghq/cloud-cost-management + Scenario: List Cloud Cost Management cloud accounts with AWS CUR 2.0 filter returns "OK" response + Given new "ListCostCloudAccountsV2" request + And request contains "filter[cloud]" parameter with value "aws_cur2" + When the request is sent + Then the response status is 200 OK + + @team:ddoghq/cloud-cost-management + Scenario: List Cloud Cost Management cloud accounts with OCI filter returns "OK" response + Given new "ListCostCloudAccountsV2" request + And request contains "filter[cloud]" parameter with value "oci" + When the request is sent + Then the response status is 200 OK + + @team:ddoghq/cloud-cost-management + Scenario: List Cloud Cost Management cloud accounts with an empty filter returns "OK" response + Given new "ListCostCloudAccountsV2" request + And request contains "filter[cloud]" parameter with value "" + When the request is sent + Then the response status is 200 OK + + @team:ddoghq/cloud-cost-management + Scenario: List Cloud Cost Management cloud accounts with mixed-case AWS CUR 2.0 filter returns "OK" response + Given new "ListCostCloudAccountsV2" request + And request contains "filter[cloud]" parameter with value "Aws_Cur2" + When the request is sent + Then the response status is 200 OK + + @team:ddoghq/cloud-cost-management + Scenario: List Cloud Cost Management cloud accounts with mixed-case OCI filter returns "OK" response + Given new "ListCostCloudAccountsV2" request + And request contains "filter[cloud]" parameter with value "OcI" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/cloud-cost-management Scenario: List Cloud Cost Management orchestrators returns "Bad Request" response Given operation "ListCostTagMetadataOrchestrators" enabled diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 6b0fafaa067..c7e0bfc8bb7 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -1808,6 +1808,12 @@ "type": "safe" } }, + "ListCostCloudAccountsV2": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "GetCommitmentsCommitmentList": { "tag": "Cloud Cost Management", "undo": { diff --git a/tests/scenarios/generated-test/test-runner-data/manifest.json b/tests/scenarios/generated-test/test-runner-data/manifest.json index 799b2774100..02c431422a9 100644 --- a/tests/scenarios/generated-test/test-runner-data/manifest.json +++ b/tests/scenarios/generated-test/test-runner-data/manifest.json @@ -4130,6 +4130,55 @@ "scenario": "List Cloud Cost Management Azure configs returns \"OK\" response", "version": "v2" }, + { + "feature": "Cloud Cost Management", + "feature_file": "../../features/v2/cloud_cost_management.feature", + "file": "v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-returns-bad-request-response.json", + "scenario": "List Cloud Cost Management cloud accounts returns \"Bad Request\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "feature_file": "../../features/v2/cloud_cost_management.feature", + "file": "v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-returns-ok-response.json", + "scenario": "List Cloud Cost Management cloud accounts returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "feature_file": "../../features/v2/cloud_cost_management.feature", + "file": "v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-aws-cur-2-0-filter-returns-ok-response.json", + "scenario": "List Cloud Cost Management cloud accounts with AWS CUR 2.0 filter returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "feature_file": "../../features/v2/cloud_cost_management.feature", + "file": "v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-oci-filter-returns-ok-response.json", + "scenario": "List Cloud Cost Management cloud accounts with OCI filter returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "feature_file": "../../features/v2/cloud_cost_management.feature", + "file": "v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-an-empty-filter-returns-ok-response.json", + "scenario": "List Cloud Cost Management cloud accounts with an empty filter returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "feature_file": "../../features/v2/cloud_cost_management.feature", + "file": "v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-mixed-case-aws-cur-2-0-filter-returns-ok-response.json", + "scenario": "List Cloud Cost Management cloud accounts with mixed-case AWS CUR 2.0 filter returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "feature_file": "../../features/v2/cloud_cost_management.feature", + "file": "v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-mixed-case-oci-filter-returns-ok-response.json", + "scenario": "List Cloud Cost Management cloud accounts with mixed-case OCI filter returns \"OK\" response", + "version": "v2" + }, { "feature": "Cloud Cost Management", "feature_file": "../../features/v2/cloud_cost_management.feature", diff --git a/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-returns-bad-request-response.json b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-returns-bad-request-response.json new file mode 100644 index 00000000000..21fd3f17251 --- /dev/null +++ b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-returns-bad-request-response.json @@ -0,0 +1,35 @@ +{ + "api": "CloudCostManagement", + "expected_status": 400, + "feature": "Cloud Cost Management", + "id": "v2/Cloud Cost Management/List Cloud Cost Management cloud accounts returns \"Bad Request\" response", + "operation_id": "ListCostCloudAccountsV2", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "query", + "name": "filter[cloud]", + "required": false, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "gcp" + }, + "style": null + } + ], + "path": "/api/v2/cost/cloud_accounts" + }, + "scenario": "List Cloud Cost Management cloud accounts returns \"Bad Request\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-returns-ok-response.json b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-returns-ok-response.json new file mode 100644 index 00000000000..a399d134d40 --- /dev/null +++ b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-returns-ok-response.json @@ -0,0 +1,18 @@ +{ + "api": "CloudCostManagement", + "expected_status": 200, + "feature": "Cloud Cost Management", + "id": "v2/Cloud Cost Management/List Cloud Cost Management cloud accounts returns \"OK\" response", + "operation_id": "ListCostCloudAccountsV2", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [], + "path": "/api/v2/cost/cloud_accounts" + }, + "scenario": "List Cloud Cost Management cloud accounts returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-an-empty-filter-returns-ok-response.json b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-an-empty-filter-returns-ok-response.json new file mode 100644 index 00000000000..86ea5a8cb28 --- /dev/null +++ b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-an-empty-filter-returns-ok-response.json @@ -0,0 +1,35 @@ +{ + "api": "CloudCostManagement", + "expected_status": 200, + "feature": "Cloud Cost Management", + "id": "v2/Cloud Cost Management/List Cloud Cost Management cloud accounts with an empty filter returns \"OK\" response", + "operation_id": "ListCostCloudAccountsV2", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "query", + "name": "filter[cloud]", + "required": false, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "" + }, + "style": null + } + ], + "path": "/api/v2/cost/cloud_accounts" + }, + "scenario": "List Cloud Cost Management cloud accounts with an empty filter returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-aws-cur-2-0-filter-returns-ok-response.json b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-aws-cur-2-0-filter-returns-ok-response.json new file mode 100644 index 00000000000..8ff72551cbb --- /dev/null +++ b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-aws-cur-2-0-filter-returns-ok-response.json @@ -0,0 +1,35 @@ +{ + "api": "CloudCostManagement", + "expected_status": 200, + "feature": "Cloud Cost Management", + "id": "v2/Cloud Cost Management/List Cloud Cost Management cloud accounts with AWS CUR 2.0 filter returns \"OK\" response", + "operation_id": "ListCostCloudAccountsV2", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "query", + "name": "filter[cloud]", + "required": false, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "aws_cur2" + }, + "style": null + } + ], + "path": "/api/v2/cost/cloud_accounts" + }, + "scenario": "List Cloud Cost Management cloud accounts with AWS CUR 2.0 filter returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-mixed-case-aws-cur-2-0-filter-returns-ok-response.json b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-mixed-case-aws-cur-2-0-filter-returns-ok-response.json new file mode 100644 index 00000000000..ffeab032025 --- /dev/null +++ b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-mixed-case-aws-cur-2-0-filter-returns-ok-response.json @@ -0,0 +1,35 @@ +{ + "api": "CloudCostManagement", + "expected_status": 200, + "feature": "Cloud Cost Management", + "id": "v2/Cloud Cost Management/List Cloud Cost Management cloud accounts with mixed-case AWS CUR 2.0 filter returns \"OK\" response", + "operation_id": "ListCostCloudAccountsV2", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "query", + "name": "filter[cloud]", + "required": false, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "Aws_Cur2" + }, + "style": null + } + ], + "path": "/api/v2/cost/cloud_accounts" + }, + "scenario": "List Cloud Cost Management cloud accounts with mixed-case AWS CUR 2.0 filter returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-mixed-case-oci-filter-returns-ok-response.json b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-mixed-case-oci-filter-returns-ok-response.json new file mode 100644 index 00000000000..ea0ed159a60 --- /dev/null +++ b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-mixed-case-oci-filter-returns-ok-response.json @@ -0,0 +1,35 @@ +{ + "api": "CloudCostManagement", + "expected_status": 200, + "feature": "Cloud Cost Management", + "id": "v2/Cloud Cost Management/List Cloud Cost Management cloud accounts with mixed-case OCI filter returns \"OK\" response", + "operation_id": "ListCostCloudAccountsV2", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "query", + "name": "filter[cloud]", + "required": false, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "OcI" + }, + "style": null + } + ], + "path": "/api/v2/cost/cloud_accounts" + }, + "scenario": "List Cloud Cost Management cloud accounts with mixed-case OCI filter returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-oci-filter-returns-ok-response.json b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-oci-filter-returns-ok-response.json new file mode 100644 index 00000000000..34c6a722f9b --- /dev/null +++ b/tests/scenarios/generated-test/test-runner-data/v2/cloud-cost-management/list-cloud-cost-management-cloud-accounts-with-oci-filter-returns-ok-response.json @@ -0,0 +1,35 @@ +{ + "api": "CloudCostManagement", + "expected_status": 200, + "feature": "Cloud Cost Management", + "id": "v2/Cloud Cost Management/List Cloud Cost Management cloud accounts with OCI filter returns \"OK\" response", + "operation_id": "ListCostCloudAccountsV2", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "query", + "name": "filter[cloud]", + "required": false, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "oci" + }, + "style": null + } + ], + "path": "/api/v2/cost/cloud_accounts" + }, + "scenario": "List Cloud Cost Management cloud accounts with OCI filter returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/scenarios/generated-test/test-server-data/v2/cloud-cost-management.json b/tests/scenarios/generated-test/test-server-data/v2/cloud-cost-management.json index ed00b46193f..de073b6055b 100644 --- a/tests/scenarios/generated-test/test-server-data/v2/cloud-cost-management.json +++ b/tests/scenarios/generated-test/test-server-data/v2/cloud-cost-management.json @@ -1108,6 +1108,253 @@ "scenario": "List Cloud Cost Management Azure configs returns \"OK\" response", "version": "v2" }, + { + "feature": "Cloud Cost Management", + "frozen_at": "2026-09-28T21:36:23.736Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/cost/cloud_accounts", + "query": [ + [ + "filter[cloud]", + "gcp" + ] + ] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"attribute \\\"filter[cloud]\\\" must be one of: oci, aws_cur2\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Bad Request", + "status": 400 + } + } + ], + "scenario": "List Cloud Cost Management cloud accounts returns \"Bad Request\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "frozen_at": "2026-09-28T21:36:24.451Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/cost/cloud_accounts", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":[{\"id\":\"12345\",\"type\":\"cloud_account\",\"attributes\":{\"account_id\":\"123456789123\",\"cloud\":\"aws_cur2\",\"created_at\":\"2026-05-21T18:11:12Z\",\"error_messages\":[],\"status\":\"active\",\"status_updated_at\":\"2026-05-21T18:11:12Z\",\"updated_at\":\"2026-05-21T18:11:12Z\"}}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "List Cloud Cost Management cloud accounts returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "frozen_at": "2026-09-28T21:36:24.578Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/cost/cloud_accounts", + "query": [ + [ + "filter[cloud]", + "aws_cur2" + ] + ] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":[{\"id\":\"12345\",\"type\":\"cloud_account\",\"attributes\":{\"account_id\":\"123456789123\",\"cloud\":\"aws_cur2\",\"created_at\":\"2026-05-21T18:11:12Z\",\"error_messages\":[],\"status\":\"active\",\"status_updated_at\":\"2026-05-21T18:11:12Z\",\"updated_at\":\"2026-05-21T18:11:12Z\"}}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "List Cloud Cost Management cloud accounts with AWS CUR 2.0 filter returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "frozen_at": "2026-09-28T21:36:24.725Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/cost/cloud_accounts", + "query": [ + [ + "filter[cloud]", + "oci" + ] + ] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":[]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "List Cloud Cost Management cloud accounts with OCI filter returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "frozen_at": "2026-09-28T21:36:24.883Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/cost/cloud_accounts", + "query": [ + [ + "filter[cloud]", + "" + ] + ] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":[{\"id\":\"12345\",\"type\":\"cloud_account\",\"attributes\":{\"account_id\":\"123456789123\",\"cloud\":\"aws_cur2\",\"created_at\":\"2026-05-21T18:11:12Z\",\"error_messages\":[],\"status\":\"active\",\"status_updated_at\":\"2026-05-21T18:11:12Z\",\"updated_at\":\"2026-05-21T18:11:12Z\"}}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "List Cloud Cost Management cloud accounts with an empty filter returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "frozen_at": "2026-09-28T21:36:25.029Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/cost/cloud_accounts", + "query": [ + [ + "filter[cloud]", + "Aws_Cur2" + ] + ] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":[{\"id\":\"12345\",\"type\":\"cloud_account\",\"attributes\":{\"account_id\":\"123456789123\",\"cloud\":\"aws_cur2\",\"created_at\":\"2026-05-21T18:11:12Z\",\"error_messages\":[],\"status\":\"active\",\"status_updated_at\":\"2026-05-21T18:11:12Z\",\"updated_at\":\"2026-05-21T18:11:12Z\"}}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "List Cloud Cost Management cloud accounts with mixed-case AWS CUR 2.0 filter returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "frozen_at": "2026-09-28T21:36:25.192Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/cost/cloud_accounts", + "query": [ + [ + "filter[cloud]", + "OcI" + ] + ] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":[]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "List Cloud Cost Management cloud accounts with mixed-case OCI filter returns \"OK\" response", + "version": "v2" + }, { "feature": "Cloud Cost Management", "frozen_at": "2024-07-22T12:06:38.368Z",