Skip to content

Commit 0a42300

Browse files
PutBlobFromURL/UploadBlobFromURL API (Azure#20558)
* Fresh PR for PutBlobFromURL * Updating copy source auth test and resolving comment * Fixing lint issues and recorded * Adding recorded negative test for copy soure auth * Updating test recordings * Update sdk/storage/azblob/blockblob/client_test.go Co-authored-by: Sourav Gupta <[email protected]> * Cleaning up tests * Updating expiry time to be shorter --------- Co-authored-by: Sourav Gupta <[email protected]>
1 parent be3f449 commit 0a42300

File tree

6 files changed

+736
-1
lines changed

6 files changed

+736
-1
lines changed

sdk/storage/azblob/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Added [Blob Batch API](https://learn.microsoft.com/rest/api/storageservices/blob-batch).
88
* Added support for bearer challenge for identity based managed disks.
99
* Added support for GetAccountInfo to container and blob level clients.
10+
* Added [UploadBlobFromURL API](https://learn.microsoft.com/rest/api/storageservices/put-blob-from-url).
1011
* Added support for CopySourceAuthorization to appendblob.AppendBlockFromURL
1112

1213
### Breaking Changes

sdk/storage/azblob/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "go",
44
"TagPrefix": "go/storage/azblob",
5-
"Tag": "go/storage/azblob_fad5549316"
5+
"Tag": "go/storage/azblob_cc6efe2d90"
66
}

sdk/storage/azblob/blockblob/client.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,19 @@ func (bb *Client) Upload(ctx context.Context, body io.ReadSeekCloser, options *U
165165
return resp, err
166166
}
167167

168+
// UploadBlobFromURL - The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from
169+
// a given URL. Partial updates are not supported with Put Blob from URL; the content of an existing blob is overwritten
170+
// with the content of the new blob. To perform partial updates to a block blob’s contents using a source URL, use the Put
171+
// Block from URL API in conjunction with Put Block List.
172+
// For more information, see https://learn.microsoft.com/rest/api/storageservices/put-blob-from-url
173+
func (bb *Client) UploadBlobFromURL(ctx context.Context, copySource string, options *UploadBlobFromURLOptions) (UploadBlobFromURLResponse, error) {
174+
opts, httpHeaders, leaseAccessConditions, cpkInfo, cpkSourceInfo, modifiedAccessConditions, sourceModifiedConditions := options.format()
175+
176+
resp, err := bb.generated().PutBlobFromURL(ctx, int64(0), copySource, opts, httpHeaders, leaseAccessConditions, cpkInfo, cpkSourceInfo, modifiedAccessConditions, sourceModifiedConditions)
177+
178+
return resp, err
179+
}
180+
168181
// StageBlock uploads the specified block to the block blob's "staging area" to be later committed by a call to CommitBlockList.
169182
// Note that the http client closes the body stream after the request is sent to the service.
170183
// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-block.

0 commit comments

Comments
 (0)