diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 840ac4eef97..1652be1a473 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -52434,6 +52434,153 @@ components: x-enum-varnames: - DONE - TIMEOUT + SecurityMonitoringContentPackActivation: + description: The activation status of a content pack + enum: + - never_activated + - activated + - deactivated + example: activated + type: string + x-enum-varnames: + - NEVER_ACTIVATED + - ACTIVATED + - DEACTIVATED + SecurityMonitoringContentPackIntegrationStatus: + description: The installation status of the related integration + enum: + - installed + - available + - partially_installed + - detected + - error + example: installed + type: string + x-enum-varnames: + - INSTALLED + - AVAILABLE + - PARTIALLY_INSTALLED + - DETECTED + - ERROR + SecurityMonitoringContentPackStateAttributes: + description: Attributes of a content pack state + properties: + cloud_siem_index_incorrect: + description: Whether the cloud SIEM index configuration is incorrect (only + applicable with the Cloud SIEM with index pricing model) + example: false + type: boolean + cp_activation: + $ref: '#/components/schemas/SecurityMonitoringContentPackActivation' + filters_configured_for_logs: + description: Whether filters (Security Filters or Index Query depending + on the pricing model) are configured for logs + example: true + type: boolean + integration_installed_status: + $ref: '#/components/schemas/SecurityMonitoringContentPackIntegrationStatus' + logs_last_collected: + $ref: '#/components/schemas/SecurityMonitoringContentPackTimestampBucket' + logs_seen_from_any_index: + description: Whether logs have been seen from any index + example: true + type: boolean + state: + $ref: '#/components/schemas/SecurityMonitoringContentPackStatus' + required: + - state + - cp_activation + - logs_seen_from_any_index + - logs_last_collected + - cloud_siem_index_incorrect + - filters_configured_for_logs + type: object + SecurityMonitoringContentPackStateData: + description: Content pack state data. + properties: + attributes: + $ref: '#/components/schemas/SecurityMonitoringContentPackStateAttributes' + id: + description: The content pack identifier. + example: aws-cloudtrail + type: string + type: + $ref: '#/components/schemas/SecurityMonitoringContentPackStateType' + required: + - id + - type + - attributes + type: object + SecurityMonitoringContentPackStateMeta: + description: Metadata for content pack states + properties: + cloud_siem_index_incorrect: + description: Whether the cloud SIEM index configuration is incorrect at + the organization level + example: false + type: boolean + sku: + $ref: '#/components/schemas/SecurityMonitoringSKU' + required: + - cloud_siem_index_incorrect + - sku + type: object + SecurityMonitoringContentPackStateType: + description: Type for content pack state object + enum: + - content_pack_state + example: content_pack_state + type: string + x-enum-varnames: + - CONTENT_PACK_STATE + SecurityMonitoringContentPackStatesResponse: + description: Response containing content pack states. + properties: + data: + description: Array of content pack states. + items: + $ref: '#/components/schemas/SecurityMonitoringContentPackStateData' + type: array + meta: + $ref: '#/components/schemas/SecurityMonitoringContentPackStateMeta' + required: + - data + - meta + type: object + SecurityMonitoringContentPackStatus: + description: The current status of a content pack + enum: + - install + - activate + - initializing + - active + - warning + - broken + example: active + type: string + x-enum-varnames: + - INSTALL + - ACTIVATE + - INITIALIZING + - ACTIVE + - WARNING + - BROKEN + SecurityMonitoringContentPackTimestampBucket: + description: Timestamp bucket indicating when logs were last collected + enum: + - not_seen + - within_24_hours + - within_24_to_72_hours + - over_72h_to_30d + - over_30d + example: within_24_hours + type: string + x-enum-varnames: + - NOT_SEEN + - WITHIN_24_HOURS + - WITHIN_24_TO_72_HOURS + - OVER_72H_TO_30D + - OVER_30D SecurityMonitoringCriticalAsset: description: The critical asset's properties. properties: @@ -53561,6 +53708,18 @@ components: - $ref: '#/components/schemas/SecurityMonitoringStandardRulePayload' - $ref: '#/components/schemas/SecurityMonitoringSignalRulePayload' - $ref: '#/components/schemas/CloudConfigurationRulePayload' + SecurityMonitoringSKU: + description: The SIEM pricing model (SKU) for the organization + enum: + - per_gb_analyzed + - per_event_in_siem_index_2023 + - add_on_2024 + example: add_on_2024 + type: string + x-enum-varnames: + - PER_GB_ANALYZED + - PER_EVENT_IN_SIEM_INDEX_2023 + - ADD_ON_2024 SecurityMonitoringSchedulingOptions: description: Options for scheduled rules. When this field is present, the rule runs based on the schedule. When absent, it runs real-time on ingested logs. @@ -93367,6 +93526,123 @@ paths: summary: Get a suppression's version history tags: - Security Monitoring + /api/v2/security_monitoring/content_packs/states: + get: + description: 'Get the activation and configuration states for all security monitoring + content packs. + + This endpoint returns status information about each content pack including + activation state, + + integration status, and log collection status.' + operationId: GetContentPacksStates + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SecurityMonitoringContentPackStatesResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get content pack states + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/security_monitoring/content_packs/{content_pack_id}/activate: + put: + description: 'Activate a security monitoring content pack. This operation configures + the necessary + + log filters or security filters depending on the pricing model and updates + the content + + pack activation state.' + operationId: ActivateContentPack + parameters: + - description: The ID of the content pack to activate. + in: path + name: content_pack_id + required: true + schema: + example: aws-cloudtrail + type: string + responses: + '202': + description: Accepted + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Activate content pack + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/security_monitoring/content_packs/{content_pack_id}/deactivate: + put: + description: 'Deactivate a security monitoring content pack. This operation + removes the content pack''s + + configuration from log filters or security filters and updates the content + pack activation state.' + operationId: DeactivateContentPack + parameters: + - description: The ID of the content pack to deactivate. + in: path + name: content_pack_id + required: true + schema: + example: aws-cloudtrail + type: string + responses: + '202': + description: Accepted + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Deactivate content pack + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/security_monitoring/rules: get: description: List rules. diff --git a/examples/v2/security-monitoring/ActivateContentPack.java b/examples/v2/security-monitoring/ActivateContentPack.java new file mode 100644 index 00000000000..e43be177cbe --- /dev/null +++ b/examples/v2/security-monitoring/ActivateContentPack.java @@ -0,0 +1,23 @@ +// Activate content pack returns "Accepted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.activateContentPack", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + apiInstance.activateContentPack("aws-cloudtrail"); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#activateContentPack"); + 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/security-monitoring/DeactivateContentPack.java b/examples/v2/security-monitoring/DeactivateContentPack.java new file mode 100644 index 00000000000..e293b73cf01 --- /dev/null +++ b/examples/v2/security-monitoring/DeactivateContentPack.java @@ -0,0 +1,23 @@ +// Deactivate content pack returns "Accepted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deactivateContentPack", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + apiInstance.deactivateContentPack("aws-cloudtrail"); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#deactivateContentPack"); + 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/security-monitoring/GetContentPacksStates.java b/examples/v2/security-monitoring/GetContentPacksStates.java new file mode 100644 index 00000000000..fe292a779f1 --- /dev/null +++ b/examples/v2/security-monitoring/GetContentPacksStates.java @@ -0,0 +1,25 @@ +// Get content pack states returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.SecurityMonitoringContentPackStatesResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getContentPacksStates", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + try { + SecurityMonitoringContentPackStatesResponse result = apiInstance.getContentPacksStates(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SecurityMonitoringApi#getContentPacksStates"); + 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 fcadf72e1e8..a6938ca0ff4 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -775,9 +775,12 @@ public class ApiClient { put("v2.getOpenAPI", false); put("v2.listAPIs", false); put("v2.updateOpenAPI", false); + put("v2.activateContentPack", false); put("v2.cancelThreatHuntingJob", false); put("v2.convertJobResultToSignal", false); + put("v2.deactivateContentPack", false); put("v2.deleteThreatHuntingJob", false); + put("v2.getContentPacksStates", false); put("v2.getFinding", false); put("v2.getRuleVersionHistory", false); put("v2.getSecretsRules", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java index 652774643e8..810817d80ec 100644 --- a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java @@ -57,6 +57,7 @@ import com.datadog.api.client.v2.model.SecurityFindingsSearchRequestDataAttributes; import com.datadog.api.client.v2.model.SecurityFindingsSearchRequestPage; import com.datadog.api.client.v2.model.SecurityFindingsSort; +import com.datadog.api.client.v2.model.SecurityMonitoringContentPackStatesResponse; import com.datadog.api.client.v2.model.SecurityMonitoringCriticalAssetCreateRequest; import com.datadog.api.client.v2.model.SecurityMonitoringCriticalAssetResponse; import com.datadog.api.client.v2.model.SecurityMonitoringCriticalAssetUpdateRequest; @@ -139,6 +140,164 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Activate content pack. + * + *

