diff --git a/.apigentools-info b/.apigentools-info index be25437e4ca..c246cbaaaee 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-17 14:24:04.348476", - "spec_repo_commit": "60205e12" + "regenerated": "2025-01-17 20:07:26.125815", + "spec_repo_commit": "127642e2" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-17 14:24:04.364670", - "spec_repo_commit": "60205e12" + "regenerated": "2025-01-17 20:07:26.141237", + "spec_repo_commit": "127642e2" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c0f7b54f032..fb8e79c35be 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -12413,6 +12413,221 @@ components: type: string x-enum-varnames: - GCP_SERVICE_ACCOUNT + GCPUsageCostConfig: + description: GCP Usage Cost config. + properties: + attributes: + $ref: '#/components/schemas/GCPUsageCostConfigAttributes' + id: + description: The ID of the GCP Usage Cost config. + format: int64 + type: integer + type: + $ref: '#/components/schemas/GCPUsageCostConfigType' + required: + - attributes + - type + type: object + GCPUsageCostConfigAttributes: + description: Attributes for a GCP Usage Cost config. + properties: + account_id: + description: The GCP account ID. + example: 123456_A123BC_12AB34 + type: string + bucket_name: + description: The GCP bucket name used to store the Usage Cost export. + example: dd-cost-bucket + type: string + created_at: + description: The timestamp when the GCP Usage Cost config was created. + pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}$ + type: string + dataset: + description: The export dataset name used for the GCP Usage Cost Report. + example: billing + type: string + error_messages: + description: The error messages for the GCP Usage Cost config. + items: + type: string + type: array + export_prefix: + description: The export prefix used for the GCP Usage Cost Report. + example: datadog_cloud_cost_usage_export + type: string + export_project_name: + description: The name of the GCP Usage Cost Report. + example: dd-cloud-cost-report + type: string + months: + deprecated: true + description: The number of months the report has been backfilled. + format: int32 + maximum: 36 + type: integer + project_id: + description: The `project_id` of the GCP Usage Cost report. + example: my-project-123 + type: string + service_account: + description: The unique GCP service account email. + example: dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com + type: string + status: + description: The status of the GCP Usage Cost config. + example: active + type: string + status_updated_at: + description: The timestamp when the GCP Usage Cost config status was updated. + pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}$ + type: string + updated_at: + description: The timestamp when the GCP Usage Cost config status was updated. + pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}$ + type: string + required: + - account_id + - bucket_name + - dataset + - export_prefix + - export_project_name + - service_account + - status + type: object + GCPUsageCostConfigPatchData: + description: GCP Usage Cost config patch data. + properties: + attributes: + $ref: '#/components/schemas/GCPUsageCostConfigPatchRequestAttributes' + type: + $ref: '#/components/schemas/GCPUsageCostConfigPatchRequestType' + required: + - attributes + - type + type: object + GCPUsageCostConfigPatchRequest: + description: GCP Usage Cost config patch request. + properties: + data: + $ref: '#/components/schemas/GCPUsageCostConfigPatchData' + required: + - data + type: object + GCPUsageCostConfigPatchRequestAttributes: + description: Attributes for GCP Usage Cost config patch request. + properties: + is_enabled: + description: Whether or not the Cloud Cost Management account is enabled. + example: true + type: boolean + required: + - is_enabled + type: object + GCPUsageCostConfigPatchRequestType: + default: gcp_usage_cost_config_patch_request + description: Type of GCP Usage Cost config patch request. + enum: + - gcp_usage_cost_config_patch_request + example: gcp_usage_cost_config_patch_request + type: string + x-enum-varnames: + - GCP_USAGE_COST_CONFIG_PATCH_REQUEST + GCPUsageCostConfigPostData: + description: GCP Usage Cost config post data. + properties: + attributes: + $ref: '#/components/schemas/GCPUsageCostConfigPostRequestAttributes' + type: + $ref: '#/components/schemas/GCPUsageCostConfigPostRequestType' + required: + - attributes + - type + type: object + GCPUsageCostConfigPostRequest: + description: GCP Usage Cost config post request. + properties: + data: + $ref: '#/components/schemas/GCPUsageCostConfigPostData' + required: + - data + type: object + GCPUsageCostConfigPostRequestAttributes: + description: Attributes for GCP Usage Cost config post request. + properties: + account_id: + description: The GCP account ID. + example: 123456_A123BC_12AB34 + type: string + bucket_name: + description: The GCP bucket name used to store the Usage Cost export. + example: dd-cost-bucket + type: string + dataset: + description: The export dataset name used for the GCP Usage Cost report. + example: billing + type: string + export_prefix: + description: The export prefix used for the GCP Usage Cost report. + example: datadog_cloud_cost_usage_export + type: string + export_project_name: + description: The name of the GCP Usage Cost report. + example: dd-cloud-cost-report + type: string + is_enabled: + description: Whether or not the Cloud Cost Management account is enabled. + type: boolean + months: + description: The month of the report. + format: int32 + maximum: 36 + type: integer + service_account: + description: The unique GCP service account email. + example: dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com + type: string + required: + - account_id + - bucket_name + - dataset + - export_prefix + - export_project_name + - service_account + type: object + GCPUsageCostConfigPostRequestType: + default: gcp_usage_cost_config_post_request + description: Type of GCP Usage Cost config post request. + enum: + - gcp_usage_cost_config_post_request + example: gcp_usage_cost_config_post_request + type: string + x-enum-varnames: + - GCP_USAGE_COST_CONFIG_POST_REQUEST + GCPUsageCostConfigResponse: + description: Response of GCP Usage Cost config. + properties: + data: + $ref: '#/components/schemas/GCPUsageCostConfig' + type: object + GCPUsageCostConfigType: + default: gcp_usage_cost_config + description: Type of GCP Usage Cost config. + enum: + - gcp_usage_cost_config + example: gcp_usage_cost_config + type: string + x-enum-varnames: + - GCP_USAGE_COST_CONFIG + GCPUsageCostConfigsResponse: + description: List of GCP Usage Cost configs. + properties: + data: + description: A GCP Usage Cost config. + items: + $ref: '#/components/schemas/GCPUsageCostConfig' + type: array + type: object GetActionConnectionResponse: description: The response for found connection properties: @@ -34195,6 +34410,152 @@ paths: summary: Get Custom Costs file tags: - Cloud Cost Management + /api/v2/cost/gcp_uc_config: + get: + description: List the GCP Usage Cost configs. + operationId: ListCostGCPUsageCostConfigs + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GCPUsageCostConfigsResponse' + 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 Cloud Cost Management GCP Usage Cost configs + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_read + post: + description: Create a Cloud Cost Management account for an GCP Usage Cost config. + operationId: CreateCostGCPUsageCostConfig + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GCPUsageCostConfigPostRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GCPUsageCostConfigResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + 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_write + summary: Create Cloud Cost Management GCP Usage Cost config + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + /api/v2/cost/gcp_uc_config/{cloud_account_id}: + delete: + description: Archive a Cloud Cost Management account. + operationId: DeleteCostGCPUsageCostConfig + parameters: + - $ref: '#/components/parameters/CloudAccountID' + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Delete Cloud Cost Management GCP Usage Cost config + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + patch: + description: Update the status of an GCP Usage Cost config (active/archived). + operationId: UpdateCostGCPUsageCostConfig + parameters: + - $ref: '#/components/parameters/CloudAccountID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GCPUsageCostConfigPatchRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GCPUsageCostConfigsResponse' + 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_write + summary: Update Cloud Cost Management GCP Usage Cost config + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_write /api/v2/cost_by_tag/active_billing_dimensions: get: description: Get active billing dimensions for cost attribution. Cost data for @@ -48879,8 +49240,8 @@ tags: for more information. name: Case Management - description: The Cloud Cost Management API allows you to set up, edit, and delete - Cloud Cost Management accounts for AWS and Azure. You can query your cost data - by using the [Metrics endpoint](https://docs.datadoghq.com/api/latest/metrics/#query-timeseries-data-across-multiple-products) + Cloud Cost Management accounts for AWS, Azure, and GCP. You can query your cost + data by using the [Metrics endpoint](https://docs.datadoghq.com/api/latest/metrics/#query-timeseries-data-across-multiple-products) and the `cloud_cost` data source. For more information, see the [Cloud Cost Management documentation](https://docs.datadoghq.com/cloud_cost_management/). name: Cloud Cost Management diff --git a/examples/v2/cloud-cost-management/CreateCostGCPUsageCostConfig.java b/examples/v2/cloud-cost-management/CreateCostGCPUsageCostConfig.java new file mode 100644 index 00000000000..6d5fb1478ec --- /dev/null +++ b/examples/v2/cloud-cost-management/CreateCostGCPUsageCostConfig.java @@ -0,0 +1,44 @@ +// Create Cloud Cost Management GCP Usage Cost config returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import com.datadog.api.client.v2.model.GCPUsageCostConfigPostData; +import com.datadog.api.client.v2.model.GCPUsageCostConfigPostRequest; +import com.datadog.api.client.v2.model.GCPUsageCostConfigPostRequestAttributes; +import com.datadog.api.client.v2.model.GCPUsageCostConfigPostRequestType; +import com.datadog.api.client.v2.model.GCPUsageCostConfigResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + GCPUsageCostConfigPostRequest body = + new GCPUsageCostConfigPostRequest() + .data( + new GCPUsageCostConfigPostData() + .attributes( + new GCPUsageCostConfigPostRequestAttributes() + .accountId("123456_A123BC_12AB34") + .bucketName("dd-cost-bucket") + .dataset("billing") + .exportPrefix("datadog_cloud_cost_usage_export") + .exportProjectName("dd-cloud-cost-report") + .serviceAccount( + "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com")) + .type(GCPUsageCostConfigPostRequestType.GCP_USAGE_COST_CONFIG_POST_REQUEST)); + + try { + GCPUsageCostConfigResponse result = apiInstance.createCostGCPUsageCostConfig(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling CloudCostManagementApi#createCostGCPUsageCostConfig"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/cloud-cost-management/DeleteCostGCPUsageCostConfig.java b/examples/v2/cloud-cost-management/DeleteCostGCPUsageCostConfig.java new file mode 100644 index 00000000000..022927331fa --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteCostGCPUsageCostConfig.java @@ -0,0 +1,23 @@ +// Delete Cloud Cost Management GCP Usage Cost config returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + apiInstance.deleteCostGCPUsageCostConfig("100"); + } catch (ApiException e) { + System.err.println( + "Exception when calling CloudCostManagementApi#deleteCostGCPUsageCostConfig"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/cloud-cost-management/ListCostGCPUsageCostConfigs.java b/examples/v2/cloud-cost-management/ListCostGCPUsageCostConfigs.java new file mode 100644 index 00000000000..eab6a6f27b0 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostGCPUsageCostConfigs.java @@ -0,0 +1,25 @@ +// List Cloud Cost Management GCP Usage Cost configs returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import com.datadog.api.client.v2.model.GCPUsageCostConfigsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + GCPUsageCostConfigsResponse result = apiInstance.listCostGCPUsageCostConfigs(); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling CloudCostManagementApi#listCostGCPUsageCostConfigs"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/cloud-cost-management/UpdateCostGCPUsageCostConfig.java b/examples/v2/cloud-cost-management/UpdateCostGCPUsageCostConfig.java new file mode 100644 index 00000000000..42ce8b0e6a6 --- /dev/null +++ b/examples/v2/cloud-cost-management/UpdateCostGCPUsageCostConfig.java @@ -0,0 +1,36 @@ +// Update Cloud Cost Management GCP Usage Cost config returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import com.datadog.api.client.v2.model.GCPUsageCostConfigPatchData; +import com.datadog.api.client.v2.model.GCPUsageCostConfigPatchRequest; +import com.datadog.api.client.v2.model.GCPUsageCostConfigPatchRequestAttributes; +import com.datadog.api.client.v2.model.GCPUsageCostConfigPatchRequestType; +import com.datadog.api.client.v2.model.GCPUsageCostConfigsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + GCPUsageCostConfigPatchRequest body = + new GCPUsageCostConfigPatchRequest() + .data( + new GCPUsageCostConfigPatchData() + .attributes(new GCPUsageCostConfigPatchRequestAttributes().isEnabled(true)) + .type(GCPUsageCostConfigPatchRequestType.GCP_USAGE_COST_CONFIG_PATCH_REQUEST)); + + try { + GCPUsageCostConfigsResponse result = apiInstance.updateCostGCPUsageCostConfig("100", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling CloudCostManagementApi#updateCostGCPUsageCostConfig"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java b/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java index 52ce60c61b3..7224cb6ef0e 100644 --- a/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java @@ -16,6 +16,10 @@ import com.datadog.api.client.v2.model.CustomCostsFileLineItem; import com.datadog.api.client.v2.model.CustomCostsFileListResponse; import com.datadog.api.client.v2.model.CustomCostsFileUploadResponse; +import com.datadog.api.client.v2.model.GCPUsageCostConfigPatchRequest; +import com.datadog.api.client.v2.model.GCPUsageCostConfigPostRequest; +import com.datadog.api.client.v2.model.GCPUsageCostConfigResponse; +import com.datadog.api.client.v2.model.GCPUsageCostConfigsResponse; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -321,6 +325,140 @@ public ApiResponse createCostAzureUCConfigsWithHttpI new GenericType() {}); } + /** + * Create Cloud Cost Management GCP Usage Cost config. + * + *

