|
7 | 7 | import com.datadog.api.client.v2.model.CreateDeploymentGateParams; |
8 | 8 | import com.datadog.api.client.v2.model.CreateDeploymentRuleParams; |
9 | 9 | import com.datadog.api.client.v2.model.DeploymentGateResponse; |
| 10 | +import com.datadog.api.client.v2.model.DeploymentGateRulesResponse; |
10 | 11 | import com.datadog.api.client.v2.model.DeploymentRuleResponse; |
11 | 12 | import com.datadog.api.client.v2.model.UpdateDeploymentGateParams; |
12 | 13 | import com.datadog.api.client.v2.model.UpdateDeploymentRuleParams; |
@@ -857,6 +858,163 @@ public CompletableFuture<ApiResponse<DeploymentGateResponse>> getDeploymentGateW |
857 | 858 | new GenericType<DeploymentGateResponse>() {}); |
858 | 859 | } |
859 | 860 |
|
| 861 | + /** |
| 862 | + * Get rules for a deployment gate. |
| 863 | + * |
| 864 | + * <p>See {@link #getDeploymentGateRulesWithHttpInfo}. |
| 865 | + * |
| 866 | + * @param gateId The ID of the deployment gate. (required) |
| 867 | + * @return DeploymentGateRulesResponse |
| 868 | + * @throws ApiException if fails to make API call |
| 869 | + */ |
| 870 | + public DeploymentGateRulesResponse getDeploymentGateRules(String gateId) throws ApiException { |
| 871 | + return getDeploymentGateRulesWithHttpInfo(gateId).getData(); |
| 872 | + } |
| 873 | + |
| 874 | + /** |
| 875 | + * Get rules for a deployment gate. |
| 876 | + * |
| 877 | + * <p>See {@link #getDeploymentGateRulesWithHttpInfoAsync}. |
| 878 | + * |
| 879 | + * @param gateId The ID of the deployment gate. (required) |
| 880 | + * @return CompletableFuture<DeploymentGateRulesResponse> |
| 881 | + */ |
| 882 | + public CompletableFuture<DeploymentGateRulesResponse> getDeploymentGateRulesAsync(String gateId) { |
| 883 | + return getDeploymentGateRulesWithHttpInfoAsync(gateId) |
| 884 | + .thenApply( |
| 885 | + response -> { |
| 886 | + return response.getData(); |
| 887 | + }); |
| 888 | + } |
| 889 | + |
| 890 | + /** |
| 891 | + * Endpoint to get rules for a deployment gate. |
| 892 | + * |
| 893 | + * @param gateId The ID of the deployment gate. (required) |
| 894 | + * @return ApiResponse<DeploymentGateRulesResponse> |
| 895 | + * @throws ApiException if fails to make API call |
| 896 | + * @http.response.details |
| 897 | + * <table border="1"> |
| 898 | + * <caption>Response details</caption> |
| 899 | + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> |
| 900 | + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> |
| 901 | + * <tr><td> 400 </td><td> Bad request. </td><td> - </td></tr> |
| 902 | + * <tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr> |
| 903 | + * <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr> |
| 904 | + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> |
| 905 | + * <tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr> |
| 906 | + * </table> |
| 907 | + */ |
| 908 | + public ApiResponse<DeploymentGateRulesResponse> getDeploymentGateRulesWithHttpInfo(String gateId) |
| 909 | + throws ApiException { |
| 910 | + // Check if unstable operation is enabled |
| 911 | + String operationId = "getDeploymentGateRules"; |
| 912 | + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { |
| 913 | + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); |
| 914 | + } else { |
| 915 | + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); |
| 916 | + } |
| 917 | + Object localVarPostBody = null; |
| 918 | + |
| 919 | + // verify the required parameter 'gateId' is set |
| 920 | + if (gateId == null) { |
| 921 | + throw new ApiException( |
| 922 | + 400, "Missing the required parameter 'gateId' when calling getDeploymentGateRules"); |
| 923 | + } |
| 924 | + // create path and map variables |
| 925 | + String localVarPath = |
| 926 | + "/api/v2/deployment_gates/{gate_id}/rules" |
| 927 | + .replaceAll("\\{" + "gate_id" + "\\}", apiClient.escapeString(gateId.toString())); |
| 928 | + |
| 929 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 930 | + |
| 931 | + Invocation.Builder builder = |
| 932 | + apiClient.createBuilder( |
| 933 | + "v2.DeploymentGatesApi.getDeploymentGateRules", |
| 934 | + localVarPath, |
| 935 | + new ArrayList<Pair>(), |
| 936 | + localVarHeaderParams, |
| 937 | + new HashMap<String, String>(), |
| 938 | + new String[] {"application/json"}, |
| 939 | + new String[] {"apiKeyAuth", "appKeyAuth"}); |
| 940 | + return apiClient.invokeAPI( |
| 941 | + "GET", |
| 942 | + builder, |
| 943 | + localVarHeaderParams, |
| 944 | + new String[] {}, |
| 945 | + localVarPostBody, |
| 946 | + new HashMap<String, Object>(), |
| 947 | + false, |
| 948 | + new GenericType<DeploymentGateRulesResponse>() {}); |
| 949 | + } |
| 950 | + |
| 951 | + /** |
| 952 | + * Get rules for a deployment gate. |
| 953 | + * |
| 954 | + * <p>See {@link #getDeploymentGateRulesWithHttpInfo}. |
| 955 | + * |
| 956 | + * @param gateId The ID of the deployment gate. (required) |
| 957 | + * @return CompletableFuture<ApiResponse<DeploymentGateRulesResponse>> |
| 958 | + */ |
| 959 | + public CompletableFuture<ApiResponse<DeploymentGateRulesResponse>> |
| 960 | + getDeploymentGateRulesWithHttpInfoAsync(String gateId) { |
| 961 | + // Check if unstable operation is enabled |
| 962 | + String operationId = "getDeploymentGateRules"; |
| 963 | + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { |
| 964 | + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); |
| 965 | + } else { |
| 966 | + CompletableFuture<ApiResponse<DeploymentGateRulesResponse>> result = |
| 967 | + new CompletableFuture<>(); |
| 968 | + result.completeExceptionally( |
| 969 | + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); |
| 970 | + return result; |
| 971 | + } |
| 972 | + Object localVarPostBody = null; |
| 973 | + |
| 974 | + // verify the required parameter 'gateId' is set |
| 975 | + if (gateId == null) { |
| 976 | + CompletableFuture<ApiResponse<DeploymentGateRulesResponse>> result = |
| 977 | + new CompletableFuture<>(); |
| 978 | + result.completeExceptionally( |
| 979 | + new ApiException( |
| 980 | + 400, "Missing the required parameter 'gateId' when calling getDeploymentGateRules")); |
| 981 | + return result; |
| 982 | + } |
| 983 | + // create path and map variables |
| 984 | + String localVarPath = |
| 985 | + "/api/v2/deployment_gates/{gate_id}/rules" |
| 986 | + .replaceAll("\\{" + "gate_id" + "\\}", apiClient.escapeString(gateId.toString())); |
| 987 | + |
| 988 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 989 | + |
| 990 | + Invocation.Builder builder; |
| 991 | + try { |
| 992 | + builder = |
| 993 | + apiClient.createBuilder( |
| 994 | + "v2.DeploymentGatesApi.getDeploymentGateRules", |
| 995 | + localVarPath, |
| 996 | + new ArrayList<Pair>(), |
| 997 | + localVarHeaderParams, |
| 998 | + new HashMap<String, String>(), |
| 999 | + new String[] {"application/json"}, |
| 1000 | + new String[] {"apiKeyAuth", "appKeyAuth"}); |
| 1001 | + } catch (ApiException ex) { |
| 1002 | + CompletableFuture<ApiResponse<DeploymentGateRulesResponse>> result = |
| 1003 | + new CompletableFuture<>(); |
| 1004 | + result.completeExceptionally(ex); |
| 1005 | + return result; |
| 1006 | + } |
| 1007 | + return apiClient.invokeAPIAsync( |
| 1008 | + "GET", |
| 1009 | + builder, |
| 1010 | + localVarHeaderParams, |
| 1011 | + new String[] {}, |
| 1012 | + localVarPostBody, |
| 1013 | + new HashMap<String, Object>(), |
| 1014 | + false, |
| 1015 | + new GenericType<DeploymentGateRulesResponse>() {}); |
| 1016 | + } |
| 1017 | + |
860 | 1018 | /** |
861 | 1019 | * Get deployment rule. |
862 | 1020 | * |
|
0 commit comments