Skip to content

Commit ecb4ff8

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit f2f1df9 of spec repo
1 parent 163298c commit ecb4ff8

16 files changed

Lines changed: 670 additions & 77 deletions

‎.generator/schemas/v2/openapi.yaml‎

Lines changed: 138 additions & 24 deletions
Large diffs are not rendered by default.

‎examples/v2/usage-metering/CreateQuotas.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import com.datadog.api.client.v2.model.UsageQuotasBulkResponse;
1212
import com.datadog.api.client.v2.model.UsageQuotasCreateRequest;
1313
import java.util.Collections;
14-
import java.util.Map;
1514

1615
public class Example {
1716
public static void main(String[] args) {
@@ -28,8 +27,8 @@ public static void main(String[] args) {
2827
.attributes(
2928
new UsageQuotaCreateAttributes()
3029
.enforced(true)
31-
.scope(Map.ofEntries(Map.entry("user_handle", "jane@example.com")))
32-
.usageLimit(100000L))
30+
.pendingUsageLimit(100000L)
31+
.usageLimit(600000L))
3332
.type(UsageQuotaType.QUOTAS)));
3433

3534
try {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Cancel a scheduled usage quota limit returns "No Content" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.UsageMeteringApi;
6+
7+
public class Example {
8+
public static void main(String[] args) {
9+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
10+
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
11+
defaultClient.setUnstableOperationEnabled("v2.deletePendingQuota", true);
12+
UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
13+
14+
try {
15+
apiInstance.deletePendingQuota(
16+
"ai_credits", "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18");
17+
} catch (ApiException e) {
18+
System.err.println("Exception when calling UsageMeteringApi#deletePendingQuota");
19+
System.err.println("Status code: " + e.getCode());
20+
System.err.println("Reason: " + e.getResponseBody());
21+
System.err.println("Response headers: " + e.getResponseHeaders());
22+
e.printStackTrace();
23+
}
24+
}
25+
}

‎examples/v2/usage-metering/DeleteQuota.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static void main(String[] args) {
1212
UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
1313

1414
try {
15-
apiInstance.deleteQuota("ai_credits", "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f");
15+
apiInstance.deleteQuota("ai_credits", "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18");
1616
} catch (ApiException e) {
1717
System.err.println("Exception when calling UsageMeteringApi#deleteQuota");
1818
System.err.println("Status code: " + e.getCode());

‎examples/v2/usage-metering/UpdateQuota.java‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ public static void main(String[] args) {
2121
.data(
2222
new UsageQuotaUpdateData()
2323
.attributes(
24-
new UsageQuotaUpdateAttributes().enforced(false).usageLimit(120000L))
25-
.id("MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f")
24+
new UsageQuotaUpdateAttributes()
25+
.enforced(false)
26+
.pendingUsageLimit(50000L)
27+
.usageLimit(120000L))
28+
.id("MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18")
2629
.type(UsageQuotaType.QUOTAS));
2730

2831
try {
2932
UsageQuotaResponse result =
3033
apiInstance.updateQuota(
31-
"ai_credits", "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f", body);
34+
"ai_credits", "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18", body);
3235
System.out.println(result);
3336
} catch (ApiException e) {
3437
System.err.println("Exception when calling UsageMeteringApi#updateQuota");

‎src/main/java/com/datadog/api/client/ApiClient.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,7 @@ public class ApiClient {
11401140
put("v2.searchCostRecommendations", false);
11411141
put("v2.updateUnitCost", false);
11421142
put("v2.createQuotas", false);
1143+
put("v2.deletePendingQuota", false);
11431144
put("v2.deleteQuota", false);
11441145
put("v2.listQuotas", false);
11451146
put("v2.updateQuota", false);

‎src/main/java/com/datadog/api/client/v2/api/UsageMeteringApi.java‎

Lines changed: 203 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,11 @@ public CompletableFuture<UsageQuotasBulkResponse> createQuotasAsync(
166166

167167
/**
168168
* Creates or updates one or more usage quotas by scope. If a quota already exists for a supplied
169-
* scope, it is updated; otherwise, a new quota is created. Requires the <code>billing_edit</code>
170-
* permission.
169+
* scope, it is updated. Otherwise, a quota is created only when <code>usage_limit</code> and
170+
* <code>enforced</code> are provided. For the organization-wide quota, <code>pending_usage_limit
171+
* </code> schedules a limit for the next usage period and can accompany an immediate limit or
172+
* update an existing quota by itself. Scheduled changes follow <code>include_descendants</code>
173+
* like the other fields. Requires the <code>billing_edit</code> permission.
171174
*
172175
* @param quotaNamespace The product-specific namespace whose usage quotas are being managed.
173176
* (required)
@@ -180,7 +183,7 @@ public CompletableFuture<UsageQuotasBulkResponse> createQuotasAsync(
180183
* <caption>Response details</caption>
181184
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
182185
* <tr><td> 200 </td><td> OK. The response includes each item&#39;s result; see each item&#39;s &#x60;error&#x60; attribute for any that failed to write. </td><td> - </td></tr>
183-
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
186+
* <tr><td> 400 </td><td> Bad Request. Returned if the request is malformed, including when an item sets &#x60;pending_usage_limit&#x60; on a scoped quota, provides &#x60;enforced&#x60; without &#x60;usage_limit&#x60;, or provides neither limit. A pending-only item for a quota that does not exist is reported in that item&#39;s &#x60;error&#x60;; when only the caller&#39;s organization is targeted, this failure returns &#x60;400&#x60;. </td><td> - </td></tr>
184187
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
185188
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
186189
* <tr><td> 500 </td><td> Internal Server Error. Every item in the batch failed to write. </td><td> - </td></tr>
@@ -329,6 +332,197 @@ public CompletableFuture<ApiResponse<UsageQuotasBulkResponse>> createQuotasWithH
329332
new GenericType<UsageQuotasBulkResponse>() {});
330333
}
331334

335+
/**
336+
* Cancel a scheduled usage quota limit.
337+
*
338+
* <p>See {@link #deletePendingQuotaWithHttpInfo}.
339+
*
340+
* @param quotaNamespace The product-specific namespace whose usage quotas are being managed.
341+
* (required)
342+
* @param id The opaque quota identifier returned by a previous list or create request. Clients
343+
* must pass this value verbatim. (required)
344+
* @throws ApiException if fails to make API call
345+
*/
346+
public void deletePendingQuota(String quotaNamespace, String id) throws ApiException {
347+
deletePendingQuotaWithHttpInfo(quotaNamespace, id);
348+
}
349+
350+
/**
351+
* Cancel a scheduled usage quota limit.
352+
*
353+
* <p>See {@link #deletePendingQuotaWithHttpInfoAsync}.
354+
*
355+
* @param quotaNamespace The product-specific namespace whose usage quotas are being managed.
356+
* (required)
357+
* @param id The opaque quota identifier returned by a previous list or create request. Clients
358+
* must pass this value verbatim. (required)
359+
* @return CompletableFuture
360+
*/
361+
public CompletableFuture<Void> deletePendingQuotaAsync(String quotaNamespace, String id) {
362+
return deletePendingQuotaWithHttpInfoAsync(quotaNamespace, id)
363+
.thenApply(
364+
response -> {
365+
return response.getData();
366+
});
367+
}
368+
369+
/**
370+
* Cancels the limit change scheduled to take effect at the start of the next usage period,
371+
* leaving the usage quota and its current limit unchanged. Returns <code>404</code> when the
372+
* quota does not exist, has no scheduled change, or its scheduled change has already taken
373+
* effect; in every case the quota is left unchanged. The quota must belong to the caller's
374+
* organization or one of its descendants, and its opaque identifier must belong to the requested
375+
* quota namespace. Requires the <code>billing_edit</code> permission.
376+
*
377+
* @param quotaNamespace The product-specific namespace whose usage quotas are being managed.
378+
* (required)
379+
* @param id The opaque quota identifier returned by a previous list or create request. Clients
380+
* must pass this value verbatim. (required)
381+
* @return ApiResponse&lt;Void&gt;
382+
* @throws ApiException if fails to make API call
383+
* @http.response.details
384+
* <table border="1">
385+
* <caption>Response details</caption>
386+
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
387+
* <tr><td> 204 </td><td> No Content </td><td> - </td></tr>
388+
* <tr><td> 400 </td><td> Bad Request. Returned if the &#x60;id&#x60; is malformed or does not belong to the requested quota namespace. </td><td> - </td></tr>
389+
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
390+
* <tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
391+
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
392+
* </table>
393+
*/
394+
public ApiResponse<Void> deletePendingQuotaWithHttpInfo(String quotaNamespace, String id)
395+
throws ApiException {
396+
// Check if unstable operation is enabled
397+
String operationId = "deletePendingQuota";
398+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
399+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
400+
} else {
401+
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
402+
}
403+
Object localVarPostBody = null;
404+
405+
// verify the required parameter 'quotaNamespace' is set
406+
if (quotaNamespace == null) {
407+
throw new ApiException(
408+
400, "Missing the required parameter 'quotaNamespace' when calling deletePendingQuota");
409+
}
410+
411+
// verify the required parameter 'id' is set
412+
if (id == null) {
413+
throw new ApiException(
414+
400, "Missing the required parameter 'id' when calling deletePendingQuota");
415+
}
416+
// create path and map variables
417+
String localVarPath =
418+
"/api/v2/usage/quotas/{quota_namespace}/{id}/pending"
419+
.replaceAll(
420+
"\\{" + "quota_namespace" + "\\}",
421+
apiClient.escapeString(quotaNamespace.toString()))
422+
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
423+
424+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
425+
426+
Invocation.Builder builder =
427+
apiClient.createBuilder(
428+
"v2.UsageMeteringApi.deletePendingQuota",
429+
localVarPath,
430+
new ArrayList<Pair>(),
431+
localVarHeaderParams,
432+
new HashMap<String, String>(),
433+
new String[] {"*/*"},
434+
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
435+
return apiClient.invokeAPI(
436+
"DELETE",
437+
builder,
438+
localVarHeaderParams,
439+
new String[] {},
440+
localVarPostBody,
441+
new HashMap<String, Object>(),
442+
false,
443+
null);
444+
}
445+
446+
/**
447+
* Cancel a scheduled usage quota limit.
448+
*
449+
* <p>See {@link #deletePendingQuotaWithHttpInfo}.
450+
*
451+
* @param quotaNamespace The product-specific namespace whose usage quotas are being managed.
452+
* (required)
453+
* @param id The opaque quota identifier returned by a previous list or create request. Clients
454+
* must pass this value verbatim. (required)
455+
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
456+
*/
457+
public CompletableFuture<ApiResponse<Void>> deletePendingQuotaWithHttpInfoAsync(
458+
String quotaNamespace, String id) {
459+
// Check if unstable operation is enabled
460+
String operationId = "deletePendingQuota";
461+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
462+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
463+
} else {
464+
CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>();
465+
result.completeExceptionally(
466+
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
467+
return result;
468+
}
469+
Object localVarPostBody = null;
470+
471+
// verify the required parameter 'quotaNamespace' is set
472+
if (quotaNamespace == null) {
473+
CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>();
474+
result.completeExceptionally(
475+
new ApiException(
476+
400,
477+
"Missing the required parameter 'quotaNamespace' when calling deletePendingQuota"));
478+
return result;
479+
}
480+
481+
// verify the required parameter 'id' is set
482+
if (id == null) {
483+
CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>();
484+
result.completeExceptionally(
485+
new ApiException(
486+
400, "Missing the required parameter 'id' when calling deletePendingQuota"));
487+
return result;
488+
}
489+
// create path and map variables
490+
String localVarPath =
491+
"/api/v2/usage/quotas/{quota_namespace}/{id}/pending"
492+
.replaceAll(
493+
"\\{" + "quota_namespace" + "\\}",
494+
apiClient.escapeString(quotaNamespace.toString()))
495+
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
496+
497+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
498+
499+
Invocation.Builder builder;
500+
try {
501+
builder =
502+
apiClient.createBuilder(
503+
"v2.UsageMeteringApi.deletePendingQuota",
504+
localVarPath,
505+
new ArrayList<Pair>(),
506+
localVarHeaderParams,
507+
new HashMap<String, String>(),
508+
new String[] {"*/*"},
509+
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
510+
} catch (ApiException ex) {
511+
CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>();
512+
result.completeExceptionally(ex);
513+
return result;
514+
}
515+
return apiClient.invokeAPIAsync(
516+
"DELETE",
517+
builder,
518+
localVarHeaderParams,
519+
new String[] {},
520+
localVarPostBody,
521+
new HashMap<String, Object>(),
522+
false,
523+
null);
524+
}
525+
332526
/**
333527
* Delete a usage quota.
334528
*
@@ -3980,10 +4174,11 @@ public CompletableFuture<UsageQuotaResponse> updateQuotaAsync(
39804174
}
39814175

39824176
/**
3983-
* Updates the supplied fields on a usage quota and leaves omitted fields unchanged. The quota
3984-
* must belong to the caller's organization or one of its descendants, and its opaque identifier
3985-
* must belong to the requested quota namespace. Requires the <code>billing_edit</code>
3986-
* permission.
4177+
* Updates the supplied fields on a usage quota and leaves omitted fields unchanged. For an
4178+
* organization-wide quota, <code>pending_usage_limit</code> schedules a limit for the next usage
4179+
* period. The quota must belong to the caller's organization or one of its descendants, and its
4180+
* opaque identifier must belong to the requested quota namespace. Requires the <code>billing_edit
4181+
* </code> permission.
39874182
*
39884183
* @param quotaNamespace The product-specific namespace whose usage quotas are being managed.
39894184
* (required)
@@ -3998,7 +4193,7 @@ public CompletableFuture<UsageQuotaResponse> updateQuotaAsync(
39984193
* <caption>Response details</caption>
39994194
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
40004195
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
4001-
* <tr><td> 400 </td><td> Bad Request. Returned if the request is malformed, or if the &#x60;id&#x60; in the request body does not match the &#x60;id&#x60; in the request path. </td><td> - </td></tr>
4196+
* <tr><td> 400 </td><td> Bad Request. Returned if the request is malformed, if the &#x60;id&#x60; in the request body does not match the &#x60;id&#x60; in the request path, if none of &#x60;usage_limit&#x60;, &#x60;enforced&#x60;, or &#x60;pending_usage_limit&#x60; is provided, or if &#x60;pending_usage_limit&#x60; is set on a scoped quota. </td><td> - </td></tr>
40024197
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
40034198
* <tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
40044199
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>

0 commit comments

Comments
 (0)