See {@link #createCostGCPUsageCostConfigWithHttpInfo}. + * + * @param body (required) + * @return GCPUsageCostConfigResponse + * @throws ApiException if fails to make API call + */ + public GCPUsageCostConfigResponse createCostGCPUsageCostConfig(GCPUsageCostConfigPostRequest body) + throws ApiException { + return createCostGCPUsageCostConfigWithHttpInfo(body).getData(); + } + + /** + * Create Cloud Cost Management GCP Usage Cost config. + * + *

See {@link #createCostGCPUsageCostConfigWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<GCPUsageCostConfigResponse> + */ + public CompletableFuture createCostGCPUsageCostConfigAsync( + GCPUsageCostConfigPostRequest body) { + return createCostGCPUsageCostConfigWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a Cloud Cost Management account for an GCP Usage Cost config. + * + * @param body (required) + * @return ApiResponse<GCPUsageCostConfigResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse createCostGCPUsageCostConfigWithHttpInfo( + GCPUsageCostConfigPostRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createCostGCPUsageCostConfig"); + } + // create path and map variables + String localVarPath = "/api/v2/cost/gcp_uc_config"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.createCostGCPUsageCostConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create Cloud Cost Management GCP Usage Cost config. + * + *

See {@link #createCostGCPUsageCostConfigWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<GCPUsageCostConfigResponse>> + */ + public CompletableFuture> + createCostGCPUsageCostConfigWithHttpInfoAsync(GCPUsageCostConfigPostRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling createCostGCPUsageCostConfig")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/cost/gcp_uc_config"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.createCostGCPUsageCostConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Delete Cloud Cost Management AWS CUR config. * @@ -603,6 +741,148 @@ public CompletableFuture> deleteCostAzureUCConfigWithHttpInfoA null); } + /** + * Delete Cloud Cost Management GCP Usage Cost config. + * + *

See {@link #deleteCostGCPUsageCostConfigWithHttpInfo}. + * + * @param cloudAccountId Cloud Account id. (required) + * @throws ApiException if fails to make API call + */ + public void deleteCostGCPUsageCostConfig(String cloudAccountId) throws ApiException { + deleteCostGCPUsageCostConfigWithHttpInfo(cloudAccountId); + } + + /** + * Delete Cloud Cost Management GCP Usage Cost config. + * + *

See {@link #deleteCostGCPUsageCostConfigWithHttpInfoAsync}. + * + * @param cloudAccountId Cloud Account id. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteCostGCPUsageCostConfigAsync(String cloudAccountId) { + return deleteCostGCPUsageCostConfigWithHttpInfoAsync(cloudAccountId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Archive a Cloud Cost Management account. + * + * @param cloudAccountId Cloud Account id. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteCostGCPUsageCostConfigWithHttpInfo(String cloudAccountId) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'cloudAccountId' is set + if (cloudAccountId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'cloudAccountId' when calling" + + " deleteCostGCPUsageCostConfig"); + } + // create path and map variables + String localVarPath = + "/api/v2/cost/gcp_uc_config/{cloud_account_id}" + .replaceAll( + "\\{" + "cloud_account_id" + "\\}", + apiClient.escapeString(cloudAccountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.deleteCostGCPUsageCostConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete Cloud Cost Management GCP Usage Cost config. + * + *

See {@link #deleteCostGCPUsageCostConfigWithHttpInfo}. + * + * @param cloudAccountId Cloud Account id. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteCostGCPUsageCostConfigWithHttpInfoAsync( + String cloudAccountId) { + Object localVarPostBody = null; + + // verify the required parameter 'cloudAccountId' is set + if (cloudAccountId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'cloudAccountId' when calling" + + " deleteCostGCPUsageCostConfig")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/cost/gcp_uc_config/{cloud_account_id}" + .replaceAll( + "\\{" + "cloud_account_id" + "\\}", + apiClient.escapeString(cloudAccountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.deleteCostGCPUsageCostConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Delete Custom Costs file. * @@ -1091,6 +1371,118 @@ public ApiResponse listCostAzureUCConfigsWithHttpInfo() new GenericType() {}); } + /** + * List Cloud Cost Management GCP Usage Cost configs. + * + *

See {@link #listCostGCPUsageCostConfigsWithHttpInfo}. + * + * @return GCPUsageCostConfigsResponse + * @throws ApiException if fails to make API call + */ + public GCPUsageCostConfigsResponse listCostGCPUsageCostConfigs() throws ApiException { + return listCostGCPUsageCostConfigsWithHttpInfo().getData(); + } + + /** + * List Cloud Cost Management GCP Usage Cost configs. + * + *

See {@link #listCostGCPUsageCostConfigsWithHttpInfoAsync}. + * + * @return CompletableFuture<GCPUsageCostConfigsResponse> + */ + public CompletableFuture listCostGCPUsageCostConfigsAsync() { + return listCostGCPUsageCostConfigsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List the GCP Usage Cost configs. + * + * @return ApiResponse<GCPUsageCostConfigsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listCostGCPUsageCostConfigsWithHttpInfo() + throws ApiException { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/cost/gcp_uc_config"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listCostGCPUsageCostConfigs", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List Cloud Cost Management GCP Usage Cost configs. + * + *

See {@link #listCostGCPUsageCostConfigsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<GCPUsageCostConfigsResponse>> + */ + public CompletableFuture> + listCostGCPUsageCostConfigsWithHttpInfoAsync() { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/cost/gcp_uc_config"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listCostGCPUsageCostConfigs", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * List Custom Costs files. * @@ -1530,6 +1922,174 @@ public ApiResponse updateCostAzureUCConfigsWithHttpI new GenericType() {}); } + /** + * Update Cloud Cost Management GCP Usage Cost config. + * + *

See {@link #updateCostGCPUsageCostConfigWithHttpInfo}. + * + * @param cloudAccountId Cloud Account id. (required) + * @param body (required) + * @return GCPUsageCostConfigsResponse + * @throws ApiException if fails to make API call + */ + public GCPUsageCostConfigsResponse updateCostGCPUsageCostConfig( + String cloudAccountId, GCPUsageCostConfigPatchRequest body) throws ApiException { + return updateCostGCPUsageCostConfigWithHttpInfo(cloudAccountId, body).getData(); + } + + /** + * Update Cloud Cost Management GCP Usage Cost config. + * + *

See {@link #updateCostGCPUsageCostConfigWithHttpInfoAsync}. + * + * @param cloudAccountId Cloud Account id. (required) + * @param body (required) + * @return CompletableFuture<GCPUsageCostConfigsResponse> + */ + public CompletableFuture updateCostGCPUsageCostConfigAsync( + String cloudAccountId, GCPUsageCostConfigPatchRequest body) { + return updateCostGCPUsageCostConfigWithHttpInfoAsync(cloudAccountId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update the status of an GCP Usage Cost config (active/archived). + * + * @param cloudAccountId Cloud Account id. (required) + * @param body (required) + * @return ApiResponse<GCPUsageCostConfigsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse updateCostGCPUsageCostConfigWithHttpInfo( + String cloudAccountId, GCPUsageCostConfigPatchRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'cloudAccountId' is set + if (cloudAccountId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'cloudAccountId' when calling" + + " updateCostGCPUsageCostConfig"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateCostGCPUsageCostConfig"); + } + // create path and map variables + String localVarPath = + "/api/v2/cost/gcp_uc_config/{cloud_account_id}" + .replaceAll( + "\\{" + "cloud_account_id" + "\\}", + apiClient.escapeString(cloudAccountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.updateCostGCPUsageCostConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update Cloud Cost Management GCP Usage Cost config. + * + *

See {@link #updateCostGCPUsageCostConfigWithHttpInfo}. + * + * @param cloudAccountId Cloud Account id. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<GCPUsageCostConfigsResponse>> + */ + public CompletableFuture> + updateCostGCPUsageCostConfigWithHttpInfoAsync( + String cloudAccountId, GCPUsageCostConfigPatchRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'cloudAccountId' is set + if (cloudAccountId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'cloudAccountId' when calling" + + " updateCostGCPUsageCostConfig")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling updateCostGCPUsageCostConfig")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/cost/gcp_uc_config/{cloud_account_id}" + .replaceAll( + "\\{" + "cloud_account_id" + "\\}", + apiClient.escapeString(cloudAccountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.updateCostGCPUsageCostConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Upload Custom Costs file. * diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfig.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfig.java new file mode 100644 index 00000000000..12f1dcd463e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfig.java @@ -0,0 +1,208 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** GCP Usage Cost config. */ +@JsonPropertyOrder({ + GCPUsageCostConfig.JSON_PROPERTY_ATTRIBUTES, + GCPUsageCostConfig.JSON_PROPERTY_ID, + GCPUsageCostConfig.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPUsageCostConfig { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GCPUsageCostConfigAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPUsageCostConfigType type = GCPUsageCostConfigType.GCP_USAGE_COST_CONFIG; + + public GCPUsageCostConfig() {} + + @JsonCreator + public GCPUsageCostConfig( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GCPUsageCostConfigAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GCPUsageCostConfigType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GCPUsageCostConfig attributes(GCPUsageCostConfigAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for a GCP Usage Cost config. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPUsageCostConfigAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GCPUsageCostConfigAttributes attributes) { + this.attributes = attributes; + } + + public GCPUsageCostConfig id(Long id) { + this.id = id; + return this; + } + + /** + * The ID of the GCP Usage Cost config. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public GCPUsageCostConfig type(GCPUsageCostConfigType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of GCP Usage Cost config. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPUsageCostConfigType getType() { + return type; + } + + public void setType(GCPUsageCostConfigType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPUsageCostConfig + */ + @JsonAnySetter + public GCPUsageCostConfig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPUsageCostConfig object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPUsageCostConfig gcpUsageCostConfig = (GCPUsageCostConfig) o; + return Objects.equals(this.attributes, gcpUsageCostConfig.attributes) + && Objects.equals(this.id, gcpUsageCostConfig.id) + && Objects.equals(this.type, gcpUsageCostConfig.type) + && Objects.equals(this.additionalProperties, gcpUsageCostConfig.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPUsageCostConfig {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigAttributes.java new file mode 100644 index 00000000000..9e171a84784 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigAttributes.java @@ -0,0 +1,504 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes for a GCP Usage Cost config. */ +@JsonPropertyOrder({ + GCPUsageCostConfigAttributes.JSON_PROPERTY_ACCOUNT_ID, + GCPUsageCostConfigAttributes.JSON_PROPERTY_BUCKET_NAME, + GCPUsageCostConfigAttributes.JSON_PROPERTY_CREATED_AT, + GCPUsageCostConfigAttributes.JSON_PROPERTY_DATASET, + GCPUsageCostConfigAttributes.JSON_PROPERTY_ERROR_MESSAGES, + GCPUsageCostConfigAttributes.JSON_PROPERTY_EXPORT_PREFIX, + GCPUsageCostConfigAttributes.JSON_PROPERTY_EXPORT_PROJECT_NAME, + GCPUsageCostConfigAttributes.JSON_PROPERTY_MONTHS, + GCPUsageCostConfigAttributes.JSON_PROPERTY_PROJECT_ID, + GCPUsageCostConfigAttributes.JSON_PROPERTY_SERVICE_ACCOUNT, + GCPUsageCostConfigAttributes.JSON_PROPERTY_STATUS, + GCPUsageCostConfigAttributes.JSON_PROPERTY_STATUS_UPDATED_AT, + GCPUsageCostConfigAttributes.JSON_PROPERTY_UPDATED_AT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPUsageCostConfigAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; + private String accountId; + + public static final String JSON_PROPERTY_BUCKET_NAME = "bucket_name"; + private String bucketName; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private String createdAt; + + public static final String JSON_PROPERTY_DATASET = "dataset"; + private String dataset; + + public static final String JSON_PROPERTY_ERROR_MESSAGES = "error_messages"; + private List errorMessages = null; + + public static final String JSON_PROPERTY_EXPORT_PREFIX = "export_prefix"; + private String exportPrefix; + + public static final String JSON_PROPERTY_EXPORT_PROJECT_NAME = "export_project_name"; + private String exportProjectName; + + public static final String JSON_PROPERTY_MONTHS = "months"; + private Integer months; + + public static final String JSON_PROPERTY_PROJECT_ID = "project_id"; + private String projectId; + + public static final String JSON_PROPERTY_SERVICE_ACCOUNT = "service_account"; + private String serviceAccount; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public static final String JSON_PROPERTY_STATUS_UPDATED_AT = "status_updated_at"; + private String statusUpdatedAt; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private String updatedAt; + + public GCPUsageCostConfigAttributes() {} + + @JsonCreator + public GCPUsageCostConfigAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACCOUNT_ID) String accountId, + @JsonProperty(required = true, value = JSON_PROPERTY_BUCKET_NAME) String bucketName, + @JsonProperty(required = true, value = JSON_PROPERTY_DATASET) String dataset, + @JsonProperty(required = true, value = JSON_PROPERTY_EXPORT_PREFIX) String exportPrefix, + @JsonProperty(required = true, value = JSON_PROPERTY_EXPORT_PROJECT_NAME) + String exportProjectName, + @JsonProperty(required = true, value = JSON_PROPERTY_SERVICE_ACCOUNT) String serviceAccount, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) String status) { + this.accountId = accountId; + this.bucketName = bucketName; + this.dataset = dataset; + this.exportPrefix = exportPrefix; + this.exportProjectName = exportProjectName; + this.serviceAccount = serviceAccount; + this.status = status; + } + + public GCPUsageCostConfigAttributes accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * The GCP account ID. + * + * @return accountId + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public GCPUsageCostConfigAttributes bucketName(String bucketName) { + this.bucketName = bucketName; + return this; + } + + /** + * The GCP bucket name used to store the Usage Cost export. + * + * @return bucketName + */ + @JsonProperty(JSON_PROPERTY_BUCKET_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getBucketName() { + return bucketName; + } + + public void setBucketName(String bucketName) { + this.bucketName = bucketName; + } + + public GCPUsageCostConfigAttributes createdAt(String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp when the GCP Usage Cost config was created. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public GCPUsageCostConfigAttributes dataset(String dataset) { + this.dataset = dataset; + return this; + } + + /** + * The export dataset name used for the GCP Usage Cost Report. + * + * @return dataset + */ + @JsonProperty(JSON_PROPERTY_DATASET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDataset() { + return dataset; + } + + public void setDataset(String dataset) { + this.dataset = dataset; + } + + public GCPUsageCostConfigAttributes errorMessages(List errorMessages) { + this.errorMessages = errorMessages; + return this; + } + + public GCPUsageCostConfigAttributes addErrorMessagesItem(String errorMessagesItem) { + if (this.errorMessages == null) { + this.errorMessages = new ArrayList<>(); + } + this.errorMessages.add(errorMessagesItem); + return this; + } + + /** + * The error messages for the GCP Usage Cost config. + * + * @return errorMessages + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ERROR_MESSAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getErrorMessages() { + return errorMessages; + } + + public void setErrorMessages(List errorMessages) { + this.errorMessages = errorMessages; + } + + public GCPUsageCostConfigAttributes exportPrefix(String exportPrefix) { + this.exportPrefix = exportPrefix; + return this; + } + + /** + * The export prefix used for the GCP Usage Cost Report. + * + * @return exportPrefix + */ + @JsonProperty(JSON_PROPERTY_EXPORT_PREFIX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getExportPrefix() { + return exportPrefix; + } + + public void setExportPrefix(String exportPrefix) { + this.exportPrefix = exportPrefix; + } + + public GCPUsageCostConfigAttributes exportProjectName(String exportProjectName) { + this.exportProjectName = exportProjectName; + return this; + } + + /** + * The name of the GCP Usage Cost Report. + * + * @return exportProjectName + */ + @JsonProperty(JSON_PROPERTY_EXPORT_PROJECT_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getExportProjectName() { + return exportProjectName; + } + + public void setExportProjectName(String exportProjectName) { + this.exportProjectName = exportProjectName; + } + + public GCPUsageCostConfigAttributes months(Integer months) { + this.months = months; + return this; + } + + /** + * The number of months the report has been backfilled. maximum: 36 + * + * @return months + * @deprecated + */ + @Deprecated + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MONTHS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getMonths() { + return months; + } + + @Deprecated + public void setMonths(Integer months) { + this.months = months; + } + + public GCPUsageCostConfigAttributes projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * The project_id of the GCP Usage Cost report. + * + * @return projectId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PROJECT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public GCPUsageCostConfigAttributes serviceAccount(String serviceAccount) { + this.serviceAccount = serviceAccount; + return this; + } + + /** + * The unique GCP service account email. + * + * @return serviceAccount + */ + @JsonProperty(JSON_PROPERTY_SERVICE_ACCOUNT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getServiceAccount() { + return serviceAccount; + } + + public void setServiceAccount(String serviceAccount) { + this.serviceAccount = serviceAccount; + } + + public GCPUsageCostConfigAttributes status(String status) { + this.status = status; + return this; + } + + /** + * The status of the GCP Usage Cost config. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public GCPUsageCostConfigAttributes statusUpdatedAt(String statusUpdatedAt) { + this.statusUpdatedAt = statusUpdatedAt; + return this; + } + + /** + * The timestamp when the GCP Usage Cost config status was updated. + * + * @return statusUpdatedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getStatusUpdatedAt() { + return statusUpdatedAt; + } + + public void setStatusUpdatedAt(String statusUpdatedAt) { + this.statusUpdatedAt = statusUpdatedAt; + } + + public GCPUsageCostConfigAttributes updatedAt(String updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp when the GCP Usage Cost config status was updated. + * + * @return updatedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPUsageCostConfigAttributes + */ + @JsonAnySetter + public GCPUsageCostConfigAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPUsageCostConfigAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPUsageCostConfigAttributes gcpUsageCostConfigAttributes = (GCPUsageCostConfigAttributes) o; + return Objects.equals(this.accountId, gcpUsageCostConfigAttributes.accountId) + && Objects.equals(this.bucketName, gcpUsageCostConfigAttributes.bucketName) + && Objects.equals(this.createdAt, gcpUsageCostConfigAttributes.createdAt) + && Objects.equals(this.dataset, gcpUsageCostConfigAttributes.dataset) + && Objects.equals(this.errorMessages, gcpUsageCostConfigAttributes.errorMessages) + && Objects.equals(this.exportPrefix, gcpUsageCostConfigAttributes.exportPrefix) + && Objects.equals(this.exportProjectName, gcpUsageCostConfigAttributes.exportProjectName) + && Objects.equals(this.months, gcpUsageCostConfigAttributes.months) + && Objects.equals(this.projectId, gcpUsageCostConfigAttributes.projectId) + && Objects.equals(this.serviceAccount, gcpUsageCostConfigAttributes.serviceAccount) + && Objects.equals(this.status, gcpUsageCostConfigAttributes.status) + && Objects.equals(this.statusUpdatedAt, gcpUsageCostConfigAttributes.statusUpdatedAt) + && Objects.equals(this.updatedAt, gcpUsageCostConfigAttributes.updatedAt) + && Objects.equals( + this.additionalProperties, gcpUsageCostConfigAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + accountId, + bucketName, + createdAt, + dataset, + errorMessages, + exportPrefix, + exportProjectName, + months, + projectId, + serviceAccount, + status, + statusUpdatedAt, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPUsageCostConfigAttributes {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" bucketName: ").append(toIndentedString(bucketName)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataset: ").append(toIndentedString(dataset)).append("\n"); + sb.append(" errorMessages: ").append(toIndentedString(errorMessages)).append("\n"); + sb.append(" exportPrefix: ").append(toIndentedString(exportPrefix)).append("\n"); + sb.append(" exportProjectName: ").append(toIndentedString(exportProjectName)).append("\n"); + sb.append(" months: ").append(toIndentedString(months)).append("\n"); + sb.append(" projectId: ").append(toIndentedString(projectId)).append("\n"); + sb.append(" serviceAccount: ").append(toIndentedString(serviceAccount)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" statusUpdatedAt: ").append(toIndentedString(statusUpdatedAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchData.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchData.java new file mode 100644 index 00000000000..6a944787d1d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchData.java @@ -0,0 +1,185 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** GCP Usage Cost config patch data. */ +@JsonPropertyOrder({ + GCPUsageCostConfigPatchData.JSON_PROPERTY_ATTRIBUTES, + GCPUsageCostConfigPatchData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPUsageCostConfigPatchData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GCPUsageCostConfigPatchRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPUsageCostConfigPatchRequestType type = + GCPUsageCostConfigPatchRequestType.GCP_USAGE_COST_CONFIG_PATCH_REQUEST; + + public GCPUsageCostConfigPatchData() {} + + @JsonCreator + public GCPUsageCostConfigPatchData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GCPUsageCostConfigPatchRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GCPUsageCostConfigPatchRequestType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GCPUsageCostConfigPatchData attributes( + GCPUsageCostConfigPatchRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for GCP Usage Cost config patch request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPUsageCostConfigPatchRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GCPUsageCostConfigPatchRequestAttributes attributes) { + this.attributes = attributes; + } + + public GCPUsageCostConfigPatchData type(GCPUsageCostConfigPatchRequestType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of GCP Usage Cost config patch request. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPUsageCostConfigPatchRequestType getType() { + return type; + } + + public void setType(GCPUsageCostConfigPatchRequestType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPUsageCostConfigPatchData + */ + @JsonAnySetter + public GCPUsageCostConfigPatchData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPUsageCostConfigPatchData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPUsageCostConfigPatchData gcpUsageCostConfigPatchData = (GCPUsageCostConfigPatchData) o; + return Objects.equals(this.attributes, gcpUsageCostConfigPatchData.attributes) + && Objects.equals(this.type, gcpUsageCostConfigPatchData.type) + && Objects.equals( + this.additionalProperties, gcpUsageCostConfigPatchData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPUsageCostConfigPatchData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchRequest.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchRequest.java new file mode 100644 index 00000000000..134f248ef13 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchRequest.java @@ -0,0 +1,147 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** GCP Usage Cost config patch request. */ +@JsonPropertyOrder({GCPUsageCostConfigPatchRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPUsageCostConfigPatchRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GCPUsageCostConfigPatchData data; + + public GCPUsageCostConfigPatchRequest() {} + + @JsonCreator + public GCPUsageCostConfigPatchRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) GCPUsageCostConfigPatchData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GCPUsageCostConfigPatchRequest data(GCPUsageCostConfigPatchData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * GCP Usage Cost config patch data. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPUsageCostConfigPatchData getData() { + return data; + } + + public void setData(GCPUsageCostConfigPatchData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPUsageCostConfigPatchRequest + */ + @JsonAnySetter + public GCPUsageCostConfigPatchRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPUsageCostConfigPatchRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPUsageCostConfigPatchRequest gcpUsageCostConfigPatchRequest = + (GCPUsageCostConfigPatchRequest) o; + return Objects.equals(this.data, gcpUsageCostConfigPatchRequest.data) + && Objects.equals( + this.additionalProperties, gcpUsageCostConfigPatchRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPUsageCostConfigPatchRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchRequestAttributes.java new file mode 100644 index 00000000000..b3d04d1d4f2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchRequestAttributes.java @@ -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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes for GCP Usage Cost config patch request. */ +@JsonPropertyOrder({GCPUsageCostConfigPatchRequestAttributes.JSON_PROPERTY_IS_ENABLED}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPUsageCostConfigPatchRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_IS_ENABLED = "is_enabled"; + private Boolean isEnabled; + + public GCPUsageCostConfigPatchRequestAttributes() {} + + @JsonCreator + public GCPUsageCostConfigPatchRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_IS_ENABLED) Boolean isEnabled) { + this.isEnabled = isEnabled; + } + + public GCPUsageCostConfigPatchRequestAttributes isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Whether or not the Cloud Cost Management account is enabled. + * + * @return isEnabled + */ + @JsonProperty(JSON_PROPERTY_IS_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsEnabled() { + return isEnabled; + } + + public void setIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPUsageCostConfigPatchRequestAttributes + */ + @JsonAnySetter + public GCPUsageCostConfigPatchRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPUsageCostConfigPatchRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPUsageCostConfigPatchRequestAttributes gcpUsageCostConfigPatchRequestAttributes = + (GCPUsageCostConfigPatchRequestAttributes) o; + return Objects.equals(this.isEnabled, gcpUsageCostConfigPatchRequestAttributes.isEnabled) + && Objects.equals( + this.additionalProperties, + gcpUsageCostConfigPatchRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(isEnabled, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPUsageCostConfigPatchRequestAttributes {\n"); + sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchRequestType.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchRequestType.java new file mode 100644 index 00000000000..1a89baf4544 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPatchRequestType.java @@ -0,0 +1,59 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type of GCP Usage Cost config patch request. */ +@JsonSerialize( + using = GCPUsageCostConfigPatchRequestType.GCPUsageCostConfigPatchRequestTypeSerializer.class) +public class GCPUsageCostConfigPatchRequestType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("gcp_usage_cost_config_patch_request")); + + public static final GCPUsageCostConfigPatchRequestType GCP_USAGE_COST_CONFIG_PATCH_REQUEST = + new GCPUsageCostConfigPatchRequestType("gcp_usage_cost_config_patch_request"); + + GCPUsageCostConfigPatchRequestType(String value) { + super(value, allowedValues); + } + + public static class GCPUsageCostConfigPatchRequestTypeSerializer + extends StdSerializer { + public GCPUsageCostConfigPatchRequestTypeSerializer( + Class t) { + super(t); + } + + public GCPUsageCostConfigPatchRequestTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GCPUsageCostConfigPatchRequestType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GCPUsageCostConfigPatchRequestType fromValue(String value) { + return new GCPUsageCostConfigPatchRequestType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostData.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostData.java new file mode 100644 index 00000000000..5176971947b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostData.java @@ -0,0 +1,184 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** GCP Usage Cost config post data. */ +@JsonPropertyOrder({ + GCPUsageCostConfigPostData.JSON_PROPERTY_ATTRIBUTES, + GCPUsageCostConfigPostData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPUsageCostConfigPostData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GCPUsageCostConfigPostRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPUsageCostConfigPostRequestType type = + GCPUsageCostConfigPostRequestType.GCP_USAGE_COST_CONFIG_POST_REQUEST; + + public GCPUsageCostConfigPostData() {} + + @JsonCreator + public GCPUsageCostConfigPostData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GCPUsageCostConfigPostRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GCPUsageCostConfigPostRequestType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GCPUsageCostConfigPostData attributes(GCPUsageCostConfigPostRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for GCP Usage Cost config post request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPUsageCostConfigPostRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GCPUsageCostConfigPostRequestAttributes attributes) { + this.attributes = attributes; + } + + public GCPUsageCostConfigPostData type(GCPUsageCostConfigPostRequestType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of GCP Usage Cost config post request. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPUsageCostConfigPostRequestType getType() { + return type; + } + + public void setType(GCPUsageCostConfigPostRequestType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPUsageCostConfigPostData + */ + @JsonAnySetter + public GCPUsageCostConfigPostData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPUsageCostConfigPostData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPUsageCostConfigPostData gcpUsageCostConfigPostData = (GCPUsageCostConfigPostData) o; + return Objects.equals(this.attributes, gcpUsageCostConfigPostData.attributes) + && Objects.equals(this.type, gcpUsageCostConfigPostData.type) + && Objects.equals( + this.additionalProperties, gcpUsageCostConfigPostData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPUsageCostConfigPostData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostRequest.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostRequest.java new file mode 100644 index 00000000000..742233ba223 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostRequest.java @@ -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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** GCP Usage Cost config post request. */ +@JsonPropertyOrder({GCPUsageCostConfigPostRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPUsageCostConfigPostRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GCPUsageCostConfigPostData data; + + public GCPUsageCostConfigPostRequest() {} + + @JsonCreator + public GCPUsageCostConfigPostRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) GCPUsageCostConfigPostData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GCPUsageCostConfigPostRequest data(GCPUsageCostConfigPostData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * GCP Usage Cost config post data. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GCPUsageCostConfigPostData getData() { + return data; + } + + public void setData(GCPUsageCostConfigPostData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPUsageCostConfigPostRequest + */ + @JsonAnySetter + public GCPUsageCostConfigPostRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPUsageCostConfigPostRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPUsageCostConfigPostRequest gcpUsageCostConfigPostRequest = (GCPUsageCostConfigPostRequest) o; + return Objects.equals(this.data, gcpUsageCostConfigPostRequest.data) + && Objects.equals( + this.additionalProperties, gcpUsageCostConfigPostRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPUsageCostConfigPostRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostRequestAttributes.java new file mode 100644 index 00000000000..e5d9266d8b4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostRequestAttributes.java @@ -0,0 +1,354 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes for GCP Usage Cost config post request. */ +@JsonPropertyOrder({ + GCPUsageCostConfigPostRequestAttributes.JSON_PROPERTY_ACCOUNT_ID, + GCPUsageCostConfigPostRequestAttributes.JSON_PROPERTY_BUCKET_NAME, + GCPUsageCostConfigPostRequestAttributes.JSON_PROPERTY_DATASET, + GCPUsageCostConfigPostRequestAttributes.JSON_PROPERTY_EXPORT_PREFIX, + GCPUsageCostConfigPostRequestAttributes.JSON_PROPERTY_EXPORT_PROJECT_NAME, + GCPUsageCostConfigPostRequestAttributes.JSON_PROPERTY_IS_ENABLED, + GCPUsageCostConfigPostRequestAttributes.JSON_PROPERTY_MONTHS, + GCPUsageCostConfigPostRequestAttributes.JSON_PROPERTY_SERVICE_ACCOUNT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPUsageCostConfigPostRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; + private String accountId; + + public static final String JSON_PROPERTY_BUCKET_NAME = "bucket_name"; + private String bucketName; + + public static final String JSON_PROPERTY_DATASET = "dataset"; + private String dataset; + + public static final String JSON_PROPERTY_EXPORT_PREFIX = "export_prefix"; + private String exportPrefix; + + public static final String JSON_PROPERTY_EXPORT_PROJECT_NAME = "export_project_name"; + private String exportProjectName; + + public static final String JSON_PROPERTY_IS_ENABLED = "is_enabled"; + private Boolean isEnabled; + + public static final String JSON_PROPERTY_MONTHS = "months"; + private Integer months; + + public static final String JSON_PROPERTY_SERVICE_ACCOUNT = "service_account"; + private String serviceAccount; + + public GCPUsageCostConfigPostRequestAttributes() {} + + @JsonCreator + public GCPUsageCostConfigPostRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACCOUNT_ID) String accountId, + @JsonProperty(required = true, value = JSON_PROPERTY_BUCKET_NAME) String bucketName, + @JsonProperty(required = true, value = JSON_PROPERTY_DATASET) String dataset, + @JsonProperty(required = true, value = JSON_PROPERTY_EXPORT_PREFIX) String exportPrefix, + @JsonProperty(required = true, value = JSON_PROPERTY_EXPORT_PROJECT_NAME) + String exportProjectName, + @JsonProperty(required = true, value = JSON_PROPERTY_SERVICE_ACCOUNT) String serviceAccount) { + this.accountId = accountId; + this.bucketName = bucketName; + this.dataset = dataset; + this.exportPrefix = exportPrefix; + this.exportProjectName = exportProjectName; + this.serviceAccount = serviceAccount; + } + + public GCPUsageCostConfigPostRequestAttributes accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * The GCP account ID. + * + * @return accountId + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public GCPUsageCostConfigPostRequestAttributes bucketName(String bucketName) { + this.bucketName = bucketName; + return this; + } + + /** + * The GCP bucket name used to store the Usage Cost export. + * + * @return bucketName + */ + @JsonProperty(JSON_PROPERTY_BUCKET_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getBucketName() { + return bucketName; + } + + public void setBucketName(String bucketName) { + this.bucketName = bucketName; + } + + public GCPUsageCostConfigPostRequestAttributes dataset(String dataset) { + this.dataset = dataset; + return this; + } + + /** + * The export dataset name used for the GCP Usage Cost report. + * + * @return dataset + */ + @JsonProperty(JSON_PROPERTY_DATASET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDataset() { + return dataset; + } + + public void setDataset(String dataset) { + this.dataset = dataset; + } + + public GCPUsageCostConfigPostRequestAttributes exportPrefix(String exportPrefix) { + this.exportPrefix = exportPrefix; + return this; + } + + /** + * The export prefix used for the GCP Usage Cost report. + * + * @return exportPrefix + */ + @JsonProperty(JSON_PROPERTY_EXPORT_PREFIX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getExportPrefix() { + return exportPrefix; + } + + public void setExportPrefix(String exportPrefix) { + this.exportPrefix = exportPrefix; + } + + public GCPUsageCostConfigPostRequestAttributes exportProjectName(String exportProjectName) { + this.exportProjectName = exportProjectName; + return this; + } + + /** + * The name of the GCP Usage Cost report. + * + * @return exportProjectName + */ + @JsonProperty(JSON_PROPERTY_EXPORT_PROJECT_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getExportProjectName() { + return exportProjectName; + } + + public void setExportProjectName(String exportProjectName) { + this.exportProjectName = exportProjectName; + } + + public GCPUsageCostConfigPostRequestAttributes isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Whether or not the Cloud Cost Management account is enabled. + * + * @return isEnabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsEnabled() { + return isEnabled; + } + + public void setIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + } + + public GCPUsageCostConfigPostRequestAttributes months(Integer months) { + this.months = months; + return this; + } + + /** + * The month of the report. maximum: 36 + * + * @return months + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MONTHS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getMonths() { + return months; + } + + public void setMonths(Integer months) { + this.months = months; + } + + public GCPUsageCostConfigPostRequestAttributes serviceAccount(String serviceAccount) { + this.serviceAccount = serviceAccount; + return this; + } + + /** + * The unique GCP service account email. + * + * @return serviceAccount + */ + @JsonProperty(JSON_PROPERTY_SERVICE_ACCOUNT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getServiceAccount() { + return serviceAccount; + } + + public void setServiceAccount(String serviceAccount) { + this.serviceAccount = serviceAccount; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPUsageCostConfigPostRequestAttributes + */ + @JsonAnySetter + public GCPUsageCostConfigPostRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPUsageCostConfigPostRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPUsageCostConfigPostRequestAttributes gcpUsageCostConfigPostRequestAttributes = + (GCPUsageCostConfigPostRequestAttributes) o; + return Objects.equals(this.accountId, gcpUsageCostConfigPostRequestAttributes.accountId) + && Objects.equals(this.bucketName, gcpUsageCostConfigPostRequestAttributes.bucketName) + && Objects.equals(this.dataset, gcpUsageCostConfigPostRequestAttributes.dataset) + && Objects.equals(this.exportPrefix, gcpUsageCostConfigPostRequestAttributes.exportPrefix) + && Objects.equals( + this.exportProjectName, gcpUsageCostConfigPostRequestAttributes.exportProjectName) + && Objects.equals(this.isEnabled, gcpUsageCostConfigPostRequestAttributes.isEnabled) + && Objects.equals(this.months, gcpUsageCostConfigPostRequestAttributes.months) + && Objects.equals( + this.serviceAccount, gcpUsageCostConfigPostRequestAttributes.serviceAccount) + && Objects.equals( + this.additionalProperties, + gcpUsageCostConfigPostRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + accountId, + bucketName, + dataset, + exportPrefix, + exportProjectName, + isEnabled, + months, + serviceAccount, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPUsageCostConfigPostRequestAttributes {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" bucketName: ").append(toIndentedString(bucketName)).append("\n"); + sb.append(" dataset: ").append(toIndentedString(dataset)).append("\n"); + sb.append(" exportPrefix: ").append(toIndentedString(exportPrefix)).append("\n"); + sb.append(" exportProjectName: ").append(toIndentedString(exportProjectName)).append("\n"); + sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); + sb.append(" months: ").append(toIndentedString(months)).append("\n"); + sb.append(" serviceAccount: ").append(toIndentedString(serviceAccount)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostRequestType.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostRequestType.java new file mode 100644 index 00000000000..40fa27d4a23 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigPostRequestType.java @@ -0,0 +1,58 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type of GCP Usage Cost config post request. */ +@JsonSerialize( + using = GCPUsageCostConfigPostRequestType.GCPUsageCostConfigPostRequestTypeSerializer.class) +public class GCPUsageCostConfigPostRequestType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("gcp_usage_cost_config_post_request")); + + public static final GCPUsageCostConfigPostRequestType GCP_USAGE_COST_CONFIG_POST_REQUEST = + new GCPUsageCostConfigPostRequestType("gcp_usage_cost_config_post_request"); + + GCPUsageCostConfigPostRequestType(String value) { + super(value, allowedValues); + } + + public static class GCPUsageCostConfigPostRequestTypeSerializer + extends StdSerializer { + public GCPUsageCostConfigPostRequestTypeSerializer(Class t) { + super(t); + } + + public GCPUsageCostConfigPostRequestTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GCPUsageCostConfigPostRequestType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GCPUsageCostConfigPostRequestType fromValue(String value) { + return new GCPUsageCostConfigPostRequestType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigResponse.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigResponse.java new file mode 100644 index 00000000000..00d05535918 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigResponse.java @@ -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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response of GCP Usage Cost config. */ +@JsonPropertyOrder({GCPUsageCostConfigResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPUsageCostConfigResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GCPUsageCostConfig data; + + public GCPUsageCostConfigResponse data(GCPUsageCostConfig data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * GCP Usage Cost config. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPUsageCostConfig getData() { + return data; + } + + public void setData(GCPUsageCostConfig data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPUsageCostConfigResponse + */ + @JsonAnySetter + public GCPUsageCostConfigResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPUsageCostConfigResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPUsageCostConfigResponse gcpUsageCostConfigResponse = (GCPUsageCostConfigResponse) o; + return Objects.equals(this.data, gcpUsageCostConfigResponse.data) + && Objects.equals( + this.additionalProperties, gcpUsageCostConfigResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPUsageCostConfigResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigType.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigType.java new file mode 100644 index 00000000000..18cdb5c3499 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigType.java @@ -0,0 +1,57 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type of GCP Usage Cost config. */ +@JsonSerialize(using = GCPUsageCostConfigType.GCPUsageCostConfigTypeSerializer.class) +public class GCPUsageCostConfigType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("gcp_usage_cost_config")); + + public static final GCPUsageCostConfigType GCP_USAGE_COST_CONFIG = + new GCPUsageCostConfigType("gcp_usage_cost_config"); + + GCPUsageCostConfigType(String value) { + super(value, allowedValues); + } + + public static class GCPUsageCostConfigTypeSerializer + extends StdSerializer { + public GCPUsageCostConfigTypeSerializer(Class t) { + super(t); + } + + public GCPUsageCostConfigTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GCPUsageCostConfigType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GCPUsageCostConfigType fromValue(String value) { + return new GCPUsageCostConfigType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigsResponse.java b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigsResponse.java new file mode 100644 index 00000000000..1e5f3a9587a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPUsageCostConfigsResponse.java @@ -0,0 +1,150 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** List of GCP Usage Cost configs. */ +@JsonPropertyOrder({GCPUsageCostConfigsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPUsageCostConfigsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public GCPUsageCostConfigsResponse data(List data) { + this.data = data; + for (GCPUsageCostConfig item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GCPUsageCostConfigsResponse addDataItem(GCPUsageCostConfig dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * A GCP Usage Cost config. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPUsageCostConfigsResponse + */ + @JsonAnySetter + public GCPUsageCostConfigsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPUsageCostConfigsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPUsageCostConfigsResponse gcpUsageCostConfigsResponse = (GCPUsageCostConfigsResponse) o; + return Objects.equals(this.data, gcpUsageCostConfigsResponse.data) + && Objects.equals( + this.additionalProperties, gcpUsageCostConfigsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPUsageCostConfigsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature index 4bef351f25c..88eb4ab13d7 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature @@ -1,8 +1,8 @@ @endpoint(cloud-cost-management) @endpoint(cloud-cost-management-v2) Feature: Cloud Cost Management The Cloud Cost Management API allows you to set up, edit, and delete Cloud - Cost Management accounts for AWS and Azure. You can query your cost data - by using the [Metrics + Cost Management accounts for AWS, Azure, and GCP. You can query your cost + data by using the [Metrics endpoint](https://docs.datadoghq.com/api/latest/metrics/#query-timeseries- data-across-multiple-products) and the `cloud_cost` data source. For more information, see the [Cloud Cost Management @@ -43,6 +43,21 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data.attributes.configs[0].account_id" is equal to "1234abcd-1234-abcd-1234-1234abcd1234" + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Create Cloud Cost Management GCP Usage Cost config returns "Bad Request" response + Given new "CreateCostGCPUsageCostConfig" request + And body with value {"data": {"attributes": {"account_id": "123456_A123BC_12AB34", "bucket_name": "dd-cost-bucket", "dataset": "billing", "export_prefix": "datadog_cloud_cost_usage_export", "export_project_name": "dd-cloud-cost-report", "service_account": "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com"}, "type": "gcp_usage_cost_config_post_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:Datadog/cloud-cost-management + Scenario: Create Cloud Cost Management GCP Usage Cost config returns "OK" response + Given new "CreateCostGCPUsageCostConfig" request + And body with value {"data": {"attributes": {"account_id": "123456_A123BC_12AB34", "bucket_name": "dd-cost-bucket", "dataset": "billing", "export_prefix": "datadog_cloud_cost_usage_export", "export_project_name": "dd-cloud-cost-report", "service_account": "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com"}, "type": "gcp_usage_cost_config_post_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.account_id" is equal to "123456_A123BC_12AB34" + @generated @skip @team:Datadog/cloud-cost-management Scenario: Delete Cloud Cost Management AWS CUR config returns "Bad Request" response Given new "DeleteCostAWSCURConfig" request @@ -85,6 +100,27 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 404 Not Found + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Delete Cloud Cost Management GCP Usage Cost config returns "Bad Request" response + Given new "DeleteCostGCPUsageCostConfig" request + And request contains "cloud_account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:Datadog/cloud-cost-management + Scenario: Delete Cloud Cost Management GCP Usage Cost config returns "No Content" response + Given new "DeleteCostGCPUsageCostConfig" request + And request contains "cloud_account_id" parameter with value "100" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Delete Cloud Cost Management GCP Usage Cost config returns "Not Found" response + Given new "DeleteCostGCPUsageCostConfig" request + And request contains "cloud_account_id" parameter from "REPLACE.ME" + 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 @@ -129,6 +165,13 @@ 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 Cloud Cost Management GCP Usage Cost configs returns "OK" response + Given new "ListCostGCPUsageCostConfigs" request + When the request is sent + Then the response status is 200 OK + And the response "data[0].attributes.bucket_name" is equal to "test_bucket_name" + @replay-only @team:Datadog/cloud-cost-management Scenario: List Custom Costs Files returns "OK" response Given new "ListCustomCostsFiles" request @@ -168,6 +211,15 @@ Feature: Cloud Cost Management 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: Update Cloud Cost Management GCP Usage Cost config returns "OK" response + Given new "UpdateCostGCPUsageCostConfig" request + And request contains "cloud_account_id" parameter with value "100" + And body with value {"data": {"attributes": {"is_enabled": true}, "type": "gcp_usage_cost_config_patch_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data[0].attributes.account_id" is equal to "123456_A123BC_12AB34" + @replay-only @team:Datadog/cloud-cost-management Scenario: Upload Custom Costs File returns "Accepted" response Given new "UploadCustomCostsFile" request diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index d1258a8d92c..11f6071e667 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -554,6 +554,30 @@ "type": "safe" } }, + "ListCostGCPUsageCostConfigs": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "CreateCostGCPUsageCostConfig": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "DeleteCostGCPUsageCostConfig": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "UpdateCostGCPUsageCostConfig": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, "GetActiveBillingDimensions": { "tag": "Usage Metering", "undo": {