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
70 changes: 70 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36135,6 +36135,51 @@ components:
required:
- name
type: object
LicensesListRequest:
properties:
data:
$ref: '#/components/schemas/LicensesListRequestData'
type: object
LicensesListRequestData:
properties:
attributes:
$ref: '#/components/schemas/LicensesListRequestDataAttributes'
id:
description: Unique identifier for the request
type: string
type:
$ref: '#/components/schemas/LicensesListRequestDataType'
required:
- type
type: object
LicensesListRequestDataAttributes:
properties:
licenses:
description: List of available licenses
items:
$ref: '#/components/schemas/LicensesListRequestLicense'
type: array
type: object
LicensesListRequestDataType:
default: licenserequest
enum:
- licenserequest
example: licenserequest
type: string
x-enum-varnames:
- LICENSEREQUEST
LicensesListRequestLicense:
properties:
display_name:
description: The display name of the license
type: string
identifier:
description: The SPDX identifier of the license
type: string
short_name:
description: The short name of the license
type: string
type: object
Links:
description: The JSON:API links related to pagination.
properties:
Expand Down Expand Up @@ -104994,6 +105039,31 @@ paths:
tags:
- Static Analysis
x-unstable: '**Note**: This endpoint may be subject to changes.'
/api/v2/static-analysis-sca/licenses/list:
get:
description: Returns a list of all available license identifiers and display
names that can be used for filtering and categorization in SCA.
operationId: GetLicenses
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/LicensesListRequest'
description: OK
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
'500':
description: Internal Server Error
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- code_analysis_read
summary: Get list of available licenses
tags:
- Static Analysis
x-unstable: '**Note**: This endpoint may be subject to changes.'
/api/v2/static-analysis-sca/vulnerabilities/resolve-vulnerable-symbols:
post:
operationId: CreateSCAResolveVulnerableSymbols
Expand Down
25 changes: 25 additions & 0 deletions examples/v2/static-analysis/GetLicenses.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Get list of available licenses returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.StaticAnalysisApi;
import com.datadog.api.client.v2.model.LicensesListRequest;

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

try {
LicensesListRequest result = apiInstance.getLicenses();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling StaticAnalysisApi#getLicenses");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ public class ApiClient {
put("v2.getCustomRule", false);
put("v2.getCustomRuleRevision", false);
put("v2.getCustomRuleset", false);
put("v2.getLicenses", false);
put("v2.listCustomRuleRevisions", false);
put("v2.revertCustomRuleRevision", false);
put("v2.updateCustomRuleset", false);
Expand Down
128 changes: 128 additions & 0 deletions src/main/java/com/datadog/api/client/v2/api/StaticAnalysisApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.datadog.api.client.v2.model.CustomRuleRevisionsResponse;
import com.datadog.api.client.v2.model.CustomRulesetRequest;
import com.datadog.api.client.v2.model.CustomRulesetResponse;
import com.datadog.api.client.v2.model.LicensesListRequest;
import com.datadog.api.client.v2.model.ResolveVulnerableSymbolsRequest;
import com.datadog.api.client.v2.model.ResolveVulnerableSymbolsResponse;
import com.datadog.api.client.v2.model.RevertCustomRuleRevisionRequest;
Expand Down Expand Up @@ -1589,6 +1590,133 @@ public CompletableFuture<ApiResponse<CustomRulesetResponse>> getCustomRulesetWit
new GenericType<CustomRulesetResponse>() {});
}

/**
* Get list of available licenses.
*
* <p>See {@link #getLicensesWithHttpInfo}.
*
* @return LicensesListRequest
* @throws ApiException if fails to make API call
*/
public LicensesListRequest getLicenses() throws ApiException {
return getLicensesWithHttpInfo().getData();
}

/**
* Get list of available licenses.
*
* <p>See {@link #getLicensesWithHttpInfoAsync}.
*
* @return CompletableFuture&lt;LicensesListRequest&gt;
*/
public CompletableFuture<LicensesListRequest> getLicensesAsync() {
return getLicensesWithHttpInfoAsync()
.thenApply(
response -> {
return response.getData();
});
}

/**
* Returns a list of all available license identifiers and display names that can be used for
* filtering and categorization in SCA.
*
* @return ApiResponse&lt;LicensesListRequest&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>
* <tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
* </table>
*/
public ApiResponse<LicensesListRequest> getLicensesWithHttpInfo() throws ApiException {
// Check if unstable operation is enabled
String operationId = "getLicenses";
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-sca/licenses/list";

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

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

/**
* Get list of available licenses.
*
* <p>See {@link #getLicensesWithHttpInfo}.
*
* @return CompletableFuture&lt;ApiResponse&lt;LicensesListRequest&gt;&gt;
*/
public CompletableFuture<ApiResponse<LicensesListRequest>> getLicensesWithHttpInfoAsync() {
// Check if unstable operation is enabled
String operationId = "getLicenses";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
CompletableFuture<ApiResponse<LicensesListRequest>> 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-sca/licenses/list";

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

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

/** Manage optional parameters to listCustomRuleRevisions. */
public static class ListCustomRuleRevisionsOptionalParameters {
private Integer pageOffset;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-Present Datadog, Inc.
*/

package com.datadog.api.client.v2.model;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/** */
@JsonPropertyOrder({LicensesListRequest.JSON_PROPERTY_DATA})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class LicensesListRequest {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_DATA = "data";
private LicensesListRequestData data;

public LicensesListRequest data(LicensesListRequestData data) {
this.data = data;
this.unparsed |= data.unparsed;
return this;
}

/**
* Getdata
*
* @return data
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_DATA)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public LicensesListRequestData getData() {
return data;
}

public void setData(LicensesListRequestData data) {
this.data = data;
}

/**
* A container for additional, undeclared properties. This is a holder for any undeclared
* properties as specified with the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> 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 LicensesListRequest
*/
@JsonAnySetter
public LicensesListRequest putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}

/**
* Return the additional (undeclared) property.
*
* @return The additional properties
*/
@JsonAnyGetter
public Map<String, Object> 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 LicensesListRequest object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LicensesListRequest licensesListRequest = (LicensesListRequest) o;
return Objects.equals(this.data, licensesListRequest.data)
&& Objects.equals(this.additionalProperties, licensesListRequest.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(data, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class LicensesListRequest {\n");
sb.append(" data: ").append(toIndentedString(data)).append("\n");
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
.append("\n");
sb.append('}');
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
Loading
Loading