Skip to content

Commit 0633346

Browse files
Edits
1 parent 96a8153 commit 0633346

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ This article shows how to copy a blob with asynchronous scheduling using the [Az
2020

2121
The methods covered in this article use the [Copy Blob](/rest/api/storageservices/copy-blob) REST API operation, and can be used when you want to perform a copy with asynchronous scheduling. For most copy scenarios where you want to move data into a storage account and have a URL for the source object, see [Copy a blob from a source object URL with Go](storage-blob-copy-url-go.md).
2222

23-
## Prerequisites
23+
[!INCLUDE [storage-dev-guide-prereqs-go](../../../includes/storage-dev-guides/storage-dev-guide-prereqs-go.md)]
2424

25-
- This article assumes you already have a project set up to work with the Azure Blob Storage client module for Go. To learn about setting up your project, including package installation, adding `import` statements, and creating an authorized client object, see [Get started with Azure Blob Storage and Go](storage-blob-go-get-started.md).
26-
- The [authorization mechanism](../common/authorize-data-access.md) must have permissions to perform a copy operation, or to abort a pending copy. To learn more, see the authorization guidance for the following REST API operation:
27-
- [Copy Blob](/rest/api/storageservices/copy-blob#authorization)
28-
- [Abort Copy Blob](/rest/api/storageservices/abort-copy-blob#authorization)
25+
## Set up your environment
26+
27+
[!INCLUDE [storage-dev-guide-project-setup-go](../../../includes/storage-dev-guides/storage-dev-guide-project-setup-go.md)]
28+
29+
#### Authorization
30+
31+
The authorization mechanism must have the necessary permissions to perform a copy operation, or to abort a pending copy. For authorization with Microsoft Entra ID (recommended), you need Azure RBAC built-in role **Storage Blob Data Contributor** or higher. To learn more, see the authorization guidance for [Copy Blob](/rest/api/storageservices/copy-blob#authorization) or [Abort Copy Blob](/rest/api/storageservices/abort-copy-blob#authorization).
2932

3033
## About copying blobs with asynchronous scheduling
3134

@@ -51,7 +54,7 @@ This section gives an overview of methods provided by the Azure Storage client m
5154

5255
The following methods wrap the [Copy Blob](/rest/api/storageservices/copy-blob) REST API operation, and begin an asynchronous copy of data from the source blob:
5356

54-
- [StartCopyFromURL](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob#BlobClient.StartCopyFromURL)
57+
- [StartCopyFromURL](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob#Client.StartCopyFromURL)
5558

5659
## Copy a blob from a source within Azure
5760

@@ -80,6 +83,14 @@ The following example shows sample usage:
8083

8184
:::code language="go" source="~/blob-devguide-go/cmd/copy-blob-async/copy_blob_async.go" id="snippet_copy_from_external_source_async_usage":::
8285

86+
## Check the status of a copy operation
87+
88+
To check the status of an asynchronous `Copy Blob` operation, you can poll the [GetProperties](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob#Client.GetProperties) method and check the copy status.
89+
90+
The following code example shows how to check the status of a copy operation:
91+
92+
:::code language="go" source="~/blob-devguide-go/cmd/copy-blob-async/copy_blob_async.go" id="snippet_check_copy_status":::
93+
8394
## Abort a copy operation
8495

8596
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.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ The following code example shows a scenario for copying a source blob within Azu
6868

6969
The following example shows sample usage:
7070

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

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

7575
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

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

7979
The following example shows sample usage:
8080

81-
:::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":::
81+
:::code language="go" source="~/blob-devguide-go/cmd/copy-put-from-url/copy_put_from_url.go" id="snippet_copy_from_external_source_usage":::
8282

8383
## Resources
8484

includes/storage-dev-guides/storage-dev-guide-project-setup-go.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
)
3737
```
3838

39-
Some code examples in this article might require additional import paths. For specific details and example usage, see [Code samples](#code-samples).
39+
These import paths represent the minimum needed to get started. Some code examples in this article might require additional import paths. For specific details and example usage, see [Code samples](#code-samples).
4040

4141
#### Create a client object
4242

0 commit comments

Comments
 (0)