diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 90e1196820e..53a4ea6a1a5 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -75076,6 +75076,18 @@ components: required: - data type: object + OwnershipConfidenceLevel: + description: The ownership confidence level. + enum: + - high + - medium + - low + example: high + type: string + x-enum-varnames: + - HIGH + - MEDIUM + - LOW OwnershipEvidenceAttributes: description: The attributes of an ownership evidence response. properties: @@ -75639,6 +75651,152 @@ components: - TEAM - SERVICE - UNKNOWN + OwnershipSettingsAttributes: + description: The attributes of the ownership settings response. + properties: + auto_tag: + description: Whether automatic ownership tagging is enabled. + example: true + type: boolean + confidence_level: + $ref: "#/components/schemas/OwnershipConfidenceLevel" + version: + description: The current version of the ownership settings. + example: 1 + format: int64 + type: integer + required: + - version + - auto_tag + - confidence_level + type: object + OwnershipSettingsData: + description: The data wrapper for an ownership settings response. + properties: + attributes: + $ref: "#/components/schemas/OwnershipSettingsAttributes" + id: + description: The identifier of the ownership settings resource. + example: settings + type: string + type: + $ref: "#/components/schemas/OwnershipSettingsType" + required: + - id + - type + - attributes + type: object + OwnershipSettingsRequest: + description: The request body for updating ownership settings. + properties: + data: + $ref: "#/components/schemas/OwnershipSettingsRequestData" + required: + - data + type: object + OwnershipSettingsRequestAttributes: + description: The attributes of an ownership settings request. + properties: + auto_tag: + description: Whether automatic ownership tagging is enabled. + example: true + type: boolean + confidence_level: + $ref: "#/components/schemas/OwnershipConfidenceLevel" + required: + - auto_tag + - confidence_level + type: object + OwnershipSettingsRequestData: + description: The data wrapper for an ownership settings request. + properties: + attributes: + $ref: "#/components/schemas/OwnershipSettingsRequestAttributes" + type: + $ref: "#/components/schemas/OwnershipSettingsType" + required: + - type + - attributes + type: object + OwnershipSettingsResponse: + description: The response returned when retrieving or updating ownership settings. + properties: + data: + $ref: "#/components/schemas/OwnershipSettingsData" + required: + - data + type: object + OwnershipSettingsType: + default: ownership_settings + description: The type of the ownership settings resource. The value should always be `ownership_settings`. + enum: + - ownership_settings + example: ownership_settings + type: string + x-enum-varnames: + - OWNERSHIP_SETTINGS + OwnershipUntaggedFindingsAttributes: + description: The counts of findings without a team tag by ownership confidence. + properties: + high_confidence: + description: The number of high confidence findings without a team tag. + example: 30 + format: int64 + type: integer + low_confidence: + description: The number of low confidence findings without a team tag. + example: 42 + format: int64 + type: integer + medium_confidence: + description: The number of medium confidence findings without a team tag. + example: 70 + format: int64 + type: integer + total: + description: The total number of findings without a team tag. + example: 142 + format: int64 + type: integer + required: + - total + - high_confidence + - medium_confidence + - low_confidence + type: object + OwnershipUntaggedFindingsData: + description: The data wrapper for an ownership untagged findings response. + properties: + attributes: + $ref: "#/components/schemas/OwnershipUntaggedFindingsAttributes" + id: + description: The identifier of the ownership untagged findings resource. + example: untagged + type: string + type: + $ref: "#/components/schemas/OwnershipUntaggedFindingsType" + required: + - id + - type + - attributes + type: object + OwnershipUntaggedFindingsResponse: + description: The response returned when counting findings without a team tag by ownership confidence. + properties: + data: + $ref: "#/components/schemas/OwnershipUntaggedFindingsData" + required: + - data + type: object + OwnershipUntaggedFindingsType: + default: ownership_untagged_findings + description: The type of the ownership untagged findings resource. The value should always be `ownership_untagged_findings`. + enum: + - ownership_untagged_findings + example: ownership_untagged_findings + type: string + x-enum-varnames: + - OWNERSHIP_UNTAGGED_FINDINGS PageAnnotationsAttributes: description: Attributes of the annotations on a page. properties: @@ -132295,6 +132453,128 @@ paths: $ref: "#/components/responses/TooManyRequestsResponse" summary: Get all CSM Serverless Agents tags: ["CSM Agents"] + /api/v2/csm/ownership/settings: + get: + description: Get ownership settings for the org. When settings are unset, the API returns the default opt-out configuration with `auto_tag` set to `true` and `confidence_level` set to `high`. + operationId: GetOwnershipSettings + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + auto_tag: true + confidence_level: high + version: 1 + id: settings + type: ownership_settings + schema: + $ref: "#/components/schemas/OwnershipSettingsResponse" + description: OK + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get ownership settings for the org + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Update ownership settings for the org. + operationId: PostOwnershipSettings + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + auto_tag: true + confidence_level: high + type: ownership_settings + schema: + $ref: "#/components/schemas/OwnershipSettingsRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + auto_tag: true + confidence_level: high + version: 1 + id: settings + type: ownership_settings + schema: + $ref: "#/components/schemas/OwnershipSettingsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update ownership settings for the org + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/csm/ownership/settings/untagged: + get: + description: Count findings with no team tag, grouped by ownership confidence level. + operationId: GetOwnershipUntaggedFindings + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + high_confidence: 30 + low_confidence: 42 + medium_confidence: 70 + total: 142 + id: untagged + type: ownership_untagged_findings + schema: + $ref: "#/components/schemas/OwnershipUntaggedFindingsResponse" + description: OK + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Count untagged findings by ownership confidence + tags: ["CSM Ownership"] + x-unstable: |- + **Note**: This endpoint is in Preview and may be subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/csm/ownership/{resource_id}: get: description: Get all current ownership inferences for a resource, one per owner type (`user`, `team`, `service`, `unknown`). diff --git a/examples/v2/csm-ownership/GetOwnershipSettings.java b/examples/v2/csm-ownership/GetOwnershipSettings.java new file mode 100644 index 00000000000..aa1e7f11df2 --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipSettings.java @@ -0,0 +1,25 @@ +// Get ownership settings for the org returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CsmOwnershipApi; +import com.datadog.api.client.v2.model.OwnershipSettingsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getOwnershipSettings", true); + CsmOwnershipApi apiInstance = new CsmOwnershipApi(defaultClient); + + try { + OwnershipSettingsResponse result = apiInstance.getOwnershipSettings(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CsmOwnershipApi#getOwnershipSettings"); + 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/csm-ownership/GetOwnershipUntaggedFindings.java b/examples/v2/csm-ownership/GetOwnershipUntaggedFindings.java new file mode 100644 index 00000000000..60050235454 --- /dev/null +++ b/examples/v2/csm-ownership/GetOwnershipUntaggedFindings.java @@ -0,0 +1,25 @@ +// Count untagged findings by ownership confidence returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CsmOwnershipApi; +import com.datadog.api.client.v2.model.OwnershipUntaggedFindingsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getOwnershipUntaggedFindings", true); + CsmOwnershipApi apiInstance = new CsmOwnershipApi(defaultClient); + + try { + OwnershipUntaggedFindingsResponse result = apiInstance.getOwnershipUntaggedFindings(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CsmOwnershipApi#getOwnershipUntaggedFindings"); + 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/csm-ownership/PostOwnershipSettings.java b/examples/v2/csm-ownership/PostOwnershipSettings.java new file mode 100644 index 00000000000..629ad1078c6 --- /dev/null +++ b/examples/v2/csm-ownership/PostOwnershipSettings.java @@ -0,0 +1,40 @@ +// Update ownership settings for the org returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CsmOwnershipApi; +import com.datadog.api.client.v2.model.OwnershipConfidenceLevel; +import com.datadog.api.client.v2.model.OwnershipSettingsRequest; +import com.datadog.api.client.v2.model.OwnershipSettingsRequestAttributes; +import com.datadog.api.client.v2.model.OwnershipSettingsRequestData; +import com.datadog.api.client.v2.model.OwnershipSettingsResponse; +import com.datadog.api.client.v2.model.OwnershipSettingsType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.postOwnershipSettings", true); + CsmOwnershipApi apiInstance = new CsmOwnershipApi(defaultClient); + + OwnershipSettingsRequest body = + new OwnershipSettingsRequest() + .data( + new OwnershipSettingsRequestData() + .attributes( + new OwnershipSettingsRequestAttributes() + .autoTag(true) + .confidenceLevel(OwnershipConfidenceLevel.HIGH)) + .type(OwnershipSettingsType.OWNERSHIP_SETTINGS)); + + try { + OwnershipSettingsResponse result = apiInstance.postOwnershipSettings(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CsmOwnershipApi#postOwnershipSettings"); + 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/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 6676946bf20..1a93d48bcf4 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -979,9 +979,12 @@ public class ApiClient { put("v2.createOwnershipFeedback", false); put("v2.getOwnershipEvidence", false); put("v2.getOwnershipInference", false); + put("v2.getOwnershipSettings", false); + put("v2.getOwnershipUntaggedFindings", false); put("v2.listOwnershipHistory", false); put("v2.listOwnershipHistoryByOwnerType", false); put("v2.listOwnershipInferences", false); + put("v2.postOwnershipSettings", false); put("v2.getCSMAgentlessHostFacetInfo", false); put("v2.getCSMUnifiedHostFacetInfo", false); put("v2.listCSMAgentlessHostFacets", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/CsmOwnershipApi.java b/src/main/java/com/datadog/api/client/v2/api/CsmOwnershipApi.java index 274a5db9624..f01d66f94b6 100644 --- a/src/main/java/com/datadog/api/client/v2/api/CsmOwnershipApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/CsmOwnershipApi.java @@ -11,6 +11,9 @@ import com.datadog.api.client.v2.model.OwnershipInferenceListResponse; import com.datadog.api.client.v2.model.OwnershipInferenceResponse; import com.datadog.api.client.v2.model.OwnershipOwnerType; +import com.datadog.api.client.v2.model.OwnershipSettingsRequest; +import com.datadog.api.client.v2.model.OwnershipSettingsResponse; +import com.datadog.api.client.v2.model.OwnershipUntaggedFindingsResponse; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -791,6 +794,266 @@ public ApiResponse getOwnershipInferenceWithHttpInfo new GenericType() {}); } + /** + * Get ownership settings for the org. + * + *

