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,24 @@ 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 user_access_manage permission) to
347+ * remove their own access from the resource if set to <code>true</code>. By default, this
348+ * is set to <code>false</code>, preventing admins from locking themselves out. (optional)
349+ * @return UpdateRestrictionPolicyOptionalParameters
350+ */
351+ public UpdateRestrictionPolicyOptionalParameters allowSelfLockout (String allowSelfLockout ) {
352+ this .allowSelfLockout = allowSelfLockout ;
353+ return this ;
354+ }
355+ }
356+
338357 /**
339358 * Update a restriction policy.
340359 *
@@ -349,7 +368,9 @@ public ApiResponse<RestrictionPolicyResponse> getRestrictionPolicyWithHttpInfo(S
349368 */
350369 public RestrictionPolicyResponse updateRestrictionPolicy (
351370 String resourceId , RestrictionPolicyUpdateRequest body ) throws ApiException {
352- return updateRestrictionPolicyWithHttpInfo (resourceId , body ).getData ();
371+ return updateRestrictionPolicyWithHttpInfo (
372+ resourceId , body , new UpdateRestrictionPolicyOptionalParameters ())
373+ .getData ();
353374 }
354375
355376 /**
@@ -365,7 +386,52 @@ public RestrictionPolicyResponse updateRestrictionPolicy(
365386 */
366387 public CompletableFuture <RestrictionPolicyResponse > updateRestrictionPolicyAsync (
367388 String resourceId , RestrictionPolicyUpdateRequest body ) {
368- return updateRestrictionPolicyWithHttpInfoAsync (resourceId , body )
389+ return updateRestrictionPolicyWithHttpInfoAsync (
390+ resourceId , body , new UpdateRestrictionPolicyOptionalParameters ())
391+ .thenApply (
392+ response -> {
393+ return response .getData ();
394+ });
395+ }
396+
397+ /**
398+ * Update a restriction policy.
399+ *
400+ * <p>See {@link #updateRestrictionPolicyWithHttpInfo}.
401+ *
402+ * @param resourceId Identifier, formatted as <code>type:id</code>. Supported types: <code>
403+ * connection</code>, <code>dashboard</code>, <code>notebook</code>, <code>reference-table
404+ * </code>, <code>security-rule</code>, <code>slo</code>. (required)
405+ * @param body Restriction policy payload (required)
406+ * @param parameters Optional parameters for the request.
407+ * @return RestrictionPolicyResponse
408+ * @throws ApiException if fails to make API call
409+ */
410+ public RestrictionPolicyResponse updateRestrictionPolicy (
411+ String resourceId ,
412+ RestrictionPolicyUpdateRequest body ,
413+ UpdateRestrictionPolicyOptionalParameters parameters )
414+ throws ApiException {
415+ return updateRestrictionPolicyWithHttpInfo (resourceId , body , parameters ).getData ();
416+ }
417+
418+ /**
419+ * Update a restriction policy.
420+ *
421+ * <p>See {@link #updateRestrictionPolicyWithHttpInfoAsync}.
422+ *
423+ * @param resourceId Identifier, formatted as <code>type:id</code>. Supported types: <code>
424+ * connection</code>, <code>dashboard</code>, <code>notebook</code>, <code>reference-table
425+ * </code>, <code>security-rule</code>, <code>slo</code>. (required)
426+ * @param body Restriction policy payload (required)
427+ * @param parameters Optional parameters for the request.
428+ * @return CompletableFuture<RestrictionPolicyResponse>
429+ */
430+ public CompletableFuture <RestrictionPolicyResponse > updateRestrictionPolicyAsync (
431+ String resourceId ,
432+ RestrictionPolicyUpdateRequest body ,
433+ UpdateRestrictionPolicyOptionalParameters parameters ) {
434+ return updateRestrictionPolicyWithHttpInfoAsync (resourceId , body , parameters )
369435 .thenApply (
370436 response -> {
371437 return response .getData ();
@@ -399,6 +465,7 @@ public CompletableFuture<RestrictionPolicyResponse> updateRestrictionPolicyAsync
399465 * connection</code>, <code>dashboard</code>, <code>notebook</code>, <code>reference-table
400466 * </code>, <code>security-rule</code>, <code>slo</code>. (required)
401467 * @param body Restriction policy payload (required)
468+ * @param parameters Optional parameters for the request.
402469 * @return ApiResponse<RestrictionPolicyResponse>
403470 * @throws ApiException if fails to make API call
404471 * @http.response.details
@@ -412,7 +479,10 @@ public CompletableFuture<RestrictionPolicyResponse> updateRestrictionPolicyAsync
412479 * </table>
413480 */
414481 public ApiResponse <RestrictionPolicyResponse > updateRestrictionPolicyWithHttpInfo (
415- String resourceId , RestrictionPolicyUpdateRequest body ) throws ApiException {
482+ String resourceId ,
483+ RestrictionPolicyUpdateRequest body ,
484+ UpdateRestrictionPolicyOptionalParameters parameters )
485+ throws ApiException {
416486 Object localVarPostBody = body ;
417487
418488 // verify the required parameter 'resourceId' is set
@@ -426,19 +496,24 @@ public ApiResponse<RestrictionPolicyResponse> updateRestrictionPolicyWithHttpInf
426496 throw new ApiException (
427497 400 , "Missing the required parameter 'body' when calling updateRestrictionPolicy" );
428498 }
499+ String allowSelfLockout = parameters .allowSelfLockout ;
429500 // create path and map variables
430501 String localVarPath =
431502 "/api/v2/restriction_policy/{resource_id}"
432503 .replaceAll (
433504 "\\ {" + "resource_id" + "\\ }" , apiClient .escapeString (resourceId .toString ()));
434505
506+ List <Pair > localVarQueryParams = new ArrayList <Pair >();
435507 Map <String , String > localVarHeaderParams = new HashMap <String , String >();
436508
509+ localVarQueryParams .addAll (
510+ apiClient .parameterToPairs ("" , "allow_self_lockout" , allowSelfLockout ));
511+
437512 Invocation .Builder builder =
438513 apiClient .createBuilder (
439514 "v2.RestrictionPoliciesApi.updateRestrictionPolicy" ,
440515 localVarPath ,
441- new ArrayList < Pair >() ,
516+ localVarQueryParams ,
442517 localVarHeaderParams ,
443518 new HashMap <String , String >(),
444519 new String [] {"application/json" },
@@ -463,11 +538,14 @@ public ApiResponse<RestrictionPolicyResponse> updateRestrictionPolicyWithHttpInf
463538 * connection</code>, <code>dashboard</code>, <code>notebook</code>, <code>reference-table
464539 * </code>, <code>security-rule</code>, <code>slo</code>. (required)
465540 * @param body Restriction policy payload (required)
541+ * @param parameters Optional parameters for the request.
466542 * @return CompletableFuture<ApiResponse<RestrictionPolicyResponse>>
467543 */
468544 public CompletableFuture <ApiResponse <RestrictionPolicyResponse >>
469545 updateRestrictionPolicyWithHttpInfoAsync (
470- String resourceId , RestrictionPolicyUpdateRequest body ) {
546+ String resourceId ,
547+ RestrictionPolicyUpdateRequest body ,
548+ UpdateRestrictionPolicyOptionalParameters parameters ) {
471549 Object localVarPostBody = body ;
472550
473551 // verify the required parameter 'resourceId' is set
@@ -488,21 +566,26 @@ public ApiResponse<RestrictionPolicyResponse> updateRestrictionPolicyWithHttpInf
488566 400 , "Missing the required parameter 'body' when calling updateRestrictionPolicy" ));
489567 return result ;
490568 }
569+ String allowSelfLockout = parameters .allowSelfLockout ;
491570 // create path and map variables
492571 String localVarPath =
493572 "/api/v2/restriction_policy/{resource_id}"
494573 .replaceAll (
495574 "\\ {" + "resource_id" + "\\ }" , apiClient .escapeString (resourceId .toString ()));
496575
576+ List <Pair > localVarQueryParams = new ArrayList <Pair >();
497577 Map <String , String > localVarHeaderParams = new HashMap <String , String >();
498578
579+ localVarQueryParams .addAll (
580+ apiClient .parameterToPairs ("" , "allow_self_lockout" , allowSelfLockout ));
581+
499582 Invocation .Builder builder ;
500583 try {
501584 builder =
502585 apiClient .createBuilder (
503586 "v2.RestrictionPoliciesApi.updateRestrictionPolicy" ,
504587 localVarPath ,
505- new ArrayList < Pair >() ,
588+ localVarQueryParams ,
506589 localVarHeaderParams ,
507590 new HashMap <String , String >(),
508591 new String [] {"application/json" },
0 commit comments