1010import jakarta .ws .rs .core .GenericType ;
1111import java .util .ArrayList ;
1212import java .util .HashMap ;
13+ import java .util .List ;
1314import java .util .Map ;
1415import java .util .concurrent .CompletableFuture ;
1516
@@ -335,6 +336,25 @@ public ApiResponse<RestrictionPolicyResponse> getRestrictionPolicyWithHttpInfo(S
335336 new GenericType <RestrictionPolicyResponse >() {});
336337 }
337338
339+ /** Manage optional parameters to updateRestrictionPolicy. */
340+ public static class UpdateRestrictionPolicyOptionalParameters {
341+ private String allowSelfLockout ;
342+
343+ /**
344+ * Set allowSelfLockout.
345+ *
346+ * @param allowSelfLockout Allows admins (users with the <code>user_access_manage</code>
347+ * permission) to remove their own access from the resource if set to <code>true</code>. By
348+ * default, this is set to <code>false</code>, preventing admins from locking themselves
349+ * out. (optional)
350+ * @return UpdateRestrictionPolicyOptionalParameters
351+ */
352+ public UpdateRestrictionPolicyOptionalParameters allowSelfLockout (String allowSelfLockout ) {
353+ this .allowSelfLockout = allowSelfLockout ;
354+ return this ;
355+ }
356+ }
357+
338358 /**
339359 * Update a restriction policy.
340360 *
@@ -349,7 +369,9 @@ public ApiResponse<RestrictionPolicyResponse> getRestrictionPolicyWithHttpInfo(S
349369 */
350370 public RestrictionPolicyResponse updateRestrictionPolicy (
351371 String resourceId , RestrictionPolicyUpdateRequest body ) throws ApiException {
352- return updateRestrictionPolicyWithHttpInfo (resourceId , body ).getData ();
372+ return updateRestrictionPolicyWithHttpInfo (
373+ resourceId , body , new UpdateRestrictionPolicyOptionalParameters ())
374+ .getData ();
353375 }
354376
355377 /**
@@ -365,7 +387,52 @@ public RestrictionPolicyResponse updateRestrictionPolicy(
365387 */
366388 public CompletableFuture <RestrictionPolicyResponse > updateRestrictionPolicyAsync (
367389 String resourceId , RestrictionPolicyUpdateRequest body ) {
368- return updateRestrictionPolicyWithHttpInfoAsync (resourceId , body )
390+ return updateRestrictionPolicyWithHttpInfoAsync (
391+ resourceId , body , new UpdateRestrictionPolicyOptionalParameters ())
392+ .thenApply (
393+ response -> {
394+ return response .getData ();
395+ });
396+ }
397+
398+ /**
399+ * Update a restriction policy.
400+ *
401+ * <p>See {@link #updateRestrictionPolicyWithHttpInfo}.
402+ *
403+ * @param resourceId Identifier, formatted as <code>type:id</code>. Supported types: <code>
404+ * connection</code>, <code>dashboard</code>, <code>notebook</code>, <code>reference-table
405+ * </code>, <code>security-rule</code>, <code>slo</code>. (required)
406+ * @param body Restriction policy payload (required)
407+ * @param parameters Optional parameters for the request.
408+ * @return RestrictionPolicyResponse
409+ * @throws ApiException if fails to make API call
410+ */
411+ public RestrictionPolicyResponse updateRestrictionPolicy (
412+ String resourceId ,
413+ RestrictionPolicyUpdateRequest body ,
414+ UpdateRestrictionPolicyOptionalParameters parameters )
415+ throws ApiException {
416+ return updateRestrictionPolicyWithHttpInfo (resourceId , body , parameters ).getData ();
417+ }
418+
419+ /**
420+ * Update a restriction policy.
421+ *
422+ * <p>See {@link #updateRestrictionPolicyWithHttpInfoAsync}.
423+ *
424+ * @param resourceId Identifier, formatted as <code>type:id</code>. Supported types: <code>
425+ * connection</code>, <code>dashboard</code>, <code>notebook</code>, <code>reference-table
426+ * </code>, <code>security-rule</code>, <code>slo</code>. (required)
427+ * @param body Restriction policy payload (required)
428+ * @param parameters Optional parameters for the request.
429+ * @return CompletableFuture<RestrictionPolicyResponse>
430+ */
431+ public CompletableFuture <RestrictionPolicyResponse > updateRestrictionPolicyAsync (
432+ String resourceId ,
433+ RestrictionPolicyUpdateRequest body ,
434+ UpdateRestrictionPolicyOptionalParameters parameters ) {
435+ return updateRestrictionPolicyWithHttpInfoAsync (resourceId , body , parameters )
369436 .thenApply (
370437 response -> {
371438 return response .getData ();
@@ -399,6 +466,7 @@ public CompletableFuture<RestrictionPolicyResponse> updateRestrictionPolicyAsync
399466 * connection</code>, <code>dashboard</code>, <code>notebook</code>, <code>reference-table
400467 * </code>, <code>security-rule</code>, <code>slo</code>. (required)
401468 * @param body Restriction policy payload (required)
469+ * @param parameters Optional parameters for the request.
402470 * @return ApiResponse<RestrictionPolicyResponse>
403471 * @throws ApiException if fails to make API call
404472 * @http.response.details
@@ -412,7 +480,10 @@ public CompletableFuture<RestrictionPolicyResponse> updateRestrictionPolicyAsync
412480 * </table>
413481 */
414482 public ApiResponse <RestrictionPolicyResponse > updateRestrictionPolicyWithHttpInfo (
415- String resourceId , RestrictionPolicyUpdateRequest body ) throws ApiException {
483+ String resourceId ,
484+ RestrictionPolicyUpdateRequest body ,
485+ UpdateRestrictionPolicyOptionalParameters parameters )
486+ throws ApiException {
416487 Object localVarPostBody = body ;
417488
418489 // verify the required parameter 'resourceId' is set
@@ -426,19 +497,24 @@ public ApiResponse<RestrictionPolicyResponse> updateRestrictionPolicyWithHttpInf
426497 throw new ApiException (
427498 400 , "Missing the required parameter 'body' when calling updateRestrictionPolicy" );
428499 }
500+ String allowSelfLockout = parameters .allowSelfLockout ;
429501 // create path and map variables
430502 String localVarPath =
431503 "/api/v2/restriction_policy/{resource_id}"
432504 .replaceAll (
433505 "\\ {" + "resource_id" + "\\ }" , apiClient .escapeString (resourceId .toString ()));
434506
507+ List <Pair > localVarQueryParams = new ArrayList <Pair >();
435508 Map <String , String > localVarHeaderParams = new HashMap <String , String >();
436509
510+ localVarQueryParams .addAll (
511+ apiClient .parameterToPairs ("" , "allow_self_lockout" , allowSelfLockout ));
512+
437513 Invocation .Builder builder =
438514 apiClient .createBuilder (
439515 "v2.RestrictionPoliciesApi.updateRestrictionPolicy" ,
440516 localVarPath ,
441- new ArrayList < Pair >() ,
517+ localVarQueryParams ,
442518 localVarHeaderParams ,
443519 new HashMap <String , String >(),
444520 new String [] {"application/json" },
@@ -463,11 +539,14 @@ public ApiResponse<RestrictionPolicyResponse> updateRestrictionPolicyWithHttpInf
463539 * connection</code>, <code>dashboard</code>, <code>notebook</code>, <code>reference-table
464540 * </code>, <code>security-rule</code>, <code>slo</code>. (required)
465541 * @param body Restriction policy payload (required)
542+ * @param parameters Optional parameters for the request.
466543 * @return CompletableFuture<ApiResponse<RestrictionPolicyResponse>>
467544 */
468545 public CompletableFuture <ApiResponse <RestrictionPolicyResponse >>
469546 updateRestrictionPolicyWithHttpInfoAsync (
470- String resourceId , RestrictionPolicyUpdateRequest body ) {
547+ String resourceId ,
548+ RestrictionPolicyUpdateRequest body ,
549+ UpdateRestrictionPolicyOptionalParameters parameters ) {
471550 Object localVarPostBody = body ;
472551
473552 // verify the required parameter 'resourceId' is set
@@ -488,21 +567,26 @@ public ApiResponse<RestrictionPolicyResponse> updateRestrictionPolicyWithHttpInf
488567 400 , "Missing the required parameter 'body' when calling updateRestrictionPolicy" ));
489568 return result ;
490569 }
570+ String allowSelfLockout = parameters .allowSelfLockout ;
491571 // create path and map variables
492572 String localVarPath =
493573 "/api/v2/restriction_policy/{resource_id}"
494574 .replaceAll (
495575 "\\ {" + "resource_id" + "\\ }" , apiClient .escapeString (resourceId .toString ()));
496576
577+ List <Pair > localVarQueryParams = new ArrayList <Pair >();
497578 Map <String , String > localVarHeaderParams = new HashMap <String , String >();
498579
580+ localVarQueryParams .addAll (
581+ apiClient .parameterToPairs ("" , "allow_self_lockout" , allowSelfLockout ));
582+
499583 Invocation .Builder builder ;
500584 try {
501585 builder =
502586 apiClient .createBuilder (
503587 "v2.RestrictionPoliciesApi.updateRestrictionPolicy" ,
504588 localVarPath ,
505- new ArrayList < Pair >() ,
589+ localVarQueryParams ,
506590 localVarHeaderParams ,
507591 new HashMap <String , String >(),
508592 new String [] {"application/json" },
0 commit comments