-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CSM Agentless Read Endpoint (#2629)
Co-authored-by: ci.datadog-api-spec <[email protected]>
- Loading branch information
1 parent
780a4d0
commit 5bf3b2f
Showing
12 changed files
with
926 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Get AWS Scan Options returns "OK" response | ||
|
||
import com.datadog.api.client.ApiClient; | ||
import com.datadog.api.client.ApiException; | ||
import com.datadog.api.client.v2.api.AgentlessScanningApi; | ||
import com.datadog.api.client.v2.model.AwsScanOptionsResponse; | ||
|
||
public class Example { | ||
public static void main(String[] args) { | ||
ApiClient defaultClient = ApiClient.getDefaultApiClient(); | ||
AgentlessScanningApi apiInstance = new AgentlessScanningApi(defaultClient); | ||
|
||
try { | ||
AwsScanOptionsResponse result = apiInstance.listAwsScanOptions(); | ||
System.out.println(result); | ||
} catch (ApiException e) { | ||
System.err.println("Exception when calling AgentlessScanningApi#listAwsScanOptions"); | ||
System.err.println("Status code: " + e.getCode()); | ||
System.err.println("Reason: " + e.getResponseBody()); | ||
System.err.println("Response headers: " + e.getResponseHeaders()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
155 changes: 155 additions & 0 deletions
155
src/main/java/com/datadog/api/client/v2/api/AgentlessScanningApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
package com.datadog.api.client.v2.api; | ||
|
||
import com.datadog.api.client.ApiClient; | ||
import com.datadog.api.client.ApiException; | ||
import com.datadog.api.client.ApiResponse; | ||
import com.datadog.api.client.Pair; | ||
import com.datadog.api.client.v2.model.AwsScanOptionsResponse; | ||
import jakarta.ws.rs.client.Invocation; | ||
import jakarta.ws.rs.core.GenericType; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
@jakarta.annotation.Generated( | ||
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") | ||
public class AgentlessScanningApi { | ||
private ApiClient apiClient; | ||
|
||
public AgentlessScanningApi() { | ||
this(ApiClient.getDefaultApiClient()); | ||
} | ||
|
||
public AgentlessScanningApi(ApiClient apiClient) { | ||
this.apiClient = apiClient; | ||
} | ||
|
||
/** | ||
* Get the API client. | ||
* | ||
* @return API client | ||
*/ | ||
public ApiClient getApiClient() { | ||
return apiClient; | ||
} | ||
|
||
/** | ||
* Set the API client. | ||
* | ||
* @param apiClient an instance of API client | ||
*/ | ||
public void setApiClient(ApiClient apiClient) { | ||
this.apiClient = apiClient; | ||
} | ||
|
||
/** | ||
* Get AWS Scan Options. | ||
* | ||
* <p>See {@link #listAwsScanOptionsWithHttpInfo}. | ||
* | ||
* @return AwsScanOptionsResponse | ||
* @throws ApiException if fails to make API call | ||
*/ | ||
public AwsScanOptionsResponse listAwsScanOptions() throws ApiException { | ||
return listAwsScanOptionsWithHttpInfo().getData(); | ||
} | ||
|
||
/** | ||
* Get AWS Scan Options. | ||
* | ||
* <p>See {@link #listAwsScanOptionsWithHttpInfoAsync}. | ||
* | ||
* @return CompletableFuture<AwsScanOptionsResponse> | ||
*/ | ||
public CompletableFuture<AwsScanOptionsResponse> listAwsScanOptionsAsync() { | ||
return listAwsScanOptionsWithHttpInfoAsync() | ||
.thenApply( | ||
response -> { | ||
return response.getData(); | ||
}); | ||
} | ||
|
||
/** | ||
* Fetches the scan options configured for AWS accounts. | ||
* | ||
* @return ApiResponse<AwsScanOptionsResponse> | ||
* @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> 403 </td><td> Not Authorized </td><td> - </td></tr> | ||
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> | ||
* </table> | ||
*/ | ||
public ApiResponse<AwsScanOptionsResponse> listAwsScanOptionsWithHttpInfo() throws ApiException { | ||
Object localVarPostBody = null; | ||
// create path and map variables | ||
String localVarPath = "/api/v2/agentless_scanning/accounts/aws"; | ||
|
||
Map<String, String> localVarHeaderParams = new HashMap<String, String>(); | ||
|
||
Invocation.Builder builder = | ||
apiClient.createBuilder( | ||
"v2.AgentlessScanningApi.listAwsScanOptions", | ||
localVarPath, | ||
new ArrayList<Pair>(), | ||
localVarHeaderParams, | ||
new HashMap<String, String>(), | ||
new String[] {"application/json"}, | ||
new String[] {"apiKeyAuth", "appKeyAuth"}); | ||
return apiClient.invokeAPI( | ||
"GET", | ||
builder, | ||
localVarHeaderParams, | ||
new String[] {}, | ||
localVarPostBody, | ||
new HashMap<String, Object>(), | ||
false, | ||
new GenericType<AwsScanOptionsResponse>() {}); | ||
} | ||
|
||
/** | ||
* Get AWS Scan Options. | ||
* | ||
* <p>See {@link #listAwsScanOptionsWithHttpInfo}. | ||
* | ||
* @return CompletableFuture<ApiResponse<AwsScanOptionsResponse>> | ||
*/ | ||
public CompletableFuture<ApiResponse<AwsScanOptionsResponse>> | ||
listAwsScanOptionsWithHttpInfoAsync() { | ||
Object localVarPostBody = null; | ||
// create path and map variables | ||
String localVarPath = "/api/v2/agentless_scanning/accounts/aws"; | ||
|
||
Map<String, String> localVarHeaderParams = new HashMap<String, String>(); | ||
|
||
Invocation.Builder builder; | ||
try { | ||
builder = | ||
apiClient.createBuilder( | ||
"v2.AgentlessScanningApi.listAwsScanOptions", | ||
localVarPath, | ||
new ArrayList<Pair>(), | ||
localVarHeaderParams, | ||
new HashMap<String, String>(), | ||
new String[] {"application/json"}, | ||
new String[] {"apiKeyAuth", "appKeyAuth"}); | ||
} catch (ApiException ex) { | ||
CompletableFuture<ApiResponse<AwsScanOptionsResponse>> result = new CompletableFuture<>(); | ||
result.completeExceptionally(ex); | ||
return result; | ||
} | ||
return apiClient.invokeAPIAsync( | ||
"GET", | ||
builder, | ||
localVarHeaderParams, | ||
new String[] {}, | ||
localVarPostBody, | ||
new HashMap<String, Object>(), | ||
false, | ||
new GenericType<AwsScanOptionsResponse>() {}); | ||
} | ||
} |
Oops, something went wrong.