Removed requestId, Timeout, versionId, snapshot from the function signature of GetTags() and SetTags() (#252)
* Changed the function signature of getTags and setTags * Minor Adjustment * Review - 1
This commit is contained in:
Родитель
e76e24c47d
Коммит
68300d2983
|
@ -146,15 +146,15 @@ func (b BlobURL) Delete(ctx context.Context, deleteOptions DeleteSnapshotsOption
|
|||
// 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, timeout *int32, versionID *string, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, requestID *string, ifTags *string, blobTagsMap BlobTagsMap) (*BlobSetTagsResponse, error) {
|
||||
func (b BlobURL) SetTags(ctx context.Context, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, ifTags *string, blobTagsMap BlobTagsMap) (*BlobSetTagsResponse, error) {
|
||||
tags := SerializeBlobTags(blobTagsMap)
|
||||
return b.blobClient.SetTags(ctx, timeout, versionID, transactionalContentMD5, transactionalContentCrc64, requestID, ifTags, &tags)
|
||||
return b.blobClient.SetTags(ctx, nil, nil, transactionalContentMD5, transactionalContentCrc64, nil, ifTags, &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, timeout *int32, requestID *string, snapshot *string, versionID *string, ifTags *string) (*BlobTags, error) {
|
||||
return b.blobClient.GetTags(ctx, timeout, requestID, snapshot, versionID, ifTags)
|
||||
func (b BlobURL) GetTags(ctx context.Context, ifTags *string) (*BlobTags, error) {
|
||||
return b.blobClient.GetTags(ctx, nil, nil, nil, nil, ifTags)
|
||||
}
|
||||
|
||||
// Undelete restores the contents and metadata of a soft-deleted blob and any associated soft-deleted snapshots.
|
||||
|
|
|
@ -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, nil, nil, nil, blobTagsMap)
|
||||
blobSetTagsResponse, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)
|
||||
|
||||
blobGetTagsResponse, err := blobURL.GetTags(ctx, nil, nil, nil, nil, nil)
|
||||
blobGetTagsResponse, err := blobURL.GetTags(ctx, nil)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
|
||||
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
|
||||
|
@ -60,11 +60,12 @@ func (s *aztestsSuite) TestSetBlobTagsWithVID(c *chk.C) {
|
|||
c.Assert(blockBlobUploadResp.StatusCode(), chk.Equals, 201)
|
||||
versionId2 := blockBlobUploadResp.VersionID()
|
||||
|
||||
blobSetTagsResponse, err := blobURL.SetTags(ctx, nil, &versionId1, nil, nil, nil, nil, blobTagsMap)
|
||||
blobURL1 := blobURL.WithVersionID(versionId1)
|
||||
blobSetTagsResponse, err := blobURL1.SetTags(ctx, nil, nil, nil, blobTagsMap)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)
|
||||
|
||||
blobGetTagsResponse, err := blobURL.GetTags(ctx, nil, nil, nil, &versionId1, nil)
|
||||
blobGetTagsResponse, err := blobURL1.GetTags(ctx, nil)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
|
||||
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
|
||||
|
@ -72,7 +73,8 @@ func (s *aztestsSuite) TestSetBlobTagsWithVID(c *chk.C) {
|
|||
c.Assert(blobTagsMap[blobTag.Key], chk.Equals, blobTag.Value)
|
||||
}
|
||||
|
||||
blobGetTagsResponse, err = blobURL.GetTags(ctx, nil, nil, nil, &versionId2, nil)
|
||||
blobURL2 := blobURL.WithVersionID(versionId2)
|
||||
blobGetTagsResponse, err = blobURL2.GetTags(ctx, nil)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
|
||||
c.Assert(blobGetTagsResponse.BlobTagSet, chk.IsNil)
|
||||
|
@ -100,11 +102,12 @@ func (s *aztestsSuite) TestSetBlobTagsWithVID2(c *chk.C) {
|
|||
"Javascript": "Android",
|
||||
}
|
||||
|
||||
blobSetTagsResponse, err := blobURL.SetTags(ctx, nil, &versionId1, nil, nil, nil, nil, blobTags1)
|
||||
blobURL1 := blobURL.WithVersionID(versionId1)
|
||||
blobSetTagsResponse, err := blobURL1.SetTags(ctx, nil, nil, nil, blobTags1)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)
|
||||
|
||||
blobGetTagsResponse, err := blobURL.GetTags(ctx, nil, nil, nil, &versionId1, nil)
|
||||
blobGetTagsResponse, err := blobURL1.GetTags(ctx, nil)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
|
||||
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
|
||||
|
@ -116,11 +119,13 @@ func (s *aztestsSuite) TestSetBlobTagsWithVID2(c *chk.C) {
|
|||
"a123": "321a",
|
||||
"b234": "432b",
|
||||
}
|
||||
blobSetTagsResponse, err = blobURL.SetTags(ctx, nil, &versionId2, nil, nil, nil, nil, blobTags2)
|
||||
|
||||
blobURL2 := blobURL.WithVersionID(versionId2)
|
||||
blobSetTagsResponse, err = blobURL2.SetTags(ctx, nil, nil, nil, blobTags2)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobSetTagsResponse.StatusCode(), chk.Equals, 204)
|
||||
|
||||
blobGetTagsResponse, err = blobURL.GetTags(ctx, nil, nil, nil, &versionId2, nil)
|
||||
blobGetTagsResponse, err = blobURL2.GetTags(ctx, nil)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
|
||||
c.Assert(blobGetTagsResponse.BlobTagSet, chk.NotNil)
|
||||
|
@ -143,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, nil, nil, nil, nil)
|
||||
blobGetTagsResponse, err := blobURL.GetTags(ctx, nil)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobGetTagsResponse.StatusCode(), chk.Equals, 200)
|
||||
c.Assert(blobGetTagsResponse.BlobTagSet, chk.HasLen, 3)
|
||||
|
@ -192,7 +197,8 @@ func (s *aztestsSuite) TestStageBlockWithTags(c *chk.C) {
|
|||
contentData, err := ioutil.ReadAll(contentResp.Body(RetryReaderOptions{}))
|
||||
c.Assert(contentData, chk.DeepEquals, []uint8(strings.Join(data, "")))
|
||||
|
||||
blobGetTagsResp, err := blobURL.GetTags(ctx, nil, nil, nil, &versionId, nil)
|
||||
blobURL1 := blobURL.WithVersionID(versionId)
|
||||
blobGetTagsResp, err := blobURL1.GetTags(ctx, nil)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobGetTagsResp, chk.NotNil)
|
||||
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)
|
||||
|
@ -200,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, nil, nil, nil, nil)
|
||||
blobGetTagsResp, err = blobURL.GetTags(ctx, nil)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobGetTagsResp, chk.NotNil)
|
||||
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)
|
||||
|
@ -284,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, nil, nil, nil, nil)
|
||||
blobGetTagsResp, err := destBlob.GetTags(ctx, nil)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)
|
||||
for _, blobTag := range blobGetTagsResp.BlobTagSet {
|
||||
|
@ -396,7 +402,7 @@ func (s *aztestsSuite) TestSetBlobTagForSnapshot(c *chk.C) {
|
|||
"Storage+SDK": "SDK/GO",
|
||||
"GO ": ".Net",
|
||||
}
|
||||
_, err := blobURL.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
|
||||
_, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
|
||||
c.Assert(err, chk.IsNil)
|
||||
|
||||
resp, err := blobURL.CreateSnapshot(ctx, nil, BlobAccessConditions{}, ClientProvidedKeyOptions{})
|
||||
|
@ -427,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, nil, nil, nil, blobTagsMap)
|
||||
setTagResp, err := blob.SetTags(ctx, nil, nil, nil, blobTagsMap)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(setTagResp.StatusCode(), chk.Equals, 204)
|
||||
|
||||
|
@ -441,7 +447,7 @@ func (s *aztestsSuite) TestCreatePageBlobWithTags(c *chk.C) {
|
|||
"b0l1o2b3": "s0d1k2",
|
||||
}
|
||||
|
||||
setTagResp, err = blob.SetTags(ctx, nil, nil, nil, nil, nil, nil, modifiedBlobTags)
|
||||
setTagResp, err = blob.SetTags(ctx, nil, nil, nil, modifiedBlobTags)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(setTagResp.StatusCode(), chk.Equals, 204)
|
||||
|
||||
|
@ -476,7 +482,7 @@ func (s *aztestsSuite) TestSetTagOnPageBlob(c *chk.C) {
|
|||
"b0l1o2b3": "s0d1k2",
|
||||
}
|
||||
|
||||
setTagResp, err := blob.SetTags(ctx, nil, nil, nil, nil, nil, nil, modifiedBlobTags)
|
||||
setTagResp, err := blob.SetTags(ctx, nil, nil, nil, modifiedBlobTags)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(setTagResp.StatusCode(), chk.Equals, 204)
|
||||
|
||||
|
@ -513,7 +519,7 @@ func (s *aztestsSuite) TestListBlobReturnsTags(c *chk.C) {
|
|||
"tag2": "+-./:=_",
|
||||
"+-./:=_1": "+-./:=_",
|
||||
}
|
||||
resp, err := blobURL.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
|
||||
resp, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(resp.StatusCode(), chk.Equals, 204)
|
||||
|
||||
|
@ -618,11 +624,11 @@ func (s *aztestsSuite) TestFilterBlobsUsingAccountSAS(c *chk.C) {
|
|||
}
|
||||
|
||||
blobTagsMap := BlobTagsMap{"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"}
|
||||
setBlobTagsResp, err := blobURL.SetTags(ctx, nil, nil, nil, nil, nil, nil, blobTagsMap)
|
||||
setBlobTagsResp, err := blobURL.SetTags(ctx, nil, nil, nil, blobTagsMap)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(setBlobTagsResp.StatusCode(), chk.Equals, 204)
|
||||
|
||||
blobGetTagsResp, err := blobURL.GetTags(ctx, nil, nil, nil, nil, nil)
|
||||
blobGetTagsResp, err := blobURL.GetTags(ctx, nil)
|
||||
c.Assert(err, chk.IsNil)
|
||||
c.Assert(blobGetTagsResp.StatusCode(), chk.Equals, 200)
|
||||
c.Assert(blobGetTagsResp.BlobTagSet, chk.HasLen, 3)
|
||||
|
|
|
@ -981,8 +981,8 @@ func (s *aztestsSuite) TestSetTierOnStageBlockFromURL(c *chk.C) {
|
|||
testSize := 8 * 1024 * 1024 // 8MB
|
||||
r, sourceData := getRandomDataAndReader(testSize)
|
||||
ctx := context.Background() // Use default Background context
|
||||
srcBlob := container.NewBlockBlobURL(generateBlobName())
|
||||
destBlob := container.NewBlockBlobURL(generateBlobName())
|
||||
srcBlob := container.NewBlockBlobURL("src" + generateBlobName())
|
||||
destBlob := container.NewBlockBlobURL("dst" + generateBlobName())
|
||||
tier := AccessTierCool
|
||||
|
||||
// Prepare source blob for copy.
|
||||
|
|
|
@ -90,7 +90,7 @@ func (s *aztestsSuite) TestContainerCreateNilMetadata(c *chk.C) {
|
|||
bsu := getBSU()
|
||||
containerURL, _ := getContainerURL(c, bsu)
|
||||
|
||||
_, err := containerURL.Create(ctx, nil, PublicAccessBlob)
|
||||
_, err := containerURL.Create(ctx, nil, PublicAccessNone)
|
||||
defer deleteContainer(c, containerURL)
|
||||
c.Assert(err, chk.IsNil)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче