Adding Support for PutBlobFromUrl (#251)

* Regenerate SDK

* Regenerate SDK with proper version

* Adding support for PutBlobFromURL

* Correcting regen code and handling other errors

* Resolving comments on PR

* Correcting SetTags method

* Updating tests with GetTags and SetTags

* Remove swagger/Go_BlobStorage/code-model-v1

* Checks value of metadata & reorganized tests

Co-authored-by: Adele Reed <adreed@microsoft.com>
This commit is contained in:
siminsavani-msft 2021-02-26 15:25:57 -05:00 коммит произвёл GitHub
Родитель 68300d2983
Коммит b0f228e10f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
15 изменённых файлов: 1746 добавлений и 380 удалений

Просмотреть файл

@ -139,22 +139,22 @@ func (b BlobURL) Delete(ctx context.Context, deleteOptions DeleteSnapshotsOption
return b.blobClient.Delete(ctx, nil, nil, nil, ac.LeaseAccessConditions.pointers(), deleteOptions,
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag,
nil, // Blob ifTags
nil)
nil, BlobDeleteNone)
}
// SetTags operation enables users to set tags on a blob or specific blob version, but not snapshot.
// Each call to this operation replaces all existing tags attached to the blob.
// To remove all tags from the blob, call this operation with no tags set.
// https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tags
func (b BlobURL) SetTags(ctx context.Context, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, ifTags *string, blobTagsMap BlobTagsMap) (*BlobSetTagsResponse, error) {
func (b BlobURL) SetTags(ctx context.Context, timeout *int32, versionID *string, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, requestID *string, ifTags *string, blobTagsMap BlobTagsMap) (*BlobSetTagsResponse, error) {
tags := SerializeBlobTags(blobTagsMap)
return b.blobClient.SetTags(ctx, nil, nil, transactionalContentMD5, transactionalContentCrc64, nil, ifTags, &tags)
return b.blobClient.SetTags(ctx, timeout, versionID, transactionalContentMD5, transactionalContentCrc64, requestID, ifTags, nil, &tags)
}
// GetTags operation enables users to get tags on a blob or specific blob version, or snapshot.
// https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-tags
func (b BlobURL) GetTags(ctx context.Context, ifTags *string) (*BlobTags, error) {
return b.blobClient.GetTags(ctx, nil, nil, nil, nil, ifTags)
func (b BlobURL) GetTags(ctx context.Context, timeout *int32, requestID *string, snapshot *string, versionID *string, ifTags *string) (*BlobTags, error) {
return b.blobClient.GetTags(ctx, timeout, requestID, snapshot, versionID, ifTags, nil)
}
// Undelete restores the contents and metadata of a soft-deleted blob and any associated soft-deleted snapshots.
@ -173,7 +173,8 @@ func (b BlobURL) Undelete(ctx context.Context) (*BlobUndeleteResponse, error) {
func (b BlobURL) SetTier(ctx context.Context, tier AccessTierType, lac LeaseAccessConditions) (*BlobSetTierResponse, error) {
return b.blobClient.SetTier(ctx, tier, nil,
nil, // Blob versioning
nil, RehydratePriorityNone, nil, lac.pointers())
nil, RehydratePriorityNone, nil, lac.pointers(),
nil) // Blob ifTags
}
// GetProperties returns the blob's properties.

Просмотреть файл

@ -154,6 +154,22 @@ func (bb BlockBlobURL) CopyFromURL(ctx context.Context, source url.URL, metadata
nil, // Blob ifTags
dstLeaseID, nil, srcContentMD5,
blobTagsString, // Blob tags
nil, // seal Blob
)
}
// PutBlobFromURL synchronously creates a new Block Blob with data from the source URL up to a max length of 256MB.
// For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/put-blob-from-url.
func (bb BlockBlobURL) PutBlobFromURL(ctx context.Context, h BlobHTTPHeaders, source url.URL, metadata Metadata, srcac ModifiedAccessConditions, dstac BlobAccessConditions, srcContentMD5 []byte, dstContentMD5 []byte, tier AccessTierType, blobTagsMap BlobTagsMap, cpk ClientProvidedKeyOptions) (*BlockBlobPutBlobFromURLResponse, error) {
srcIfModifiedSince, srcIfUnmodifiedSince, srcIfMatchETag, srcIfNoneMatchETag := srcac.pointers()
dstIfModifiedSince, dstIfUnmodifiedSince, dstIfMatchETag, dstIfNoneMatchETag := dstac.ModifiedAccessConditions.pointers()
dstLeaseID := dstac.LeaseAccessConditions.pointers()
blobTagsString := SerializeBlobTagsHeader(blobTagsMap)
return bb.bbClient.PutBlobFromURL(ctx, 0, source.String(), nil, nil,
&h.ContentType, &h.ContentEncoding, &h.ContentLanguage, dstContentMD5, &h.CacheControl,
metadata, dstLeaseID, &h.ContentDisposition, cpk.EncryptionKey, cpk.EncryptionKeySha256,
cpk.EncryptionAlgorithm, cpk.EncryptionScope, tier, dstIfModifiedSince, dstIfUnmodifiedSince,
dstIfMatchETag, dstIfNoneMatchETag, nil, srcIfModifiedSince, srcIfUnmodifiedSince,
srcIfMatchETag, srcIfNoneMatchETag, nil, nil, srcContentMD5, blobTagsString, nil)
}

Просмотреть файл

@ -126,7 +126,7 @@ func (pb PageBlobURL) ClearPages(ctx context.Context, offset int64, count int64,
cpk.EncryptionKey, cpk.EncryptionKeySha256, cpk.EncryptionAlgorithm, // CPK
cpk.EncryptionScope, // CPK-N
ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan,
ifSequenceNumberEqual, ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil)
ifSequenceNumberEqual, ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil, nil)
}
// GetPageRanges returns the list of valid page ranges for a page blob or snapshot of a page blob.
@ -175,7 +175,7 @@ func (pb PageBlobURL) Resize(ctx context.Context, size int64, ac BlobAccessCondi
return pb.pbClient.Resize(ctx, size, nil, ac.LeaseAccessConditions.pointers(),
cpk.EncryptionKey, cpk.EncryptionKeySha256, cpk.EncryptionAlgorithm, // CPK
cpk.EncryptionScope, // CPK-N
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil)
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil, nil)
}
// UpdateSequenceNumber sets the page blob's sequence number.
@ -188,7 +188,7 @@ func (pb PageBlobURL) UpdateSequenceNumber(ctx context.Context, action SequenceN
ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch := ac.ModifiedAccessConditions.pointers()
return pb.pbClient.UpdateSequenceNumber(ctx, action, nil,
ac.LeaseAccessConditions.pointers(), ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch,
sn, nil)
nil, sn, nil)
}
// StartCopyIncremental begins an operation to start an incremental copy from one page blob's snapshot to this page blob.
@ -202,7 +202,7 @@ func (pb PageBlobURL) StartCopyIncremental(ctx context.Context, source url.URL,
qp.Set("snapshot", snapshot)
source.RawQuery = qp.Encode()
return pb.pbClient.CopyIncremental(ctx, source.String(), nil,
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil)
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil, nil)
}
func (pr PageRange) pointers() *string {

Просмотреть файл

@ -27,11 +27,11 @@ func (s *aztestsSuite) TestSetBlobTags(c *chk.C) {
blockBlobUploadResp, err := blobURL.Upload(ctx, bytes.NewReader([]byte("data")), BlobHTTPHeaders{}, basicMetadata, BlobAccessConditions{}, DefaultAccessTier, nil, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(blockBlobUploadResp.StatusCode(), chk.Equals, 201)
blobSetTagsResponse, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
blobSetTagsResponse, err := blobURL.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)
blobGetTagsResponse, err := blobURL.GetTags(ctx, nil)
blobGetTagsResponse, err := blobURL.GetTags(ctx, nil, nil, nil, nil, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
@ -61,11 +61,11 @@ func (s *aztestsSuite) TestSetBlobTagsWithVID(c *chk.C) {
versionId2 := blockBlobUploadResp.VersionID()
blobURL1 := blobURL.WithVersionID(versionId1)
blobSetTagsResponse, err := blobURL1.SetTags(ctx, nil, nil, nil, blobTagsMap)
blobSetTagsResponse, err := blobURL1.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)
blobGetTagsResponse, err := blobURL1.GetTags(ctx, nil)
blobGetTagsResponse, err := blobURL1.GetTags(ctx, nil, nil, nil, nil, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
@ -74,7 +74,7 @@ func (s *aztestsSuite) TestSetBlobTagsWithVID(c *chk.C) {
}
blobURL2 := blobURL.WithVersionID(versionId2)
blobGetTagsResponse, err = blobURL2.GetTags(ctx, nil)
blobGetTagsResponse, err = blobURL2.GetTags(ctx, nil, nil, nil, nil, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.IsNil)
@ -103,11 +103,11 @@ func (s *aztestsSuite) TestSetBlobTagsWithVID2(c *chk.C) {
}
blobURL1 := blobURL.WithVersionID(versionId1)
blobSetTagsResponse, err := blobURL1.SetTags(ctx, nil, nil, nil, blobTags1)
blobSetTagsResponse, err := blobURL1.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTags1)
c.Assert(err, chk.IsNil)
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)
blobGetTagsResponse, err := blobURL1.GetTags(ctx, nil)
blobGetTagsResponse, err := blobURL1.GetTags(ctx, nil, nil, nil, nil, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
@ -121,11 +121,11 @@ func (s *aztestsSuite) TestSetBlobTagsWithVID2(c *chk.C) {
}
blobURL2 := blobURL.WithVersionID(versionId2)
blobSetTagsResponse, err = blobURL2.SetTags(ctx, nil, nil, nil, blobTags2)
blobSetTagsResponse, err = blobURL2.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTags2)
c.Assert(err, chk.IsNil)
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)
blobGetTagsResponse, err = blobURL2.GetTags(ctx, nil)
blobGetTagsResponse, err = blobURL2.GetTags(ctx, nil, nil, nil, nil, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.NotNil)
@ -148,7 +148,7 @@ func (s *aztestsSuite) TestUploadBlockBlobWithSpecialCharactersInTags(c *chk.C)
c.Assert(err, chk.IsNil)
c.Assert(blockBlobUploadResp.StatusCode(), chk.Equals, 201)
blobGetTagsResponse, err := blobURL.GetTags(ctx, nil)
blobGetTagsResponse, err := blobURL.GetTags(ctx, nil, nil, nil, nil, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
@ -198,7 +198,7 @@ func (s *aztestsSuite) TestStageBlockWithTags(c *chk.C) {
c.Assert(contentData, chk.DeepEquals, []uint8(strings.Join(data, "")))
blobURL1 := blobURL.WithVersionID(versionId)
blobGetTagsResp, err := blobURL1.GetTags(ctx, nil)
blobGetTagsResp, err := blobURL1.GetTags(ctx, nil, nil, nil, nil, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResp, chk.NotNil)
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)
@ -206,7 +206,7 @@ func (s *aztestsSuite) TestStageBlockWithTags(c *chk.C) {
c.Assert(blobTagsMap[blobTag.Key], chk.Equals, blobTag.Value)
}
blobGetTagsResp, err = blobURL.GetTags(ctx, nil)
blobGetTagsResp, err = blobURL.GetTags(ctx, nil, nil, nil, nil, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResp, chk.NotNil)
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)
@ -290,7 +290,7 @@ func (s *aztestsSuite) TestStageBlockFromURLWithTags(c *chk.C) {
c.Assert(err, chk.IsNil)
c.Assert(destData, chk.DeepEquals, sourceData)
blobGetTagsResp, err := destBlob.GetTags(ctx, nil)
blobGetTagsResp, err := destBlob.GetTags(ctx, nil, nil, nil, nil, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)
for _, blobTag := range blobGetTagsResp.BlobTagSet {
@ -402,7 +402,7 @@ func (s *aztestsSuite) TestSetBlobTagForSnapshot(c *chk.C) {
"Storage+SDK": "SDK/GO",
"GO ": ".Net",
}
_, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
_, err := blobURL.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)
resp, err := blobURL.CreateSnapshot(ctx, nil, BlobAccessConditions{}, ClientProvidedKeyOptions{})
@ -433,7 +433,7 @@ func (s *aztestsSuite) TestCreatePageBlobWithTags(c *chk.C) {
c.Assert(putResp.Version(), chk.Not(chk.Equals), "")
c.Assert(putResp.rawResponse.Header.Get("x-ms-version-id"), chk.NotNil)
setTagResp, err := blob.SetTags(ctx, nil, nil, nil, blobTagsMap)
setTagResp, err := blob.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)
c.Assert(setTagResp.StatusCode(), chk.Equals, 204)
@ -447,7 +447,7 @@ func (s *aztestsSuite) TestCreatePageBlobWithTags(c *chk.C) {
"b0l1o2b3": "s0d1k2",
}
setTagResp, err = blob.SetTags(ctx, nil, nil, nil, modifiedBlobTags)
setTagResp, err = blob.SetTags(ctx, nil, nil, nil, nil, nil, nil, modifiedBlobTags)
c.Assert(err, chk.IsNil)
c.Assert(setTagResp.StatusCode(), chk.Equals, 204)
@ -482,7 +482,7 @@ func (s *aztestsSuite) TestSetTagOnPageBlob(c *chk.C) {
"b0l1o2b3": "s0d1k2",
}
setTagResp, err := blob.SetTags(ctx, nil, nil, nil, modifiedBlobTags)
setTagResp, err := blob.SetTags(ctx, nil, nil, nil, nil, nil, nil, modifiedBlobTags)
c.Assert(err, chk.IsNil)
c.Assert(setTagResp.StatusCode(), chk.Equals, 204)
@ -519,7 +519,7 @@ func (s *aztestsSuite) TestListBlobReturnsTags(c *chk.C) {
"tag2": "+-./:=_",
"+-./:=_1": "+-./:=_",
}
resp, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
resp, err := blobURL.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)
c.Assert(resp.StatusCode(), chk.Equals, 204)
@ -582,7 +582,15 @@ func (s *aztestsSuite) TestFindBlobsByTags(c *chk.C) {
c.Assert(err, chk.IsNil)
for _, blob := range lResp.Blobs {
c.Assert(blob.TagValue, chk.Equals, "firsttag")
containsTag := false
for _, tag := range blob.Tags.BlobTagSet {
if tag.Value == "firsttag" {
containsTag = true
}
}
c.Assert(containsTag, chk.Equals, true)
}
}
@ -624,11 +632,11 @@ func (s *aztestsSuite) TestFilterBlobsUsingAccountSAS(c *chk.C) {
}
blobTagsMap := BlobTagsMap{"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"}
setBlobTagsResp, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
setBlobTagsResp, err := blobURL.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
c.Assert(err, chk.IsNil)
c.Assert(setBlobTagsResp.StatusCode(), chk.Equals, 204)
blobGetTagsResp, err := blobURL.GetTags(ctx, nil)
blobGetTagsResp, err := blobURL.GetTags(ctx, nil, nil, nil, nil, nil)
c.Assert(err, chk.IsNil)
c.Assert(blobGetTagsResp.StatusCode(), chk.Equals, 200)
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)

Просмотреть файл

@ -0,0 +1,249 @@
package azblob
import (
"bytes"
"crypto/md5"
chk "gopkg.in/check.v1"
"io/ioutil"
"net/url"
"time"
)
func CreateBlockBlobsForTesting(c *chk.C, size int) (ContainerURL, *SharedKeyCredential, *bytes.Reader, []uint8, [16]uint8, BlockBlobURL, BlockBlobURL) {
bsu := getBSU()
credential, err := getGenericCredential("")
if err != nil {
c.Fatal("Invalid credential")
}
container, _ := createNewContainer(c, bsu)
testSize := size * 1024 * 1024 // 1MB
r, sourceData := getRandomDataAndReader(testSize)
sourceDataMD5Value := md5.Sum(sourceData)
srcBlob := container.NewBlockBlobURL(generateBlobName())
destBlob := container.NewBlockBlobURL(generateBlobName())
return container, credential, r, sourceData, sourceDataMD5Value, srcBlob, destBlob
}
func (s *aztestsSuite) TestPutBlobFromURLWithIncorrectURL(c *chk.C) {
container, _, _, _, sourceDataMD5Value, _, destBlob := CreateBlockBlobsForTesting(c, 8)
defer delContainer(c, container)
// Invoke put blob from URL with URL without SAS and make sure it fails
resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, url.URL{}, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, BlobTagsMap{}, ClientProvidedKeyOptions{})
c.Assert(err, chk.NotNil)
c.Assert(resp, chk.IsNil)
}
func (s *aztestsSuite) TestPutBlobFromURLWithMissingSAS(c *chk.C) {
container, _, r, _, sourceDataMD5Value, srcBlob, destBlob := CreateBlockBlobsForTesting(c, 8)
defer delContainer(c, container)
// Prepare source blob for put.
uploadSrcResp, err := srcBlob.Upload(ctx, r, BlobHTTPHeaders{}, Metadata{}, BlobAccessConditions{}, DefaultAccessTier, nil, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(uploadSrcResp.Response().StatusCode, chk.Equals, 201)
// Invoke put blob from URL with URL without SAS and make sure it fails
resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlob.URL(), basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, BlobTagsMap{}, ClientProvidedKeyOptions{})
c.Assert(err, chk.NotNil)
c.Assert(resp, chk.IsNil)
}
func (s *aztestsSuite) TestSetTierOnPutBlockBlobFromURL(c *chk.C) {
container, credential, r, _, sourceDataMD5Value, srcBlob, _ := CreateBlockBlobsForTesting(c, 1)
defer delContainer(c, container)
// Setting blob tier as "cool"
uploadSrcResp, err := srcBlob.Upload(ctx, r, BlobHTTPHeaders{}, Metadata{}, BlobAccessConditions{}, AccessTierCool, nil, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(uploadSrcResp.Response().StatusCode, chk.Equals, 201)
// Get source blob URL with SAS for StageFromURL.
srcBlobParts := NewBlobURLParts(srcBlob.URL())
srcBlobParts.SAS, err = BlobSASSignatureValues{
Protocol: SASProtocolHTTPS,
ExpiryTime: time.Now().UTC().Add(2 * time.Hour),
ContainerName: srcBlobParts.ContainerName,
BlobName: srcBlobParts.BlobName,
Permissions: BlobSASPermissions{Read: true}.String(),
}.NewSASQueryParameters(credential)
if err != nil {
c.Fatal(err)
}
srcBlobURLWithSAS := srcBlobParts.URL()
for _, tier := range []AccessTierType{AccessTierArchive, AccessTierCool, AccessTierHot} {
destBlob := container.NewBlockBlobURL(generateBlobName())
resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], tier, BlobTagsMap{}, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(resp.Response().StatusCode, chk.Equals, 201)
destBlobPropResp, err := destBlob.GetProperties(ctx, BlobAccessConditions{}, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(destBlobPropResp.AccessTier(), chk.Equals, string(tier))
c.Assert(destBlobPropResp.NewMetadata(), chk.DeepEquals, basicMetadata)
}
}
func (s *aztestsSuite) TestPutBlockBlobFromURL(c *chk.C) {
container, credential, r, sourceData, sourceDataMD5Value, srcBlob, destBlob := CreateBlockBlobsForTesting(c, 8)
defer delContainer(c, container)
// Prepare source blob for copy.
uploadSrcResp, err := srcBlob.Upload(ctx, r, BlobHTTPHeaders{}, Metadata{}, BlobAccessConditions{}, DefaultAccessTier, nil, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(uploadSrcResp.Response().StatusCode, chk.Equals, 201)
// Get source blob URL with SAS for StageFromURL.
srcBlobParts := NewBlobURLParts(srcBlob.URL())
srcBlobParts.SAS, err = BlobSASSignatureValues{
Protocol: SASProtocolHTTPS, // Users MUST use HTTPS (not HTTP)
ExpiryTime: time.Now().UTC().Add(48 * time.Hour), // 48-hours before expiration
ContainerName: srcBlobParts.ContainerName,
BlobName: srcBlobParts.BlobName,
Permissions: BlobSASPermissions{Read: true}.String(),
}.NewSASQueryParameters(credential)
if err != nil {
c.Fatal(err)
}
srcBlobURLWithSAS := srcBlobParts.URL()
// Invoke put blob from URL.
resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, BlobTagsMap{}, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(resp.Response().StatusCode, chk.Equals, 201)
c.Assert(resp.ETag(), chk.Not(chk.Equals), "")
c.Assert(resp.RequestID(), chk.Not(chk.Equals), "")
c.Assert(resp.Version(), chk.Not(chk.Equals), "")
c.Assert(resp.Date().IsZero(), chk.Equals, false)
c.Assert(resp.ContentMD5(), chk.DeepEquals, sourceDataMD5Value[:])
// Check data integrity through downloading.
downloadResp, err := destBlob.BlobURL.Download(ctx, 0, CountToEnd, BlobAccessConditions{}, false, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
destData, err := ioutil.ReadAll(downloadResp.Body(RetryReaderOptions{}))
c.Assert(err, chk.IsNil)
c.Assert(destData, chk.DeepEquals, sourceData)
// Make sure the metadata got copied over
c.Assert(len(downloadResp.NewMetadata()), chk.Equals, 1)
c.Assert(downloadResp.NewMetadata(), chk.DeepEquals, basicMetadata)
}
func (s *aztestsSuite) TestPutBlobFromURLWithSASReturnsVID(c *chk.C) {
container, credential, r, sourceData, sourceDataMD5Value, srcBlob, destBlob := CreateBlockBlobsForTesting(c, 4)
defer delContainer(c, container)
uploadSrcResp, err := srcBlob.Upload(ctx, r, BlobHTTPHeaders{}, Metadata{}, BlobAccessConditions{}, DefaultAccessTier, nil, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(uploadSrcResp.Response().StatusCode, chk.Equals, 201)
c.Assert(uploadSrcResp.Response().Header.Get("x-ms-version-id"), chk.NotNil)
// Get source blob URL with SAS for StageFromURL.
srcBlobParts := NewBlobURLParts(srcBlob.URL())
srcBlobParts.SAS, err = BlobSASSignatureValues{
Protocol: SASProtocolHTTPS, // Users MUST use HTTPS (not HTTP)
ExpiryTime: time.Now().UTC().Add(48 * time.Hour), // 48-hours before expiration
ContainerName: srcBlobParts.ContainerName,
BlobName: srcBlobParts.BlobName,
Permissions: BlobSASPermissions{Read: true}.String(),
}.NewSASQueryParameters(credential)
if err != nil {
c.Fatal(err)
}
srcBlobURLWithSAS := srcBlobParts.URL()
// Invoke put blob from URL
resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, nil, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(resp.Response().StatusCode, chk.Equals, 201)
c.Assert(resp.Version(), chk.Not(chk.Equals), "")
c.Assert(resp.VersionID(), chk.NotNil)
// Check data integrity through downloading.
downloadResp, err := destBlob.BlobURL.Download(ctx, 0, CountToEnd, BlobAccessConditions{}, false, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
destData, err := ioutil.ReadAll(downloadResp.Body(RetryReaderOptions{}))
c.Assert(err, chk.IsNil)
c.Assert(destData, chk.DeepEquals, sourceData)
c.Assert(downloadResp.Response().Header.Get("x-ms-version-id"), chk.NotNil)
c.Assert(len(downloadResp.NewMetadata()), chk.Equals, 1)
c.Assert(downloadResp.NewMetadata(), chk.DeepEquals, basicMetadata)
// Edge case: Not providing any source MD5 should see the CRC getting returned instead and service version matches
resp, err = destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, nil, DefaultAccessTier, nil, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(resp.Response().StatusCode, chk.Equals, 201)
c.Assert(resp.rawResponse.Header.Get("x-mx-content-crc64"), chk.NotNil)
c.Assert(resp.Response().Header.Get("x-ms-version"), chk.Equals, ServiceVersion)
c.Assert(resp.Response().Header.Get("x-ms-version-id"), chk.NotNil)
}
func (s *aztestsSuite) TestPutBlockBlobFromURLWithTags(c *chk.C) {
container, credential, r, sourceData, sourceDataMD5Value, srcBlob, destBlob := CreateBlockBlobsForTesting(c, 1)
defer delContainer(c, container)
blobTagsMap := BlobTagsMap{
"Go": "CPlusPlus",
"Python": "CSharp",
"Javascript": "Android",
}
uploadSrcResp, err := srcBlob.Upload(ctx, r, BlobHTTPHeaders{}, Metadata{}, BlobAccessConditions{}, DefaultAccessTier, blobTagsMap, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(uploadSrcResp.Response().StatusCode, chk.Equals, 201)
// Get source blob URL with SAS for StageFromURL.
srcBlobParts := NewBlobURLParts(srcBlob.URL())
srcBlobParts.SAS, err = BlobSASSignatureValues{
Protocol: SASProtocolHTTPS, // Users MUST use HTTPS (not HTTP)
ExpiryTime: time.Now().UTC().Add(48 * time.Hour), // 48-hours before expiration
ContainerName: srcBlobParts.ContainerName,
BlobName: srcBlobParts.BlobName,
Permissions: BlobSASPermissions{Read: true}.String(),
}.NewSASQueryParameters(credential)
if err != nil {
c.Fatal(err)
}
srcBlobURLWithSAS := srcBlobParts.URL()
// Invoke put blob from URL
resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, blobTagsMap, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(resp.Response().StatusCode, chk.Equals, 201)
c.Assert(resp.ETag(), chk.Not(chk.Equals), "")
c.Assert(resp.RequestID(), chk.Not(chk.Equals), "")
c.Assert(resp.Version(), chk.Not(chk.Equals), "")
c.Assert(resp.Date().IsZero(), chk.Equals, false)
c.Assert(resp.ContentMD5(), chk.DeepEquals, sourceDataMD5Value[:])
// Check data integrity through downloading.
downloadResp, err := destBlob.BlobURL.Download(ctx, 0, CountToEnd, BlobAccessConditions{}, false, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
destData, err := ioutil.ReadAll(downloadResp.Body(RetryReaderOptions{}))
c.Assert(err, chk.IsNil)
c.Assert(destData, chk.DeepEquals, sourceData)
c.Assert(len(downloadResp.NewMetadata()), chk.Equals, 1)
c.Assert(downloadResp.r.rawResponse.Header.Get("x-ms-tag-count"), chk.Equals, "3")
c.Assert(downloadResp.NewMetadata(), chk.DeepEquals, basicMetadata)
// Edge case 1: Provide bad MD5 and make sure the put fails
_, badMD5 := getRandomDataAndReader(16)
_, err = destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, badMD5, badMD5, DefaultAccessTier, blobTagsMap, ClientProvidedKeyOptions{})
c.Assert(err, chk.NotNil)
// Edge case 2: Not providing any source MD5 should see the CRC getting returned instead
resp, err = destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, nil, DefaultAccessTier, blobTagsMap, ClientProvidedKeyOptions{})
c.Assert(err, chk.IsNil)
c.Assert(resp.Response().StatusCode, chk.Equals, 201)
c.Assert(resp.rawResponse.Header.Get("x-mx-content-crc64"), chk.NotNil)
}

Просмотреть файл

@ -1,15 +1,8 @@
package azblob
import (
"bytes"
"strings"
"time"
chk "gopkg.in/check.v1"
)
// TODO: This test will be addressed, it is failing due to a service change
//Creates a container and tests permissions by listing blobs
func (s *aztestsSuite) TestUserDelegationSASContainer(c *chk.C) {
/*func (s *aztestsSuite) TestUserDelegationSASContainer(c *chk.C) {
bsu := getBSU()
containerURL, containerName := getContainerURL(c, bsu)
currentTime := time.Now().UTC()
@ -81,10 +74,11 @@ func (s *aztestsSuite) TestUserDelegationSASContainer(c *chk.C) {
if err != nil {
c.Fatal(err)
}
}
}*/
// TODO: This test will be addressed, it is failing due to a service change
// Creates a blob, takes a snapshot, downloads from snapshot, and deletes from the snapshot w/ the token
func (s *aztestsSuite) TestUserDelegationSASBlob(c *chk.C) {
/*func (s *aztestsSuite) TestUserDelegationSASBlob(c *chk.C) {
// Accumulate prerequisite details to create storage etc.
bsu := getBSU()
containerURL, containerName := getContainerURL(c, bsu)
@ -161,4 +155,4 @@ func (s *aztestsSuite) TestUserDelegationSASBlob(c *chk.C) {
if err != nil {
c.Fatal(err)
}
}
}*/

Просмотреть файл

@ -366,16 +366,15 @@ func (client blobClient) changeLeaseResponder(resp pipeline.Response) (pipeline.
// only succeeds if the resource's lease is active and matches this ID. requestID is provides a client-generated,
// opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is
// enabled. sourceContentMD5 is specify the md5 calculated for the range of bytes that must be read from the copy
// source. blobTagsString is optional. Used to set blob tags in various blob operations. sealBlob is overrides the
// sealed state of the destination blob. Service version 2019-12-12 and newer.
func (client blobClient) CopyFromURL(ctx context.Context, copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, leaseID *string, requestID *string, sourceContentMD5 []byte, blobTagsString *string, sealBlob *bool) (*BlobCopyFromURLResponse, error) {
// source. blobTagsString is optional. Used to set blob tags in various blob operations.
func (client blobClient) CopyFromURL(ctx context.Context, copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, leaseID *string, requestID *string, sourceContentMD5 []byte, blobTagsString *string) (*BlobCopyFromURLResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.copyFromURLPreparer(copySource, timeout, metadata, tier, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseID, requestID, sourceContentMD5, blobTagsString, sealBlob)
req, err := client.copyFromURLPreparer(copySource, timeout, metadata, tier, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseID, requestID, sourceContentMD5, blobTagsString)
if err != nil {
return nil, err
}
@ -387,7 +386,7 @@ func (client blobClient) CopyFromURL(ctx context.Context, copySource string, tim
}
// copyFromURLPreparer prepares the CopyFromURL request.
func (client blobClient) copyFromURLPreparer(copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, leaseID *string, requestID *string, sourceContentMD5 []byte, blobTagsString *string, sealBlob *bool) (pipeline.Request, error) {
func (client blobClient) copyFromURLPreparer(copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, leaseID *string, requestID *string, sourceContentMD5 []byte, blobTagsString *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@ -446,9 +445,6 @@ func (client blobClient) copyFromURLPreparer(copySource string, timeout *int32,
if blobTagsString != nil {
req.Header.Set("x-ms-tags", *blobTagsString)
}
if sealBlob != nil {
req.Header.Set("x-ms-seal-blob", strconv.FormatBool(*sealBlob))
}
req.Header.Set("x-ms-requires-sync", "true")
return req, nil
}
@ -599,15 +595,16 @@ func (client blobClient) createSnapshotResponder(resp pipeline.Response) (pipeli
// blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value.
// ifTags is specify a SQL where clause on blob tags to operate only on blobs with a matching value. requestID is
// provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when
// storage analytics logging is enabled.
func (client blobClient) Delete(ctx context.Context, snapshot *string, versionID *string, timeout *int32, leaseID *string, deleteSnapshots DeleteSnapshotsOptionType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*BlobDeleteResponse, error) {
// storage analytics logging is enabled. blobDeleteType is optional. Only possible value is 'permanent', which
// specifies to permanently delete a blob if blob soft delete is enabled.
func (client blobClient) Delete(ctx context.Context, snapshot *string, versionID *string, timeout *int32, leaseID *string, deleteSnapshots DeleteSnapshotsOptionType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string, blobDeleteType BlobDeleteType) (*BlobDeleteResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.deletePreparer(snapshot, versionID, timeout, leaseID, deleteSnapshots, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestID)
req, err := client.deletePreparer(snapshot, versionID, timeout, leaseID, deleteSnapshots, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestID, blobDeleteType)
if err != nil {
return nil, err
}
@ -619,7 +616,7 @@ func (client blobClient) Delete(ctx context.Context, snapshot *string, versionID
}
// deletePreparer prepares the Delete request.
func (client blobClient) deletePreparer(snapshot *string, versionID *string, timeout *int32, leaseID *string, deleteSnapshots DeleteSnapshotsOptionType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (pipeline.Request, error) {
func (client blobClient) deletePreparer(snapshot *string, versionID *string, timeout *int32, leaseID *string, deleteSnapshots DeleteSnapshotsOptionType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string, blobDeleteType BlobDeleteType) (pipeline.Request, error) {
req, err := pipeline.NewRequest("DELETE", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@ -634,6 +631,9 @@ func (client blobClient) deletePreparer(snapshot *string, versionID *string, tim
if timeout != nil {
params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
}
if blobDeleteType != BlobDeleteNone {
params.Set("deletetype", string(blobDeleteType))
}
req.URL.RawQuery = params.Encode()
if leaseID != nil {
req.Header.Set("x-ms-lease-id", *leaseID)
@ -1020,15 +1020,16 @@ func (client blobClient) getPropertiesResponder(resp pipeline.Response) (pipelin
// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating
// a Snapshot of a Blob.</a> versionID is the version id parameter is an opaque DateTime value that, when present,
// specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. ifTags is specify a
// SQL where clause on blob tags to operate only on blobs with a matching value.
func (client blobClient) GetTags(ctx context.Context, timeout *int32, requestID *string, snapshot *string, versionID *string, ifTags *string) (*BlobTags, error) {
// SQL where clause on blob tags to operate only on blobs with a matching value. leaseID is if specified, the operation
// only succeeds if the resource's lease is active and matches this ID.
func (client blobClient) GetTags(ctx context.Context, timeout *int32, requestID *string, snapshot *string, versionID *string, ifTags *string, leaseID *string) (*BlobTags, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.getTagsPreparer(timeout, requestID, snapshot, versionID, ifTags)
req, err := client.getTagsPreparer(timeout, requestID, snapshot, versionID, ifTags, leaseID)
if err != nil {
return nil, err
}
@ -1040,7 +1041,7 @@ func (client blobClient) GetTags(ctx context.Context, timeout *int32, requestID
}
// getTagsPreparer prepares the GetTags request.
func (client blobClient) getTagsPreparer(timeout *int32, requestID *string, snapshot *string, versionID *string, ifTags *string) (pipeline.Request, error) {
func (client blobClient) getTagsPreparer(timeout *int32, requestID *string, snapshot *string, versionID *string, ifTags *string, leaseID *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("GET", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@ -1064,6 +1065,9 @@ func (client blobClient) getTagsPreparer(timeout *int32, requestID *string, snap
if ifTags != nil {
req.Header.Set("x-ms-if-tags", *ifTags)
}
if leaseID != nil {
req.Header.Set("x-ms-lease-id", *leaseID)
}
return req, nil
}
@ -1092,107 +1096,111 @@ func (client blobClient) getTagsResponder(resp pipeline.Response) (pipeline.Resp
return result, nil
}
// TODO funky quick query code
//// Query the Query operation enables users to select/project on blob data by providing simple query expressions.
////
//// snapshot is the snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to
//// retrieve. For more information on working with blob snapshots, see <a
//// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating
//// a Snapshot of a Blob.</a> timeout is the timeout parameter is expressed in seconds. For more information, see <a
//// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
//// Timeouts for Blob Service Operations.</a> leaseID is if specified, the operation only succeeds if the resource's
//// lease is active and matches this ID. encryptionKey is optional. Specifies the encryption key to use to encrypt the
//// data provided in the request. If not specified, encryption is performed with the root account encryption key. For
//// more information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of the
//// provided encryption key. Must be provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is the
//// algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided
//// if the x-ms-encryption-key header is provided. ifModifiedSince is specify this header value to operate only on a
//// blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to
//// operate only on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value
//// to operate only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs
//// without a matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is
//// recorded in the analytics logs when storage analytics logging is enabled.
//func (client blobClient) Query(ctx context.Context, snapshot *string, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*QueryResponse, error) {
// if err := validate([]validation{
// {targetValue: timeout,
// constraints: []constraint{{target: "timeout", name: null, rule: false,
// chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
// return nil, err
// }
// req, err := client.queryPreparer(snapshot, timeout, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID)
// if err != nil {
// return nil, err
// }
// resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.queryResponder}, req)
// if err != nil {
// return nil, err
// }
// return resp.(*QueryResponse), err
//}
// todo funky quick query code
// // Query the Query operation enables users to select/project on blob data by providing simple query expressions.
// //
// // snapshot is the snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to
// // retrieve. For more information on working with blob snapshots, see <a
// // href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating
// // a Snapshot of a Blob.</a> timeout is the timeout parameter is expressed in seconds. For more information, see <a
// // href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
// // Timeouts for Blob Service Operations.</a> leaseID is if specified, the operation only succeeds if the resource's
// // lease is active and matches this ID. encryptionKey is optional. Specifies the encryption key to use to encrypt the
// // data provided in the request. If not specified, encryption is performed with the root account encryption key. For
// // more information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of the
// // provided encryption key. Must be provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is the
// // algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided
// // if the x-ms-encryption-key header is provided. ifModifiedSince is specify this header value to operate only on a
// // blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to
// // operate only on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value
// // to operate only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs
// // without a matching value. ifTags is specify a SQL where clause on blob tags to operate only on blobs with a matching
// // value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded in the
// // analytics logs when storage analytics logging is enabled.
// func (client blobClient) Query(ctx context.Context, snapshot *string, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*QueryResponse, error) {
// if err := validate([]validation{
// {targetValue: timeout,
// constraints: []constraint{{target: "timeout", name: null, rule: false,
// chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
// return nil, err
// }
// req, err := client.queryPreparer(snapshot, timeout, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestID)
// if err != nil {
// return nil, err
// }
// resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.queryResponder}, req)
// if err != nil {
// return nil, err
// }
// return resp.(*QueryResponse), err
// }
//
//// queryPreparer prepares the Query request.
//func (client blobClient) queryPreparer(snapshot *string, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) {
// req, err := pipeline.NewRequest("POST", client.url, nil)
// if err != nil {
// return req, pipeline.NewError(err, "failed to create request")
// }
// params := req.URL.Query()
// if snapshot != nil && len(*snapshot) > 0 {
// params.Set("snapshot", *snapshot)
// }
// if timeout != nil {
// params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
// }
// params.Set("comp", "query")
// req.URL.RawQuery = params.Encode()
// if leaseID != nil {
// req.Header.Set("x-ms-lease-id", *leaseID)
// }
// if encryptionKey != nil {
// req.Header.Set("x-ms-encryption-key", *encryptionKey)
// }
// if encryptionKeySha256 != nil {
// req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256)
// }
// if encryptionAlgorithm != EncryptionAlgorithmNone {
// req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm))
// }
// if ifModifiedSince != nil {
// req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
// }
// if ifUnmodifiedSince != nil {
// req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
// }
// if ifMatch != nil {
// req.Header.Set("If-Match", string(*ifMatch))
// }
// if ifNoneMatch != nil {
// req.Header.Set("If-None-Match", string(*ifNoneMatch))
// }
// req.Header.Set("x-ms-version", ServiceVersion)
// if requestID != nil {
// req.Header.Set("x-ms-client-request-id", *requestID)
// }
// b, err := xml.Marshal(queryRequest)
// if err != nil {
// return req, pipeline.NewError(err, "failed to marshal request body")
// }
// req.Header.Set("Content-Type", "application/xml")
// err = req.SetBody(bytes.NewReader(b))
// if err != nil {
// return req, pipeline.NewError(err, "failed to set request body")
// }
// return req, nil
//}
// // queryPreparer prepares the Query request.
// func (client blobClient) queryPreparer(snapshot *string, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (pipeline.Request, error) {
// req, err := pipeline.NewRequest("POST", client.url, nil)
// if err != nil {
// return req, pipeline.NewError(err, "failed to create request")
// }
// params := req.URL.Query()
// if snapshot != nil && len(*snapshot) > 0 {
// params.Set("snapshot", *snapshot)
// }
// if timeout != nil {
// params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
// }
// params.Set("comp", "query")
// req.URL.RawQuery = params.Encode()
// if leaseID != nil {
// req.Header.Set("x-ms-lease-id", *leaseID)
// }
// if encryptionKey != nil {
// req.Header.Set("x-ms-encryption-key", *encryptionKey)
// }
// if encryptionKeySha256 != nil {
// req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256)
// }
// if encryptionAlgorithm != EncryptionAlgorithmNone {
// req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm))
// }
// if ifModifiedSince != nil {
// req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
// }
// if ifUnmodifiedSince != nil {
// req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
// }
// if ifMatch != nil {
// req.Header.Set("If-Match", string(*ifMatch))
// }
// if ifNoneMatch != nil {
// req.Header.Set("If-None-Match", string(*ifNoneMatch))
// }
// if ifTags != nil {
// req.Header.Set("x-ms-if-tags", *ifTags)
// }
// req.Header.Set("x-ms-version", ServiceVersion)
// if requestID != nil {
// req.Header.Set("x-ms-client-request-id", *requestID)
// }
// b, err := xml.Marshal(queryRequest)
// if err != nil {
// return req, pipeline.NewError(err, "failed to marshal request body")
// }
// req.Header.Set("Content-Type", "application/xml")
// err = req.SetBody(bytes.NewReader(b))
// if err != nil {
// return req, pipeline.NewError(err, "failed to set request body")
// }
// return req, nil
// }
//
//// queryResponder handles the response to the Query request.
//func (client blobClient) queryResponder(resp pipeline.Response) (pipeline.Response, error) {
// err := validateResponse(resp, http.StatusOK, http.StatusPartialContent)
// if resp == nil {
// return nil, err
// }
// return &QueryResponse{rawResponse: resp.Response()}, err
//}
// // queryResponder handles the response to the Query request.
// func (client blobClient) queryResponder(resp pipeline.Response) (pipeline.Response, error) {
// err := validateResponse(resp, http.StatusOK, http.StatusPartialContent)
// if resp == nil {
// return nil, err
// }
// return &QueryResponse{rawResponse: resp.Response()}, err
// }
// ReleaseLease [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
// operations
@ -1272,146 +1280,145 @@ func (client blobClient) releaseLeaseResponder(resp pipeline.Response) (pipeline
return &BlobReleaseLeaseResponse{rawResponse: resp.Response()}, err
}
// TODO funky rename API
//// Rename rename a blob/file. By default, the destination is overwritten and if the destination already exists and has
//// a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see
//// [Specifying Conditional Headers for Blob Service
//// Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
//// To fail if the destination already exists, use a conditional request with If-None-Match: "*".
////
//// renameSource is the file or directory to be renamed. The value must have the following format:
//// "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties;
//// otherwise, the existing properties will be preserved. timeout is the timeout parameter is expressed in seconds. For
//// more information, see <a
//// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
//// Timeouts for Blob Service Operations.</a> directoryProperties is optional. User-defined properties to be stored
//// with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...",
//// where each value is base64 encoded. posixPermissions is optional and only valid if Hierarchical Namespace is enabled
//// for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may
//// be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and
//// 4-digit octal notation (e.g. 0766) are supported. posixUmask is only valid if Hierarchical Namespace is enabled for
//// the account. This umask restricts permission settings for file and directory, and will only be applied when default
//// Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be
//// disabled. Otherwise the corresponding permission will be determined by the permission. A 4-digit octal notation
//// (e.g. 0022) is supported here. If no umask was specified, a default umask - 0027 will be used. cacheControl is cache
//// control for given resource contentType is content type for given resource contentEncoding is content encoding for
//// given resource contentLanguage is content language for given resource contentDisposition is content disposition for
//// given resource leaseID is if specified, the operation only succeeds if the resource's lease is active and matches
//// this ID. sourceLeaseID is a lease ID for the source path. If specified, the source path must have an active lease
//// and the lease ID must match. ifModifiedSince is specify this header value to operate only on a blob if it has been
//// modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if
//// it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate only on blobs
//// with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value.
//// sourceIfModifiedSince is specify this header value to operate only on a blob if it has been modified since the
//// specified date/time. sourceIfUnmodifiedSince is specify this header value to operate only on a blob if it has not
//// been modified since the specified date/time. sourceIfMatch is specify an ETag value to operate only on blobs with a
//// matching value. sourceIfNoneMatch is specify an ETag value to operate only on blobs without a matching value.
//// requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics
//// logs when storage analytics logging is enabled.
//func (client blobClient) Rename(ctx context.Context, renameSource string, timeout *int32, directoryProperties *string, posixPermissions *string, posixUmask *string, cacheControl *string, contentType *string, contentEncoding *string, contentLanguage *string, contentDisposition *string, leaseID *string, sourceLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string) (*BlobRenameResponse, error) {
// if err := validate([]validation{
// {targetValue: timeout,
// constraints: []constraint{{target: "timeout", name: null, rule: false,
// chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
// return nil, err
// }
// req, err := client.renamePreparer(renameSource, timeout, directoryProperties, posixPermissions, posixUmask, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseID, sourceLeaseID, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestID)
// if err != nil {
// return nil, err
// }
// resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.renameResponder}, req)
// if err != nil {
// return nil, err
// }
// return resp.(*BlobRenameResponse), err
//}
// Rename rename a blob/file. By default, the destination is overwritten and if the destination already exists and has
// a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see
// [Specifying Conditional Headers for Blob Service
// Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
// To fail if the destination already exists, use a conditional request with If-None-Match: "*".
//
//// renamePreparer prepares the Rename request.
//func (client blobClient) renamePreparer(renameSource string, timeout *int32, directoryProperties *string, posixPermissions *string, posixUmask *string, cacheControl *string, contentType *string, contentEncoding *string, contentLanguage *string, contentDisposition *string, leaseID *string, sourceLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string) (pipeline.Request, error) {
// req, err := pipeline.NewRequest("PUT", client.url, nil)
// if err != nil {
// return req, pipeline.NewError(err, "failed to create request")
// }
// params := req.URL.Query()
// if timeout != nil {
// params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
// }
// if pathRenameMode != PathRenameModeNone {
// params.Set("mode", string(client.PathRenameMode))
// }
// req.URL.RawQuery = params.Encode()
// req.Header.Set("x-ms-rename-source", renameSource)
// if directoryProperties != nil {
// req.Header.Set("x-ms-properties", *directoryProperties)
// }
// if posixPermissions != nil {
// req.Header.Set("x-ms-permissions", *posixPermissions)
// }
// if posixUmask != nil {
// req.Header.Set("x-ms-umask", *posixUmask)
// }
// if cacheControl != nil {
// req.Header.Set("x-ms-cache-control", *cacheControl)
// }
// if contentType != nil {
// req.Header.Set("x-ms-content-type", *contentType)
// }
// if contentEncoding != nil {
// req.Header.Set("x-ms-content-encoding", *contentEncoding)
// }
// if contentLanguage != nil {
// req.Header.Set("x-ms-content-language", *contentLanguage)
// }
// if contentDisposition != nil {
// req.Header.Set("x-ms-content-disposition", *contentDisposition)
// }
// if leaseID != nil {
// req.Header.Set("x-ms-lease-id", *leaseID)
// }
// if sourceLeaseID != nil {
// req.Header.Set("x-ms-source-lease-id", *sourceLeaseID)
// }
// if ifModifiedSince != nil {
// req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
// }
// if ifUnmodifiedSince != nil {
// req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
// }
// if ifMatch != nil {
// req.Header.Set("If-Match", string(*ifMatch))
// }
// if ifNoneMatch != nil {
// req.Header.Set("If-None-Match", string(*ifNoneMatch))
// }
// if sourceIfModifiedSince != nil {
// req.Header.Set("x-ms-source-if-modified-since", (*sourceIfModifiedSince).In(gmt).Format(time.RFC1123))
// }
// if sourceIfUnmodifiedSince != nil {
// req.Header.Set("x-ms-source-if-unmodified-since", (*sourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123))
// }
// if sourceIfMatch != nil {
// req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch))
// }
// if sourceIfNoneMatch != nil {
// req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch))
// }
// req.Header.Set("x-ms-version", ServiceVersion)
// if requestID != nil {
// req.Header.Set("x-ms-client-request-id", *requestID)
// }
// return req, nil
//}
//
//// renameResponder handles the response to the Rename request.
//func (client blobClient) renameResponder(resp pipeline.Response) (pipeline.Response, error) {
// err := validateResponse(resp, http.StatusOK, http.StatusCreated)
// if resp == nil {
// return nil, err
// }
// io.Copy(ioutil.Discard, resp.Response().Body)
// resp.Response().Body.Close()
// return &BlobRenameResponse{rawResponse: resp.Response()}, err
//}
// renameSource is the file or directory to be renamed. The value must have the following format:
// "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties;
// otherwise, the existing properties will be preserved. timeout is the timeout parameter is expressed in seconds. For
// more information, see <a
// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
// Timeouts for Blob Service Operations.</a> directoryProperties is optional. User-defined properties to be stored
// with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...",
// where each value is base64 encoded. posixPermissions is optional and only valid if Hierarchical Namespace is enabled
// for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may
// be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and
// 4-digit octal notation (e.g. 0766) are supported. posixUmask is only valid if Hierarchical Namespace is enabled for
// the account. This umask restricts permission settings for file and directory, and will only be applied when default
// Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be
// disabled. Otherwise the corresponding permission will be determined by the permission. A 4-digit octal notation
// (e.g. 0022) is supported here. If no umask was specified, a default umask - 0027 will be used. cacheControl is cache
// control for given resource contentType is content type for given resource contentEncoding is content encoding for
// given resource contentLanguage is content language for given resource contentDisposition is content disposition for
// given resource leaseID is if specified, the operation only succeeds if the resource's lease is active and matches
// this ID. sourceLeaseID is a lease ID for the source path. If specified, the source path must have an active lease
// and the lease ID must match. ifModifiedSince is specify this header value to operate only on a blob if it has been
// modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if
// it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate only on blobs
// with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value.
// sourceIfModifiedSince is specify this header value to operate only on a blob if it has been modified since the
// specified date/time. sourceIfUnmodifiedSince is specify this header value to operate only on a blob if it has not
// been modified since the specified date/time. sourceIfMatch is specify an ETag value to operate only on blobs with a
// matching value. sourceIfNoneMatch is specify an ETag value to operate only on blobs without a matching value.
// requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics
// logs when storage analytics logging is enabled.
func (client blobClient) Rename(ctx context.Context, renameSource string, timeout *int32, directoryProperties *string, posixPermissions *string, posixUmask *string, cacheControl *string, contentType *string, contentEncoding *string, contentLanguage *string, contentDisposition *string, leaseID *string, sourceLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string) (*BlobRenameResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.renamePreparer(renameSource, timeout, directoryProperties, posixPermissions, posixUmask, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseID, sourceLeaseID, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestID)
if err != nil {
return nil, err
}
resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.renameResponder}, req)
if err != nil {
return nil, err
}
return resp.(*BlobRenameResponse), err
}
// renamePreparer prepares the Rename request.
func (client blobClient) renamePreparer(renameSource string, timeout *int32, directoryProperties *string, posixPermissions *string, posixUmask *string, cacheControl *string, contentType *string, contentEncoding *string, contentLanguage *string, contentDisposition *string, leaseID *string, sourceLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
}
params := req.URL.Query()
if timeout != nil {
params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
}
// if pathRenameMode != PathRenameModeNone {
// params.Set("mode", string(client.PathRenameMode))
// }
req.URL.RawQuery = params.Encode()
req.Header.Set("x-ms-rename-source", renameSource)
if directoryProperties != nil {
req.Header.Set("x-ms-properties", *directoryProperties)
}
if posixPermissions != nil {
req.Header.Set("x-ms-permissions", *posixPermissions)
}
if posixUmask != nil {
req.Header.Set("x-ms-umask", *posixUmask)
}
if cacheControl != nil {
req.Header.Set("x-ms-cache-control", *cacheControl)
}
if contentType != nil {
req.Header.Set("x-ms-content-type", *contentType)
}
if contentEncoding != nil {
req.Header.Set("x-ms-content-encoding", *contentEncoding)
}
if contentLanguage != nil {
req.Header.Set("x-ms-content-language", *contentLanguage)
}
if contentDisposition != nil {
req.Header.Set("x-ms-content-disposition", *contentDisposition)
}
if leaseID != nil {
req.Header.Set("x-ms-lease-id", *leaseID)
}
if sourceLeaseID != nil {
req.Header.Set("x-ms-source-lease-id", *sourceLeaseID)
}
if ifModifiedSince != nil {
req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
}
if ifUnmodifiedSince != nil {
req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
}
if ifMatch != nil {
req.Header.Set("If-Match", string(*ifMatch))
}
if ifNoneMatch != nil {
req.Header.Set("If-None-Match", string(*ifNoneMatch))
}
if sourceIfModifiedSince != nil {
req.Header.Set("x-ms-source-if-modified-since", (*sourceIfModifiedSince).In(gmt).Format(time.RFC1123))
}
if sourceIfUnmodifiedSince != nil {
req.Header.Set("x-ms-source-if-unmodified-since", (*sourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123))
}
if sourceIfMatch != nil {
req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch))
}
if sourceIfNoneMatch != nil {
req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch))
}
req.Header.Set("x-ms-version", ServiceVersion)
if requestID != nil {
req.Header.Set("x-ms-client-request-id", *requestID)
}
return req, nil
}
// renameResponder handles the response to the Rename request.
func (client blobClient) renameResponder(resp pipeline.Response) (pipeline.Response, error) {
err := validateResponse(resp, http.StatusOK, http.StatusCreated)
if resp == nil {
return nil, err
}
io.Copy(ioutil.Discard, resp.Response().Body)
resp.Response().Body.Close()
return &BlobRenameResponse{rawResponse: resp.Response()}, err
}
// RenewLease [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
// operations
@ -1866,15 +1873,16 @@ func (client blobClient) setMetadataResponder(resp pipeline.Response) (pipeline.
// transactionalContentCrc64 is specify the transactional crc64 for the body, to be validated by the service. requestID
// is provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when
// storage analytics logging is enabled. ifTags is specify a SQL where clause on blob tags to operate only on blobs
// with a matching value. tags is blob tags
func (client blobClient) SetTags(ctx context.Context, timeout *int32, versionID *string, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, requestID *string, ifTags *string, tags *BlobTags) (*BlobSetTagsResponse, error) {
// with a matching value. leaseID is if specified, the operation only succeeds if the resource's lease is active and
// matches this ID. tags is blob tags
func (client blobClient) SetTags(ctx context.Context, timeout *int32, versionID *string, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, requestID *string, ifTags *string, leaseID *string, tags *BlobTags) (*BlobSetTagsResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.setTagsPreparer(timeout, versionID, transactionalContentMD5, transactionalContentCrc64, requestID, ifTags, tags)
req, err := client.setTagsPreparer(timeout, versionID, transactionalContentMD5, transactionalContentCrc64, requestID, ifTags, leaseID, tags)
if err != nil {
return nil, err
}
@ -1886,7 +1894,7 @@ func (client blobClient) SetTags(ctx context.Context, timeout *int32, versionID
}
// setTagsPreparer prepares the SetTags request.
func (client blobClient) setTagsPreparer(timeout *int32, versionID *string, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, requestID *string, ifTags *string, tags *BlobTags) (pipeline.Request, error) {
func (client blobClient) setTagsPreparer(timeout *int32, versionID *string, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, requestID *string, ifTags *string, leaseID *string, tags *BlobTags) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@ -1913,6 +1921,9 @@ func (client blobClient) setTagsPreparer(timeout *int32, versionID *string, tran
if ifTags != nil {
req.Header.Set("x-ms-if-tags", *ifTags)
}
if leaseID != nil {
req.Header.Set("x-ms-lease-id", *leaseID)
}
b, err := xml.Marshal(tags)
if err != nil {
return req, pipeline.NewError(err, "failed to marshal request body")
@ -1952,15 +1963,16 @@ func (client blobClient) setTagsResponder(resp pipeline.Response) (pipeline.Resp
// Timeouts for Blob Service Operations.</a> rehydratePriority is optional: Indicates the priority with which to
// rehydrate an archived blob. requestID is provides a client-generated, opaque value with a 1 KB character limit that
// is recorded in the analytics logs when storage analytics logging is enabled. leaseID is if specified, the operation
// only succeeds if the resource's lease is active and matches this ID.
func (client blobClient) SetTier(ctx context.Context, tier AccessTierType, snapshot *string, versionID *string, timeout *int32, rehydratePriority RehydratePriorityType, requestID *string, leaseID *string) (*BlobSetTierResponse, error) {
// only succeeds if the resource's lease is active and matches this ID. ifTags is specify a SQL where clause on blob
// tags to operate only on blobs with a matching value.
func (client blobClient) SetTier(ctx context.Context, tier AccessTierType, snapshot *string, versionID *string, timeout *int32, rehydratePriority RehydratePriorityType, requestID *string, leaseID *string, ifTags *string) (*BlobSetTierResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.setTierPreparer(tier, snapshot, versionID, timeout, rehydratePriority, requestID, leaseID)
req, err := client.setTierPreparer(tier, snapshot, versionID, timeout, rehydratePriority, requestID, leaseID, ifTags)
if err != nil {
return nil, err
}
@ -1972,7 +1984,7 @@ func (client blobClient) SetTier(ctx context.Context, tier AccessTierType, snaps
}
// setTierPreparer prepares the SetTier request.
func (client blobClient) setTierPreparer(tier AccessTierType, snapshot *string, versionID *string, timeout *int32, rehydratePriority RehydratePriorityType, requestID *string, leaseID *string) (pipeline.Request, error) {
func (client blobClient) setTierPreparer(tier AccessTierType, snapshot *string, versionID *string, timeout *int32, rehydratePriority RehydratePriorityType, requestID *string, leaseID *string, ifTags *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@ -2000,6 +2012,9 @@ func (client blobClient) setTierPreparer(tier AccessTierType, snapshot *string,
if leaseID != nil {
req.Header.Set("x-ms-lease-id", *leaseID)
}
if ifTags != nil {
req.Header.Set("x-ms-if-tags", *ifTags)
}
return req, nil
}

Просмотреть файл

@ -275,6 +275,188 @@ func (client blockBlobClient) getBlockListResponder(resp pipeline.Response) (pip
return result, nil
}
// PutBlobFromURL the Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from
// a given URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with
// Put Blob from URL; the content of an existing blob is overwritten with the content of the new blob. To perform
// partial updates to a block blobs contents using a source URL, use the Put Block from URL API in conjunction with
// Put Block List.
//
// contentLength is the length of the request. copySource is specifies the name of the source page blob snapshot. This
// value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it
// would appear in a request URI. The source blob must either be public or must be authenticated via a shared access
// signature. timeout is the timeout parameter is expressed in seconds. For more information, see <a
// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
// Timeouts for Blob Service Operations.</a> transactionalContentMD5 is specify the transactional md5 for the body, to
// be validated by the service. blobContentType is optional. Sets the blob's content type. If specified, this property
// is stored with the blob and returned with a read request. blobContentEncoding is optional. Sets the blob's content
// encoding. If specified, this property is stored with the blob and returned with a read request. blobContentLanguage
// is optional. Set the blob's content language. If specified, this property is stored with the blob and returned with
// a read request. blobContentMD5 is optional. An MD5 hash of the blob content. Note that this hash is not validated,
// as the hashes for the individual blocks were validated when each was uploaded. blobCacheControl is optional. Sets
// the blob's cache control. If specified, this property is stored with the blob and returned with a read request.
// metadata is optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are
// specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more
// name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not
// copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the
// naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information.
// leaseID is if specified, the operation only succeeds if the resource's lease is active and matches this ID.
// blobContentDisposition is optional. Sets the blob's Content-Disposition header. encryptionKey is optional. Specifies
// the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed
// with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services.
// encryptionKeySha256 is the SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key
// header is provided. encryptionAlgorithm is the algorithm used to produce the encryption key hash. Currently, the
// only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. encryptionScope is
// optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data
// provided in the request. If not specified, encryption is performed with the default account encryption scope. For
// more information, see Encryption at Rest for Azure Storage Services. tier is optional. Indicates the tier to be set
// on the blob. ifModifiedSince is specify this header value to operate only on a blob if it has been modified since
// the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if it has not been
// modified since the specified date/time. ifMatch is specify an ETag value to operate only on blobs with a matching
// value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. ifTags is specify a
// SQL where clause on blob tags to operate only on blobs with a matching value. sourceIfModifiedSince is specify this
// header value to operate only on a blob if it has been modified since the specified date/time.
// sourceIfUnmodifiedSince is specify this header value to operate only on a blob if it has not been modified since the
// specified date/time. sourceIfMatch is specify an ETag value to operate only on blobs with a matching value.
// sourceIfNoneMatch is specify an ETag value to operate only on blobs without a matching value. sourceIfTags is
// specify a SQL where clause on blob tags to operate only on blobs with a matching value. requestID is provides a
// client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage
// analytics logging is enabled. sourceContentMD5 is specify the md5 calculated for the range of bytes that must be
// read from the copy source. blobTagsString is optional. Used to set blob tags in various blob operations.
// copySourceBlobProperties is optional, default is true. Indicates if properties from the source blob should be
// copied.
func (client blockBlobClient) PutBlobFromURL(ctx context.Context, contentLength int64, copySource string, timeout *int32, transactionalContentMD5 []byte, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, blobCacheControl *string, metadata map[string]string, leaseID *string, blobContentDisposition *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, tier AccessTierType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, sourceIfTags *string, requestID *string, sourceContentMD5 []byte, blobTagsString *string, copySourceBlobProperties *bool) (*BlockBlobPutBlobFromURLResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.putBlobFromURLPreparer(contentLength, copySource, timeout, transactionalContentMD5, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5, blobCacheControl, metadata, leaseID, blobContentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, requestID, sourceContentMD5, blobTagsString, copySourceBlobProperties)
if err != nil {
return nil, err
}
resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.putBlobFromURLResponder}, req)
if err != nil {
return nil, err
}
return resp.(*BlockBlobPutBlobFromURLResponse), err
}
// putBlobFromURLPreparer prepares the PutBlobFromURL request.
func (client blockBlobClient) putBlobFromURLPreparer(contentLength int64, copySource string, timeout *int32, transactionalContentMD5 []byte, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, blobCacheControl *string, metadata map[string]string, leaseID *string, blobContentDisposition *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, tier AccessTierType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, sourceIfTags *string, requestID *string, sourceContentMD5 []byte, blobTagsString *string, copySourceBlobProperties *bool) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
}
params := req.URL.Query()
if timeout != nil {
params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
}
req.URL.RawQuery = params.Encode()
if transactionalContentMD5 != nil {
req.Header.Set("Content-MD5", base64.StdEncoding.EncodeToString(transactionalContentMD5))
}
req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10))
if blobContentType != nil {
req.Header.Set("x-ms-blob-content-type", *blobContentType)
}
if blobContentEncoding != nil {
req.Header.Set("x-ms-blob-content-encoding", *blobContentEncoding)
}
if blobContentLanguage != nil {
req.Header.Set("x-ms-blob-content-language", *blobContentLanguage)
}
if blobContentMD5 != nil {
req.Header.Set("x-ms-blob-content-md5", base64.StdEncoding.EncodeToString(blobContentMD5))
}
if blobCacheControl != nil {
req.Header.Set("x-ms-blob-cache-control", *blobCacheControl)
}
if metadata != nil {
for k, v := range metadata {
req.Header.Set("x-ms-meta-"+k, v)
}
}
if leaseID != nil {
req.Header.Set("x-ms-lease-id", *leaseID)
}
if blobContentDisposition != nil {
req.Header.Set("x-ms-blob-content-disposition", *blobContentDisposition)
}
if encryptionKey != nil {
req.Header.Set("x-ms-encryption-key", *encryptionKey)
}
if encryptionKeySha256 != nil {
req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256)
}
if encryptionAlgorithm != EncryptionAlgorithmNone {
req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm))
}
if encryptionScope != nil {
req.Header.Set("x-ms-encryption-scope", *encryptionScope)
}
if tier != AccessTierNone {
req.Header.Set("x-ms-access-tier", string(tier))
}
if ifModifiedSince != nil {
req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
}
if ifUnmodifiedSince != nil {
req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
}
if ifMatch != nil {
req.Header.Set("If-Match", string(*ifMatch))
}
if ifNoneMatch != nil {
req.Header.Set("If-None-Match", string(*ifNoneMatch))
}
if ifTags != nil {
req.Header.Set("x-ms-if-tags", *ifTags)
}
if sourceIfModifiedSince != nil {
req.Header.Set("x-ms-source-if-modified-since", (*sourceIfModifiedSince).In(gmt).Format(time.RFC1123))
}
if sourceIfUnmodifiedSince != nil {
req.Header.Set("x-ms-source-if-unmodified-since", (*sourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123))
}
if sourceIfMatch != nil {
req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch))
}
if sourceIfNoneMatch != nil {
req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch))
}
if sourceIfTags != nil {
req.Header.Set("x-ms-source-if-tags", *sourceIfTags)
}
req.Header.Set("x-ms-version", ServiceVersion)
if requestID != nil {
req.Header.Set("x-ms-client-request-id", *requestID)
}
if sourceContentMD5 != nil {
req.Header.Set("x-ms-source-content-md5", base64.StdEncoding.EncodeToString(sourceContentMD5))
}
if blobTagsString != nil {
req.Header.Set("x-ms-tags", *blobTagsString)
}
req.Header.Set("x-ms-copy-source", copySource)
if copySourceBlobProperties != nil {
req.Header.Set("x-ms-copy-source-blob-properties", strconv.FormatBool(*copySourceBlobProperties))
}
req.Header.Set("x-ms-blob-type", "BlockBlob")
return req, nil
}
// putBlobFromURLResponder handles the response to the PutBlobFromURL request.
func (client blockBlobClient) putBlobFromURLResponder(resp pipeline.Response) (pipeline.Response, error) {
err := validateResponse(resp, http.StatusOK, http.StatusCreated)
if resp == nil {
return nil, err
}
io.Copy(ioutil.Discard, resp.Response().Body)
resp.Response().Body.Close()
return &BlockBlobPutBlobFromURLResponse{rawResponse: resp.Response()}, err
}
// StageBlock the Stage Block operation creates a new block to be committed as part of a blob
//
// blockID is a valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or

Просмотреть файл

@ -10,7 +10,7 @@ import (
const (
// ServiceVersion specifies the version of the operations used in this package.
ServiceVersion = "2019-12-12"
ServiceVersion = "2020-04-08"
)
// managementClient is the base client for Azblob.

Просмотреть файл

@ -823,6 +823,67 @@ func (client containerClient) releaseLeaseResponder(resp pipeline.Response) (pip
return &ContainerReleaseLeaseResponse{rawResponse: resp.Response()}, err
}
// Rename renames an existing container.
//
// sourceContainerName is required. Specifies the name of the container to rename. timeout is the timeout parameter is
// expressed in seconds. For more information, see <a
// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
// Timeouts for Blob Service Operations.</a> requestID is provides a client-generated, opaque value with a 1 KB
// character limit that is recorded in the analytics logs when storage analytics logging is enabled. sourceLeaseID is a
// lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match.
func (client containerClient) Rename(ctx context.Context, sourceContainerName string, timeout *int32, requestID *string, sourceLeaseID *string) (*ContainerRenameResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.renamePreparer(sourceContainerName, timeout, requestID, sourceLeaseID)
if err != nil {
return nil, err
}
resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.renameResponder}, req)
if err != nil {
return nil, err
}
return resp.(*ContainerRenameResponse), err
}
// renamePreparer prepares the Rename request.
func (client containerClient) renamePreparer(sourceContainerName string, timeout *int32, requestID *string, sourceLeaseID *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
}
params := req.URL.Query()
if timeout != nil {
params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
}
params.Set("restype", "container")
params.Set("comp", "rename")
req.URL.RawQuery = params.Encode()
req.Header.Set("x-ms-version", ServiceVersion)
if requestID != nil {
req.Header.Set("x-ms-client-request-id", *requestID)
}
req.Header.Set("x-ms-source-container-name", sourceContainerName)
if sourceLeaseID != nil {
req.Header.Set("x-ms-source-lease-id", *sourceLeaseID)
}
return req, nil
}
// renameResponder handles the response to the Rename request.
func (client containerClient) renameResponder(resp pipeline.Response) (pipeline.Response, error) {
err := validateResponse(resp, http.StatusOK)
if resp == nil {
return nil, err
}
io.Copy(ioutil.Discard, resp.Response().Body)
resp.Response().Body.Close()
return &ContainerRenameResponse{rawResponse: resp.Response()}, err
}
// RenewLease [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15
// to 60 seconds, or can be infinite
//
@ -897,8 +958,8 @@ func (client containerClient) renewLeaseResponder(resp pipeline.Response) (pipel
// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
// Timeouts for Blob Service Operations.</a> requestID is provides a client-generated, opaque value with a 1 KB
// character limit that is recorded in the analytics logs when storage analytics logging is enabled.
// deletedContainerName is optional. Version 2019-12-12 and laster. Specifies the name of the deleted container to
// restore. deletedContainerVersion is optional. Version 2019-12-12 and laster. Specifies the version of the deleted
// deletedContainerName is optional. Version 2019-12-12 and later. Specifies the name of the deleted container to
// restore. deletedContainerVersion is optional. Version 2019-12-12 and later. Specifies the version of the deleted
// container to restore.
func (client containerClient) Restore(ctx context.Context, timeout *int32, requestID *string, deletedContainerName *string, deletedContainerVersion *string) (*ContainerRestoreResponse, error) {
if err := validate([]validation{
@ -1109,3 +1170,63 @@ func (client containerClient) setMetadataResponder(resp pipeline.Response) (pipe
resp.Response().Body.Close()
return &ContainerSetMetadataResponse{rawResponse: resp.Response()}, err
}
// SubmitBatch the Batch operation allows multiple API calls to be embedded into a single HTTP request.
//
// body is initial data body will be closed upon successful return. Callers should ensure closure when receiving an
// error.contentLength is the length of the request. multipartContentType is required. The value of this header must be
// multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_<GUID> timeout is the
// timeout parameter is expressed in seconds. For more information, see <a
// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
// Timeouts for Blob Service Operations.</a> requestID is provides a client-generated, opaque value with a 1 KB
// character limit that is recorded in the analytics logs when storage analytics logging is enabled.
func (client containerClient) SubmitBatch(ctx context.Context, body io.ReadSeeker, contentLength int64, multipartContentType string, timeout *int32, requestID *string) (*SubmitBatchResponse, error) {
if err := validate([]validation{
{targetValue: body,
constraints: []constraint{{target: "body", name: null, rule: true, chain: nil}}},
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.submitBatchPreparer(body, contentLength, multipartContentType, timeout, requestID)
if err != nil {
return nil, err
}
resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.submitBatchResponder}, req)
if err != nil {
return nil, err
}
return resp.(*SubmitBatchResponse), err
}
// submitBatchPreparer prepares the SubmitBatch request.
func (client containerClient) submitBatchPreparer(body io.ReadSeeker, contentLength int64, multipartContentType string, timeout *int32, requestID *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("POST", client.url, body)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
}
params := req.URL.Query()
if timeout != nil {
params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
}
params.Set("restype", "container")
params.Set("comp", "batch")
req.URL.RawQuery = params.Encode()
req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10))
req.Header.Set("Content-Type", multipartContentType)
req.Header.Set("x-ms-version", ServiceVersion)
if requestID != nil {
req.Header.Set("x-ms-client-request-id", *requestID)
}
return req, nil
}
// submitBatchResponder handles the response to the SubmitBatch request.
func (client containerClient) submitBatchResponder(resp pipeline.Response) (pipeline.Response, error) {
err := validateResponse(resp, http.StatusOK, http.StatusAccepted)
if resp == nil {
return nil, err
}
return &SubmitBatchResponse{rawResponse: resp.Response()}, err
}

Просмотреть файл

@ -174,6 +174,21 @@ func PossibleArchiveStatusTypeValues() []ArchiveStatusType {
return []ArchiveStatusType{ArchiveStatusNone, ArchiveStatusRehydratePendingToCool, ArchiveStatusRehydratePendingToHot}
}
// BlobDeleteType enumerates the values for blob delete type.
type BlobDeleteType string
const (
// BlobDeleteNone represents an empty BlobDeleteType.
BlobDeleteNone BlobDeleteType = ""
// BlobDeletePermanent ...
BlobDeletePermanent BlobDeleteType = "Permanent"
)
// PossibleBlobDeleteTypeValues returns an array of possible values for the BlobDeleteType const type.
func PossibleBlobDeleteTypeValues() []BlobDeleteType {
return []BlobDeleteType{BlobDeleteNone, BlobDeletePermanent}
}
// BlobExpiryOptionsType enumerates the values for blob expiry options type.
type BlobExpiryOptionsType string
@ -479,6 +494,8 @@ func PossiblePublicAccessTypeValues() []PublicAccessType {
type QueryFormatType string
const (
// QueryFormatArrow ...
QueryFormatArrow QueryFormatType = "arrow"
// QueryFormatDelimited ...
QueryFormatDelimited QueryFormatType = "delimited"
// QueryFormatJSON ...
@ -489,7 +506,7 @@ const (
// PossibleQueryFormatTypeValues returns an array of possible values for the QueryFormatType const type.
func PossibleQueryFormatTypeValues() []QueryFormatType {
return []QueryFormatType{QueryFormatDelimited, QueryFormatJSON, QueryFormatNone}
return []QueryFormatType{QueryFormatArrow, QueryFormatDelimited, QueryFormatJSON, QueryFormatNone}
}
// RehydratePriorityType enumerates the values for rehydrate priority type.
@ -583,6 +600,8 @@ const (
StorageErrorCodeBlobArchived StorageErrorCodeType = "BlobArchived"
// StorageErrorCodeBlobBeingRehydrated ...
StorageErrorCodeBlobBeingRehydrated StorageErrorCodeType = "BlobBeingRehydrated"
// StorageErrorCodeBlobImmutableDueToPolicy ...
StorageErrorCodeBlobImmutableDueToPolicy StorageErrorCodeType = "BlobImmutableDueToPolicy"
// StorageErrorCodeBlobNotArchived ...
StorageErrorCodeBlobNotArchived StorageErrorCodeType = "BlobNotArchived"
// StorageErrorCodeBlobNotFound ...
@ -783,7 +802,7 @@ const (
// PossibleStorageErrorCodeTypeValues returns an array of possible values for the StorageErrorCodeType const type.
func PossibleStorageErrorCodeTypeValues() []StorageErrorCodeType {
return []StorageErrorCodeType{StorageErrorCodeAccountAlreadyExists, StorageErrorCodeAccountBeingCreated, StorageErrorCodeAccountIsDisabled, StorageErrorCodeAppendPositionConditionNotMet, StorageErrorCodeAuthenticationFailed, StorageErrorCodeAuthorizationFailure, StorageErrorCodeAuthorizationPermissionMismatch, StorageErrorCodeAuthorizationProtocolMismatch, StorageErrorCodeAuthorizationResourceTypeMismatch, StorageErrorCodeAuthorizationServiceMismatch, StorageErrorCodeAuthorizationSourceIPMismatch, StorageErrorCodeBlobAlreadyExists, StorageErrorCodeBlobArchived, StorageErrorCodeBlobBeingRehydrated, StorageErrorCodeBlobNotArchived, StorageErrorCodeBlobNotFound, StorageErrorCodeBlobOverwritten, StorageErrorCodeBlobTierInadequateForContentLength, StorageErrorCodeBlockCountExceedsLimit, StorageErrorCodeBlockListTooLong, StorageErrorCodeCannotChangeToLowerTier, StorageErrorCodeCannotVerifyCopySource, StorageErrorCodeConditionHeadersNotSupported, StorageErrorCodeConditionNotMet, StorageErrorCodeContainerAlreadyExists, StorageErrorCodeContainerBeingDeleted, StorageErrorCodeContainerDisabled, StorageErrorCodeContainerNotFound, StorageErrorCodeContentLengthLargerThanTierLimit, StorageErrorCodeCopyAcrossAccountsNotSupported, StorageErrorCodeCopyIDMismatch, StorageErrorCodeEmptyMetadataKey, StorageErrorCodeFeatureVersionMismatch, StorageErrorCodeIncrementalCopyBlobMismatch, StorageErrorCodeIncrementalCopyOfEralierVersionSnapshotNotAllowed, StorageErrorCodeIncrementalCopySourceMustBeSnapshot, StorageErrorCodeInfiniteLeaseDurationRequired, StorageErrorCodeInsufficientAccountPermissions, StorageErrorCodeInternalError, StorageErrorCodeInvalidAuthenticationInfo, StorageErrorCodeInvalidBlobOrBlock, StorageErrorCodeInvalidBlobTier, StorageErrorCodeInvalidBlobType, StorageErrorCodeInvalidBlockID, StorageErrorCodeInvalidBlockList, StorageErrorCodeInvalidHeaderValue, StorageErrorCodeInvalidHTTPVerb, StorageErrorCodeInvalidInput, StorageErrorCodeInvalidMd5, StorageErrorCodeInvalidMetadata, StorageErrorCodeInvalidOperation, StorageErrorCodeInvalidPageRange, StorageErrorCodeInvalidQueryParameterValue, StorageErrorCodeInvalidRange, StorageErrorCodeInvalidResourceName, StorageErrorCodeInvalidSourceBlobType, StorageErrorCodeInvalidSourceBlobURL, StorageErrorCodeInvalidURI, StorageErrorCodeInvalidVersionForPageBlobOperation, StorageErrorCodeInvalidXMLDocument, StorageErrorCodeInvalidXMLNodeValue, StorageErrorCodeLeaseAlreadyBroken, StorageErrorCodeLeaseAlreadyPresent, StorageErrorCodeLeaseIDMismatchWithBlobOperation, StorageErrorCodeLeaseIDMismatchWithContainerOperation, StorageErrorCodeLeaseIDMismatchWithLeaseOperation, StorageErrorCodeLeaseIDMissing, StorageErrorCodeLeaseIsBreakingAndCannotBeAcquired, StorageErrorCodeLeaseIsBreakingAndCannotBeChanged, StorageErrorCodeLeaseIsBrokenAndCannotBeRenewed, StorageErrorCodeLeaseLost, StorageErrorCodeLeaseNotPresentWithBlobOperation, StorageErrorCodeLeaseNotPresentWithContainerOperation, StorageErrorCodeLeaseNotPresentWithLeaseOperation, StorageErrorCodeMaxBlobSizeConditionNotMet, StorageErrorCodeMd5Mismatch, StorageErrorCodeMetadataTooLarge, StorageErrorCodeMissingContentLengthHeader, StorageErrorCodeMissingRequiredHeader, StorageErrorCodeMissingRequiredQueryParameter, StorageErrorCodeMissingRequiredXMLNode, StorageErrorCodeMultipleConditionHeadersNotSupported, StorageErrorCodeNoAuthenticationInformation, StorageErrorCodeNone, StorageErrorCodeNoPendingCopyOperation, StorageErrorCodeOperationNotAllowedOnIncrementalCopyBlob, StorageErrorCodeOperationTimedOut, StorageErrorCodeOutOfRangeInput, StorageErrorCodeOutOfRangeQueryParameterValue, StorageErrorCodePendingCopyOperation, StorageErrorCodePreviousSnapshotCannotBeNewer, StorageErrorCodePreviousSnapshotNotFound, StorageErrorCodePreviousSnapshotOperationNotSupported, StorageErrorCodeRequestBodyTooLarge, StorageErrorCodeRequestURLFailedToParse, StorageErrorCodeResourceAlreadyExists, StorageErrorCodeResourceNotFound, StorageErrorCodeResourceTypeMismatch, StorageErrorCodeSequenceNumberConditionNotMet, StorageErrorCodeSequenceNumberIncrementTooLarge, StorageErrorCodeServerBusy, StorageErrorCodeSnaphotOperationRateExceeded, StorageErrorCodeSnapshotCountExceeded, StorageErrorCodeSnapshotsPresent, StorageErrorCodeSourceConditionNotMet, StorageErrorCodeSystemInUse, StorageErrorCodeTargetConditionNotMet, StorageErrorCodeUnauthorizedBlobOverwrite, StorageErrorCodeUnsupportedHeader, StorageErrorCodeUnsupportedHTTPVerb, StorageErrorCodeUnsupportedQueryParameter, StorageErrorCodeUnsupportedXMLNode}
return []StorageErrorCodeType{StorageErrorCodeAccountAlreadyExists, StorageErrorCodeAccountBeingCreated, StorageErrorCodeAccountIsDisabled, StorageErrorCodeAppendPositionConditionNotMet, StorageErrorCodeAuthenticationFailed, StorageErrorCodeAuthorizationFailure, StorageErrorCodeAuthorizationPermissionMismatch, StorageErrorCodeAuthorizationProtocolMismatch, StorageErrorCodeAuthorizationResourceTypeMismatch, StorageErrorCodeAuthorizationServiceMismatch, StorageErrorCodeAuthorizationSourceIPMismatch, StorageErrorCodeBlobAlreadyExists, StorageErrorCodeBlobArchived, StorageErrorCodeBlobBeingRehydrated, StorageErrorCodeBlobImmutableDueToPolicy, StorageErrorCodeBlobNotArchived, StorageErrorCodeBlobNotFound, StorageErrorCodeBlobOverwritten, StorageErrorCodeBlobTierInadequateForContentLength, StorageErrorCodeBlockCountExceedsLimit, StorageErrorCodeBlockListTooLong, StorageErrorCodeCannotChangeToLowerTier, StorageErrorCodeCannotVerifyCopySource, StorageErrorCodeConditionHeadersNotSupported, StorageErrorCodeConditionNotMet, StorageErrorCodeContainerAlreadyExists, StorageErrorCodeContainerBeingDeleted, StorageErrorCodeContainerDisabled, StorageErrorCodeContainerNotFound, StorageErrorCodeContentLengthLargerThanTierLimit, StorageErrorCodeCopyAcrossAccountsNotSupported, StorageErrorCodeCopyIDMismatch, StorageErrorCodeEmptyMetadataKey, StorageErrorCodeFeatureVersionMismatch, StorageErrorCodeIncrementalCopyBlobMismatch, StorageErrorCodeIncrementalCopyOfEralierVersionSnapshotNotAllowed, StorageErrorCodeIncrementalCopySourceMustBeSnapshot, StorageErrorCodeInfiniteLeaseDurationRequired, StorageErrorCodeInsufficientAccountPermissions, StorageErrorCodeInternalError, StorageErrorCodeInvalidAuthenticationInfo, StorageErrorCodeInvalidBlobOrBlock, StorageErrorCodeInvalidBlobTier, StorageErrorCodeInvalidBlobType, StorageErrorCodeInvalidBlockID, StorageErrorCodeInvalidBlockList, StorageErrorCodeInvalidHeaderValue, StorageErrorCodeInvalidHTTPVerb, StorageErrorCodeInvalidInput, StorageErrorCodeInvalidMd5, StorageErrorCodeInvalidMetadata, StorageErrorCodeInvalidOperation, StorageErrorCodeInvalidPageRange, StorageErrorCodeInvalidQueryParameterValue, StorageErrorCodeInvalidRange, StorageErrorCodeInvalidResourceName, StorageErrorCodeInvalidSourceBlobType, StorageErrorCodeInvalidSourceBlobURL, StorageErrorCodeInvalidURI, StorageErrorCodeInvalidVersionForPageBlobOperation, StorageErrorCodeInvalidXMLDocument, StorageErrorCodeInvalidXMLNodeValue, StorageErrorCodeLeaseAlreadyBroken, StorageErrorCodeLeaseAlreadyPresent, StorageErrorCodeLeaseIDMismatchWithBlobOperation, StorageErrorCodeLeaseIDMismatchWithContainerOperation, StorageErrorCodeLeaseIDMismatchWithLeaseOperation, StorageErrorCodeLeaseIDMissing, StorageErrorCodeLeaseIsBreakingAndCannotBeAcquired, StorageErrorCodeLeaseIsBreakingAndCannotBeChanged, StorageErrorCodeLeaseIsBrokenAndCannotBeRenewed, StorageErrorCodeLeaseLost, StorageErrorCodeLeaseNotPresentWithBlobOperation, StorageErrorCodeLeaseNotPresentWithContainerOperation, StorageErrorCodeLeaseNotPresentWithLeaseOperation, StorageErrorCodeMaxBlobSizeConditionNotMet, StorageErrorCodeMd5Mismatch, StorageErrorCodeMetadataTooLarge, StorageErrorCodeMissingContentLengthHeader, StorageErrorCodeMissingRequiredHeader, StorageErrorCodeMissingRequiredQueryParameter, StorageErrorCodeMissingRequiredXMLNode, StorageErrorCodeMultipleConditionHeadersNotSupported, StorageErrorCodeNoAuthenticationInformation, StorageErrorCodeNone, StorageErrorCodeNoPendingCopyOperation, StorageErrorCodeOperationNotAllowedOnIncrementalCopyBlob, StorageErrorCodeOperationTimedOut, StorageErrorCodeOutOfRangeInput, StorageErrorCodeOutOfRangeQueryParameterValue, StorageErrorCodePendingCopyOperation, StorageErrorCodePreviousSnapshotCannotBeNewer, StorageErrorCodePreviousSnapshotNotFound, StorageErrorCodePreviousSnapshotOperationNotSupported, StorageErrorCodeRequestBodyTooLarge, StorageErrorCodeRequestURLFailedToParse, StorageErrorCodeResourceAlreadyExists, StorageErrorCodeResourceNotFound, StorageErrorCodeResourceTypeMismatch, StorageErrorCodeSequenceNumberConditionNotMet, StorageErrorCodeSequenceNumberIncrementTooLarge, StorageErrorCodeServerBusy, StorageErrorCodeSnaphotOperationRateExceeded, StorageErrorCodeSnapshotCountExceeded, StorageErrorCodeSnapshotsPresent, StorageErrorCodeSourceConditionNotMet, StorageErrorCodeSystemInUse, StorageErrorCodeTargetConditionNotMet, StorageErrorCodeUnauthorizedBlobOverwrite, StorageErrorCodeUnsupportedHeader, StorageErrorCodeUnsupportedHTTPVerb, StorageErrorCodeUnsupportedQueryParameter, StorageErrorCodeUnsupportedXMLNode}
}
// SyncCopyStatusType enumerates the values for sync copy status type.
@ -1258,6 +1277,21 @@ func (absr AppendBlobSealResponse) Version() string {
return absr.rawResponse.Header.Get("x-ms-version")
}
// ArrowConfiguration - arrow configuration
type ArrowConfiguration struct {
Schema []ArrowField `xml:"Schema>Field"`
}
// ArrowField - field of an arrow schema
type ArrowField struct {
// XMLName is used for marshalling and is subject to removal in a future release.
XMLName xml.Name `xml:"Field"`
Type string `xml:"Type"`
Name *string `xml:"Name"`
Precision *int32 `xml:"Precision"`
Scale *int32 `xml:"Scale"`
}
// BlobAbortCopyFromURLResponse ...
type BlobAbortCopyFromURLResponse struct {
rawResponse *http.Response
@ -2229,6 +2263,19 @@ func (bgpr BlobGetPropertiesResponse) IsServerEncrypted() string {
return bgpr.rawResponse.Header.Get("x-ms-server-encrypted")
}
// LastAccessed returns the value for header x-ms-last-access-time.
func (bgpr BlobGetPropertiesResponse) LastAccessed() time.Time {
s := bgpr.rawResponse.Header.Get("x-ms-last-access-time")
if s == "" {
return time.Time{}
}
t, err := time.Parse(time.RFC1123, s)
if err != nil {
t = time.Time{}
}
return t
}
// LastModified returns the value for header Last-Modified.
func (bgpr BlobGetPropertiesResponse) LastModified() time.Time {
s := bgpr.rawResponse.Header.Get("Last-Modified")
@ -2311,18 +2358,16 @@ type BlobHierarchyListSegment struct {
// BlobItemInternal - An Azure Storage blob
type BlobItemInternal struct {
// XMLName is used for marshalling and is subject to removal in a future release.
XMLName xml.Name `xml:"Blob"`
Name string `xml:"Name"`
Deleted bool `xml:"Deleted"`
Snapshot string `xml:"Snapshot"`
VersionID *string `xml:"VersionId"`
IsCurrentVersion *bool `xml:"IsCurrentVersion"`
Properties BlobProperties `xml:"Properties"`
// TODO funky generator type -> *BlobMetadata
Metadata Metadata `xml:"Metadata"`
BlobTags *BlobTags `xml:"Tags"`
ObjectReplicationMetadata map[string]string `xml:"ObjectReplicationMetadata"`
XMLName xml.Name `xml:"Blob"`
Name string `xml:"Name"`
Deleted bool `xml:"Deleted"`
Snapshot string `xml:"Snapshot"`
VersionID *string `xml:"VersionId"`
IsCurrentVersion *bool `xml:"IsCurrentVersion"`
Properties BlobPropertiesInternal `xml:"Properties"`
Metadata Metadata `xml:"Metadata"`
BlobTags *BlobTags `xml:"Tags"`
ObjectReplicationMetadata map[string]string `xml:"ObjectReplicationMetadata"`
}
// BlobMetadata ...
@ -2339,8 +2384,8 @@ type BlobPrefix struct {
Name string `xml:"Name"`
}
// BlobProperties - Properties of a blob
type BlobProperties struct {
// BlobPropertiesInternal - Properties of a blob
type BlobPropertiesInternal struct {
// XMLName is used for marshalling and is subject to removal in a future release.
XMLName xml.Name `xml:"Properties"`
CreationTime *time.Time `xml:"Creation-Time"`
@ -2386,20 +2431,21 @@ type BlobProperties struct {
AccessTierChangeTime *time.Time `xml:"AccessTierChangeTime"`
TagCount *int32 `xml:"TagCount"`
ExpiresOn *time.Time `xml:"Expiry-Time"`
IsSealed *bool `xml:"IsSealed"`
IsSealed *bool `xml:"Sealed"`
// RehydratePriority - Possible values include: 'RehydratePriorityHigh', 'RehydratePriorityStandard', 'RehydratePriorityNone'
RehydratePriority RehydratePriorityType `xml:"RehydratePriority"`
LastAccessedOn *time.Time `xml:"LastAccessTime"`
}
// MarshalXML implements the xml.Marshaler interface for BlobProperties.
func (bpi BlobProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
bpi2 := (*blobProperties)(unsafe.Pointer(&bpi))
// MarshalXML implements the xml.Marshaler interface for BlobPropertiesInternal.
func (bpi BlobPropertiesInternal) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
bpi2 := (*blobPropertiesInternal)(unsafe.Pointer(&bpi))
return e.EncodeElement(*bpi2, start)
}
// UnmarshalXML implements the xml.Unmarshaler interface for BlobProperties.
func (bpi *BlobProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
bpi2 := (*blobProperties)(unsafe.Pointer(bpi))
// UnmarshalXML implements the xml.Unmarshaler interface for BlobPropertiesInternal.
func (bpi *BlobPropertiesInternal) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
bpi2 := (*blobPropertiesInternal)(unsafe.Pointer(bpi))
return d.DecodeElement(bpi2, &start)
}
@ -3242,7 +3288,7 @@ type Block struct {
// Name - The base64 encoded block ID.
Name string `xml:"Name"`
// Size - The block size in bytes.
Size int64 `xml:"Size"`
Size int32 `xml:"Size"`
}
// BlockBlobCommitBlockListResponse ...
@ -3362,6 +3408,110 @@ func (bbcblr BlockBlobCommitBlockListResponse) XMsContentCrc64() []byte {
return b
}
// BlockBlobPutBlobFromURLResponse ...
type BlockBlobPutBlobFromURLResponse struct {
rawResponse *http.Response
}
// Response returns the raw HTTP response object.
func (bbpbfur BlockBlobPutBlobFromURLResponse) Response() *http.Response {
return bbpbfur.rawResponse
}
// StatusCode returns the HTTP status code of the response, e.g. 200.
func (bbpbfur BlockBlobPutBlobFromURLResponse) StatusCode() int {
return bbpbfur.rawResponse.StatusCode
}
// Status returns the HTTP status message of the response, e.g. "200 OK".
func (bbpbfur BlockBlobPutBlobFromURLResponse) Status() string {
return bbpbfur.rawResponse.Status
}
// ClientRequestID returns the value for header x-ms-client-request-id.
func (bbpbfur BlockBlobPutBlobFromURLResponse) ClientRequestID() string {
return bbpbfur.rawResponse.Header.Get("x-ms-client-request-id")
}
// ContentMD5 returns the value for header Content-MD5.
func (bbpbfur BlockBlobPutBlobFromURLResponse) ContentMD5() []byte {
s := bbpbfur.rawResponse.Header.Get("Content-MD5")
if s == "" {
return nil
}
b, err := base64.StdEncoding.DecodeString(s)
if err != nil {
b = nil
}
return b
}
// Date returns the value for header Date.
func (bbpbfur BlockBlobPutBlobFromURLResponse) Date() time.Time {
s := bbpbfur.rawResponse.Header.Get("Date")
if s == "" {
return time.Time{}
}
t, err := time.Parse(time.RFC1123, s)
if err != nil {
t = time.Time{}
}
return t
}
// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256.
func (bbpbfur BlockBlobPutBlobFromURLResponse) EncryptionKeySha256() string {
return bbpbfur.rawResponse.Header.Get("x-ms-encryption-key-sha256")
}
// EncryptionScope returns the value for header x-ms-encryption-scope.
func (bbpbfur BlockBlobPutBlobFromURLResponse) EncryptionScope() string {
return bbpbfur.rawResponse.Header.Get("x-ms-encryption-scope")
}
// ErrorCode returns the value for header x-ms-error-code.
func (bbpbfur BlockBlobPutBlobFromURLResponse) ErrorCode() string {
return bbpbfur.rawResponse.Header.Get("x-ms-error-code")
}
// ETag returns the value for header ETag.
func (bbpbfur BlockBlobPutBlobFromURLResponse) ETag() ETag {
return ETag(bbpbfur.rawResponse.Header.Get("ETag"))
}
// IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (bbpbfur BlockBlobPutBlobFromURLResponse) IsServerEncrypted() string {
return bbpbfur.rawResponse.Header.Get("x-ms-request-server-encrypted")
}
// LastModified returns the value for header Last-Modified.
func (bbpbfur BlockBlobPutBlobFromURLResponse) LastModified() time.Time {
s := bbpbfur.rawResponse.Header.Get("Last-Modified")
if s == "" {
return time.Time{}
}
t, err := time.Parse(time.RFC1123, s)
if err != nil {
t = time.Time{}
}
return t
}
// RequestID returns the value for header x-ms-request-id.
func (bbpbfur BlockBlobPutBlobFromURLResponse) RequestID() string {
return bbpbfur.rawResponse.Header.Get("x-ms-request-id")
}
// Version returns the value for header x-ms-version.
func (bbpbfur BlockBlobPutBlobFromURLResponse) Version() string {
return bbpbfur.rawResponse.Header.Get("x-ms-version")
}
// VersionID returns the value for header x-ms-version-id.
func (bbpbfur BlockBlobPutBlobFromURLResponse) VersionID() string {
return bbpbfur.rawResponse.Header.Get("x-ms-version-id")
}
// BlockBlobStageBlockFromURLResponse ...
type BlockBlobStageBlockFromURLResponse struct {
rawResponse *http.Response
@ -4421,6 +4571,59 @@ func (crlr ContainerReleaseLeaseResponse) Version() string {
return crlr.rawResponse.Header.Get("x-ms-version")
}
// ContainerRenameResponse ...
type ContainerRenameResponse struct {
rawResponse *http.Response
}
// Response returns the raw HTTP response object.
func (crr ContainerRenameResponse) Response() *http.Response {
return crr.rawResponse
}
// StatusCode returns the HTTP status code of the response, e.g. 200.
func (crr ContainerRenameResponse) StatusCode() int {
return crr.rawResponse.StatusCode
}
// Status returns the HTTP status message of the response, e.g. "200 OK".
func (crr ContainerRenameResponse) Status() string {
return crr.rawResponse.Status
}
// ClientRequestID returns the value for header x-ms-client-request-id.
func (crr ContainerRenameResponse) ClientRequestID() string {
return crr.rawResponse.Header.Get("x-ms-client-request-id")
}
// Date returns the value for header Date.
func (crr ContainerRenameResponse) Date() time.Time {
s := crr.rawResponse.Header.Get("Date")
if s == "" {
return time.Time{}
}
t, err := time.Parse(time.RFC1123, s)
if err != nil {
t = time.Time{}
}
return t
}
// ErrorCode returns the value for header x-ms-error-code.
func (crr ContainerRenameResponse) ErrorCode() string {
return crr.rawResponse.Header.Get("x-ms-error-code")
}
// RequestID returns the value for header x-ms-request-id.
func (crr ContainerRenameResponse) RequestID() string {
return crr.rawResponse.Header.Get("x-ms-request-id")
}
// Version returns the value for header x-ms-version.
func (crr ContainerRenameResponse) Version() string {
return crr.rawResponse.Header.Get("x-ms-version")
}
// ContainerRenewLeaseResponse ...
type ContainerRenewLeaseResponse struct {
rawResponse *http.Response
@ -5339,6 +5542,11 @@ func (dr downloadResponse) ETag() ETag {
return ETag(dr.rawResponse.Header.Get("ETag"))
}
// IsCurrentVersion returns the value for header x-ms-is-current-version.
func (dr downloadResponse) IsCurrentVersion() string {
return dr.rawResponse.Header.Get("x-ms-is-current-version")
}
// IsSealed returns the value for header x-ms-blob-sealed.
func (dr downloadResponse) IsSealed() string {
return dr.rawResponse.Header.Get("x-ms-blob-sealed")
@ -5349,6 +5557,19 @@ func (dr downloadResponse) IsServerEncrypted() string {
return dr.rawResponse.Header.Get("x-ms-server-encrypted")
}
// LastAccessed returns the value for header x-ms-last-access-time.
func (dr downloadResponse) LastAccessed() time.Time {
s := dr.rawResponse.Header.Get("x-ms-last-access-time")
if s == "" {
return time.Time{}
}
t, err := time.Parse(time.RFC1123, s)
if err != nil {
t = time.Time{}
}
return t
}
// LastModified returns the value for header Last-Modified.
func (dr downloadResponse) LastModified() time.Time {
s := dr.rawResponse.Header.Get("Last-Modified")
@ -5418,10 +5639,10 @@ func (dr downloadResponse) VersionID() string {
// FilterBlobItem - Blob info from a Filter Blobs API call
type FilterBlobItem struct {
// XMLName is used for marshalling and is subject to removal in a future release.
XMLName xml.Name `xml:"Blob"`
Name string `xml:"Name"`
ContainerName string `xml:"ContainerName"`
TagValue string `xml:"TagValue"`
XMLName xml.Name `xml:"Blob"`
Name string `xml:"Name"`
ContainerName string `xml:"ContainerName"`
Tags *BlobTags `xml:"Tags"`
}
// FilterBlobSegment - The result of a Filter Blobs API call
@ -6528,10 +6749,11 @@ type PageRange struct {
// QueryFormat ...
type QueryFormat struct {
// Type - Possible values include: 'QueryFormatDelimited', 'QueryFormatJSON', 'QueryFormatNone'
// Type - Possible values include: 'QueryFormatDelimited', 'QueryFormatJSON', 'QueryFormatArrow', 'QueryFormatNone'
Type QueryFormatType `xml:"Type"`
DelimitedTextConfiguration *DelimitedTextConfiguration `xml:"DelimitedTextConfiguration"`
JSONTextConfiguration *JSONTextConfiguration `xml:"JsonTextConfiguration"`
ArrowConfiguration *ArrowConfiguration `xml:"ArrowConfiguration"`
}
// QueryRequest - the quick query body
@ -6830,6 +7052,8 @@ type RetentionPolicy struct {
Enabled bool `xml:"Enabled"`
// Days - Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted
Days *int32 `xml:"Days"`
// AllowPermanentDelete - Indicates whether permanent delete is allowed on this storage account.
AllowPermanentDelete *bool `xml:"AllowPermanentDelete"`
}
// ServiceGetAccountInfoResponse ...
@ -6880,6 +7104,11 @@ func (sgair ServiceGetAccountInfoResponse) ErrorCode() string {
return sgair.rawResponse.Header.Get("x-ms-error-code")
}
// IsHierarchicalNamespaceEnabled returns the value for header x-ms-is-hns-enabled.
func (sgair ServiceGetAccountInfoResponse) IsHierarchicalNamespaceEnabled() string {
return sgair.rawResponse.Header.Get("x-ms-is-hns-enabled")
}
// RequestID returns the value for header x-ms-request-id.
func (sgair ServiceGetAccountInfoResponse) RequestID() string {
return sgair.rawResponse.Header.Get("x-ms-request-id")
@ -7031,6 +7260,11 @@ type StaticWebsite struct {
DefaultIndexDocumentPath *string `xml:"DefaultIndexDocumentPath"`
}
// StorageError ...
// type StorageError struct {
// Message *string `xml:"Message"`
// }
// StorageServiceProperties - Storage Service Properties.
type StorageServiceProperties struct {
rawResponse *http.Response
@ -7134,7 +7368,7 @@ func (sss StorageServiceStats) Version() string {
return sss.rawResponse.Header.Get("x-ms-version")
}
// SubmitBatchResponse - Wraps the response from the serviceClient.SubmitBatch method.
// SubmitBatchResponse - Wraps the response from the containerClient.SubmitBatch method.
type SubmitBatchResponse struct {
rawResponse *http.Response
}
@ -7265,8 +7499,8 @@ func init() {
if reflect.TypeOf((*AccessPolicy)(nil)).Elem().Size() != reflect.TypeOf((*accessPolicy)(nil)).Elem().Size() {
validateError(errors.New("size mismatch between AccessPolicy and accessPolicy"))
}
if reflect.TypeOf((*BlobProperties)(nil)).Elem().Size() != reflect.TypeOf((*blobProperties)(nil)).Elem().Size() {
validateError(errors.New("size mismatch between BlobProperties and blobProperties"))
if reflect.TypeOf((*BlobPropertiesInternal)(nil)).Elem().Size() != reflect.TypeOf((*blobPropertiesInternal)(nil)).Elem().Size() {
validateError(errors.New("size mismatch between BlobPropertiesInternal and blobPropertiesInternal"))
}
if reflect.TypeOf((*ContainerProperties)(nil)).Elem().Size() != reflect.TypeOf((*containerProperties)(nil)).Elem().Size() {
validateError(errors.New("size mismatch between ContainerProperties and containerProperties"))
@ -7277,7 +7511,7 @@ func init() {
}
const (
rfc3339Format = "2006-01-02T15:04:05Z" //This was wrong in the generated code, FYI
rfc3339Format = "2006-01-02T15:04:05Z"
)
// used to convert times from UTC to GMT before sending across the wire
@ -7355,7 +7589,7 @@ type accessPolicy struct {
}
// internal type used for marshalling
type blobProperties struct {
type blobPropertiesInternal struct {
// XMLName is used for marshalling and is subject to removal in a future release.
XMLName xml.Name `xml:"Properties"`
CreationTime *timeRFC1123 `xml:"Creation-Time"`
@ -7392,8 +7626,9 @@ type blobProperties struct {
AccessTierChangeTime *timeRFC1123 `xml:"AccessTierChangeTime"`
TagCount *int32 `xml:"TagCount"`
ExpiresOn *timeRFC1123 `xml:"Expiry-Time"`
IsSealed *bool `xml:"IsSealed"`
IsSealed *bool `xml:"Sealed"`
RehydratePriority RehydratePriorityType `xml:"RehydratePriority"`
LastAccessedOn *timeRFC1123 `xml:"LastAccessTime"`
}
// internal type used for marshalling

Просмотреть файл

@ -48,16 +48,17 @@ func newPageBlobClient(url url.URL, p pipeline.Pipeline) pageBlobClient {
// on a blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to
// operate only on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value
// to operate only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs
// without a matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is
// recorded in the analytics logs when storage analytics logging is enabled.
func (client pageBlobClient) ClearPages(ctx context.Context, contentLength int64, timeout *int32, rangeParameter *string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*PageBlobClearPagesResponse, error) {
// without a matching value. ifTags is specify a SQL where clause on blob tags to operate only on blobs with a matching
// value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded in the
// analytics logs when storage analytics logging is enabled.
func (client pageBlobClient) ClearPages(ctx context.Context, contentLength int64, timeout *int32, rangeParameter *string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*PageBlobClearPagesResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.clearPagesPreparer(contentLength, timeout, rangeParameter, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID)
req, err := client.clearPagesPreparer(contentLength, timeout, rangeParameter, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestID)
if err != nil {
return nil, err
}
@ -69,7 +70,7 @@ func (client pageBlobClient) ClearPages(ctx context.Context, contentLength int64
}
// clearPagesPreparer prepares the ClearPages request.
func (client pageBlobClient) clearPagesPreparer(contentLength int64, timeout *int32, rangeParameter *string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) {
func (client pageBlobClient) clearPagesPreparer(contentLength int64, timeout *int32, rangeParameter *string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@ -120,6 +121,9 @@ func (client pageBlobClient) clearPagesPreparer(contentLength int64, timeout *in
if ifNoneMatch != nil {
req.Header.Set("If-None-Match", string(*ifNoneMatch))
}
if ifTags != nil {
req.Header.Set("x-ms-if-tags", *ifTags)
}
req.Header.Set("x-ms-version", ServiceVersion)
if requestID != nil {
req.Header.Set("x-ms-client-request-id", *requestID)
@ -153,16 +157,17 @@ func (client pageBlobClient) clearPagesResponder(resp pipeline.Response) (pipeli
// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only
// on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate
// only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a
// matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded
// in the analytics logs when storage analytics logging is enabled.
func (client pageBlobClient) CopyIncremental(ctx context.Context, copySource string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*PageBlobCopyIncrementalResponse, error) {
// matching value. ifTags is specify a SQL where clause on blob tags to operate only on blobs with a matching value.
// requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics
// logs when storage analytics logging is enabled.
func (client pageBlobClient) CopyIncremental(ctx context.Context, copySource string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*PageBlobCopyIncrementalResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.copyIncrementalPreparer(copySource, timeout, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID)
req, err := client.copyIncrementalPreparer(copySource, timeout, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestID)
if err != nil {
return nil, err
}
@ -174,7 +179,7 @@ func (client pageBlobClient) CopyIncremental(ctx context.Context, copySource str
}
// copyIncrementalPreparer prepares the CopyIncremental request.
func (client pageBlobClient) copyIncrementalPreparer(copySource string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) {
func (client pageBlobClient) copyIncrementalPreparer(copySource string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@ -197,6 +202,9 @@ func (client pageBlobClient) copyIncrementalPreparer(copySource string, timeout
if ifNoneMatch != nil {
req.Header.Set("If-None-Match", string(*ifNoneMatch))
}
if ifTags != nil {
req.Header.Set("x-ms-if-tags", *ifTags)
}
req.Header.Set("x-ms-copy-source", copySource)
req.Header.Set("x-ms-version", ServiceVersion)
if requestID != nil {
@ -601,17 +609,18 @@ func (client pageBlobClient) getPageRangesDiffResponder(resp pipeline.Response)
// Services. ifModifiedSince is specify this header value to operate only on a blob if it has been modified since the
// specified date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if it has not been
// modified since the specified date/time. ifMatch is specify an ETag value to operate only on blobs with a matching
// value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. requestID is provides
// a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage
// value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. ifTags is specify a
// SQL where clause on blob tags to operate only on blobs with a matching value. requestID is provides a
// client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage
// analytics logging is enabled.
func (client pageBlobClient) Resize(ctx context.Context, blobContentLength int64, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*PageBlobResizeResponse, error) {
func (client pageBlobClient) Resize(ctx context.Context, blobContentLength int64, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*PageBlobResizeResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.resizePreparer(blobContentLength, timeout, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID)
req, err := client.resizePreparer(blobContentLength, timeout, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestID)
if err != nil {
return nil, err
}
@ -623,7 +632,7 @@ func (client pageBlobClient) Resize(ctx context.Context, blobContentLength int64
}
// resizePreparer prepares the Resize request.
func (client pageBlobClient) resizePreparer(blobContentLength int64, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) {
func (client pageBlobClient) resizePreparer(blobContentLength int64, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@ -661,6 +670,9 @@ func (client pageBlobClient) resizePreparer(blobContentLength int64, timeout *in
if ifNoneMatch != nil {
req.Header.Set("If-None-Match", string(*ifNoneMatch))
}
if ifTags != nil {
req.Header.Set("x-ms-if-tags", *ifTags)
}
req.Header.Set("x-ms-blob-content-length", strconv.FormatInt(blobContentLength, 10))
req.Header.Set("x-ms-version", ServiceVersion)
if requestID != nil {
@ -691,18 +703,18 @@ func (client pageBlobClient) resizeResponder(resp pipeline.Response) (pipeline.R
// has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a
// blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate only on
// blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value.
// blobSequenceNumber is set for page blobs only. The sequence number is a user-controlled value that you can use to
// track requests. The value of the sequence number must be between 0 and 2^63 - 1. requestID is provides a
// client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage
// analytics logging is enabled.
func (client pageBlobClient) UpdateSequenceNumber(ctx context.Context, sequenceNumberAction SequenceNumberActionType, timeout *int32, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, blobSequenceNumber *int64, requestID *string) (*PageBlobUpdateSequenceNumberResponse, error) {
// ifTags is specify a SQL where clause on blob tags to operate only on blobs with a matching value. blobSequenceNumber
// is set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The
// value of the sequence number must be between 0 and 2^63 - 1. requestID is provides a client-generated, opaque value
// with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
func (client pageBlobClient) UpdateSequenceNumber(ctx context.Context, sequenceNumberAction SequenceNumberActionType, timeout *int32, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, blobSequenceNumber *int64, requestID *string) (*PageBlobUpdateSequenceNumberResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.updateSequenceNumberPreparer(sequenceNumberAction, timeout, leaseID, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, blobSequenceNumber, requestID)
req, err := client.updateSequenceNumberPreparer(sequenceNumberAction, timeout, leaseID, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestID)
if err != nil {
return nil, err
}
@ -714,7 +726,7 @@ func (client pageBlobClient) UpdateSequenceNumber(ctx context.Context, sequenceN
}
// updateSequenceNumberPreparer prepares the UpdateSequenceNumber request.
func (client pageBlobClient) updateSequenceNumberPreparer(sequenceNumberAction SequenceNumberActionType, timeout *int32, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, blobSequenceNumber *int64, requestID *string) (pipeline.Request, error) {
func (client pageBlobClient) updateSequenceNumberPreparer(sequenceNumberAction SequenceNumberActionType, timeout *int32, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, blobSequenceNumber *int64, requestID *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@ -740,6 +752,9 @@ func (client pageBlobClient) updateSequenceNumberPreparer(sequenceNumberAction S
if ifNoneMatch != nil {
req.Header.Set("If-None-Match", string(*ifNoneMatch))
}
if ifTags != nil {
req.Header.Set("x-ms-if-tags", *ifTags)
}
req.Header.Set("x-ms-sequence-number-action", string(sequenceNumberAction))
if blobSequenceNumber != nil {
req.Header.Set("x-ms-blob-sequence-number", strconv.FormatInt(*blobSequenceNumber, 10))

Просмотреть файл

@ -5,7 +5,7 @@ package azblob
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/0.0.0 azblob/2019-12-12"
return "Azure-SDK-For-Go/0.0.0 azblob/2020-04-08"
}
// Version returns the semantic version (see http://semver.org) of the client.

Просмотреть файл

@ -45,7 +45,7 @@ func (dr downloadResponse) NewHTTPHeaders() BlobHTTPHeaders {
///////////////////////////////////////////////////////////////////////////////
// DownloadResponse wraps AutoRest generated DownloadResponse and helps to provide info for retry.
// downloadResponse wraps AutoRest generated downloadResponse and helps to provide info for retry.
type DownloadResponse struct {
r *downloadResponse
ctx context.Context

Просмотреть файл

@ -2,7 +2,7 @@
"swagger": "2.0",
"info": {
"title": "Azure Blob Storage",
"version": "2019-12-12",
"version": "2020-04-08",
"x-ms-code-generation-settings": {
"header": "MIT",
"strictSpecAdherence": false
@ -485,6 +485,11 @@
"modelAsString": false
},
"description": "Identifies the account kind"
},
"x-ms-is-hns-enabled": {
"x-ms-client-name": "IsHierarchicalNamespaceEnabled",
"type": "boolean",
"description": "Version 2019-07-07 and newer. Indicates if the account has a hierarchical namespace enabled."
}
}
},
@ -1363,6 +1368,177 @@
}
]
},
"/{containerName}?restype=container&comp=rename": {
"put": {
"tags": [
"container"
],
"operationId": "Container_Rename",
"description": "Renames an existing container.",
"parameters": [
{
"$ref": "#/parameters/Timeout"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/ClientRequestId"
},
{
"$ref": "#/parameters/SourceContainerName"
},
{
"$ref": "#/parameters/SourceLeaseId"
}
],
"responses": {
"200": {
"description": "Created.",
"headers": {
"x-ms-client-request-id": {
"x-ms-client-name": "ClientRequestId",
"type": "string",
"description": "If a client request id header is sent in the request, this header will be present in the response with the same value."
},
"x-ms-request-id": {
"x-ms-client-name": "RequestId",
"type": "string",
"description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request."
},
"x-ms-version": {
"x-ms-client-name": "Version",
"type": "string",
"description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."
},
"Date": {
"type": "string",
"format": "date-time-rfc1123",
"description": "UTC date/time value generated by the service that indicates the time at which the response was initiated"
}
}
},
"default": {
"description": "Failure",
"headers": {
"x-ms-error-code": {
"x-ms-client-name": "ErrorCode",
"type": "string"
}
},
"schema": {
"$ref": "#/definitions/StorageError"
}
}
}
},
"parameters": [
{
"name": "restype",
"in": "query",
"required": true,
"type": "string",
"enum": [
"container"
]
},
{
"name": "comp",
"in": "query",
"required": true,
"type": "string",
"enum": [
"rename"
]
}
]
},
"/{containerName}?restype=container&comp=batch": {
"post": {
"tags": [
"container"
],
"operationId": "Container_SubmitBatch",
"description": "The Batch operation allows multiple API calls to be embedded into a single HTTP request.",
"parameters": [
{
"$ref": "#/parameters/Body"
},
{
"$ref": "#/parameters/ContentLength"
},
{
"$ref": "#/parameters/MultipartContentType"
},
{
"$ref": "#/parameters/Timeout"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/ClientRequestId"
}
],
"responses": {
"202": {
"description": "Success.",
"headers": {
"Content-Type": {
"type": "string",
"description": "The media type of the body of the response. For batch requests, this is multipart/mixed; boundary=batchresponse_GUID"
},
"x-ms-request-id": {
"x-ms-client-name": "RequestId",
"type": "string",
"description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request."
},
"x-ms-version": {
"x-ms-client-name": "Version",
"type": "string",
"description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."
}
},
"schema": {
"type": "object",
"format": "file"
}
},
"default": {
"description": "Failure",
"headers": {
"x-ms-error-code": {
"x-ms-client-name": "ErrorCode",
"type": "string"
}
},
"schema": {
"$ref": "#/definitions/StorageError"
}
}
}
},
"parameters": [
{
"name": "restype",
"in": "query",
"required": true,
"type": "string",
"enum": [
"container"
]
},
{
"name": "comp",
"in": "query",
"required": true,
"type": "string",
"enum": [
"batch"
]
}
]
},
"/{containerName}?comp=lease&restype=container&acquire": {
"put": {
"tags": [
@ -3139,6 +3315,11 @@
"type": "string",
"description": "A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob version, and may be used in subsequent requests to access this version of the blob."
},
"x-ms-is-current-version": {
"x-ms-client-name": "IsCurrentVersion",
"type": "boolean",
"description": "The value of this header indicates whether version of this blob is a current version, see also x-ms-version-id header."
},
"Accept-Ranges": {
"type": "string",
"description": "Indicates that the service supports requests for partial blob content."
@ -3184,6 +3365,12 @@
"x-ms-client-name": "IsSealed",
"type": "boolean",
"description": "If this blob has been sealed"
},
"x-ms-last-access-time": {
"x-ms-client-name": "LastAccessed",
"type": "string",
"format": "date-time-rfc1123",
"description": "UTC date/time value generated by the service that indicates the time at which the blob was last read or written to"
}
},
"schema": {
@ -3378,6 +3565,16 @@
"type": "string",
"description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."
},
"x-ms-version-id": {
"x-ms-client-name": "VersionId",
"type": "string",
"description": "A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob version, and may be used in subsequent requests to access this version of the blob."
},
"x-ms-is-current-version": {
"x-ms-client-name": "IsCurrentVersion",
"type": "boolean",
"description": "The value of this header indicates whether version of this blob is a current version, see also x-ms-version-id header."
},
"Accept-Ranges": {
"type": "string",
"description": "Indicates that the service supports requests for partial blob content."
@ -3423,6 +3620,12 @@
"x-ms-client-name": "IsSealed",
"type": "boolean",
"description": "If this blob has been sealed"
},
"x-ms-last-access-time": {
"x-ms-client-name": "LastAccessed",
"type": "string",
"format": "date-time-rfc1123",
"description": "UTC date/time value generated by the service that indicates the time at which the blob was last read or written to"
}
},
"schema": {
@ -3769,6 +3972,12 @@
"x-ms-client-name": "RehydratePriority",
"description": "If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High and Standard.",
"type": "string"
},
"x-ms-last-access-time": {
"x-ms-client-name": "LastAccessed",
"type": "string",
"format": "date-time-rfc1123",
"description": "UTC date/time value generated by the service that indicates the time at which the blob was last read or written to"
}
}
},
@ -3828,6 +4037,9 @@
},
{
"$ref": "#/parameters/ClientRequestId"
},
{
"$ref": "#/parameters/BlobDeleteType"
}
],
"responses": {
@ -4786,6 +4998,208 @@
}
]
},
"/{containerName}/{blob}?BlockBlob&fromUrl": {
"put": {
"tags": [
"blob"
],
"operationId": "BlockBlob_PutBlobFromUrl",
"description": "The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial updates to a block blobs contents using a source URL, use the Put Block from URL API in conjunction with Put Block List.",
"consumes": [
"application/octet-stream"
],
"parameters": [
{
"$ref": "#/parameters/Timeout"
},
{
"$ref": "#/parameters/ContentMD5"
},
{
"$ref": "#/parameters/ContentLength"
},
{
"$ref": "#/parameters/BlobContentType"
},
{
"$ref": "#/parameters/BlobContentEncoding"
},
{
"$ref": "#/parameters/BlobContentLanguage"
},
{
"$ref": "#/parameters/BlobContentMD5"
},
{
"$ref": "#/parameters/BlobCacheControl"
},
{
"$ref": "#/parameters/Metadata"
},
{
"$ref": "#/parameters/LeaseIdOptional"
},
{
"$ref": "#/parameters/BlobContentDisposition"
},
{
"$ref": "#/parameters/EncryptionKey"
},
{
"$ref": "#/parameters/EncryptionKeySha256"
},
{
"$ref": "#/parameters/EncryptionAlgorithm"
},
{
"$ref": "#/parameters/EncryptionScope"
},
{
"$ref": "#/parameters/AccessTierOptional"
},
{
"$ref": "#/parameters/IfModifiedSince"
},
{
"$ref": "#/parameters/IfUnmodifiedSince"
},
{
"$ref": "#/parameters/IfMatch"
},
{
"$ref": "#/parameters/IfNoneMatch"
},
{
"$ref": "#/parameters/IfTags"
},
{
"$ref": "#/parameters/SourceIfModifiedSince"
},
{
"$ref": "#/parameters/SourceIfUnmodifiedSince"
},
{
"$ref": "#/parameters/SourceIfMatch"
},
{
"$ref": "#/parameters/SourceIfNoneMatch"
},
{
"$ref": "#/parameters/SourceIfTags"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/ClientRequestId"
},
{
"$ref": "#/parameters/SourceContentMD5"
},
{
"$ref": "#/parameters/BlobTagsHeader"
},
{
"$ref": "#/parameters/CopySource"
},
{
"$ref": "#/parameters/CopySourceBlobProperties"
}
],
"responses": {
"201": {
"description": "The blob was updated.",
"headers": {
"ETag": {
"type": "string",
"format": "etag",
"description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes."
},
"Last-Modified": {
"type": "string",
"format": "date-time-rfc1123",
"description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob."
},
"Content-MD5": {
"type": "string",
"format": "byte",
"description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity."
},
"x-ms-client-request-id": {
"x-ms-client-name": "ClientRequestId",
"type": "string",
"description": "If a client request id header is sent in the request, this header will be present in the response with the same value."
},
"x-ms-request-id": {
"x-ms-client-name": "RequestId",
"type": "string",
"description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request."
},
"x-ms-version": {
"x-ms-client-name": "Version",
"type": "string",
"description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above."
},
"x-ms-version-id": {
"x-ms-client-name": "VersionId",
"type": "string",
"description": "A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob version, and may be used in subsequent requests to access this version of the blob."
},
"Date": {
"type": "string",
"format": "date-time-rfc1123",
"description": "UTC date/time value generated by the service that indicates the time at which the response was initiated"
},
"x-ms-request-server-encrypted": {
"x-ms-client-name": "IsServerEncrypted",
"type": "boolean",
"description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise."
},
"x-ms-encryption-key-sha256": {
"x-ms-client-name": "EncryptionKeySha256",
"type": "string",
"description": "The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted with a customer-provided key."
},
"x-ms-encryption-scope": {
"x-ms-client-name": "EncryptionScope",
"type": "string",
"description": "Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note that the absence of this header implies use of the default account encryption scope."
}
}
},
"default": {
"description": "Failure",
"headers": {
"x-ms-error-code": {
"x-ms-client-name": "ErrorCode",
"type": "string"
}
},
"schema": {
"$ref": "#/definitions/StorageError"
}
}
}
},
"parameters": [
{
"name": "x-ms-blob-type",
"x-ms-client-name": "blobType",
"in": "header",
"required": true,
"x-ms-parameter-location": "method",
"description": "Specifies the type of blob to create: block blob, page blob, or append blob.",
"type": "string",
"enum": [
"BlockBlob"
],
"x-ms-enum": {
"name": "BlobType",
"modelAsString": false
}
}
]
},
"/{containerName}/{blob}?comp=undelete": {
"put": {
"tags": [
@ -6128,9 +6542,6 @@
},
{
"$ref": "#/parameters/BlobTagsHeader"
},
{
"$ref": "#/parameters/SealBlob"
}
],
"responses": {
@ -6345,6 +6756,9 @@
},
{
"$ref": "#/parameters/LeaseIdOptional"
},
{
"$ref": "#/parameters/IfTags"
}
],
"responses": {
@ -7300,6 +7714,9 @@
{
"$ref": "#/parameters/IfNoneMatch"
},
{
"$ref": "#/parameters/IfTags"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
@ -7865,6 +8282,9 @@
{
"$ref": "#/parameters/IfNoneMatch"
},
{
"$ref": "#/parameters/IfTags"
},
{
"$ref": "#/parameters/BlobContentLengthRequired"
},
@ -7969,6 +8389,9 @@
{
"$ref": "#/parameters/IfNoneMatch"
},
{
"$ref": "#/parameters/IfTags"
},
{
"$ref": "#/parameters/SequenceNumberAction"
},
@ -8073,6 +8496,9 @@
{
"$ref": "#/parameters/IfNoneMatch"
},
{
"$ref": "#/parameters/IfTags"
},
{
"$ref": "#/parameters/CopySource"
},
@ -8651,6 +9077,9 @@
{
"$ref": "#/parameters/IfNoneMatch"
},
{
"$ref": "#/parameters/IfTags"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
@ -9138,6 +9567,9 @@
},
{
"$ref": "#/parameters/IfTags"
},
{
"$ref": "#/parameters/LeaseIdOptional"
}
],
"responses": {
@ -9211,6 +9643,9 @@
{
"$ref": "#/parameters/IfTags"
},
{
"$ref": "#/parameters/LeaseIdOptional"
},
{
"$ref": "#/parameters/BlobTagsBody"
}
@ -9651,11 +10086,17 @@
"type": "string",
"format": "date-time-rfc1123"
},
"IsSealed": {
"Sealed": {
"x-ms-client-name": "IsSealed",
"type": "boolean"
},
"RehydratePriority": {
"$ref": "#/definitions/RehydratePriority"
},
"LastAccessTime": {
"x-ms-client-name": "LastAccessedOn",
"type": "string",
"format": "date-time-rfc1123"
}
}
},
@ -10059,6 +10500,52 @@
}
}
},
"ArrowConfiguration" : {
"xml": {
"name": "ArrowConfiguration"
},
"description": "arrow configuration",
"type": "object",
"required": [
"Schema"
],
"properties": {
"Schema": {
"type": "array",
"items": {
"$ref": "#/definitions/ArrowField"
},
"xml": {
"wrapped": true,
"name": "Schema"
}
}
}
},
"ArrowField": {
"xml": {
"name": "Field"
},
"description": "field of an arrow schema",
"type": "object",
"required": [
"Type"
],
"properties": {
"Type": {
"type": "string"
},
"Name": {
"type": "string"
},
"Precision": {
"type": "integer"
},
"Scale": {
"type": "integer"
}
}
},
"ListContainersSegmentResponse": {
"xml": {
"name": "EnumerationResults"
@ -10182,6 +10669,7 @@
"UnsupportedHttpVerb",
"AppendPositionConditionNotMet",
"BlobAlreadyExists",
"BlobImmutableDueToPolicy",
"BlobNotFound",
"BlobOverwritten",
"BlobTierInadequateForContentLength",
@ -10273,8 +10761,8 @@
"ContainerName": {
"type": "string"
},
"TagValue": {
"type": "string"
"Tags": {
"$ref": "#/definitions/BlobTags"
}
}
},
@ -10531,7 +11019,7 @@
"$ref": "#/definitions/QuerySerialization",
"xml": {
"name": "InputSerialization"
}
}
},
"OutputSerialization": {
"$ref": "#/definitions/QuerySerialization",
@ -10558,6 +11046,9 @@
},
"JsonTextConfiguration": {
"$ref": "#/definitions/JsonTextConfiguration"
},
"ArrowConfiguration": {
"$ref": "#/definitions/ArrowConfiguration"
}
}
},
@ -10580,7 +11071,8 @@
"description": "The quick query format type.",
"enum": [
"delimited",
"json"
"json",
"arrow"
],
"x-ms-enum": {
"name": "QueryFormatType",
@ -10620,6 +11112,10 @@
"description": "Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted",
"type": "integer",
"minimum": 1
},
"AllowPermanentDelete": {
"description": "Indicates whether permanent delete is allowed on this storage account.",
"type": "boolean"
}
}
},
@ -10741,7 +11237,7 @@
"type": "string",
"description": "Specifies the version of the operation to use for this request.",
"enum": [
"2019-12-12"
"2020-04-08"
]
},
"Blob": {
@ -11026,6 +11522,22 @@
},
"description": "Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request."
},
"BlobDeleteType": {
"name": "deletetype",
"x-ms-client-name": "blobDeleteType",
"in": "query",
"required": false,
"type": "string",
"enum": [
"Permanent"
],
"x-ms-enum": {
"name": "BlobDeleteType",
"modelAsString": false
},
"x-ms-parameter-location": "method",
"description": "Optional. Only possible value is 'permanent', which specifies to permanently delete a blob if blob soft delete is enabled."
},
"BlobExpiryOptions": {
"name": "x-ms-expiry-option",
"x-ms-client-name": "ExpiryOptions",
@ -11187,6 +11699,15 @@
"x-ms-parameter-location": "method",
"description": "Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature."
},
"CopySourceBlobProperties": {
"name": "x-ms-copy-source-blob-properties",
"x-ms-client-name": "copySourceBlobProperties",
"in": "header",
"required": false,
"type": "boolean",
"x-ms-parameter-location": "method",
"description": "Optional, default is true. Indicates if properties from the source blob should be copied."
},
"DeleteSnapshots": {
"name": "x-ms-delete-snapshots",
"x-ms-client-name": "deleteSnapshots",
@ -11295,7 +11816,7 @@
"in": "header",
"required": false,
"x-ms-parameter-location": "method",
"description": "Optional. Version 2019-12-12 and laster. Specifies the name of the deleted container to restore."
"description": "Optional. Version 2019-12-12 and later. Specifies the name of the deleted container to restore."
},
"DeletedContainerVersion": {
"name": "x-ms-deleted-container-version",
@ -11304,7 +11825,7 @@
"in": "header",
"required": false,
"x-ms-parameter-location": "method",
"description": "Optional. Version 2019-12-12 and laster. Specifies the version of the deleted container to restore."
"description": "Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore."
},
"DenyEncryptionScopeOverride": {
"name": "x-ms-deny-encryption-scope-override",
@ -11797,6 +12318,15 @@
"x-ms-parameter-location": "method",
"description": "Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer."
},
"SourceContainerName": {
"name": "x-ms-source-container-name",
"x-ms-client-name": "SourceContainerName",
"type": "string",
"in": "header",
"required": true,
"x-ms-parameter-location": "method",
"description": "Required. Specifies the name of the container to rename."
},
"SourceContentMD5": {
"name": "x-ms-source-content-md5",
"x-ms-client-name": "sourceContentMD5",