See {@link #activateContentPackWithHttpInfo}. + * + * @param contentPackId The ID of the content pack to activate. (required) + * @throws ApiException if fails to make API call + */ + public void activateContentPack(String contentPackId) throws ApiException { + activateContentPackWithHttpInfo(contentPackId); + } + + /** + * Activate content pack. + * + *

See {@link #activateContentPackWithHttpInfoAsync}. + * + * @param contentPackId The ID of the content pack to activate. (required) + * @return CompletableFuture + */ + public CompletableFuture activateContentPackAsync(String contentPackId) { + return activateContentPackWithHttpInfoAsync(contentPackId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Activate a security monitoring content pack. This operation configures the necessary log + * filters or security filters depending on the pricing model and updates the content pack + * activation state. + * + * @param contentPackId The ID of the content pack to activate. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Accepted -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse activateContentPackWithHttpInfo(String contentPackId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "activateContentPack"; + 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; + + // verify the required parameter 'contentPackId' is set + if (contentPackId == null) { + throw new ApiException( + 400, "Missing the required parameter 'contentPackId' when calling activateContentPack"); + } + // create path and map variables + String localVarPath = + "/api/v2/security_monitoring/content_packs/{content_pack_id}/activate" + .replaceAll( + "\\{" + "content_pack_id" + "\\}", + apiClient.escapeString(contentPackId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.activateContentPack", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Activate content pack. + * + *

See {@link #activateContentPackWithHttpInfo}. + * + * @param contentPackId The ID of the content pack to activate. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> activateContentPackWithHttpInfoAsync( + String contentPackId) { + // Check if unstable operation is enabled + String operationId = "activateContentPack"; + 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; + + // verify the required parameter 'contentPackId' is set + if (contentPackId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'contentPackId' when calling activateContentPack")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/security_monitoring/content_packs/{content_pack_id}/activate" + .replaceAll( + "\\{" + "content_pack_id" + "\\}", + apiClient.escapeString(contentPackId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.activateContentPack", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Attach security findings to a case. * @@ -2424,6 +2583,164 @@ public ApiResponse createVulnerabilityNotificationRule new GenericType() {}); } + /** + * Deactivate content pack. + * + *

See {@link #deactivateContentPackWithHttpInfo}. + * + * @param contentPackId The ID of the content pack to deactivate. (required) + * @throws ApiException if fails to make API call + */ + public void deactivateContentPack(String contentPackId) throws ApiException { + deactivateContentPackWithHttpInfo(contentPackId); + } + + /** + * Deactivate content pack. + * + *

See {@link #deactivateContentPackWithHttpInfoAsync}. + * + * @param contentPackId The ID of the content pack to deactivate. (required) + * @return CompletableFuture + */ + public CompletableFuture deactivateContentPackAsync(String contentPackId) { + return deactivateContentPackWithHttpInfoAsync(contentPackId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Deactivate a security monitoring content pack. This operation removes the content pack's + * configuration from log filters or security filters and updates the content pack activation + * state. + * + * @param contentPackId The ID of the content pack to deactivate. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Accepted -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deactivateContentPackWithHttpInfo(String contentPackId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deactivateContentPack"; + 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; + + // verify the required parameter 'contentPackId' is set + if (contentPackId == null) { + throw new ApiException( + 400, "Missing the required parameter 'contentPackId' when calling deactivateContentPack"); + } + // create path and map variables + String localVarPath = + "/api/v2/security_monitoring/content_packs/{content_pack_id}/deactivate" + .replaceAll( + "\\{" + "content_pack_id" + "\\}", + apiClient.escapeString(contentPackId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.deactivateContentPack", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Deactivate content pack. + * + *

See {@link #deactivateContentPackWithHttpInfo}. + * + * @param contentPackId The ID of the content pack to deactivate. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deactivateContentPackWithHttpInfoAsync( + String contentPackId) { + // Check if unstable operation is enabled + String operationId = "deactivateContentPack"; + 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; + + // verify the required parameter 'contentPackId' is set + if (contentPackId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'contentPackId' when calling deactivateContentPack")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/security_monitoring/content_packs/{content_pack_id}/deactivate" + .replaceAll( + "\\{" + "content_pack_id" + "\\}", + apiClient.escapeString(contentPackId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.deactivateContentPack", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Delete a custom framework. * @@ -4213,6 +4530,140 @@ public SecurityMonitoringSignalTriageUpdateResponse editSecurityMonitoringSignal new GenericType() {}); } + /** + * Get content pack states. + * + *

See {@link #getContentPacksStatesWithHttpInfo}. + * + * @return SecurityMonitoringContentPackStatesResponse + * @throws ApiException if fails to make API call + */ + public SecurityMonitoringContentPackStatesResponse getContentPacksStates() throws ApiException { + return getContentPacksStatesWithHttpInfo().getData(); + } + + /** + * Get content pack states. + * + *

See {@link #getContentPacksStatesWithHttpInfoAsync}. + * + * @return CompletableFuture<SecurityMonitoringContentPackStatesResponse> + */ + public CompletableFuture + getContentPacksStatesAsync() { + return getContentPacksStatesWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get the activation and configuration states for all security monitoring content packs. This + * endpoint returns status information about each content pack including activation state, + * integration status, and log collection status. + * + * @return ApiResponse<SecurityMonitoringContentPackStatesResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse + getContentPacksStatesWithHttpInfo() throws ApiException { + // Check if unstable operation is enabled + String operationId = "getContentPacksStates"; + 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/security_monitoring/content_packs/states"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getContentPacksStates", + 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 content pack states. + * + *

See {@link #getContentPacksStatesWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<SecurityMonitoringContentPackStatesResponse>> + */ + public CompletableFuture> + getContentPacksStatesWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "getContentPacksStates"; + 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/security_monitoring/content_packs/states"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getContentPacksStates", + 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() {}); + } + /** * Get critical assets affecting a specific rule. * diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackActivation.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackActivation.java new file mode 100644 index 00000000000..2d3c0328e92 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackActivation.java @@ -0,0 +1,67 @@ +/* + * 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 activation status of a content pack */ +@JsonSerialize( + using = + SecurityMonitoringContentPackActivation.SecurityMonitoringContentPackActivationSerializer + .class) +public class SecurityMonitoringContentPackActivation extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("never_activated", "activated", "deactivated")); + + public static final SecurityMonitoringContentPackActivation NEVER_ACTIVATED = + new SecurityMonitoringContentPackActivation("never_activated"); + public static final SecurityMonitoringContentPackActivation ACTIVATED = + new SecurityMonitoringContentPackActivation("activated"); + public static final SecurityMonitoringContentPackActivation DEACTIVATED = + new SecurityMonitoringContentPackActivation("deactivated"); + + SecurityMonitoringContentPackActivation(String value) { + super(value, allowedValues); + } + + public static class SecurityMonitoringContentPackActivationSerializer + extends StdSerializer { + public SecurityMonitoringContentPackActivationSerializer( + Class t) { + super(t); + } + + public SecurityMonitoringContentPackActivationSerializer() { + this(null); + } + + @Override + public void serialize( + SecurityMonitoringContentPackActivation value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityMonitoringContentPackActivation fromValue(String value) { + return new SecurityMonitoringContentPackActivation(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackIntegrationStatus.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackIntegrationStatus.java new file mode 100644 index 00000000000..93f8867efee --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackIntegrationStatus.java @@ -0,0 +1,72 @@ +/* + * 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 installation status of the related integration */ +@JsonSerialize( + using = + SecurityMonitoringContentPackIntegrationStatus + .SecurityMonitoringContentPackIntegrationStatusSerializer.class) +public class SecurityMonitoringContentPackIntegrationStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("installed", "available", "partially_installed", "detected", "error")); + + public static final SecurityMonitoringContentPackIntegrationStatus INSTALLED = + new SecurityMonitoringContentPackIntegrationStatus("installed"); + public static final SecurityMonitoringContentPackIntegrationStatus AVAILABLE = + new SecurityMonitoringContentPackIntegrationStatus("available"); + public static final SecurityMonitoringContentPackIntegrationStatus PARTIALLY_INSTALLED = + new SecurityMonitoringContentPackIntegrationStatus("partially_installed"); + public static final SecurityMonitoringContentPackIntegrationStatus DETECTED = + new SecurityMonitoringContentPackIntegrationStatus("detected"); + public static final SecurityMonitoringContentPackIntegrationStatus ERROR = + new SecurityMonitoringContentPackIntegrationStatus("error"); + + SecurityMonitoringContentPackIntegrationStatus(String value) { + super(value, allowedValues); + } + + public static class SecurityMonitoringContentPackIntegrationStatusSerializer + extends StdSerializer { + public SecurityMonitoringContentPackIntegrationStatusSerializer( + Class t) { + super(t); + } + + public SecurityMonitoringContentPackIntegrationStatusSerializer() { + this(null); + } + + @Override + public void serialize( + SecurityMonitoringContentPackIntegrationStatus value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityMonitoringContentPackIntegrationStatus fromValue(String value) { + return new SecurityMonitoringContentPackIntegrationStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStateAttributes.java new file mode 100644 index 00000000000..0830053c1b3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStateAttributes.java @@ -0,0 +1,380 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of a content pack state */ +@JsonPropertyOrder({ + SecurityMonitoringContentPackStateAttributes.JSON_PROPERTY_CLOUD_SIEM_INDEX_INCORRECT, + SecurityMonitoringContentPackStateAttributes.JSON_PROPERTY_CP_ACTIVATION, + SecurityMonitoringContentPackStateAttributes.JSON_PROPERTY_FILTERS_CONFIGURED_FOR_LOGS, + SecurityMonitoringContentPackStateAttributes.JSON_PROPERTY_INTEGRATION_INSTALLED_STATUS, + SecurityMonitoringContentPackStateAttributes.JSON_PROPERTY_LOGS_LAST_COLLECTED, + SecurityMonitoringContentPackStateAttributes.JSON_PROPERTY_LOGS_SEEN_FROM_ANY_INDEX, + SecurityMonitoringContentPackStateAttributes.JSON_PROPERTY_STATE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringContentPackStateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CLOUD_SIEM_INDEX_INCORRECT = + "cloud_siem_index_incorrect"; + private Boolean cloudSiemIndexIncorrect; + + public static final String JSON_PROPERTY_CP_ACTIVATION = "cp_activation"; + private SecurityMonitoringContentPackActivation cpActivation; + + public static final String JSON_PROPERTY_FILTERS_CONFIGURED_FOR_LOGS = + "filters_configured_for_logs"; + private Boolean filtersConfiguredForLogs; + + public static final String JSON_PROPERTY_INTEGRATION_INSTALLED_STATUS = + "integration_installed_status"; + private SecurityMonitoringContentPackIntegrationStatus integrationInstalledStatus; + + public static final String JSON_PROPERTY_LOGS_LAST_COLLECTED = "logs_last_collected"; + private SecurityMonitoringContentPackTimestampBucket logsLastCollected; + + public static final String JSON_PROPERTY_LOGS_SEEN_FROM_ANY_INDEX = "logs_seen_from_any_index"; + private Boolean logsSeenFromAnyIndex; + + public static final String JSON_PROPERTY_STATE = "state"; + private SecurityMonitoringContentPackStatus state; + + public SecurityMonitoringContentPackStateAttributes() {} + + @JsonCreator + public SecurityMonitoringContentPackStateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CLOUD_SIEM_INDEX_INCORRECT) + Boolean cloudSiemIndexIncorrect, + @JsonProperty(required = true, value = JSON_PROPERTY_CP_ACTIVATION) + SecurityMonitoringContentPackActivation cpActivation, + @JsonProperty(required = true, value = JSON_PROPERTY_FILTERS_CONFIGURED_FOR_LOGS) + Boolean filtersConfiguredForLogs, + @JsonProperty(required = true, value = JSON_PROPERTY_LOGS_LAST_COLLECTED) + SecurityMonitoringContentPackTimestampBucket logsLastCollected, + @JsonProperty(required = true, value = JSON_PROPERTY_LOGS_SEEN_FROM_ANY_INDEX) + Boolean logsSeenFromAnyIndex, + @JsonProperty(required = true, value = JSON_PROPERTY_STATE) + SecurityMonitoringContentPackStatus state) { + this.cloudSiemIndexIncorrect = cloudSiemIndexIncorrect; + this.cpActivation = cpActivation; + this.unparsed |= !cpActivation.isValid(); + this.filtersConfiguredForLogs = filtersConfiguredForLogs; + this.logsLastCollected = logsLastCollected; + this.unparsed |= !logsLastCollected.isValid(); + this.logsSeenFromAnyIndex = logsSeenFromAnyIndex; + this.state = state; + this.unparsed |= !state.isValid(); + } + + public SecurityMonitoringContentPackStateAttributes cloudSiemIndexIncorrect( + Boolean cloudSiemIndexIncorrect) { + this.cloudSiemIndexIncorrect = cloudSiemIndexIncorrect; + return this; + } + + /** + * Whether the cloud SIEM index configuration is incorrect (only applicable with the Cloud SIEM + * with index pricing model) + * + * @return cloudSiemIndexIncorrect + */ + @JsonProperty(JSON_PROPERTY_CLOUD_SIEM_INDEX_INCORRECT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getCloudSiemIndexIncorrect() { + return cloudSiemIndexIncorrect; + } + + public void setCloudSiemIndexIncorrect(Boolean cloudSiemIndexIncorrect) { + this.cloudSiemIndexIncorrect = cloudSiemIndexIncorrect; + } + + public SecurityMonitoringContentPackStateAttributes cpActivation( + SecurityMonitoringContentPackActivation cpActivation) { + this.cpActivation = cpActivation; + this.unparsed |= !cpActivation.isValid(); + return this; + } + + /** + * The activation status of a content pack + * + * @return cpActivation + */ + @JsonProperty(JSON_PROPERTY_CP_ACTIVATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringContentPackActivation getCpActivation() { + return cpActivation; + } + + public void setCpActivation(SecurityMonitoringContentPackActivation cpActivation) { + if (!cpActivation.isValid()) { + this.unparsed = true; + } + this.cpActivation = cpActivation; + } + + public SecurityMonitoringContentPackStateAttributes filtersConfiguredForLogs( + Boolean filtersConfiguredForLogs) { + this.filtersConfiguredForLogs = filtersConfiguredForLogs; + return this; + } + + /** + * Whether filters (Security Filters or Index Query depending on the pricing model) are configured + * for logs + * + * @return filtersConfiguredForLogs + */ + @JsonProperty(JSON_PROPERTY_FILTERS_CONFIGURED_FOR_LOGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getFiltersConfiguredForLogs() { + return filtersConfiguredForLogs; + } + + public void setFiltersConfiguredForLogs(Boolean filtersConfiguredForLogs) { + this.filtersConfiguredForLogs = filtersConfiguredForLogs; + } + + public SecurityMonitoringContentPackStateAttributes integrationInstalledStatus( + SecurityMonitoringContentPackIntegrationStatus integrationInstalledStatus) { + this.integrationInstalledStatus = integrationInstalledStatus; + this.unparsed |= !integrationInstalledStatus.isValid(); + return this; + } + + /** + * The installation status of the related integration + * + * @return integrationInstalledStatus + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INTEGRATION_INSTALLED_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SecurityMonitoringContentPackIntegrationStatus getIntegrationInstalledStatus() { + return integrationInstalledStatus; + } + + public void setIntegrationInstalledStatus( + SecurityMonitoringContentPackIntegrationStatus integrationInstalledStatus) { + if (!integrationInstalledStatus.isValid()) { + this.unparsed = true; + } + this.integrationInstalledStatus = integrationInstalledStatus; + } + + public SecurityMonitoringContentPackStateAttributes logsLastCollected( + SecurityMonitoringContentPackTimestampBucket logsLastCollected) { + this.logsLastCollected = logsLastCollected; + this.unparsed |= !logsLastCollected.isValid(); + return this; + } + + /** + * Timestamp bucket indicating when logs were last collected + * + * @return logsLastCollected + */ + @JsonProperty(JSON_PROPERTY_LOGS_LAST_COLLECTED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringContentPackTimestampBucket getLogsLastCollected() { + return logsLastCollected; + } + + public void setLogsLastCollected(SecurityMonitoringContentPackTimestampBucket logsLastCollected) { + if (!logsLastCollected.isValid()) { + this.unparsed = true; + } + this.logsLastCollected = logsLastCollected; + } + + public SecurityMonitoringContentPackStateAttributes logsSeenFromAnyIndex( + Boolean logsSeenFromAnyIndex) { + this.logsSeenFromAnyIndex = logsSeenFromAnyIndex; + return this; + } + + /** + * Whether logs have been seen from any index + * + * @return logsSeenFromAnyIndex + */ + @JsonProperty(JSON_PROPERTY_LOGS_SEEN_FROM_ANY_INDEX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getLogsSeenFromAnyIndex() { + return logsSeenFromAnyIndex; + } + + public void setLogsSeenFromAnyIndex(Boolean logsSeenFromAnyIndex) { + this.logsSeenFromAnyIndex = logsSeenFromAnyIndex; + } + + public SecurityMonitoringContentPackStateAttributes state( + SecurityMonitoringContentPackStatus state) { + this.state = state; + this.unparsed |= !state.isValid(); + return this; + } + + /** + * The current status of a content pack + * + * @return state + */ + @JsonProperty(JSON_PROPERTY_STATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringContentPackStatus getState() { + return state; + } + + public void setState(SecurityMonitoringContentPackStatus state) { + if (!state.isValid()) { + this.unparsed = true; + } + this.state = state; + } + + /** + * 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 SecurityMonitoringContentPackStateAttributes + */ + @JsonAnySetter + public SecurityMonitoringContentPackStateAttributes 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 SecurityMonitoringContentPackStateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringContentPackStateAttributes securityMonitoringContentPackStateAttributes = + (SecurityMonitoringContentPackStateAttributes) o; + return Objects.equals( + this.cloudSiemIndexIncorrect, + securityMonitoringContentPackStateAttributes.cloudSiemIndexIncorrect) + && Objects.equals( + this.cpActivation, securityMonitoringContentPackStateAttributes.cpActivation) + && Objects.equals( + this.filtersConfiguredForLogs, + securityMonitoringContentPackStateAttributes.filtersConfiguredForLogs) + && Objects.equals( + this.integrationInstalledStatus, + securityMonitoringContentPackStateAttributes.integrationInstalledStatus) + && Objects.equals( + this.logsLastCollected, securityMonitoringContentPackStateAttributes.logsLastCollected) + && Objects.equals( + this.logsSeenFromAnyIndex, + securityMonitoringContentPackStateAttributes.logsSeenFromAnyIndex) + && Objects.equals(this.state, securityMonitoringContentPackStateAttributes.state) + && Objects.equals( + this.additionalProperties, + securityMonitoringContentPackStateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + cloudSiemIndexIncorrect, + cpActivation, + filtersConfiguredForLogs, + integrationInstalledStatus, + logsLastCollected, + logsSeenFromAnyIndex, + state, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringContentPackStateAttributes {\n"); + sb.append(" cloudSiemIndexIncorrect: ") + .append(toIndentedString(cloudSiemIndexIncorrect)) + .append("\n"); + sb.append(" cpActivation: ").append(toIndentedString(cpActivation)).append("\n"); + sb.append(" filtersConfiguredForLogs: ") + .append(toIndentedString(filtersConfiguredForLogs)) + .append("\n"); + sb.append(" integrationInstalledStatus: ") + .append(toIndentedString(integrationInstalledStatus)) + .append("\n"); + sb.append(" logsLastCollected: ").append(toIndentedString(logsLastCollected)).append("\n"); + sb.append(" logsSeenFromAnyIndex: ") + .append(toIndentedString(logsSeenFromAnyIndex)) + .append("\n"); + sb.append(" state: ").append(toIndentedString(state)).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/SecurityMonitoringContentPackStateData.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStateData.java new file mode 100644 index 00000000000..aea07e352ec --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStateData.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; + +/** Content pack state data. */ +@JsonPropertyOrder({ + SecurityMonitoringContentPackStateData.JSON_PROPERTY_ATTRIBUTES, + SecurityMonitoringContentPackStateData.JSON_PROPERTY_ID, + SecurityMonitoringContentPackStateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringContentPackStateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private SecurityMonitoringContentPackStateAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SecurityMonitoringContentPackStateType type; + + public SecurityMonitoringContentPackStateData() {} + + @JsonCreator + public SecurityMonitoringContentPackStateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + SecurityMonitoringContentPackStateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + SecurityMonitoringContentPackStateType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SecurityMonitoringContentPackStateData attributes( + SecurityMonitoringContentPackStateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a content pack state + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringContentPackStateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(SecurityMonitoringContentPackStateAttributes attributes) { + this.attributes = attributes; + } + + public SecurityMonitoringContentPackStateData id(String id) { + this.id = id; + return this; + } + + /** + * The content pack identifier. + * + * @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 SecurityMonitoringContentPackStateData type(SecurityMonitoringContentPackStateType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type for content pack state object + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringContentPackStateType getType() { + return type; + } + + public void setType(SecurityMonitoringContentPackStateType 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 SecurityMonitoringContentPackStateData + */ + @JsonAnySetter + public SecurityMonitoringContentPackStateData 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 SecurityMonitoringContentPackStateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringContentPackStateData securityMonitoringContentPackStateData = + (SecurityMonitoringContentPackStateData) o; + return Objects.equals(this.attributes, securityMonitoringContentPackStateData.attributes) + && Objects.equals(this.id, securityMonitoringContentPackStateData.id) + && Objects.equals(this.type, securityMonitoringContentPackStateData.type) + && Objects.equals( + this.additionalProperties, securityMonitoringContentPackStateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringContentPackStateData {\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/SecurityMonitoringContentPackStateMeta.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStateMeta.java new file mode 100644 index 00000000000..fc23f9a2738 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStateMeta.java @@ -0,0 +1,187 @@ +/* + * 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; + +/** Metadata for content pack states */ +@JsonPropertyOrder({ + SecurityMonitoringContentPackStateMeta.JSON_PROPERTY_CLOUD_SIEM_INDEX_INCORRECT, + SecurityMonitoringContentPackStateMeta.JSON_PROPERTY_SKU +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringContentPackStateMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CLOUD_SIEM_INDEX_INCORRECT = + "cloud_siem_index_incorrect"; + private Boolean cloudSiemIndexIncorrect; + + public static final String JSON_PROPERTY_SKU = "sku"; + private SecurityMonitoringSKU sku; + + public SecurityMonitoringContentPackStateMeta() {} + + @JsonCreator + public SecurityMonitoringContentPackStateMeta( + @JsonProperty(required = true, value = JSON_PROPERTY_CLOUD_SIEM_INDEX_INCORRECT) + Boolean cloudSiemIndexIncorrect, + @JsonProperty(required = true, value = JSON_PROPERTY_SKU) SecurityMonitoringSKU sku) { + this.cloudSiemIndexIncorrect = cloudSiemIndexIncorrect; + this.sku = sku; + this.unparsed |= !sku.isValid(); + } + + public SecurityMonitoringContentPackStateMeta cloudSiemIndexIncorrect( + Boolean cloudSiemIndexIncorrect) { + this.cloudSiemIndexIncorrect = cloudSiemIndexIncorrect; + return this; + } + + /** + * Whether the cloud SIEM index configuration is incorrect at the organization level + * + * @return cloudSiemIndexIncorrect + */ + @JsonProperty(JSON_PROPERTY_CLOUD_SIEM_INDEX_INCORRECT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getCloudSiemIndexIncorrect() { + return cloudSiemIndexIncorrect; + } + + public void setCloudSiemIndexIncorrect(Boolean cloudSiemIndexIncorrect) { + this.cloudSiemIndexIncorrect = cloudSiemIndexIncorrect; + } + + public SecurityMonitoringContentPackStateMeta sku(SecurityMonitoringSKU sku) { + this.sku = sku; + this.unparsed |= !sku.isValid(); + return this; + } + + /** + * The SIEM pricing model (SKU) for the organization + * + * @return sku + */ + @JsonProperty(JSON_PROPERTY_SKU) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringSKU getSku() { + return sku; + } + + public void setSku(SecurityMonitoringSKU sku) { + if (!sku.isValid()) { + this.unparsed = true; + } + this.sku = sku; + } + + /** + * 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 SecurityMonitoringContentPackStateMeta + */ + @JsonAnySetter + public SecurityMonitoringContentPackStateMeta 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 SecurityMonitoringContentPackStateMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringContentPackStateMeta securityMonitoringContentPackStateMeta = + (SecurityMonitoringContentPackStateMeta) o; + return Objects.equals( + this.cloudSiemIndexIncorrect, + securityMonitoringContentPackStateMeta.cloudSiemIndexIncorrect) + && Objects.equals(this.sku, securityMonitoringContentPackStateMeta.sku) + && Objects.equals( + this.additionalProperties, securityMonitoringContentPackStateMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(cloudSiemIndexIncorrect, sku, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringContentPackStateMeta {\n"); + sb.append(" cloudSiemIndexIncorrect: ") + .append(toIndentedString(cloudSiemIndexIncorrect)) + .append("\n"); + sb.append(" sku: ").append(toIndentedString(sku)).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/SecurityMonitoringContentPackStateType.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStateType.java new file mode 100644 index 00000000000..f59c55b3345 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStateType.java @@ -0,0 +1,63 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type for content pack state object */ +@JsonSerialize( + using = + SecurityMonitoringContentPackStateType.SecurityMonitoringContentPackStateTypeSerializer + .class) +public class SecurityMonitoringContentPackStateType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("content_pack_state")); + + public static final SecurityMonitoringContentPackStateType CONTENT_PACK_STATE = + new SecurityMonitoringContentPackStateType("content_pack_state"); + + SecurityMonitoringContentPackStateType(String value) { + super(value, allowedValues); + } + + public static class SecurityMonitoringContentPackStateTypeSerializer + extends StdSerializer { + public SecurityMonitoringContentPackStateTypeSerializer( + Class t) { + super(t); + } + + public SecurityMonitoringContentPackStateTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SecurityMonitoringContentPackStateType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityMonitoringContentPackStateType fromValue(String value) { + return new SecurityMonitoringContentPackStateType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStatesResponse.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStatesResponse.java new file mode 100644 index 00000000000..c5c977212dc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStatesResponse.java @@ -0,0 +1,195 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing content pack states. */ +@JsonPropertyOrder({ + SecurityMonitoringContentPackStatesResponse.JSON_PROPERTY_DATA, + SecurityMonitoringContentPackStatesResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringContentPackStatesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_META = "meta"; + private SecurityMonitoringContentPackStateMeta meta; + + public SecurityMonitoringContentPackStatesResponse() {} + + @JsonCreator + public SecurityMonitoringContentPackStatesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data, + @JsonProperty(required = true, value = JSON_PROPERTY_META) + SecurityMonitoringContentPackStateMeta meta) { + this.data = data; + this.meta = meta; + this.unparsed |= meta.unparsed; + } + + public SecurityMonitoringContentPackStatesResponse data( + List data) { + this.data = data; + for (SecurityMonitoringContentPackStateData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public SecurityMonitoringContentPackStatesResponse addDataItem( + SecurityMonitoringContentPackStateData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of content pack states. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public SecurityMonitoringContentPackStatesResponse meta( + SecurityMonitoringContentPackStateMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Metadata for content pack states + * + * @return meta + */ + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringContentPackStateMeta getMeta() { + return meta; + } + + public void setMeta(SecurityMonitoringContentPackStateMeta meta) { + this.meta = meta; + } + + /** + * 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 SecurityMonitoringContentPackStatesResponse + */ + @JsonAnySetter + public SecurityMonitoringContentPackStatesResponse 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 SecurityMonitoringContentPackStatesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringContentPackStatesResponse securityMonitoringContentPackStatesResponse = + (SecurityMonitoringContentPackStatesResponse) o; + return Objects.equals(this.data, securityMonitoringContentPackStatesResponse.data) + && Objects.equals(this.meta, securityMonitoringContentPackStatesResponse.meta) + && Objects.equals( + this.additionalProperties, + securityMonitoringContentPackStatesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringContentPackStatesResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).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/SecurityMonitoringContentPackStatus.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStatus.java new file mode 100644 index 00000000000..953111c0ad1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackStatus.java @@ -0,0 +1,70 @@ +/* + * 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 current status of a content pack */ +@JsonSerialize( + using = SecurityMonitoringContentPackStatus.SecurityMonitoringContentPackStatusSerializer.class) +public class SecurityMonitoringContentPackStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("install", "activate", "initializing", "active", "warning", "broken")); + + public static final SecurityMonitoringContentPackStatus INSTALL = + new SecurityMonitoringContentPackStatus("install"); + public static final SecurityMonitoringContentPackStatus ACTIVATE = + new SecurityMonitoringContentPackStatus("activate"); + public static final SecurityMonitoringContentPackStatus INITIALIZING = + new SecurityMonitoringContentPackStatus("initializing"); + public static final SecurityMonitoringContentPackStatus ACTIVE = + new SecurityMonitoringContentPackStatus("active"); + public static final SecurityMonitoringContentPackStatus WARNING = + new SecurityMonitoringContentPackStatus("warning"); + public static final SecurityMonitoringContentPackStatus BROKEN = + new SecurityMonitoringContentPackStatus("broken"); + + SecurityMonitoringContentPackStatus(String value) { + super(value, allowedValues); + } + + public static class SecurityMonitoringContentPackStatusSerializer + extends StdSerializer { + public SecurityMonitoringContentPackStatusSerializer( + Class t) { + super(t); + } + + public SecurityMonitoringContentPackStatusSerializer() { + this(null); + } + + @Override + public void serialize( + SecurityMonitoringContentPackStatus value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityMonitoringContentPackStatus fromValue(String value) { + return new SecurityMonitoringContentPackStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackTimestampBucket.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackTimestampBucket.java new file mode 100644 index 00000000000..065c1f05ab3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringContentPackTimestampBucket.java @@ -0,0 +1,77 @@ +/* + * 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; + +/** Timestamp bucket indicating when logs were last collected */ +@JsonSerialize( + using = + SecurityMonitoringContentPackTimestampBucket + .SecurityMonitoringContentPackTimestampBucketSerializer.class) +public class SecurityMonitoringContentPackTimestampBucket extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "not_seen", + "within_24_hours", + "within_24_to_72_hours", + "over_72h_to_30d", + "over_30d")); + + public static final SecurityMonitoringContentPackTimestampBucket NOT_SEEN = + new SecurityMonitoringContentPackTimestampBucket("not_seen"); + public static final SecurityMonitoringContentPackTimestampBucket WITHIN_24_HOURS = + new SecurityMonitoringContentPackTimestampBucket("within_24_hours"); + public static final SecurityMonitoringContentPackTimestampBucket WITHIN_24_TO_72_HOURS = + new SecurityMonitoringContentPackTimestampBucket("within_24_to_72_hours"); + public static final SecurityMonitoringContentPackTimestampBucket OVER_72H_TO_30D = + new SecurityMonitoringContentPackTimestampBucket("over_72h_to_30d"); + public static final SecurityMonitoringContentPackTimestampBucket OVER_30D = + new SecurityMonitoringContentPackTimestampBucket("over_30d"); + + SecurityMonitoringContentPackTimestampBucket(String value) { + super(value, allowedValues); + } + + public static class SecurityMonitoringContentPackTimestampBucketSerializer + extends StdSerializer { + public SecurityMonitoringContentPackTimestampBucketSerializer( + Class t) { + super(t); + } + + public SecurityMonitoringContentPackTimestampBucketSerializer() { + this(null); + } + + @Override + public void serialize( + SecurityMonitoringContentPackTimestampBucket value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityMonitoringContentPackTimestampBucket fromValue(String value) { + return new SecurityMonitoringContentPackTimestampBucket(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSKU.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSKU.java new file mode 100644 index 00000000000..ecef96592f0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringSKU.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 SIEM pricing model (SKU) for the organization */ +@JsonSerialize(using = SecurityMonitoringSKU.SecurityMonitoringSKUSerializer.class) +public class SecurityMonitoringSKU extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("per_gb_analyzed", "per_event_in_siem_index_2023", "add_on_2024")); + + public static final SecurityMonitoringSKU PER_GB_ANALYZED = + new SecurityMonitoringSKU("per_gb_analyzed"); + public static final SecurityMonitoringSKU PER_EVENT_IN_SIEM_INDEX_2023 = + new SecurityMonitoringSKU("per_event_in_siem_index_2023"); + public static final SecurityMonitoringSKU ADD_ON_2024 = new SecurityMonitoringSKU("add_on_2024"); + + SecurityMonitoringSKU(String value) { + super(value, allowedValues); + } + + public static class SecurityMonitoringSKUSerializer extends StdSerializer { + public SecurityMonitoringSKUSerializer(Class t) { + super(t); + } + + public SecurityMonitoringSKUSerializer() { + this(null); + } + + @Override + public void serialize( + SecurityMonitoringSKU value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityMonitoringSKU fromValue(String value) { + return new SecurityMonitoringSKU(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature index ccc027734e2..df5e32bcc4d 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature @@ -9,6 +9,22 @@ Feature: Security Monitoring And a valid "appKeyAuth" key in the system And an instance of "SecurityMonitoring" API + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Activate content pack returns "Accepted" response + Given operation "ActivateContentPack" enabled + And new "ActivateContentPack" request + And request contains "content_pack_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Activate content pack returns "Not Found" response + Given operation "ActivateContentPack" enabled + And new "ActivateContentPack" request + And request contains "content_pack_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/k9-investigation Scenario: Attach security finding to a Jira issue returns "OK" response Given new "AttachJiraIssue" request @@ -681,6 +697,22 @@ Feature: Security Monitoring When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Deactivate content pack returns "Accepted" response + Given operation "DeactivateContentPack" enabled + And new "DeactivateContentPack" request + And request contains "content_pack_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Deactivate content pack returns "Not Found" response + Given operation "DeactivateContentPack" enabled + And new "DeactivateContentPack" request + And request contains "content_pack_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/k9-cloud-security-platform Scenario: Delete a critical asset returns "Not Found" response Given new "DeleteSecurityMonitoringCriticalAsset" request @@ -1225,6 +1257,20 @@ Feature: Security Monitoring Then the response status is 200 OK And the response "data[0].attributes.name" is equal to "suppression2 {{ unique_hash }}" + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Get content pack states returns "Not Found" response + Given operation "GetContentPacksStates" enabled + And new "GetContentPacksStates" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Get content pack states returns "OK" response + Given operation "GetContentPacksStates" enabled + And new "GetContentPacksStates" request + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/k9-cloud-security-platform Scenario: Get critical assets affecting a specific rule returns "Not Found" response Given new "GetCriticalAssetsAffectingRule" request diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 41fa31182a8..908226f7a80 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 @@ -4494,6 +4494,24 @@ "type": "safe" } }, + "GetContentPacksStates": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "ActivateContentPack": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "DeactivateContentPack": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "ListSecurityMonitoringRules": { "tag": "Security Monitoring", "undo": {