uploadRangeFromUrlWithResponse(long length, long destinationOffset,
long sourceOffset, String sourceUrl, ShareRequestConditions requestConditions, Duration timeout,
Context context) {
+ return this.uploadRangeFromUrlWithResponse(new ShareFileUploadRangeFromUrlOptions(length, sourceUrl)
+ .setDestinationOffset(destinationOffset).setSourceOffset(sourceOffset)
+ .setDestinationRequestConditions(requestConditions), timeout, context);
+ }
+
+ /**
+ * Uploads a range of bytes from one file to another file.
+ *
+ * Code Samples
+ *
+ * Upload a number of bytes from a file at defined source and destination offsets
+ *
+ * {@codesnippet com.azure.storage.file.share.ShareFileClient.uploadRangeFromUrlWithResponse#ShareFileUploadRangeFromUrlOptions-Duration-Context}
+ *
+ * For more information, see the
+ * Azure Docs.
+ *
+ * @param options argument collection
+ * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout
+ * concludes a {@link RuntimeException} will be thrown.
+ * @param context Additional context that is passed through the Http pipeline during the service call.
+ * @return A response containing the {@link ShareFileUploadRangeFromUrlInfo file upload range from url info} with
+ * headers and response status code.
+ * @throws RuntimeException if the operation doesn't complete before the timeout concludes.
+ */
+ // TODO: (gapra) Fix put range from URL link. Service docs have not been updated to show this API
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response uploadRangeFromUrlWithResponse(
+ ShareFileUploadRangeFromUrlOptions options, Duration timeout, Context context) {
Mono> response = shareFileAsyncClient.uploadRangeFromUrlWithResponse(
- length, destinationOffset, sourceOffset, sourceUrl, requestConditions, context);
+ options, context);
return StorageImplUtils.blockWithOptionalTimeout(response, timeout);
}
diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java
index ab2b3ac0cff5..3d1674e48932 100644
--- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java
+++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java
@@ -223,6 +223,7 @@ Mono uploadRangeFromURL(
@HeaderParam("x-ms-source-if-none-match-crc64") String sourceIfNoneMatchCrc64,
@HeaderParam("x-ms-version") String version,
@HeaderParam("x-ms-lease-id") String leaseId,
+ @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization,
@HeaderParam("Accept") String accept,
Context context);
@@ -802,6 +803,8 @@ public Mono uploadRangeWithResponseAsync(
* @param sourceContentCrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy
* source.
* @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID.
+ * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to
+ * copy source.
* @param sourceModifiedAccessConditions Parameter group.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -820,6 +823,7 @@ public Mono uploadRangeFromURLWithResponseAsync
String sourceRange,
byte[] sourceContentCrc64,
String leaseId,
+ String copySourceAuthorization,
SourceModifiedAccessConditions sourceModifiedAccessConditions,
Context context) {
final String comp = "range";
@@ -854,6 +858,7 @@ public Mono uploadRangeFromURLWithResponseAsync
sourceIfNoneMatchCrc64Converted,
this.client.getVersion(),
leaseId,
+ copySourceAuthorization,
accept,
context);
}
diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareFileUploadRangeFromUrlOptions.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareFileUploadRangeFromUrlOptions.java
new file mode 100644
index 000000000000..91e47436a447
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareFileUploadRangeFromUrlOptions.java
@@ -0,0 +1,115 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.storage.file.share.options;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.core.experimental.http.HttpAuthorization;
+import com.azure.storage.common.implementation.StorageImplUtils;
+import com.azure.storage.file.share.models.ShareRequestConditions;
+
+/**
+ * Extended options that may be passed when uploading a range from a source URL.
+ */
+@Fluent
+public class ShareFileUploadRangeFromUrlOptions {
+ private final long length;
+ private final String sourceUrl;
+ private long destinationOffset;
+ private long sourceOffset;
+ private HttpAuthorization sourceAuthorization;
+ private ShareRequestConditions destinationRequestConditions;
+
+ /**
+ * @param length data length to upload for this operation.
+ * @param sourceUrl source URL for this operation.
+ */
+ public ShareFileUploadRangeFromUrlOptions(
+ long length, String sourceUrl) {
+ StorageImplUtils.assertNotNull("sourceUrl", sourceUrl);
+ this.length = length;
+ this.sourceUrl = sourceUrl;
+ }
+
+ /**
+ * @return data length to upload for this operation.
+ */
+ public long getLength() {
+ return length;
+ }
+
+ /**
+ * @return source URL for this operation.
+ */
+ public String getSourceUrl() {
+ return sourceUrl;
+ }
+
+ /**
+ * @return destination offset for this operation.
+ */
+ public long getDestinationOffset() {
+ return destinationOffset;
+ }
+
+ /**
+ * @param destinationOffset offset for upload destination.
+ * @return modified options.
+ */
+ public ShareFileUploadRangeFromUrlOptions setDestinationOffset(long destinationOffset) {
+ this.destinationOffset = destinationOffset;
+ return this;
+ }
+
+ /**
+ * @return source offset for this operation.
+ */
+ public long getSourceOffset() {
+ return sourceOffset;
+ }
+
+ /**
+ * @param sourceOffset offset for upload source.
+ * @return modified options.
+ */
+ public ShareFileUploadRangeFromUrlOptions setSourceOffset(long sourceOffset) {
+ this.sourceOffset = sourceOffset;
+ return this;
+ }
+
+ /**
+ * @return optional auth header for access to source URL for this operation.
+ */
+ public HttpAuthorization getSourceAuthorization() {
+ return sourceAuthorization;
+ }
+
+ /**
+ * Sets "Authorization" header for accessing source URL. Currently only "Bearer" authentication is accepted by
+ * Storage.
+ *
+ * @param sourceAuthorization optional auth header for access to source URL.
+ * @return modified options.
+ */
+ public ShareFileUploadRangeFromUrlOptions setSourceAuthorization(HttpAuthorization sourceAuthorization) {
+ this.sourceAuthorization = sourceAuthorization;
+ return this;
+ }
+
+ /**
+ * @return {@link ShareRequestConditions} for this operation.
+ */
+ public ShareRequestConditions getDestinationRequestConditions() {
+ return destinationRequestConditions;
+ }
+
+ /**
+ * @param destinationRequestConditions {@link ShareRequestConditions} for this operation.
+ * @return modified options.
+ */
+ public ShareFileUploadRangeFromUrlOptions setDestinationRequestConditions(
+ ShareRequestConditions destinationRequestConditions) {
+ this.destinationRequestConditions = destinationRequestConditions;
+ return this;
+ }
+}
diff --git a/sdk/storage/azure-storage-file-share/src/main/java/module-info.java b/sdk/storage/azure-storage-file-share/src/main/java/module-info.java
index 6ed42fafdcef..8b44a673bbb1 100644
--- a/sdk/storage/azure-storage-file-share/src/main/java/module-info.java
+++ b/sdk/storage/azure-storage-file-share/src/main/java/module-info.java
@@ -5,6 +5,7 @@
requires transitive com.azure.storage.common;
requires com.fasterxml.jackson.dataformat.xml;
+ requires com.azure.core.experimental;
exports com.azure.storage.file.share;
exports com.azure.storage.file.share.models;
diff --git a/sdk/storage/azure-storage-file-share/src/samples/java/com/azure/storage/file/share/ShareFileAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file-share/src/samples/java/com/azure/storage/file/share/ShareFileAsyncJavaDocCodeSamples.java
index b6971b03ac38..e06ed50bc545 100644
--- a/sdk/storage/azure-storage-file-share/src/samples/java/com/azure/storage/file/share/ShareFileAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file-share/src/samples/java/com/azure/storage/file/share/ShareFileAsyncJavaDocCodeSamples.java
@@ -16,6 +16,7 @@
import com.azure.storage.file.share.models.ShareFileUploadRangeOptions;
import com.azure.storage.file.share.models.ShareRequestConditions;
import com.azure.storage.file.share.options.ShareFileListRangesDiffOptions;
+import com.azure.storage.file.share.options.ShareFileUploadRangeFromUrlOptions;
import com.azure.storage.file.share.sas.ShareFileSasPermission;
import com.azure.storage.file.share.sas.ShareServiceSasSignatureValues;
import reactor.core.publisher.Flux;
@@ -479,6 +480,21 @@ public void uploadFileFromURLWithResponseAsync() {
// END: com.azure.storage.file.share.ShareFileAsyncClient.uploadRangeFromUrlWithResponse#long-long-long-String
}
+ /**
+ * Generates a code sample for using {@link ShareFileAsyncClient#uploadRangeFromUrlWithResponse(long, long, long, String)}
+ */
+ public void uploadFileFromURLOptionsBagWithResponseAsync() {
+ ShareFileAsyncClient shareFileAsyncClient = createAsyncClientWithSASToken();
+ // BEGIN: com.azure.storage.file.share.ShareFileAsyncClient.uploadRangeFromUrlWithResponse#ShareFileUploadRangeFromUrlOptions
+ shareFileAsyncClient.uploadRangeFromUrlWithResponse(
+ new ShareFileUploadRangeFromUrlOptions(6, "sourceUrl").setDestinationOffset(8))
+ .subscribe(
+ response -> { },
+ error -> System.err.print(error.toString()),
+ () -> System.out.println("Completed upload range from url!"));
+ // END: com.azure.storage.file.share.ShareFileAsyncClient.uploadRangeFromUrlWithResponse#ShareFileUploadRangeFromUrlOptions
+ }
+
/**
* Generates a code sample for using {@link ShareFileAsyncClient#uploadRangeFromUrlWithResponse(long, long, long, String, ShareRequestConditions)}
*/
diff --git a/sdk/storage/azure-storage-file-share/src/samples/java/com/azure/storage/file/share/ShareFileJavaDocCodeSamples.java b/sdk/storage/azure-storage-file-share/src/samples/java/com/azure/storage/file/share/ShareFileJavaDocCodeSamples.java
index e01a7fc83c2f..b4c967c080e0 100644
--- a/sdk/storage/azure-storage-file-share/src/samples/java/com/azure/storage/file/share/ShareFileJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file-share/src/samples/java/com/azure/storage/file/share/ShareFileJavaDocCodeSamples.java
@@ -24,6 +24,7 @@
import com.azure.storage.file.share.models.ShareFileUploadRangeOptions;
import com.azure.storage.file.share.models.ShareRequestConditions;
import com.azure.storage.file.share.options.ShareFileListRangesDiffOptions;
+import com.azure.storage.file.share.options.ShareFileUploadRangeFromUrlOptions;
import com.azure.storage.file.share.sas.ShareFileSasPermission;
import com.azure.storage.file.share.sas.ShareServiceSasSignatureValues;
@@ -575,6 +576,20 @@ public void uploadFileFromURLWithResponseAsync() {
// END: com.azure.storage.file.share.ShareFileClient.uploadRangeFromUrlWithResponse#long-long-long-String-Duration-Context
}
+ /**
+ * Generates a code sample for using {@link ShareFileClient#uploadRangeFromUrlWithResponse(ShareFileUploadRangeFromUrlOptions,
+ * Duration, Context)}
+ */
+ public void uploadFileFromURLOptionsBagWithResponseAsync() {
+ ShareFileClient fileClient = createClientWithSASToken();
+ // BEGIN: com.azure.storage.file.share.ShareFileClient.uploadRangeFromUrlWithResponse#ShareFileUploadRangeFromUrlOptions-Duration-Context
+ Response response =
+ fileClient.uploadRangeFromUrlWithResponse(new ShareFileUploadRangeFromUrlOptions(6, "sourceUrl")
+ .setDestinationOffset(8), Duration.ofSeconds(1), Context.NONE);
+ System.out.println("Completed upload range from url!");
+ // END: com.azure.storage.file.share.ShareFileClient.uploadRangeFromUrlWithResponse#ShareFileUploadRangeFromUrlOptions-Duration-Context
+ }
+
/**
* Generates a code sample for using {@link ShareFileClient#uploadRangeFromUrlWithResponse(long, long, long, String, ShareRequestConditions,
* Duration, Context)}
diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/APISpec.groovy b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/APISpec.groovy
index 0b40b888afb1..88e786b5bc9b 100644
--- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/APISpec.groovy
+++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/APISpec.groovy
@@ -3,6 +3,8 @@
package com.azure.storage.file.share
+import com.azure.core.credential.AccessToken
+import com.azure.core.credential.TokenRequestContext
import com.azure.core.http.HttpHeaders
import com.azure.core.http.HttpPipelineCallContext
import com.azure.core.http.HttpPipelineNextPolicy
@@ -11,6 +13,11 @@ import com.azure.core.http.HttpResponse
import com.azure.core.http.policy.HttpPipelinePolicy
import com.azure.core.test.TestMode
import com.azure.core.util.Context
+import com.azure.identity.EnvironmentCredential
+import com.azure.identity.EnvironmentCredentialBuilder
+import com.azure.identity.implementation.IdentityClientOptions
+import com.azure.storage.blob.BlobServiceClient
+import com.azure.storage.blob.BlobServiceClientBuilder
import com.azure.storage.common.StorageSharedKeyCredential
import com.azure.storage.common.test.shared.StorageSpec
import com.azure.storage.common.test.shared.TestAccount
diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAPITests.groovy b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAPITests.groovy
index 78d38db60c3e..a614a04a8561 100644
--- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAPITests.groovy
+++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAPITests.groovy
@@ -26,7 +26,6 @@ import com.azure.storage.file.share.options.ShareFileListRangesDiffOptions
import com.azure.storage.file.share.sas.ShareFileSasPermission
import com.azure.storage.file.share.sas.ShareServiceSasSignatureValues
import spock.lang.Ignore
-import spock.lang.Requires
import spock.lang.Unroll
import java.nio.charset.StandardCharsets
diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/OAuthCopySourceTests.groovy b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/OAuthCopySourceTests.groovy
new file mode 100644
index 000000000000..7783179185e1
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/OAuthCopySourceTests.groovy
@@ -0,0 +1,76 @@
+package com.azure.storage.file.share
+
+import com.azure.core.experimental.http.HttpAuthorization
+import com.azure.core.util.Context
+import com.azure.storage.blob.BlobClient
+import com.azure.storage.blob.BlobContainerClient
+import com.azure.storage.blob.BlobServiceClientBuilder
+import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion
+import com.azure.storage.file.share.models.ShareStorageException
+import com.azure.storage.file.share.options.ShareFileUploadRangeFromUrlOptions
+
+@RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "V2020_10_02")
+class OAuthCopySourceTests extends APISpec {
+ ShareFileClient primaryFileClient
+ ShareClient shareClient
+ String shareName
+ String filePath
+
+ BlobContainerClient container
+ BlobClient blob
+
+ def setup() {
+ shareName = namer.getRandomName(60)
+ filePath = namer.getRandomName(60)
+ shareClient = shareBuilderHelper(shareName).buildClient()
+ shareClient.create()
+ primaryFileClient = fileBuilderHelper(shareName, filePath).buildFileClient()
+
+ container = getBlobContainer()
+ blob = container.getBlobClient(generatePathName())
+ blob.upload(data.defaultBinaryData)
+ }
+
+ def cleanup() {
+ container.delete()
+ }
+
+ def getBlobContainer() {
+ instrument(new BlobServiceClientBuilder())
+ .endpoint(env.primaryAccount.blobEndpoint)
+ .credential(env.primaryAccount.credential)
+ .buildClient()
+ .createBlobContainer(getShareName())
+ }
+
+ def "Copy from URL with oauth source"() {
+ given:
+ def oauthHeader = getAuthToken()
+ primaryFileClient.create(data.defaultDataSize)
+
+ when:
+ primaryFileClient.uploadRangeFromUrlWithResponse(
+ new ShareFileUploadRangeFromUrlOptions(data.defaultDataSize, blob.getBlobUrl())
+ .setSourceAuthorization(new HttpAuthorization("Bearer", oauthHeader)),
+ null, Context.NONE)
+
+ then:
+ def os = new ByteArrayOutputStream(data.defaultDataSize)
+ primaryFileClient.download(os)
+ os.toByteArray() == data.defaultBytes
+ }
+
+ def "Copy from URL with oauth source invalid credential"() {
+ given:
+ def oauthHeader = "garbage"
+ primaryFileClient.create(data.defaultDataSize)
+
+ when:
+ primaryFileClient.uploadRangeFromUrlWithResponse(
+ new ShareFileUploadRangeFromUrlOptions(data.defaultDataSize, blob.getBlobUrl())
+ .setSourceAuthorization(new HttpAuthorization("Bearer", oauthHeader)), null, Context.NONE)
+
+ then:
+ thrown(ShareStorageException)
+ }
+}
diff --git a/sdk/storage/azure-storage-file-share/src/test/resources/session-records/OAuthCopySourceTestsCopyFromURLWithOauthSource.json b/sdk/storage/azure-storage-file-share/src/test/resources/session-records/OAuthCopySourceTestsCopyFromURLWithOauthSource.json
new file mode 100644
index 000000000000..b5170ce0f136
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/src/test/resources/session-records/OAuthCopySourceTestsCopyFromURLWithOauthSource.json
@@ -0,0 +1,177 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.file.core.windows.net/a7a4d4c7a7a4d4c7ebc09259f14aa44bd20a4ad4be?restype=share",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-share/12.11.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "40ec3682-48db-4584-b9a9-7a4ff6234a19"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-10-02",
+ "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0",
+ "eTag" : "0x8D9367D7A15887C",
+ "Last-Modified" : "Wed, 23 Jun 2021 19:31:19 GMT",
+ "retry-after" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "e1ae70e9-f01a-0001-4866-689c3e000000",
+ "x-ms-client-request-id" : "40ec3682-48db-4584-b9a9-7a4ff6234a19",
+ "Date" : "Wed, 23 Jun 2021 19:31:18 GMT"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.blob.core.windows.net/a7a4d4c7a7a4d4c7ebc09259f14aa44bd20a4ad4be?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.13.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "1d58fc9e-caf8-4044-b09b-346e1e0b4869"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-10-02",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "eTag" : "0x8D9367D7A83105D",
+ "Last-Modified" : "Wed, 23 Jun 2021 19:31:20 GMT",
+ "retry-after" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "e3fccdd3-001e-0007-4a66-68dd0f000000",
+ "x-ms-client-request-id" : "1d58fc9e-caf8-4044-b09b-346e1e0b4869",
+ "Date" : "Wed, 23 Jun 2021 19:31:19 GMT"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.blob.core.windows.net/a7a4d4c7a7a4d4c7ebc09259f14aa44bd20a4ad4be/a7a4d4c70a7a4d4c7ebc3828761461e371ae4471ca34",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.13.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "5cf69771-8b77-471c-9750-52135f745b54",
+ "Content-Type" : "application/octet-stream"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-10-02",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "x-ms-content-crc64" : "6RYQPwaVsyQ=",
+ "Last-Modified" : "Wed, 23 Jun 2021 19:31:20 GMT",
+ "retry-after" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-server-encrypted" : "true",
+ "Date" : "Wed, 23 Jun 2021 19:31:20 GMT",
+ "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==",
+ "eTag" : "0x8D9367D7AADA36D",
+ "x-ms-request-id" : "e3fccdf4-001e-0007-6866-68dd0f000000",
+ "x-ms-client-request-id" : "5cf69771-8b77-471c-9750-52135f745b54"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.file.core.windows.net/a7a4d4c7a7a4d4c7ebc09259f14aa44bd20a4ad4be/a7a4d4c7a7a4d4c7ebc75579cc7febde12314293be",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-share/12.11.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "24c98f53-a709-4147-8e56-50ee69d82416"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-10-02",
+ "x-ms-file-permission-key" : "16466167399171598336*5486365400479318158",
+ "x-ms-file-id" : "13835128424026341376",
+ "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0",
+ "x-ms-file-creation-time" : "2021-06-23T19:31:21.3233822Z",
+ "Last-Modified" : "Wed, 23 Jun 2021 19:31:21 GMT",
+ "retry-after" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-server-encrypted" : "true",
+ "Date" : "Wed, 23 Jun 2021 19:31:20 GMT",
+ "x-ms-file-attributes" : "Archive",
+ "x-ms-file-change-time" : "2021-06-23T19:31:21.3233822Z",
+ "x-ms-file-parent-id" : "0",
+ "eTag" : "0x8D9367D7B12229E",
+ "x-ms-request-id" : "e1ae70f7-f01a-0001-5466-689c3e000000",
+ "x-ms-client-request-id" : "24c98f53-a709-4147-8e56-50ee69d82416",
+ "x-ms-file-last-write-time" : "2021-06-23T19:31:21.3233822Z"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.file.core.windows.net/a7a4d4c7a7a4d4c7ebc09259f14aa44bd20a4ad4be/a7a4d4c7a7a4d4c7ebc75579cc7febde12314293be?comp=range",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-share/12.11.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "33395265-4f43-4ae2-a9fc-a137dc64318b"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-10-02",
+ "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0",
+ "x-ms-content-crc64" : "6RYQPwaVsyQ=",
+ "eTag" : "0x8D9367D7B41B708",
+ "Last-Modified" : "Wed, 23 Jun 2021 19:31:21 GMT",
+ "retry-after" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "e1ae70fa-f01a-0001-5666-689c3e000000",
+ "x-ms-request-server-encrypted" : "true",
+ "x-ms-client-request-id" : "33395265-4f43-4ae2-a9fc-a137dc64318b",
+ "Date" : "Wed, 23 Jun 2021 19:31:20 GMT"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "GET",
+ "Uri" : "https://REDACTED.file.core.windows.net/a7a4d4c7a7a4d4c7ebc09259f14aa44bd20a4ad4be/a7a4d4c7a7a4d4c7ebc75579cc7febde12314293be",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-share/12.11.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "a9a94757-559d-4eca-a1d0-d5e74443a8f0"
+ },
+ "Response" : {
+ "content-length" : "7",
+ "x-ms-version" : "2020-10-02",
+ "x-ms-lease-status" : "unlocked",
+ "x-ms-file-permission-key" : "16466167399171598336*5486365400479318158",
+ "x-ms-file-id" : "13835128424026341376",
+ "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0",
+ "x-ms-file-creation-time" : "2021-06-23T19:31:21.3233822Z",
+ "x-ms-lease-state" : "available",
+ "Last-Modified" : "Wed, 23 Jun 2021 19:31:21 GMT",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "Date" : "Wed, 23 Jun 2021 19:31:20 GMT",
+ "Accept-Ranges" : "bytes",
+ "x-ms-server-encrypted" : "true",
+ "x-ms-type" : "File",
+ "x-ms-file-attributes" : "Archive",
+ "x-ms-file-change-time" : "2021-06-23T19:31:21.3233822Z",
+ "x-ms-file-parent-id" : "0",
+ "eTag" : "0x8D9367D7B41B708",
+ "x-ms-request-id" : "e1ae70fe-f01a-0001-5966-689c3e000000",
+ "Body" : "ZGVmYXVsdA==",
+ "x-ms-client-request-id" : "a9a94757-559d-4eca-a1d0-d5e74443a8f0",
+ "x-ms-file-last-write-time" : "2021-06-23T19:31:21.3233822Z",
+ "Content-Type" : "application/octet-stream"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "DELETE",
+ "Uri" : "https://REDACTED.blob.core.windows.net/a7a4d4c7a7a4d4c7ebc09259f14aa44bd20a4ad4be?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.13.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "b750385f-61c7-4fb8-b647-34bd5aeb44a5"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-10-02",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "retry-after" : "0",
+ "StatusCode" : "202",
+ "x-ms-request-id" : "e3fcce65-001e-0007-5766-68dd0f000000",
+ "x-ms-client-request-id" : "b750385f-61c7-4fb8-b647-34bd5aeb44a5",
+ "Date" : "Wed, 23 Jun 2021 19:31:21 GMT"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ "a7a4d4c7a7a4d4c7ebc09259f14aa44bd20a4ad4be", "a7a4d4c7a7a4d4c7ebc75579cc7febde12314293be", "a7a4d4c70a7a4d4c7ebc3828761461e371ae4471ca34" ]
+}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-file-share/src/test/resources/session-records/OAuthCopySourceTestsCopyFromURLWithOauthSourceInvalidCredential.json b/sdk/storage/azure-storage-file-share/src/test/resources/session-records/OAuthCopySourceTestsCopyFromURLWithOauthSourceInvalidCredential.json
new file mode 100644
index 000000000000..0d77b55eb824
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/src/test/resources/session-records/OAuthCopySourceTestsCopyFromURLWithOauthSourceInvalidCredential.json
@@ -0,0 +1,141 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.file.core.windows.net/5196802e5196802ee39778066fa1ca4b20b94c71b3?restype=share",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-share/12.11.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "c6229f0b-014d-4498-b7e4-46a6c7dcad84"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-10-02",
+ "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0",
+ "eTag" : "0x8D9367D7B9DC41A",
+ "Last-Modified" : "Wed, 23 Jun 2021 19:31:22 GMT",
+ "retry-after" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "e1ae7109-f01a-0001-6166-689c3e000000",
+ "x-ms-client-request-id" : "c6229f0b-014d-4498-b7e4-46a6c7dcad84",
+ "Date" : "Wed, 23 Jun 2021 19:31:21 GMT"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.blob.core.windows.net/5196802e5196802ee39778066fa1ca4b20b94c71b3?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.13.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "3573f573-2b13-4992-a37d-93403c618dac"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-10-02",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "eTag" : "0x8D9367D7BAC22BB",
+ "Last-Modified" : "Wed, 23 Jun 2021 19:31:22 GMT",
+ "retry-after" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "e3fcce9a-001e-0007-0a66-68dd0f000000",
+ "x-ms-client-request-id" : "3573f573-2b13-4992-a37d-93403c618dac",
+ "Date" : "Wed, 23 Jun 2021 19:31:21 GMT"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.blob.core.windows.net/5196802e5196802ee39778066fa1ca4b20b94c71b3/5196802e05196802ee395771039c2bebd762642d3911",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.13.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "4687165f-f419-4279-89c7-fda42c0cf1ce",
+ "Content-Type" : "application/octet-stream"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-10-02",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "x-ms-content-crc64" : "6RYQPwaVsyQ=",
+ "Last-Modified" : "Wed, 23 Jun 2021 19:31:22 GMT",
+ "retry-after" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-server-encrypted" : "true",
+ "Date" : "Wed, 23 Jun 2021 19:31:21 GMT",
+ "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==",
+ "eTag" : "0x8D9367D7BBAA58E",
+ "x-ms-request-id" : "e3fccea1-001e-0007-1066-68dd0f000000",
+ "x-ms-client-request-id" : "4687165f-f419-4279-89c7-fda42c0cf1ce"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.file.core.windows.net/5196802e5196802ee39778066fa1ca4b20b94c71b3/5196802e5196802ee393988289c77d43ecd94f79ba",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-share/12.11.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "6ee14bea-537a-4b05-9d65-44eb0dd99c9d"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-10-02",
+ "x-ms-file-permission-key" : "16466167399171598336*5486365400479318158",
+ "x-ms-file-id" : "13835128424026341376",
+ "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0",
+ "x-ms-file-creation-time" : "2021-06-23T19:31:22.5146887Z",
+ "Last-Modified" : "Wed, 23 Jun 2021 19:31:22 GMT",
+ "retry-after" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-server-encrypted" : "true",
+ "Date" : "Wed, 23 Jun 2021 19:31:21 GMT",
+ "x-ms-file-attributes" : "Archive",
+ "x-ms-file-change-time" : "2021-06-23T19:31:22.5146887Z",
+ "x-ms-file-parent-id" : "0",
+ "eTag" : "0x8D9367D7BC7EA07",
+ "x-ms-request-id" : "e1ae7111-f01a-0001-6666-689c3e000000",
+ "x-ms-client-request-id" : "6ee14bea-537a-4b05-9d65-44eb0dd99c9d",
+ "x-ms-file-last-write-time" : "2021-06-23T19:31:22.5146887Z"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.file.core.windows.net/5196802e5196802ee39778066fa1ca4b20b94c71b3/5196802e5196802ee393988289c77d43ecd94f79ba?comp=range",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-share/12.11.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "ef92573c-9061-47f2-9174-aa1c861a08d6"
+ },
+ "Response" : {
+ "content-length" : "297",
+ "x-ms-version" : "2020-10-02",
+ "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0",
+ "x-ms-error-code" : "CannotVerifyCopySource",
+ "retry-after" : "0",
+ "StatusCode" : "401",
+ "x-ms-request-id" : "e1ae7113-f01a-0001-6866-689c3e000000",
+ "Body" : "CannotVerifyCopySourceServer failed to authenticate the request. Please refer to the information in the www-authenticate header.\nRequestId:e1ae7113-f01a-0001-6866-689c3e000000\nTime:2021-06-23T19:31:22.6642243Z",
+ "x-ms-client-request-id" : "ef92573c-9061-47f2-9174-aa1c861a08d6",
+ "Date" : "Wed, 23 Jun 2021 19:31:21 GMT",
+ "Content-Type" : "application/xml"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "DELETE",
+ "Uri" : "https://REDACTED.blob.core.windows.net/5196802e5196802ee39778066fa1ca4b20b94c71b3?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-10-02",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.13.0-beta.1 (11.0.11; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "f52fe140-8139-4a81-b435-54392e9c2521"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-10-02",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "retry-after" : "0",
+ "StatusCode" : "202",
+ "x-ms-request-id" : "e3fccec0-001e-0007-2f66-68dd0f000000",
+ "x-ms-client-request-id" : "f52fe140-8139-4a81-b435-54392e9c2521",
+ "Date" : "Wed, 23 Jun 2021 19:31:22 GMT"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ "5196802e5196802ee39778066fa1ca4b20b94c71b3", "5196802e5196802ee393988289c77d43ecd94f79ba", "5196802e05196802ee395771039c2bebd762642d3911" ]
+}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md
index 73fbc0541d01..71487a2f7903 100644
--- a/sdk/storage/azure-storage-file-share/swagger/README.md
+++ b/sdk/storage/azure-storage-file-share/swagger/README.md
@@ -16,7 +16,7 @@ autorest --java --use:@autorest/java@4.0.x
### Code generation settings
``` yaml
-input-file: https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/feature/storage/listFilesV2/specification/storage/data-plane/Microsoft.FileStorage/preview/2020-10-02/file.json
+input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.FileStorage/preview/2020-10-02/file.json
java: true
output-folder: ../
namespace: com.azure.storage.file.share