Skip to content

Commit 6971fc2

Browse files
Add section for abort copy
1 parent 2961375 commit 6971fc2

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

articles/storage/blobs/storage-blob-copy-async-go.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,52 +61,52 @@ If you're copying a blob within the same storage account, the operation can comp
6161

6262
If the copy source is a blob in a different storage account, the operation can complete asynchronously. The source blob must either be public or authorized via SAS token. The SAS token needs to include the **Read ('r')** permission. To learn more about SAS tokens, see [Delegate access with shared access signatures](../common/storage-sas-overview.md).
6363

64-
The following example shows a scenario for copying a source blob from a different storage account with asynchronous scheduling. In this example, we create a source blob URL with an appended user delegation SAS token. The example shows how to generate the SAS token using the client library, but you can also provide your own. The example also shows how to lease the source blob during the copy operation to prevent changes to the blob from a different client. The `Copy Blob` operation saves the `ETag` value of the source blob when the copy operation starts. If the `ETag` value is changed before the copy operation finishes, the operation fails.
64+
The following example shows a scenario for copying a source blob from a different storage account with asynchronous scheduling. In this example, we create a source blob URL with an appended user delegation SAS token. The example assumes you provide your own SAS. The example also shows how to lease the source blob during the copy operation to prevent changes to the blob from a different client. The `Copy Blob` operation saves the `ETag` value of the source blob when the copy operation starts. If the `ETag` value is changed before the copy operation finishes, the operation fails. We also set the access tier for the destination blob to `Cool` using the [StartCopyFromURLOptions](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob#StartCopyFromURLOptions) struct.
6565

6666
:::code language="go" source="~/blob-devguide-go/cmd/copy-blob-async/copy_blob_async.go" id="snippet_copy_from_source_async":::
6767

68+
The following example shows sample usage:
69+
70+
:::code language="go" source="~/blob-devguide-go/cmd/copy-blob-async/copy_blob_async.go" id="snippet_copy_from_source_async_usage":::
71+
6872
> [!NOTE]
6973
> User delegation SAS tokens offer greater security, as they're signed with Microsoft Entra credentials instead of an account key. To create a user delegation SAS token, the Microsoft Entra security principal needs appropriate permissions. For authorization requirements, see [Get User Delegation Key](/rest/api/storageservices/get-user-delegation-key#authorization).
7074
7175
## Copy a blob from a source outside of Azure
7276

73-
You can perform a copy operation on any source object that can be retrieved via HTTP GET request on a given URL, including accessible objects outside of Azure. The following example shows a scenario for copying a blob from an accessible source object URL.
77+
You can perform a copy operation on any source object that can be retrieved via HTTP GET request on a given URL, including accessible objects outside of Azure. The following example shows a scenario for copying a blob from an accessible source object URL:
7478

7579
:::code language="go" source="~/blob-devguide-go/cmd/copy-blob-async/copy_blob_async.go" id="snippet_copy_from_external_source_async":::
7680

77-
## Check the status of a copy operation
78-
79-
To check the status of an asynchronous `Copy Blob` operation, you can poll the [get_blob_properties](/python/api/azure-storage-blob/azure.storage.blob.blobclient#azure-storage-blob-blobclient-get-blob-properties) method and check the copy status.
81+
The following example shows sample usage:
8082

81-
The following code example shows how to check the status of a pending copy operation:
82-
83-
:::code language="go" source="~/blob-devguide-go/cmd/copy-blob-async/copy_blob_async.go" id="snippet_check_copy_status":::
83+
:::code language="go" source="~/blob-devguide-go/cmd/copy-blob-async/copy_blob_async.go" id="snippet_copy_from_external_source_async_usage":::
8484

8585
## Abort a copy operation
8686

8787
Aborting a pending `Copy Blob` operation results in a destination blob of zero length. However, the metadata for the destination blob has the new values copied from the source blob or set explicitly during the copy operation. To keep the original metadata from before the copy, make a snapshot of the destination blob before calling one of the copy methods.
8888

8989
To abort a pending copy operation, call the following operation:
9090

91-
- [abort_copy](/python/api/azure-storage-blob/azure.storage.blob.blobclient#azure-storage-blob-blobclient-abort-copy)
91+
- [AbortCopyFromURL](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob#Client.AbortCopyFromURL)
9292

9393
This method wraps the [Abort Copy Blob](/rest/api/storageservices/abort-copy-blob) REST API operation, which cancels a pending `Copy Blob` operation. The following code example shows how to abort a pending `Copy Blob` operation:
9494

95-
:::code language="python" source="~/azure-storage-snippets/blobs/howto/python/blob-devguide-py/blob_devguide_copy_blob.py" id="Snippet_abort_copy":::
95+
:::code language="go" source="~/blob-devguide-go/cmd/copy-blob-async/copy_blob_async.go" id="snippet_abort_copy":::
9696

9797
## Resources
9898

9999
To learn more about copying blobs with asynchronous scheduling using the Azure Blob Storage client module for Go, see the following resources.
100100

101+
### Code samples
102+
103+
- [View code samples from this article (GitHub)](https://github.com/Azure-Samples/blob-storage-devguide-go/blob/main/cmd/copy-blob-async/copy_blob_async.go)
104+
101105
### REST API operations
102106

103107
The Azure SDK for Go contains libraries that build on top of the Azure REST API, allowing you to interact with REST API operations through familiar Go paradigms. The methods covered in this article use the following REST API operations:
104108

105109
- [Copy Blob](/rest/api/storageservices/copy-blob) (REST API)
106110
- [Abort Copy Blob](/rest/api/storageservices/abort-copy-blob) (REST API)
107111

108-
### Code samples
109-
110-
- [View code samples from this article (GitHub)](https://github.com/Azure-Samples/AzureStorageSnippets/blob/master/blobs/howto/python/blob-devguide-py/blob_devguide_copy_blob.py)
111-
112112
[!INCLUDE [storage-dev-guide-resources-go](../../../includes/storage-dev-guides/storage-dev-guide-resources-go.md)]

articles/storage/blobs/storage-blob-copy-url-go.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,21 @@ For large objects, you might choose to work with individual blocks. The followin
6262

6363
If you're copying a blob from a source within Azure, access to the source blob can be authorized via Microsoft Entra ID (recommended), a shared access signature (SAS), or an account key.
6464

65-
The following example shows a scenario for copying a source blob within Azure. In this example, we also set the access tier for the destination blob to `Cool` using the [UploadBlobFromURLOptions](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob#UploadBlobFromURLOptions) struct.
65+
The following code example shows a scenario for copying a source blob within Azure. In this example, we also set the access tier for the destination blob to `Cool` using the [UploadBlobFromURLOptions](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob#UploadBlobFromURLOptions) struct.
6666

6767
:::code language="go" source="~/blob-devguide-go/cmd/copy-put-from-url/copy_put_from_url.go" id="snippet_copy_from_source_url":::
6868

69-
The following example shows sample usage to copy a blob from one storage account to another:
69+
The following example shows sample usage:
7070

7171
:::code language="go" source="~/blob-devguide-go/cmd/copy-put-from-url/copy_put_from_url.go" id="snippet_copy_from_source_url":::
7272

7373
## Copy a blob from a source outside of Azure
7474

75-
You can perform a copy operation on any source object that can be retrieved via HTTP GET request on a given URL, including accessible objects outside of Azure. The following example shows a scenario for copying a blob from an accessible source object URL.
75+
You can perform a copy operation on any source object that can be retrieved via HTTP GET request on a given URL, including accessible objects outside of Azure. The following code example shows a scenario for copying a blob from an accessible source object URL.
7676

7777
:::code language="go" source="~/blob-devguide-go/cmd/copy-put-from-url/copy_put_from_url.go" id="snippet_copy_from_source_url":::
7878

79-
The following example shows sample usage to copy a blob from an external source object URL:
79+
The following example shows sample usage:
8080

8181
:::code language="go" source="~/blob-devguide-go/cmd/copy-put-from-url/copy_put_from_url.go" id="snippet_copy_from_source_url_external_usage":::
8282

0 commit comments

Comments
 (0)