Skip to content
Merged
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
379 changes: 379 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions examples/v2/product-catalog/ListProductCatalogSKUs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// List SKUs returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ProductCatalogApi;
import com.datadog.api.client.v2.model.ProductCatalogSKUsAPIVersion;
import com.datadog.api.client.v2.model.ProductCatalogSKUsResponse;

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

try {
ProductCatalogSKUsResponse result =
apiInstance.listProductCatalogSKUs(ProductCatalogSKUsAPIVersion.V1);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ProductCatalogApi#listProductCatalogSKUs");
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 @@ -1344,6 +1344,7 @@ public class ApiClient {
put("v2.queryEventFilteredUsers", false);
put("v2.queryUsers", false);
put("v2.updateConnection", false);
put("v2.listProductCatalogSKUs", false);
put("v2.getPrunedTraceByID", false);
put("v2.getTraceByID", false);
put("v2.getAsmServiceByName", false);
Expand Down
286 changes: 286 additions & 0 deletions src/main/java/com/datadog/api/client/v2/api/ProductCatalogApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
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.ProductCatalogSKUsAPIVersion;
import com.datadog.api.client.v2.model.ProductCatalogSKUsResponse;
import jakarta.ws.rs.client.Invocation;
import jakarta.ws.rs.core.GenericType;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
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 ProductCatalogApi {
private ApiClient apiClient;

public ProductCatalogApi() {
this(ApiClient.getDefaultApiClient());
}

public ProductCatalogApi(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;
}

/** Manage optional parameters to listProductCatalogSKUs. */
public static class ListProductCatalogSKUsOptionalParameters {
private OffsetDateTime asOfDate;

/**
* Set asOfDate.
*
* @param asOfDate The date the returned prices, allotments, and pricing tiers are effective as
* of, in <code>YYYY-MM-DD</code> format. Defaults to the date of the request, and must not
* be later than it. (optional)
* @return ListProductCatalogSKUsOptionalParameters
*/
public ListProductCatalogSKUsOptionalParameters asOfDate(OffsetDateTime asOfDate) {
this.asOfDate = asOfDate;
return this;
}
}

/**
* List SKUs.
*
* <p>See {@link #listProductCatalogSKUsWithHttpInfo}.
*
* @param version The version of the product catalog contract to return. <code>v1</code> is the
* latest. (required)
* @return ProductCatalogSKUsResponse
* @throws ApiException if fails to make API call
*/
public ProductCatalogSKUsResponse listProductCatalogSKUs(ProductCatalogSKUsAPIVersion version)
throws ApiException {
return listProductCatalogSKUsWithHttpInfo(
version, new ListProductCatalogSKUsOptionalParameters())
.getData();
}

/**
* List SKUs.
*
* <p>See {@link #listProductCatalogSKUsWithHttpInfoAsync}.
*
* @param version The version of the product catalog contract to return. <code>v1</code> is the
* latest. (required)
* @return CompletableFuture&lt;ProductCatalogSKUsResponse&gt;
*/
public CompletableFuture<ProductCatalogSKUsResponse> listProductCatalogSKUsAsync(
ProductCatalogSKUsAPIVersion version) {
return listProductCatalogSKUsWithHttpInfoAsync(
version, new ListProductCatalogSKUsOptionalParameters())
.thenApply(
response -> {
return response.getData();
});
}

/**
* List SKUs.
*
* <p>See {@link #listProductCatalogSKUsWithHttpInfo}.
*
* @param version The version of the product catalog contract to return. <code>v1</code> is the
* latest. (required)
* @param parameters Optional parameters for the request.
* @return ProductCatalogSKUsResponse
* @throws ApiException if fails to make API call
*/
public ProductCatalogSKUsResponse listProductCatalogSKUs(
ProductCatalogSKUsAPIVersion version, ListProductCatalogSKUsOptionalParameters parameters)
throws ApiException {
return listProductCatalogSKUsWithHttpInfo(version, parameters).getData();
}

/**
* List SKUs.
*
* <p>See {@link #listProductCatalogSKUsWithHttpInfoAsync}.
*
* @param version The version of the product catalog contract to return. <code>v1</code> is the
* latest. (required)
* @param parameters Optional parameters for the request.
* @return CompletableFuture&lt;ProductCatalogSKUsResponse&gt;
*/
public CompletableFuture<ProductCatalogSKUsResponse> listProductCatalogSKUsAsync(
ProductCatalogSKUsAPIVersion version, ListProductCatalogSKUsOptionalParameters parameters) {
return listProductCatalogSKUsWithHttpInfoAsync(version, parameters)
.thenApply(
response -> {
return response.getData();
});
}

/**
* Get every generally available Datadog SKU, with the pricing and allotment metadata that applies
* to it, for the Datadog site serving the request. A SKU is generally available when it is billed
* through a metered commitment or through automatic billing; SKUs in any other phase are not
* returned.
*
* <p>Prices, allotments, and pricing tiers are returned as they were in effect on <code>
* as_of_date</code>, which defaults to the date of the request. Prices are public list prices:
* they do not reflect discounts, commitments, or negotiated rates on an account.
*
* <p>Each SKU is a separate resource in <code>data</code>, identified by its SKU code, and sorted
* by that code in ascending order. The whole catalog is returned in a single response, so this
* endpoint is not paginated.
*
* @param version The version of the product catalog contract to return. <code>v1</code> is the
* latest. (required)
* @param parameters Optional parameters for the request.
* @return ApiResponse&lt;ProductCatalogSKUsResponse&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> 400 </td><td> Bad Request - version is missing or invalid, or as_of_date is malformed or in the future </td><td> - </td></tr>
* <tr><td> 403 </td><td> Forbidden - the caller has neither the billing_read nor the usage_read permission </td><td> - </td></tr>
* <tr><td> 404 </td><td> Not Found - the requested catalog version is not supported </td><td> - </td></tr>
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
* </table>
*/
public ApiResponse<ProductCatalogSKUsResponse> listProductCatalogSKUsWithHttpInfo(
ProductCatalogSKUsAPIVersion version, ListProductCatalogSKUsOptionalParameters parameters)
throws ApiException {
// Check if unstable operation is enabled
String operationId = "listProductCatalogSKUs";
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 'version' is set
if (version == null) {
throw new ApiException(
400, "Missing the required parameter 'version' when calling listProductCatalogSKUs");
}
OffsetDateTime asOfDate = parameters.asOfDate;
// create path and map variables
String localVarPath = "/api/v2/product-catalog/skus";

List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();

localVarQueryParams.addAll(apiClient.parameterToPairs("", "version", version));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "as_of_date", asOfDate));

Invocation.Builder builder =
apiClient.createBuilder(
"v2.ProductCatalogApi.listProductCatalogSKUs",
localVarPath,
localVarQueryParams,
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<ProductCatalogSKUsResponse>() {});
}

/**
* List SKUs.
*
* <p>See {@link #listProductCatalogSKUsWithHttpInfo}.
*
* @param version The version of the product catalog contract to return. <code>v1</code> is the
* latest. (required)
* @param parameters Optional parameters for the request.
* @return CompletableFuture&lt;ApiResponse&lt;ProductCatalogSKUsResponse&gt;&gt;
*/
public CompletableFuture<ApiResponse<ProductCatalogSKUsResponse>>
listProductCatalogSKUsWithHttpInfoAsync(
ProductCatalogSKUsAPIVersion version,
ListProductCatalogSKUsOptionalParameters parameters) {
// Check if unstable operation is enabled
String operationId = "listProductCatalogSKUs";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
CompletableFuture<ApiResponse<ProductCatalogSKUsResponse>> 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 'version' is set
if (version == null) {
CompletableFuture<ApiResponse<ProductCatalogSKUsResponse>> result = new CompletableFuture<>();
result.completeExceptionally(
new ApiException(
400, "Missing the required parameter 'version' when calling listProductCatalogSKUs"));
return result;
}
OffsetDateTime asOfDate = parameters.asOfDate;
// create path and map variables
String localVarPath = "/api/v2/product-catalog/skus";

List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();

localVarQueryParams.addAll(apiClient.parameterToPairs("", "version", version));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "as_of_date", asOfDate));

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