|
11 | 11 | import com.datadog.api.client.v2.model.RoleCreateRequest;
|
12 | 12 | import com.datadog.api.client.v2.model.RoleCreateResponse;
|
13 | 13 | import com.datadog.api.client.v2.model.RoleResponse;
|
| 14 | +import com.datadog.api.client.v2.model.RoleTemplateArray; |
14 | 15 | import com.datadog.api.client.v2.model.RoleUpdateRequest;
|
15 | 16 | import com.datadog.api.client.v2.model.RoleUpdateResponse;
|
16 | 17 | import com.datadog.api.client.v2.model.RolesResponse;
|
@@ -1389,6 +1390,131 @@ public CompletableFuture<ApiResponse<RolesResponse>> listRolesWithHttpInfoAsync(
|
1389 | 1390 | new GenericType<RolesResponse>() {});
|
1390 | 1391 | }
|
1391 | 1392 |
|
| 1393 | + /** |
| 1394 | + * List role templates. |
| 1395 | + * |
| 1396 | + * <p>See {@link #listRoleTemplatesWithHttpInfo}. |
| 1397 | + * |
| 1398 | + * @return RoleTemplateArray |
| 1399 | + * @throws ApiException if fails to make API call |
| 1400 | + */ |
| 1401 | + public RoleTemplateArray listRoleTemplates() throws ApiException { |
| 1402 | + return listRoleTemplatesWithHttpInfo().getData(); |
| 1403 | + } |
| 1404 | + |
| 1405 | + /** |
| 1406 | + * List role templates. |
| 1407 | + * |
| 1408 | + * <p>See {@link #listRoleTemplatesWithHttpInfoAsync}. |
| 1409 | + * |
| 1410 | + * @return CompletableFuture<RoleTemplateArray> |
| 1411 | + */ |
| 1412 | + public CompletableFuture<RoleTemplateArray> listRoleTemplatesAsync() { |
| 1413 | + return listRoleTemplatesWithHttpInfoAsync() |
| 1414 | + .thenApply( |
| 1415 | + response -> { |
| 1416 | + return response.getData(); |
| 1417 | + }); |
| 1418 | + } |
| 1419 | + |
| 1420 | + /** |
| 1421 | + * List all role templates |
| 1422 | + * |
| 1423 | + * @return ApiResponse<RoleTemplateArray> |
| 1424 | + * @throws ApiException if fails to make API call |
| 1425 | + * @http.response.details |
| 1426 | + * <table border="1"> |
| 1427 | + * <caption>Response details</caption> |
| 1428 | + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> |
| 1429 | + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> |
| 1430 | + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> |
| 1431 | + * </table> |
| 1432 | + */ |
| 1433 | + public ApiResponse<RoleTemplateArray> listRoleTemplatesWithHttpInfo() throws ApiException { |
| 1434 | + // Check if unstable operation is enabled |
| 1435 | + String operationId = "listRoleTemplates"; |
| 1436 | + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { |
| 1437 | + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); |
| 1438 | + } else { |
| 1439 | + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); |
| 1440 | + } |
| 1441 | + Object localVarPostBody = null; |
| 1442 | + // create path and map variables |
| 1443 | + String localVarPath = "/api/v2/roles/templates"; |
| 1444 | + |
| 1445 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 1446 | + |
| 1447 | + Invocation.Builder builder = |
| 1448 | + apiClient.createBuilder( |
| 1449 | + "v2.RolesApi.listRoleTemplates", |
| 1450 | + localVarPath, |
| 1451 | + new ArrayList<Pair>(), |
| 1452 | + localVarHeaderParams, |
| 1453 | + new HashMap<String, String>(), |
| 1454 | + new String[] {"application/json"}, |
| 1455 | + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); |
| 1456 | + return apiClient.invokeAPI( |
| 1457 | + "GET", |
| 1458 | + builder, |
| 1459 | + localVarHeaderParams, |
| 1460 | + new String[] {}, |
| 1461 | + localVarPostBody, |
| 1462 | + new HashMap<String, Object>(), |
| 1463 | + false, |
| 1464 | + new GenericType<RoleTemplateArray>() {}); |
| 1465 | + } |
| 1466 | + |
| 1467 | + /** |
| 1468 | + * List role templates. |
| 1469 | + * |
| 1470 | + * <p>See {@link #listRoleTemplatesWithHttpInfo}. |
| 1471 | + * |
| 1472 | + * @return CompletableFuture<ApiResponse<RoleTemplateArray>> |
| 1473 | + */ |
| 1474 | + public CompletableFuture<ApiResponse<RoleTemplateArray>> listRoleTemplatesWithHttpInfoAsync() { |
| 1475 | + // Check if unstable operation is enabled |
| 1476 | + String operationId = "listRoleTemplates"; |
| 1477 | + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { |
| 1478 | + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); |
| 1479 | + } else { |
| 1480 | + CompletableFuture<ApiResponse<RoleTemplateArray>> result = new CompletableFuture<>(); |
| 1481 | + result.completeExceptionally( |
| 1482 | + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); |
| 1483 | + return result; |
| 1484 | + } |
| 1485 | + Object localVarPostBody = null; |
| 1486 | + // create path and map variables |
| 1487 | + String localVarPath = "/api/v2/roles/templates"; |
| 1488 | + |
| 1489 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 1490 | + |
| 1491 | + Invocation.Builder builder; |
| 1492 | + try { |
| 1493 | + builder = |
| 1494 | + apiClient.createBuilder( |
| 1495 | + "v2.RolesApi.listRoleTemplates", |
| 1496 | + localVarPath, |
| 1497 | + new ArrayList<Pair>(), |
| 1498 | + localVarHeaderParams, |
| 1499 | + new HashMap<String, String>(), |
| 1500 | + new String[] {"application/json"}, |
| 1501 | + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); |
| 1502 | + } catch (ApiException ex) { |
| 1503 | + CompletableFuture<ApiResponse<RoleTemplateArray>> result = new CompletableFuture<>(); |
| 1504 | + result.completeExceptionally(ex); |
| 1505 | + return result; |
| 1506 | + } |
| 1507 | + return apiClient.invokeAPIAsync( |
| 1508 | + "GET", |
| 1509 | + builder, |
| 1510 | + localVarHeaderParams, |
| 1511 | + new String[] {}, |
| 1512 | + localVarPostBody, |
| 1513 | + new HashMap<String, Object>(), |
| 1514 | + false, |
| 1515 | + new GenericType<RoleTemplateArray>() {}); |
| 1516 | + } |
| 1517 | + |
1392 | 1518 | /** Manage optional parameters to listRoleUsers. */
|
1393 | 1519 | public static class ListRoleUsersOptionalParameters {
|
1394 | 1520 | private Long pageSize;
|
|
0 commit comments