@@ -1946,7 +1946,7 @@ public String createPermission(String filePermission) {
19461946 */
19471947 @ ServiceMethod (returns = ReturnType .SINGLE )
19481948 public String createPermission (ShareFilePermission filePermission ) {
1949- return createPermissionWithResponse (filePermission , Context .NONE ).getValue ();
1949+ return createPermissionWithResponse (filePermission , null , Context .NONE ).getValue ();
19501950 }
19511951
19521952 /**
@@ -1986,23 +1986,27 @@ public Response<String> createPermissionWithResponse(String filePermission, Cont
19861986 * <pre>
19871987 * ShareFilePermission permission = new ShareFilePermission().setPermission("filePermission")
19881988 * .setPermissionFormat(FilePermissionFormat.BINARY);
1989- * Response<String> response1 = shareClient.createPermissionWithResponse(permission, Context.NONE);
1989+ * Response<String> response1 = shareClient.createPermissionWithResponse(permission, null, Context.NONE);
19901990 * System.out.printf("The file permission key is %s", response1.getValue());
19911991 * </pre>
19921992 * <!-- end com.azure.storage.file.share.ShareClient.createPermissionWithResponse#ShareFilePermission-context -->
19931993 *
19941994 * @param filePermission The file permission to get/create.
1995+ * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
19951996 * @param context Additional context that is passed through the Http pipeline during the service call.
19961997 * @return A response that contains the file permission key associated with the file permission.
19971998 */
19981999 @ ServiceMethod (returns = ReturnType .SINGLE )
1999- public Response <String > createPermissionWithResponse (ShareFilePermission filePermission , Context context ) {
2000+ public Response <String > createPermissionWithResponse (ShareFilePermission filePermission , Duration timeout , Context context ) {
20002001 Context finalContext = context == null ? Context .NONE : context ;
20012002 SharePermission sharePermission = new SharePermission ().setPermission (filePermission .getPermission ())
20022003 .setFormat (filePermission .getPermissionFormat ());
2003- ResponseBase <SharesCreatePermissionHeaders , Void > response = this .azureFileStorageClient .getShares ()
2004+
2005+ Callable <ResponseBase <SharesCreatePermissionHeaders , Void >> operation = () -> this .azureFileStorageClient .getShares ()
20042006 .createPermissionWithResponse (shareName , sharePermission , null , finalContext );
20052007
2008+ ResponseBase <SharesCreatePermissionHeaders , Void > response = sendRequest (operation , timeout , ShareStorageException .class );
2009+
20062010 return new SimpleResponse <>(response , response .getDeserializedHeaders ().getXMsFilePermissionKey ());
20072011 }
20082012
@@ -2048,7 +2052,7 @@ public String getPermission(String filePermissionKey) {
20482052 */
20492053 @ ServiceMethod (returns = ReturnType .SINGLE )
20502054 public String getPermission (String filePermissionKey , FilePermissionFormat filePermissionFormat ) {
2051- return getPermissionWithResponse (filePermissionKey , filePermissionFormat , Context .NONE ).getValue ();
2055+ return getPermissionWithResponse (filePermissionKey , filePermissionFormat , null , Context .NONE ).getValue ();
20522056 }
20532057
20542058 /**
@@ -2085,7 +2089,7 @@ public Response<String> getPermissionWithResponse(String filePermissionKey, Cont
20852089 * <pre>
20862090 * FilePermissionFormat filePermissionFormat = FilePermissionFormat.BINARY;
20872091 * Response<String> response1 = shareClient.getPermissionWithResponse("filePermissionKey",
2088- * filePermissionFormat, Context.NONE);
2092+ * filePermissionFormat, null, Context.NONE);
20892093 * System.out.printf("The file permission is %s", response1.getValue());
20902094 * </pre>
20912095 * <!-- end com.azure.storage.file.share.ShareClient.getPermissionWithResponse#string-FilePermissionFormat-context -->
@@ -2095,15 +2099,21 @@ public Response<String> getPermissionWithResponse(String filePermissionKey, Cont
20952099 * the permission is returned. If filePermissionFormat is unspecified or explicitly set to SDDL, the permission will
20962100 * be returned in SSDL format. If filePermissionFormat is explicity set to binary, the permission is returned as a
20972101 * base64 string representing the binary encoding of the permission in self-relative format.
2102+ * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
20982103 * @param context Additional context that is passed through the Http pipeline during the service call.
20992104 * @return A response that contains th file permission associated with the file permission key.
21002105 */
21012106 @ ServiceMethod (returns = ReturnType .SINGLE )
2102- public Response <String > getPermissionWithResponse (String filePermissionKey , FilePermissionFormat filePermissionFormat , Context context ) {
2107+ public Response <String > getPermissionWithResponse (String filePermissionKey , FilePermissionFormat filePermissionFormat ,
2108+ Duration timeout , Context context ) {
21032109 Context finalContext = context == null ? Context .NONE : context ;
2104- ResponseBase <SharesGetPermissionHeaders , SharePermission > response = this .azureFileStorageClient .getShares ()
2110+
2111+ Callable <ResponseBase <SharesGetPermissionHeaders , SharePermission >> operation = () -> this .azureFileStorageClient .getShares ()
21052112 .getPermissionWithResponse (shareName , filePermissionKey , filePermissionFormat , null , finalContext );
21062113
2114+ ResponseBase <SharesGetPermissionHeaders , SharePermission > response = sendRequest (operation , timeout ,
2115+ ShareStorageException .class );
2116+
21072117 return new SimpleResponse <>(response , response .getValue ().getPermission ());
21082118 }
21092119
0 commit comments