Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
451 changes: 451 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions examples/v2/security-monitoring/GetSecretsRules.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Returns list of Secrets rules 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.SecretRuleArray;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.getSecretsRules", true);
SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);

try {
SecretRuleArray result = apiInstance.getSecretsRules();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SecurityMonitoringApi#getSecretsRules");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
36 changes: 36 additions & 0 deletions examples/v2/security-monitoring/ListMultipleRulesets.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Ruleset get multiple 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.GetMultipleRulesetsRequest;
import com.datadog.api.client.v2.model.GetMultipleRulesetsRequestData;
import com.datadog.api.client.v2.model.GetMultipleRulesetsRequestDataAttributes;
import com.datadog.api.client.v2.model.GetMultipleRulesetsRequestDataType;
import com.datadog.api.client.v2.model.GetMultipleRulesetsResponse;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.listMultipleRulesets", true);
SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);

GetMultipleRulesetsRequest body =
new GetMultipleRulesetsRequest()
.data(
new GetMultipleRulesetsRequestData()
.attributes(new GetMultipleRulesetsRequestDataAttributes())
.type(GetMultipleRulesetsRequestDataType.GET_MULTIPLE_RULESETS_REQUEST));

try {
GetMultipleRulesetsResponse result = apiInstance.listMultipleRulesets(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SecurityMonitoringApi#listMultipleRulesets");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,13 @@ public class ApiClient {
put("v2.getHistoricalJob", false);
put("v2.getRuleVersionHistory", false);
put("v2.getSBOM", false);
put("v2.getSecretsRules", false);
put("v2.getSecurityMonitoringHistsignal", false);
put("v2.getSecurityMonitoringHistsignalsByJobId", false);
put("v2.listAssetsSBOMs", false);
put("v2.listFindings", false);
put("v2.listHistoricalJobs", false);
put("v2.listMultipleRulesets", false);
put("v2.listSecurityMonitoringHistsignals", false);
put("v2.listVulnerabilities", false);
put("v2.listVulnerableAssets", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import com.datadog.api.client.v2.model.FindingVulnerabilityType;
import com.datadog.api.client.v2.model.GetCustomFrameworkResponse;
import com.datadog.api.client.v2.model.GetFindingResponse;
import com.datadog.api.client.v2.model.GetMultipleRulesetsRequest;
import com.datadog.api.client.v2.model.GetMultipleRulesetsResponse;
import com.datadog.api.client.v2.model.GetResourceEvaluationFiltersResponse;
import com.datadog.api.client.v2.model.GetRuleVersionHistoryResponse;
import com.datadog.api.client.v2.model.GetSBOMResponse;
Expand All @@ -33,6 +35,7 @@
import com.datadog.api.client.v2.model.PatchNotificationRuleParameters;
import com.datadog.api.client.v2.model.RunHistoricalJobRequest;
import com.datadog.api.client.v2.model.SBOMComponentLicenseType;
import com.datadog.api.client.v2.model.SecretRuleArray;
import com.datadog.api.client.v2.model.SecurityFilterCreateRequest;
import com.datadog.api.client.v2.model.SecurityFilterResponse;
import com.datadog.api.client.v2.model.SecurityFilterUpdateRequest;
Expand Down Expand Up @@ -4269,6 +4272,131 @@ public CompletableFuture<ApiResponse<GetSBOMResponse>> getSBOMWithHttpInfoAsync(
new GenericType<GetSBOMResponse>() {});
}

/**
* Returns list of Secrets rules.
*
* <p>See {@link #getSecretsRulesWithHttpInfo}.
*
* @return SecretRuleArray
* @throws ApiException if fails to make API call
*/
public SecretRuleArray getSecretsRules() throws ApiException {
return getSecretsRulesWithHttpInfo().getData();
}

/**
* Returns list of Secrets rules.
*
* <p>See {@link #getSecretsRulesWithHttpInfoAsync}.
*
* @return CompletableFuture&lt;SecretRuleArray&gt;
*/
public CompletableFuture<SecretRuleArray> getSecretsRulesAsync() {
return getSecretsRulesWithHttpInfoAsync()
.thenApply(
response -> {
return response.getData();
});
}

/**
* Returns list of Secrets rules with ID, Pattern, Description, Priority, and SDS ID
*
* @return ApiResponse&lt;SecretRuleArray&gt;
* @throws ApiException if fails to make API call
* @http.response.details
* <table border="1">
* <caption>Response details</caption>
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
* </table>
*/
public ApiResponse<SecretRuleArray> getSecretsRulesWithHttpInfo() throws ApiException {
// Check if unstable operation is enabled
String operationId = "getSecretsRules";
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/static-analysis/secrets/rules";

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder =
apiClient.createBuilder(
"v2.SecurityMonitoringApi.getSecretsRules",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
return apiClient.invokeAPI(
"GET",
builder,
localVarHeaderParams,
new String[] {},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<SecretRuleArray>() {});
}

/**
* Returns list of Secrets rules.
*
* <p>See {@link #getSecretsRulesWithHttpInfo}.
*
* @return CompletableFuture&lt;ApiResponse&lt;SecretRuleArray&gt;&gt;
*/
public CompletableFuture<ApiResponse<SecretRuleArray>> getSecretsRulesWithHttpInfoAsync() {
// Check if unstable operation is enabled
String operationId = "getSecretsRules";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
CompletableFuture<ApiResponse<SecretRuleArray>> 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/static-analysis/secrets/rules";

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder;
try {
builder =
apiClient.createBuilder(
"v2.SecurityMonitoringApi.getSecretsRules",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
} catch (ApiException ex) {
CompletableFuture<ApiResponse<SecretRuleArray>> result = new CompletableFuture<>();
result.completeExceptionally(ex);
return result;
}
return apiClient.invokeAPIAsync(
"GET",
builder,
localVarHeaderParams,
new String[] {},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<SecretRuleArray>() {});
}

/**
* Get a security filter.
*
Expand Down Expand Up @@ -7211,6 +7339,157 @@ public ApiResponse<ListHistoricalJobsResponse> listHistoricalJobsWithHttpInfo(
new GenericType<ListHistoricalJobsResponse>() {});
}

/**
* Ruleset get multiple.
*
* <p>See {@link #listMultipleRulesetsWithHttpInfo}.
*
* @param body (required)
* @return GetMultipleRulesetsResponse
* @throws ApiException if fails to make API call
*/
public GetMultipleRulesetsResponse listMultipleRulesets(GetMultipleRulesetsRequest body)
throws ApiException {
return listMultipleRulesetsWithHttpInfo(body).getData();
}

/**
* Ruleset get multiple.
*
* <p>See {@link #listMultipleRulesetsWithHttpInfoAsync}.
*
* @param body (required)
* @return CompletableFuture&lt;GetMultipleRulesetsResponse&gt;
*/
public CompletableFuture<GetMultipleRulesetsResponse> listMultipleRulesetsAsync(
GetMultipleRulesetsRequest body) {
return listMultipleRulesetsWithHttpInfoAsync(body)
.thenApply(
response -> {
return response.getData();
});
}

/**
* Get rules for multiple rulesets in batch.
*
* @param body (required)
* @return ApiResponse&lt;GetMultipleRulesetsResponse&gt;
* @throws ApiException if fails to make API call
* @http.response.details
* <table border="1">
* <caption>Response details</caption>
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
* </table>
*/
public ApiResponse<GetMultipleRulesetsResponse> listMultipleRulesetsWithHttpInfo(
GetMultipleRulesetsRequest body) throws ApiException {
// Check if unstable operation is enabled
String operationId = "listMultipleRulesets";
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 listMultipleRulesets");
}
// create path and map variables
String localVarPath = "/api/v2/static-analysis/rulesets";

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder =
apiClient.createBuilder(
"v2.SecurityMonitoringApi.listMultipleRulesets",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
return apiClient.invokeAPI(
"POST",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<GetMultipleRulesetsResponse>() {});
}

/**
* Ruleset get multiple.
*
* <p>See {@link #listMultipleRulesetsWithHttpInfo}.
*
* @param body (required)
* @return CompletableFuture&lt;ApiResponse&lt;GetMultipleRulesetsResponse&gt;&gt;
*/
public CompletableFuture<ApiResponse<GetMultipleRulesetsResponse>>
listMultipleRulesetsWithHttpInfoAsync(GetMultipleRulesetsRequest body) {
// Check if unstable operation is enabled
String operationId = "listMultipleRulesets";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
CompletableFuture<ApiResponse<GetMultipleRulesetsResponse>> 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<ApiResponse<GetMultipleRulesetsResponse>> result =
new CompletableFuture<>();
result.completeExceptionally(
new ApiException(
400, "Missing the required parameter 'body' when calling listMultipleRulesets"));
return result;
}
// create path and map variables
String localVarPath = "/api/v2/static-analysis/rulesets";

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder;
try {
builder =
apiClient.createBuilder(
"v2.SecurityMonitoringApi.listMultipleRulesets",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
} catch (ApiException ex) {
CompletableFuture<ApiResponse<GetMultipleRulesetsResponse>> result =
new CompletableFuture<>();
result.completeExceptionally(ex);
return result;
}
return apiClient.invokeAPIAsync(
"POST",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<GetMultipleRulesetsResponse>() {});
}

/**
* Get all security filters.
*
Expand Down
Loading