See {@link #getOwnershipSettingsWithHttpInfo}. + * + * @return OwnershipSettingsResponse + * @throws ApiException if fails to make API call + */ + public OwnershipSettingsResponse getOwnershipSettings() throws ApiException { + return getOwnershipSettingsWithHttpInfo().getData(); + } + + /** + * Get ownership settings for the org. + * + *

See {@link #getOwnershipSettingsWithHttpInfoAsync}. + * + * @return CompletableFuture<OwnershipSettingsResponse> + */ + public CompletableFuture getOwnershipSettingsAsync() { + return getOwnershipSettingsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get ownership settings for the org. When settings are unset, the API returns the default + * opt-out configuration with auto_tag set to true and + * confidence_level set to high. + * + * @return ApiResponse<OwnershipSettingsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse getOwnershipSettingsWithHttpInfo() + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getOwnershipSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/csm/ownership/settings"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.getOwnershipSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get ownership settings for the org. + * + *

See {@link #getOwnershipSettingsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<OwnershipSettingsResponse>> + */ + public CompletableFuture> + getOwnershipSettingsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "getOwnershipSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/csm/ownership/settings"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.getOwnershipSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"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() {}); + } + + /** + * Count untagged findings by ownership confidence. + * + *

See {@link #getOwnershipUntaggedFindingsWithHttpInfo}. + * + * @return OwnershipUntaggedFindingsResponse + * @throws ApiException if fails to make API call + */ + public OwnershipUntaggedFindingsResponse getOwnershipUntaggedFindings() throws ApiException { + return getOwnershipUntaggedFindingsWithHttpInfo().getData(); + } + + /** + * Count untagged findings by ownership confidence. + * + *

See {@link #getOwnershipUntaggedFindingsWithHttpInfoAsync}. + * + * @return CompletableFuture<OwnershipUntaggedFindingsResponse> + */ + public CompletableFuture getOwnershipUntaggedFindingsAsync() { + return getOwnershipUntaggedFindingsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Count findings with no team tag, grouped by ownership confidence level. + * + * @return ApiResponse<OwnershipUntaggedFindingsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse getOwnershipUntaggedFindingsWithHttpInfo() + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getOwnershipUntaggedFindings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/csm/ownership/settings/untagged"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.getOwnershipUntaggedFindings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Count untagged findings by ownership confidence. + * + *

See {@link #getOwnershipUntaggedFindingsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<OwnershipUntaggedFindingsResponse>> + */ + public CompletableFuture> + getOwnershipUntaggedFindingsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "getOwnershipUntaggedFindings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/csm/ownership/settings/untagged"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.getOwnershipUntaggedFindings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"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() {}); + } + /** Manage optional parameters to listOwnershipHistory. */ public static class ListOwnershipHistoryOptionalParameters { private String cursor; @@ -1472,4 +1735,154 @@ public ApiResponse listOwnershipInferencesWithHt false, new GenericType() {}); } + + /** + * Update ownership settings for the org. + * + *

See {@link #postOwnershipSettingsWithHttpInfo}. + * + * @param body (required) + * @return OwnershipSettingsResponse + * @throws ApiException if fails to make API call + */ + public OwnershipSettingsResponse postOwnershipSettings(OwnershipSettingsRequest body) + throws ApiException { + return postOwnershipSettingsWithHttpInfo(body).getData(); + } + + /** + * Update ownership settings for the org. + * + *

See {@link #postOwnershipSettingsWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<OwnershipSettingsResponse> + */ + public CompletableFuture postOwnershipSettingsAsync( + OwnershipSettingsRequest body) { + return postOwnershipSettingsWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update ownership settings for the org. + * + * @param body (required) + * @return ApiResponse<OwnershipSettingsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
429 Too many requests -
+ */ + public ApiResponse postOwnershipSettingsWithHttpInfo( + OwnershipSettingsRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "postOwnershipSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling postOwnershipSettings"); + } + // create path and map variables + String localVarPath = "/api/v2/csm/ownership/settings"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.postOwnershipSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update ownership settings for the org. + * + *

See {@link #postOwnershipSettingsWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<OwnershipSettingsResponse>> + */ + public CompletableFuture> + postOwnershipSettingsWithHttpInfoAsync(OwnershipSettingsRequest body) { + // Check if unstable operation is enabled + String operationId = "postOwnershipSettings"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + 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 postOwnershipSettings")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/csm/ownership/settings"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CsmOwnershipApi.postOwnershipSettings", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"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() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipConfidenceLevel.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipConfidenceLevel.java new file mode 100644 index 00000000000..9ebc02be271 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipConfidenceLevel.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; + +/** The ownership confidence level. */ +@JsonSerialize(using = OwnershipConfidenceLevel.OwnershipConfidenceLevelSerializer.class) +public class OwnershipConfidenceLevel extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("high", "medium", "low")); + + public static final OwnershipConfidenceLevel HIGH = new OwnershipConfidenceLevel("high"); + public static final OwnershipConfidenceLevel MEDIUM = new OwnershipConfidenceLevel("medium"); + public static final OwnershipConfidenceLevel LOW = new OwnershipConfidenceLevel("low"); + + OwnershipConfidenceLevel(String value) { + super(value, allowedValues); + } + + public static class OwnershipConfidenceLevelSerializer + extends StdSerializer { + public OwnershipConfidenceLevelSerializer(Class t) { + super(t); + } + + public OwnershipConfidenceLevelSerializer() { + this(null); + } + + @Override + public void serialize( + OwnershipConfidenceLevel value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipConfidenceLevel fromValue(String value) { + return new OwnershipConfidenceLevel(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsAttributes.java new file mode 100644 index 00000000000..747880d0178 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsAttributes.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; + +/** The attributes of the ownership settings response. */ +@JsonPropertyOrder({ + OwnershipSettingsAttributes.JSON_PROPERTY_AUTO_TAG, + OwnershipSettingsAttributes.JSON_PROPERTY_CONFIDENCE_LEVEL, + OwnershipSettingsAttributes.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipSettingsAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTO_TAG = "auto_tag"; + private Boolean autoTag; + + public static final String JSON_PROPERTY_CONFIDENCE_LEVEL = "confidence_level"; + private OwnershipConfidenceLevel confidenceLevel; + + public static final String JSON_PROPERTY_VERSION = "version"; + private Long version; + + public OwnershipSettingsAttributes() {} + + @JsonCreator + public OwnershipSettingsAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTO_TAG) Boolean autoTag, + @JsonProperty(required = true, value = JSON_PROPERTY_CONFIDENCE_LEVEL) + OwnershipConfidenceLevel confidenceLevel, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION) Long version) { + this.autoTag = autoTag; + this.confidenceLevel = confidenceLevel; + this.unparsed |= !confidenceLevel.isValid(); + this.version = version; + } + + public OwnershipSettingsAttributes autoTag(Boolean autoTag) { + this.autoTag = autoTag; + return this; + } + + /** + * Whether automatic ownership tagging is enabled. + * + * @return autoTag + */ + @JsonProperty(JSON_PROPERTY_AUTO_TAG) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getAutoTag() { + return autoTag; + } + + public void setAutoTag(Boolean autoTag) { + this.autoTag = autoTag; + } + + public OwnershipSettingsAttributes confidenceLevel(OwnershipConfidenceLevel confidenceLevel) { + this.confidenceLevel = confidenceLevel; + this.unparsed |= !confidenceLevel.isValid(); + return this; + } + + /** + * The ownership confidence level. + * + * @return confidenceLevel + */ + @JsonProperty(JSON_PROPERTY_CONFIDENCE_LEVEL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipConfidenceLevel getConfidenceLevel() { + return confidenceLevel; + } + + public void setConfidenceLevel(OwnershipConfidenceLevel confidenceLevel) { + if (!confidenceLevel.isValid()) { + this.unparsed = true; + } + this.confidenceLevel = confidenceLevel; + } + + public OwnershipSettingsAttributes version(Long version) { + this.version = version; + return this; + } + + /** + * The current version of the ownership settings. + * + * @return version + */ + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + /** + * 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 OwnershipSettingsAttributes + */ + @JsonAnySetter + public OwnershipSettingsAttributes 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 OwnershipSettingsAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipSettingsAttributes ownershipSettingsAttributes = (OwnershipSettingsAttributes) o; + return Objects.equals(this.autoTag, ownershipSettingsAttributes.autoTag) + && Objects.equals(this.confidenceLevel, ownershipSettingsAttributes.confidenceLevel) + && Objects.equals(this.version, ownershipSettingsAttributes.version) + && Objects.equals( + this.additionalProperties, ownershipSettingsAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(autoTag, confidenceLevel, version, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipSettingsAttributes {\n"); + sb.append(" autoTag: ").append(toIndentedString(autoTag)).append("\n"); + sb.append(" confidenceLevel: ").append(toIndentedString(confidenceLevel)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/OwnershipSettingsData.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsData.java new file mode 100644 index 00000000000..72d5cad13f9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsData.java @@ -0,0 +1,213 @@ +/* + * 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; + +/** The data wrapper for an ownership settings response. */ +@JsonPropertyOrder({ + OwnershipSettingsData.JSON_PROPERTY_ATTRIBUTES, + OwnershipSettingsData.JSON_PROPERTY_ID, + OwnershipSettingsData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipSettingsData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OwnershipSettingsAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OwnershipSettingsType type = OwnershipSettingsType.OWNERSHIP_SETTINGS; + + public OwnershipSettingsData() {} + + @JsonCreator + public OwnershipSettingsData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OwnershipSettingsAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OwnershipSettingsType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OwnershipSettingsData attributes(OwnershipSettingsAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of the ownership settings response. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipSettingsAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OwnershipSettingsAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public OwnershipSettingsData id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the ownership settings resource. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public OwnershipSettingsData type(OwnershipSettingsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the ownership settings resource. The value should always be + * ownership_settings. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipSettingsType getType() { + return type; + } + + public void setType(OwnershipSettingsType 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 OwnershipSettingsData + */ + @JsonAnySetter + public OwnershipSettingsData 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 OwnershipSettingsData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipSettingsData ownershipSettingsData = (OwnershipSettingsData) o; + return Objects.equals(this.attributes, ownershipSettingsData.attributes) + && Objects.equals(this.id, ownershipSettingsData.id) + && Objects.equals(this.type, ownershipSettingsData.type) + && Objects.equals(this.additionalProperties, ownershipSettingsData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipSettingsData {\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/OwnershipSettingsRequest.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsRequest.java new file mode 100644 index 00000000000..1cf6edeed60 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsRequest.java @@ -0,0 +1,149 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package 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; + +/** The request body for updating ownership settings. */ +@JsonPropertyOrder({OwnershipSettingsRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipSettingsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OwnershipSettingsRequestData data; + + public OwnershipSettingsRequest() {} + + @JsonCreator + public OwnershipSettingsRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + OwnershipSettingsRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OwnershipSettingsRequest data(OwnershipSettingsRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data wrapper for an ownership settings request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipSettingsRequestData getData() { + return data; + } + + public void setData(OwnershipSettingsRequestData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 OwnershipSettingsRequest + */ + @JsonAnySetter + public OwnershipSettingsRequest 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 OwnershipSettingsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipSettingsRequest ownershipSettingsRequest = (OwnershipSettingsRequest) o; + return Objects.equals(this.data, ownershipSettingsRequest.data) + && Objects.equals(this.additionalProperties, ownershipSettingsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipSettingsRequest {\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/OwnershipSettingsRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsRequestAttributes.java new file mode 100644 index 00000000000..d3cf1ed1e6d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsRequestAttributes.java @@ -0,0 +1,182 @@ +/* + * 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; + +/** The attributes of an ownership settings request. */ +@JsonPropertyOrder({ + OwnershipSettingsRequestAttributes.JSON_PROPERTY_AUTO_TAG, + OwnershipSettingsRequestAttributes.JSON_PROPERTY_CONFIDENCE_LEVEL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipSettingsRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTO_TAG = "auto_tag"; + private Boolean autoTag; + + public static final String JSON_PROPERTY_CONFIDENCE_LEVEL = "confidence_level"; + private OwnershipConfidenceLevel confidenceLevel; + + public OwnershipSettingsRequestAttributes() {} + + @JsonCreator + public OwnershipSettingsRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTO_TAG) Boolean autoTag, + @JsonProperty(required = true, value = JSON_PROPERTY_CONFIDENCE_LEVEL) + OwnershipConfidenceLevel confidenceLevel) { + this.autoTag = autoTag; + this.confidenceLevel = confidenceLevel; + this.unparsed |= !confidenceLevel.isValid(); + } + + public OwnershipSettingsRequestAttributes autoTag(Boolean autoTag) { + this.autoTag = autoTag; + return this; + } + + /** + * Whether automatic ownership tagging is enabled. + * + * @return autoTag + */ + @JsonProperty(JSON_PROPERTY_AUTO_TAG) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getAutoTag() { + return autoTag; + } + + public void setAutoTag(Boolean autoTag) { + this.autoTag = autoTag; + } + + public OwnershipSettingsRequestAttributes confidenceLevel( + OwnershipConfidenceLevel confidenceLevel) { + this.confidenceLevel = confidenceLevel; + this.unparsed |= !confidenceLevel.isValid(); + return this; + } + + /** + * The ownership confidence level. + * + * @return confidenceLevel + */ + @JsonProperty(JSON_PROPERTY_CONFIDENCE_LEVEL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipConfidenceLevel getConfidenceLevel() { + return confidenceLevel; + } + + public void setConfidenceLevel(OwnershipConfidenceLevel confidenceLevel) { + if (!confidenceLevel.isValid()) { + this.unparsed = true; + } + this.confidenceLevel = confidenceLevel; + } + + /** + * 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 OwnershipSettingsRequestAttributes + */ + @JsonAnySetter + public OwnershipSettingsRequestAttributes 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 OwnershipSettingsRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipSettingsRequestAttributes ownershipSettingsRequestAttributes = + (OwnershipSettingsRequestAttributes) o; + return Objects.equals(this.autoTag, ownershipSettingsRequestAttributes.autoTag) + && Objects.equals(this.confidenceLevel, ownershipSettingsRequestAttributes.confidenceLevel) + && Objects.equals( + this.additionalProperties, ownershipSettingsRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(autoTag, confidenceLevel, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipSettingsRequestAttributes {\n"); + sb.append(" autoTag: ").append(toIndentedString(autoTag)).append("\n"); + sb.append(" confidenceLevel: ").append(toIndentedString(confidenceLevel)).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/OwnershipSettingsRequestData.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsRequestData.java new file mode 100644 index 00000000000..615ab58e5bb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsRequestData.java @@ -0,0 +1,186 @@ +/* + * 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; + +/** The data wrapper for an ownership settings request. */ +@JsonPropertyOrder({ + OwnershipSettingsRequestData.JSON_PROPERTY_ATTRIBUTES, + OwnershipSettingsRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipSettingsRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OwnershipSettingsRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OwnershipSettingsType type = OwnershipSettingsType.OWNERSHIP_SETTINGS; + + public OwnershipSettingsRequestData() {} + + @JsonCreator + public OwnershipSettingsRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OwnershipSettingsRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OwnershipSettingsType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OwnershipSettingsRequestData attributes(OwnershipSettingsRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of an ownership settings request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipSettingsRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OwnershipSettingsRequestAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public OwnershipSettingsRequestData type(OwnershipSettingsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the ownership settings resource. The value should always be + * ownership_settings. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipSettingsType getType() { + return type; + } + + public void setType(OwnershipSettingsType 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 OwnershipSettingsRequestData + */ + @JsonAnySetter + public OwnershipSettingsRequestData 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 OwnershipSettingsRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipSettingsRequestData ownershipSettingsRequestData = (OwnershipSettingsRequestData) o; + return Objects.equals(this.attributes, ownershipSettingsRequestData.attributes) + && Objects.equals(this.type, ownershipSettingsRequestData.type) + && Objects.equals( + this.additionalProperties, ownershipSettingsRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipSettingsRequestData {\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/OwnershipSettingsResponse.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsResponse.java new file mode 100644 index 00000000000..90b372c92e6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsResponse.java @@ -0,0 +1,149 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package 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; + +/** The response returned when retrieving or updating ownership settings. */ +@JsonPropertyOrder({OwnershipSettingsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipSettingsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OwnershipSettingsData data; + + public OwnershipSettingsResponse() {} + + @JsonCreator + public OwnershipSettingsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) OwnershipSettingsData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OwnershipSettingsResponse data(OwnershipSettingsData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data wrapper for an ownership settings response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipSettingsData getData() { + return data; + } + + public void setData(OwnershipSettingsData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 OwnershipSettingsResponse + */ + @JsonAnySetter + public OwnershipSettingsResponse 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 OwnershipSettingsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipSettingsResponse ownershipSettingsResponse = (OwnershipSettingsResponse) o; + return Objects.equals(this.data, ownershipSettingsResponse.data) + && Objects.equals( + this.additionalProperties, ownershipSettingsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipSettingsResponse {\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/OwnershipSettingsType.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsType.java new file mode 100644 index 00000000000..67b995f1c30 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipSettingsType.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; + +/** + * The type of the ownership settings resource. The value should always be ownership_settings + * . + */ +@JsonSerialize(using = OwnershipSettingsType.OwnershipSettingsTypeSerializer.class) +public class OwnershipSettingsType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ownership_settings")); + + public static final OwnershipSettingsType OWNERSHIP_SETTINGS = + new OwnershipSettingsType("ownership_settings"); + + OwnershipSettingsType(String value) { + super(value, allowedValues); + } + + public static class OwnershipSettingsTypeSerializer extends StdSerializer { + public OwnershipSettingsTypeSerializer(Class t) { + super(t); + } + + public OwnershipSettingsTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OwnershipSettingsType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipSettingsType fromValue(String value) { + return new OwnershipSettingsType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OwnershipUntaggedFindingsAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipUntaggedFindingsAttributes.java new file mode 100644 index 00000000000..1e3fe5ad99c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipUntaggedFindingsAttributes.java @@ -0,0 +1,233 @@ +/* + * 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; + +/** The counts of findings without a team tag by ownership confidence. */ +@JsonPropertyOrder({ + OwnershipUntaggedFindingsAttributes.JSON_PROPERTY_HIGH_CONFIDENCE, + OwnershipUntaggedFindingsAttributes.JSON_PROPERTY_LOW_CONFIDENCE, + OwnershipUntaggedFindingsAttributes.JSON_PROPERTY_MEDIUM_CONFIDENCE, + OwnershipUntaggedFindingsAttributes.JSON_PROPERTY_TOTAL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipUntaggedFindingsAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_HIGH_CONFIDENCE = "high_confidence"; + private Long highConfidence; + + public static final String JSON_PROPERTY_LOW_CONFIDENCE = "low_confidence"; + private Long lowConfidence; + + public static final String JSON_PROPERTY_MEDIUM_CONFIDENCE = "medium_confidence"; + private Long mediumConfidence; + + public static final String JSON_PROPERTY_TOTAL = "total"; + private Long total; + + public OwnershipUntaggedFindingsAttributes() {} + + @JsonCreator + public OwnershipUntaggedFindingsAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_HIGH_CONFIDENCE) Long highConfidence, + @JsonProperty(required = true, value = JSON_PROPERTY_LOW_CONFIDENCE) Long lowConfidence, + @JsonProperty(required = true, value = JSON_PROPERTY_MEDIUM_CONFIDENCE) Long mediumConfidence, + @JsonProperty(required = true, value = JSON_PROPERTY_TOTAL) Long total) { + this.highConfidence = highConfidence; + this.lowConfidence = lowConfidence; + this.mediumConfidence = mediumConfidence; + this.total = total; + } + + public OwnershipUntaggedFindingsAttributes highConfidence(Long highConfidence) { + this.highConfidence = highConfidence; + return this; + } + + /** + * The number of high confidence findings without a team tag. + * + * @return highConfidence + */ + @JsonProperty(JSON_PROPERTY_HIGH_CONFIDENCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getHighConfidence() { + return highConfidence; + } + + public void setHighConfidence(Long highConfidence) { + this.highConfidence = highConfidence; + } + + public OwnershipUntaggedFindingsAttributes lowConfidence(Long lowConfidence) { + this.lowConfidence = lowConfidence; + return this; + } + + /** + * The number of low confidence findings without a team tag. + * + * @return lowConfidence + */ + @JsonProperty(JSON_PROPERTY_LOW_CONFIDENCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLowConfidence() { + return lowConfidence; + } + + public void setLowConfidence(Long lowConfidence) { + this.lowConfidence = lowConfidence; + } + + public OwnershipUntaggedFindingsAttributes mediumConfidence(Long mediumConfidence) { + this.mediumConfidence = mediumConfidence; + return this; + } + + /** + * The number of medium confidence findings without a team tag. + * + * @return mediumConfidence + */ + @JsonProperty(JSON_PROPERTY_MEDIUM_CONFIDENCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getMediumConfidence() { + return mediumConfidence; + } + + public void setMediumConfidence(Long mediumConfidence) { + this.mediumConfidence = mediumConfidence; + } + + public OwnershipUntaggedFindingsAttributes total(Long total) { + this.total = total; + return this; + } + + /** + * The total number of findings without a team tag. + * + * @return total + */ + @JsonProperty(JSON_PROPERTY_TOTAL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + /** + * 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 OwnershipUntaggedFindingsAttributes + */ + @JsonAnySetter + public OwnershipUntaggedFindingsAttributes 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 OwnershipUntaggedFindingsAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipUntaggedFindingsAttributes ownershipUntaggedFindingsAttributes = + (OwnershipUntaggedFindingsAttributes) o; + return Objects.equals(this.highConfidence, ownershipUntaggedFindingsAttributes.highConfidence) + && Objects.equals(this.lowConfidence, ownershipUntaggedFindingsAttributes.lowConfidence) + && Objects.equals( + this.mediumConfidence, ownershipUntaggedFindingsAttributes.mediumConfidence) + && Objects.equals(this.total, ownershipUntaggedFindingsAttributes.total) + && Objects.equals( + this.additionalProperties, ownershipUntaggedFindingsAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + highConfidence, lowConfidence, mediumConfidence, total, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipUntaggedFindingsAttributes {\n"); + sb.append(" highConfidence: ").append(toIndentedString(highConfidence)).append("\n"); + sb.append(" lowConfidence: ").append(toIndentedString(lowConfidence)).append("\n"); + sb.append(" mediumConfidence: ").append(toIndentedString(mediumConfidence)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).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/OwnershipUntaggedFindingsData.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipUntaggedFindingsData.java new file mode 100644 index 00000000000..817cc522315 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipUntaggedFindingsData.java @@ -0,0 +1,216 @@ +/* + * 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; + +/** The data wrapper for an ownership untagged findings response. */ +@JsonPropertyOrder({ + OwnershipUntaggedFindingsData.JSON_PROPERTY_ATTRIBUTES, + OwnershipUntaggedFindingsData.JSON_PROPERTY_ID, + OwnershipUntaggedFindingsData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipUntaggedFindingsData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OwnershipUntaggedFindingsAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OwnershipUntaggedFindingsType type = + OwnershipUntaggedFindingsType.OWNERSHIP_UNTAGGED_FINDINGS; + + public OwnershipUntaggedFindingsData() {} + + @JsonCreator + public OwnershipUntaggedFindingsData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OwnershipUntaggedFindingsAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + OwnershipUntaggedFindingsType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OwnershipUntaggedFindingsData attributes(OwnershipUntaggedFindingsAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The counts of findings without a team tag by ownership confidence. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipUntaggedFindingsAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OwnershipUntaggedFindingsAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public OwnershipUntaggedFindingsData id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the ownership untagged findings resource. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public OwnershipUntaggedFindingsData type(OwnershipUntaggedFindingsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the ownership untagged findings resource. The value should always be + * ownership_untagged_findings. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipUntaggedFindingsType getType() { + return type; + } + + public void setType(OwnershipUntaggedFindingsType 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 OwnershipUntaggedFindingsData + */ + @JsonAnySetter + public OwnershipUntaggedFindingsData 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 OwnershipUntaggedFindingsData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipUntaggedFindingsData ownershipUntaggedFindingsData = (OwnershipUntaggedFindingsData) o; + return Objects.equals(this.attributes, ownershipUntaggedFindingsData.attributes) + && Objects.equals(this.id, ownershipUntaggedFindingsData.id) + && Objects.equals(this.type, ownershipUntaggedFindingsData.type) + && Objects.equals( + this.additionalProperties, ownershipUntaggedFindingsData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipUntaggedFindingsData {\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/OwnershipUntaggedFindingsResponse.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipUntaggedFindingsResponse.java new file mode 100644 index 00000000000..ad18b223f82 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipUntaggedFindingsResponse.java @@ -0,0 +1,151 @@ +/* + * 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; + +/** The response returned when counting findings without a team tag by ownership confidence. */ +@JsonPropertyOrder({OwnershipUntaggedFindingsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OwnershipUntaggedFindingsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OwnershipUntaggedFindingsData data; + + public OwnershipUntaggedFindingsResponse() {} + + @JsonCreator + public OwnershipUntaggedFindingsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + OwnershipUntaggedFindingsData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OwnershipUntaggedFindingsResponse data(OwnershipUntaggedFindingsData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data wrapper for an ownership untagged findings response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OwnershipUntaggedFindingsData getData() { + return data; + } + + public void setData(OwnershipUntaggedFindingsData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 OwnershipUntaggedFindingsResponse + */ + @JsonAnySetter + public OwnershipUntaggedFindingsResponse 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 OwnershipUntaggedFindingsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnershipUntaggedFindingsResponse ownershipUntaggedFindingsResponse = + (OwnershipUntaggedFindingsResponse) o; + return Objects.equals(this.data, ownershipUntaggedFindingsResponse.data) + && Objects.equals( + this.additionalProperties, ownershipUntaggedFindingsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnershipUntaggedFindingsResponse {\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/OwnershipUntaggedFindingsType.java b/src/main/java/com/datadog/api/client/v2/model/OwnershipUntaggedFindingsType.java new file mode 100644 index 00000000000..cb8176274b8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OwnershipUntaggedFindingsType.java @@ -0,0 +1,60 @@ +/* + * 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; + +/** + * The type of the ownership untagged findings resource. The value should always be + * ownership_untagged_findings. + */ +@JsonSerialize(using = OwnershipUntaggedFindingsType.OwnershipUntaggedFindingsTypeSerializer.class) +public class OwnershipUntaggedFindingsType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ownership_untagged_findings")); + + public static final OwnershipUntaggedFindingsType OWNERSHIP_UNTAGGED_FINDINGS = + new OwnershipUntaggedFindingsType("ownership_untagged_findings"); + + OwnershipUntaggedFindingsType(String value) { + super(value, allowedValues); + } + + public static class OwnershipUntaggedFindingsTypeSerializer + extends StdSerializer { + public OwnershipUntaggedFindingsTypeSerializer(Class t) { + super(t); + } + + public OwnershipUntaggedFindingsTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OwnershipUntaggedFindingsType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OwnershipUntaggedFindingsType fromValue(String value) { + return new OwnershipUntaggedFindingsType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/csm_ownership.feature b/src/test/resources/com/datadog/api/client/v2/api/csm_ownership.feature index 58498ca1550..661e420b5c2 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/csm_ownership.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/csm_ownership.feature @@ -12,6 +12,13 @@ Feature: CSM Ownership And a valid "appKeyAuth" key in the system And an instance of "CSMOwnership" API + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Count untagged findings by ownership confidence returns "OK" response + Given operation "GetOwnershipUntaggedFindings" enabled + And new "GetOwnershipUntaggedFindings" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-misconfigs Scenario: Get an ownership inference by owner type returns "Bad Request" response Given operation "GetOwnershipInference" enabled @@ -39,6 +46,13 @@ Feature: CSM Ownership When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get ownership settings for the org returns "OK" response + Given operation "GetOwnershipSettings" enabled + And new "GetOwnershipSettings" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-misconfigs Scenario: Get the evidence for an ownership inference returns "Bad Request" response Given operation "GetOwnershipEvidence" enabled @@ -163,3 +177,19 @@ Feature: CSM Ownership And body with value {"data": {"attributes": {"action": "confirm", "actor_handle": "user@example.com", "actor_type": "user", "corrected_owner_handle": "team-b", "corrected_owner_type": "team", "inference_checksum": "abc123", "reason": "Confirmed by team lead."}, "type": "ownership_feedback"}} When the request is sent Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Update ownership settings for the org returns "Bad Request" response + Given operation "PostOwnershipSettings" enabled + And new "PostOwnershipSettings" request + And body with value {"data": {"attributes": {"auto_tag": true, "confidence_level": "high"}, "type": "ownership_settings"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Update ownership settings for the org returns "OK" response + Given operation "PostOwnershipSettings" enabled + And new "PostOwnershipSettings" request + And body with value {"data": {"attributes": {"auto_tag": true, "confidence_level": "high"}, "type": "ownership_settings"}} + When the request is sent + Then the response status is 200 OK 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 e72767d8e0d..10ae8ac71d4 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 @@ -2049,6 +2049,24 @@ "type": "safe" } }, + "GetOwnershipSettings": { + "tag": "CSM Ownership", + "undo": { + "type": "safe" + } + }, + "PostOwnershipSettings": { + "tag": "CSM Ownership", + "undo": { + "type": "idempotent" + } + }, + "GetOwnershipUntaggedFindings": { + "tag": "CSM Ownership", + "undo": { + "type": "safe" + } + }, "ListOwnershipInferences": { "tag": "CSM Ownership", "undo": {