diff --git a/azblob/access_conditions.go b/azblob/access_conditions.go index 94af160..25fe684 100644 --- a/azblob/access_conditions.go +++ b/azblob/access_conditions.go @@ -13,7 +13,7 @@ type ModifiedAccessConditions struct { } // pointers is for internal infrastructure. It returns the fields as pointers. -func (ac ModifiedAccessConditions) pointers() (ims *time.Time, ius *time.Time, ime *string, inme *string) { +func (ac ModifiedAccessConditions) pointers() (ims *time.Time, ius *time.Time, ime *ETag, inme *ETag) { if !ac.IfModifiedSince.IsZero() { ims = &ac.IfModifiedSince } @@ -21,10 +21,10 @@ func (ac ModifiedAccessConditions) pointers() (ims *time.Time, ius *time.Time, i ius = &ac.IfUnmodifiedSince } if ac.IfMatch != ETagNone { - ime = (*string)(&ac.IfMatch) + ime = &ac.IfMatch } if ac.IfNoneMatch != ETagNone { - inme = (*string)(&ac.IfNoneMatch) + inme = &ac.IfNoneMatch } return } diff --git a/azblob/url_append_blob.go b/azblob/url_append_blob.go index bbfe4f4..0fdf038 100644 --- a/azblob/url_append_blob.go +++ b/azblob/url_append_blob.go @@ -99,7 +99,7 @@ func (ab AppendBlobURL) AppendBlock(ctx context.Context, body io.ReadSeeker, ac // AppendBlockFromURL copies a new block of data from source URL to the end of the existing append blob. // For more information, see https://docs.microsoft.com/rest/api/storageservices/append-block-from-url. -func (ab AppendBlobURL) AppendBlockFromURL(ctx context.Context, sourceURL url.URL, offset int64, count int64, destinationAccessConditions AppendBlobAccessConditions, sourceAccessConditions ModifiedAccessConditions, transactionalMD5 []byte, cpk ClientProvidedKeyOptions) (*AppendBlobAppendBlockFromURLResponse, error) { +func (ab AppendBlobURL) AppendBlockFromURL(ctx context.Context, sourceURL url.URL, offset int64, count int64, destinationAccessConditions AppendBlobAccessConditions, sourceAccessConditions ModifiedAccessConditions, transactionalMD5 []byte, cpk ClientProvidedKeyOptions, sourceAuthorization TokenCredential) (*AppendBlobAppendBlockFromURLResponse, error) { ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := destinationAccessConditions.ModifiedAccessConditions.pointers() sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag := sourceAccessConditions.pointers() ifAppendPositionEqual, ifMaxSizeLessThanOrEqual := destinationAccessConditions.AppendPositionAccessConditions.pointers() @@ -111,7 +111,7 @@ func (ab AppendBlobURL) AppendBlockFromURL(ctx context.Context, sourceURL url.UR ifMaxSizeLessThanOrEqual, ifAppendPositionEqual, ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil, // Blob ifTags - sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag, nil, nil) + sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag, nil, tokenCredentialPointers(sourceAuthorization)) } type AppendBlobAccessConditions struct { diff --git a/azblob/url_block_blob.go b/azblob/url_block_blob.go index 8d6bdf3..ae0079e 100644 --- a/azblob/url_block_blob.go +++ b/azblob/url_block_blob.go @@ -103,12 +103,12 @@ func (bb BlockBlobURL) StageBlock(ctx context.Context, base64BlockID string, bod // StageBlockFromURL copies the specified block from a source URL to the block blob's "staging area" to be later committed by a call to CommitBlockList. // If count is CountToEnd (0), then data is read from specified offset to the end. // For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/put-block-from-url. -func (bb BlockBlobURL) StageBlockFromURL(ctx context.Context, base64BlockID string, sourceURL url.URL, offset int64, count int64, destinationAccessConditions LeaseAccessConditions, sourceAccessConditions ModifiedAccessConditions, cpk ClientProvidedKeyOptions) (*BlockBlobStageBlockFromURLResponse, error) { +func (bb BlockBlobURL) StageBlockFromURL(ctx context.Context, base64BlockID string, sourceURL url.URL, offset int64, count int64, destinationAccessConditions LeaseAccessConditions, sourceAccessConditions ModifiedAccessConditions, cpk ClientProvidedKeyOptions, sourceAuthorization TokenCredential) (*BlockBlobStageBlockFromURLResponse, error) { sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag := sourceAccessConditions.pointers() return bb.bbClient.StageBlockFromURL(ctx, base64BlockID, 0, sourceURL.String(), httpRange{offset: offset, count: count}.pointers(), nil, nil, nil, cpk.EncryptionKey, cpk.EncryptionKeySha256, cpk.EncryptionAlgorithm, // CPK cpk.EncryptionScope, // CPK-N - destinationAccessConditions.pointers(), sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag, nil, nil) + destinationAccessConditions.pointers(), sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag, nil, tokenCredentialPointers(sourceAuthorization)) } // CommitBlockList writes a blob by specifying the list of block IDs that make up the blob. @@ -146,7 +146,7 @@ func (bb BlockBlobURL) GetBlockList(ctx context.Context, listType BlockListType, // CopyFromURL synchronously copies the data at the source URL to a block blob, with sizes up to 256 MB. // For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob-from-url. -func (bb BlockBlobURL) CopyFromURL(ctx context.Context, source url.URL, metadata Metadata, srcac ModifiedAccessConditions, dstac BlobAccessConditions, srcContentMD5 []byte, tier AccessTierType, blobTagsMap BlobTagsMap, immutability ImmutabilityPolicyOptions) (*BlobCopyFromURLResponse, error) { +func (bb BlockBlobURL) CopyFromURL(ctx context.Context, source url.URL, metadata Metadata, srcac ModifiedAccessConditions, dstac BlobAccessConditions, srcContentMD5 []byte, tier AccessTierType, blobTagsMap BlobTagsMap, immutability ImmutabilityPolicyOptions, sourceAuthorization TokenCredential) (*BlobCopyFromURLResponse, error) { srcIfModifiedSince, srcIfUnmodifiedSince, srcIfMatchETag, srcIfNoneMatchETag := srcac.pointers() dstIfModifiedSince, dstIfUnmodifiedSince, dstIfMatchETag, dstIfNoneMatchETag := dstac.ModifiedAccessConditions.pointers() dstLeaseID := dstac.LeaseAccessConditions.pointers() @@ -161,12 +161,12 @@ func (bb BlockBlobURL) CopyFromURL(ctx context.Context, source url.URL, metadata dstLeaseID, nil, srcContentMD5, blobTagsString, // Blob tags // immutability policy - immutabilityExpiry, immutabilityMode, legalHold, nil) + immutabilityExpiry, immutabilityMode, legalHold, tokenCredentialPointers(sourceAuthorization)) } // 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) { +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, sourceAuthorization TokenCredential) (*BlockBlobPutBlobFromURLResponse, error) { srcIfModifiedSince, srcIfUnmodifiedSince, srcIfMatchETag, srcIfNoneMatchETag := srcac.pointers() dstIfModifiedSince, dstIfUnmodifiedSince, dstIfMatchETag, dstIfNoneMatchETag := dstac.ModifiedAccessConditions.pointers() @@ -178,5 +178,5 @@ func (bb BlockBlobURL) PutBlobFromURL(ctx context.Context, h BlobHTTPHeaders, so 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, nil) + srcIfMatchETag, srcIfNoneMatchETag, nil, nil, srcContentMD5, blobTagsString, nil, tokenCredentialPointers(sourceAuthorization)) } diff --git a/azblob/url_page_blob.go b/azblob/url_page_blob.go index 1fac66c..dc57765 100644 --- a/azblob/url_page_blob.go +++ b/azblob/url_page_blob.go @@ -103,7 +103,7 @@ func (pb PageBlobURL) UploadPages(ctx context.Context, offset int64, body io.Rea // The destOffset specifies the start offset of data in page blob will be written to. // The count must be a multiple of 512 bytes. // For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page-from-url. -func (pb PageBlobURL) UploadPagesFromURL(ctx context.Context, sourceURL url.URL, sourceOffset int64, destOffset int64, count int64, transactionalMD5 []byte, destinationAccessConditions PageBlobAccessConditions, sourceAccessConditions ModifiedAccessConditions, cpk ClientProvidedKeyOptions) (*PageBlobUploadPagesFromURLResponse, error) { +func (pb PageBlobURL) UploadPagesFromURL(ctx context.Context, sourceURL url.URL, sourceOffset int64, destOffset int64, count int64, transactionalMD5 []byte, destinationAccessConditions PageBlobAccessConditions, sourceAccessConditions ModifiedAccessConditions, cpk ClientProvidedKeyOptions, sourceAuthorization TokenCredential) (*PageBlobUploadPagesFromURLResponse, error) { ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := destinationAccessConditions.ModifiedAccessConditions.pointers() sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag := sourceAccessConditions.pointers() ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan, ifSequenceNumberEqual := destinationAccessConditions.SequenceNumberAccessConditions.pointers() @@ -115,7 +115,7 @@ func (pb PageBlobURL) UploadPagesFromURL(ctx context.Context, sourceURL url.URL, ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan, ifSequenceNumberEqual, ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil, // Blob ifTags - sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag, nil, nil) + sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag, nil, tokenCredentialPointers(sourceAuthorization)) } // ClearPages frees the specified pages from the page blob. diff --git a/azblob/zc_credential_token.go b/azblob/zc_credential_token.go index 7e78d25..c7d8ab0 100644 --- a/azblob/zc_credential_token.go +++ b/azblob/zc_credential_token.go @@ -23,6 +23,15 @@ type TokenCredential interface { SetToken(newToken string) } +func tokenCredentialPointers(credential TokenCredential) *string { + if credential == nil { + return nil + } + + out := "Bearer " + credential.Token() + return &out +} + // NewTokenCredential creates a token credential for use with role-based access control (RBAC) access to Azure Storage // resources. You initialize the TokenCredential with an initial token value. If you pass a non-nil value for // tokenRefresher, then the function you pass will be called immediately so it can refresh and change the @@ -68,7 +77,7 @@ func (f *tokenCredentialWithRefresh) New(next pipeline.Policy, po *pipeline.Poli return f.token.New(next, po) } -/////////////////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////////////// // tokenCredential is a pipeline.Factory is the credential's policy factory. type tokenCredential struct { diff --git a/azblob/zt_blob_tags_test.go b/azblob/zt_blob_tags_test.go index 4040d8c..5db337e 100644 --- a/azblob/zt_blob_tags_test.go +++ b/azblob/zt_blob_tags_test.go @@ -258,7 +258,7 @@ func (s *aztestsSuite) TestStageBlockFromURLWithTags(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() blockID1, blockID2 := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%6d", 0))), base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%6d", 1))) - stageResp1, err := destBlob.StageBlockFromURL(ctx, blockID1, srcBlobURLWithSAS, 0, 4*1024*1024, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}) + stageResp1, err := destBlob.StageBlockFromURL(ctx, blockID1, srcBlobURLWithSAS, 0, 4*1024*1024, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(stageResp1.Response().StatusCode, chk.Equals, 201) c.Assert(stageResp1.ContentMD5(), chk.Not(chk.Equals), "") @@ -266,7 +266,7 @@ func (s *aztestsSuite) TestStageBlockFromURLWithTags(c *chk.C) { c.Assert(stageResp1.Version(), chk.Not(chk.Equals), "") c.Assert(stageResp1.Date().IsZero(), chk.Equals, false) - stageResp2, err := destBlob.StageBlockFromURL(ctx, blockID2, srcBlobURLWithSAS, 4*1024*1024, CountToEnd, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}) + stageResp2, err := destBlob.StageBlockFromURL(ctx, blockID2, srcBlobURLWithSAS, 4*1024*1024, CountToEnd, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(stageResp2.Response().StatusCode, chk.Equals, 201) c.Assert(stageResp2.ContentMD5(), chk.Not(chk.Equals), "") @@ -283,7 +283,7 @@ func (s *aztestsSuite) TestStageBlockFromURLWithTags(c *chk.C) { listResp, err := destBlob.CommitBlockList(ctx, []string{blockID1, blockID2}, BlobHTTPHeaders{}, nil, BlobAccessConditions{}, DefaultAccessTier, blobTagsMap, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{}) c.Assert(err, chk.IsNil) c.Assert(listResp.Response().StatusCode, chk.Equals, 201) - //versionId := listResp.VersionID() + // versionId := listResp.VersionID() downloadResp, err := destBlob.BlobURL.Download(ctx, 0, CountToEnd, BlobAccessConditions{}, false, ClientProvidedKeyOptions{}) c.Assert(err, chk.IsNil) @@ -340,7 +340,7 @@ func (s *aztestsSuite) TestCopyBlockBlobFromURLWithTags(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() - resp, err := destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{"foo": "bar"}, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], DefaultAccessTier, nil, ImmutabilityPolicyOptions{}) + resp, err := destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{"foo": "bar"}, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], DefaultAccessTier, nil, ImmutabilityPolicyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(resp.Response().StatusCode, chk.Equals, 202) c.Assert(resp.ETag(), chk.Not(chk.Equals), "") @@ -360,10 +360,10 @@ func (s *aztestsSuite) TestCopyBlockBlobFromURLWithTags(c *chk.C) { c.Assert(len(downloadResp.NewMetadata()), chk.Equals, 1) _, badMD5 := getRandomDataAndReader(16) - _, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, badMD5, DefaultAccessTier, blobTagsMap, ImmutabilityPolicyOptions{}) + _, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, badMD5, DefaultAccessTier, blobTagsMap, ImmutabilityPolicyOptions{}, nil) c.Assert(err, chk.NotNil) - resp, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, DefaultAccessTier, blobTagsMap, ImmutabilityPolicyOptions{}) + resp, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, DefaultAccessTier, blobTagsMap, ImmutabilityPolicyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(resp.Response().StatusCode, chk.Equals, 202) c.Assert(resp.XMsContentCrc64(), chk.Not(chk.Equals), "") @@ -575,8 +575,8 @@ func (s *aztestsSuite) TestFindBlobsByTags(c *chk.C) { c.Assert(err, chk.IsNil) c.Assert(lResp.Blobs, chk.HasLen, 0) - //where = "\"tag1\"='firsttag'AND\"tag2\"='secondtag'AND\"@container\"='"+ containerName1 + "'" - //TODO: Figure out how to do a composite query based on container. + // where = "\"tag1\"='firsttag'AND\"tag2\"='secondtag'AND\"@container\"='"+ containerName1 + "'" + // TODO: Figure out how to do a composite query based on container. where = "\"tag1\"='firsttag'AND\"tag2\"='secondtag'" lResp, err = bsu.FindBlobsByTags(ctx, nil, nil, &where, Marker{}, nil) diff --git a/azblob/zt_blob_versioning_test.go b/azblob/zt_blob_versioning_test.go index 541055b..dc87f3e 100644 --- a/azblob/zt_blob_versioning_test.go +++ b/azblob/zt_blob_versioning_test.go @@ -247,7 +247,7 @@ func (s *aztestsSuite) TestCopyBlobFromURLWithSASReturnsVID(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() - resp, err := destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{"foo": "bar"}, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], DefaultAccessTier, nil, ImmutabilityPolicyOptions{}) + resp, err := destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{"foo": "bar"}, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], DefaultAccessTier, nil, ImmutabilityPolicyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(resp.Response().StatusCode, chk.Equals, 202) c.Assert(resp.Version(), chk.Not(chk.Equals), "") @@ -263,10 +263,10 @@ func (s *aztestsSuite) TestCopyBlobFromURLWithSASReturnsVID(c *chk.C) { c.Assert(downloadResp.Response().Header.Get("x-ms-version-id"), chk.NotNil) c.Assert(len(downloadResp.NewMetadata()), chk.Equals, 1) _, badMD5 := getRandomDataAndReader(16) - _, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, badMD5, DefaultAccessTier, nil, ImmutabilityPolicyOptions{}) + _, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, badMD5, DefaultAccessTier, nil, ImmutabilityPolicyOptions{}, nil) c.Assert(err, chk.NotNil) - resp, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, DefaultAccessTier, nil, ImmutabilityPolicyOptions{}) + resp, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, DefaultAccessTier, nil, ImmutabilityPolicyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(resp.Response().StatusCode, chk.Equals, 202) c.Assert(resp.XMsContentCrc64(), chk.Not(chk.Equals), "") diff --git a/azblob/zt_client_provided_key_test.go b/azblob/zt_client_provided_key_test.go index 6ec8cc9..448e6c1 100644 --- a/azblob/zt_client_provided_key_test.go +++ b/azblob/zt_client_provided_key_test.go @@ -43,10 +43,10 @@ func blockIDIntToBase64(blockID int) string { return blockIDBinaryToBase64(binaryBlockID) } -//func blockIDBase64ToInt(blockID string) int { +// func blockIDBase64ToInt(blockID string) int { // blockIDBase64ToBinary(blockID) // return int(binary.LittleEndian.Uint32(blockIDBase64ToBinary(blockID))) -//} +// } func (s *aztestsSuite) TestPutBlockAndPutBlockListWithCPK(c *chk.C) { bsu := getBSU() @@ -174,7 +174,7 @@ func (s *aztestsSuite) TestPutBlockFromURLAndCommitWithCPK(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() destBlob := container.NewBlockBlobURL(generateBlobName()) blockID1, blockID2 := blockIDIntToBase64(0), blockIDIntToBase64(1) - stageResp1, err := destBlob.StageBlockFromURL(ctx, blockID1, srcBlobURLWithSAS, 0, 1*1024, LeaseAccessConditions{}, ModifiedAccessConditions{}, testCPK) + stageResp1, err := destBlob.StageBlockFromURL(ctx, blockID1, srcBlobURLWithSAS, 0, 1*1024, LeaseAccessConditions{}, ModifiedAccessConditions{}, testCPK, nil) c.Assert(err, chk.IsNil) c.Assert(stageResp1.Response().StatusCode, chk.Equals, 201) c.Assert(stageResp1.ContentMD5(), chk.Not(chk.Equals), "") @@ -183,7 +183,7 @@ func (s *aztestsSuite) TestPutBlockFromURLAndCommitWithCPK(c *chk.C) { c.Assert(stageResp1.Date().IsZero(), chk.Equals, false) c.Assert(stageResp1.IsServerEncrypted(), chk.Equals, "true") - stageResp2, err := destBlob.StageBlockFromURL(ctx, blockID2, srcBlobURLWithSAS, 1*1024, CountToEnd, LeaseAccessConditions{}, ModifiedAccessConditions{}, testCPK) + stageResp2, err := destBlob.StageBlockFromURL(ctx, blockID2, srcBlobURLWithSAS, 1*1024, CountToEnd, LeaseAccessConditions{}, ModifiedAccessConditions{}, testCPK, nil) c.Assert(err, chk.IsNil) c.Assert(stageResp2.Response().StatusCode, chk.Equals, 201) c.Assert(stageResp2.ContentMD5(), chk.Not(chk.Equals), "") @@ -255,7 +255,7 @@ func (s *aztestsSuite) TestPutBlockFromURLAndCommitWithCPKWithScope(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() destBlob := container.NewBlockBlobURL(generateBlobName()) blockID1, blockID2 := blockIDIntToBase64(0), blockIDIntToBase64(1) - stageResp1, err := destBlob.StageBlockFromURL(ctx, blockID1, srcBlobURLWithSAS, 0, 1*1024, LeaseAccessConditions{}, ModifiedAccessConditions{}, testCPK1) + stageResp1, err := destBlob.StageBlockFromURL(ctx, blockID1, srcBlobURLWithSAS, 0, 1*1024, LeaseAccessConditions{}, ModifiedAccessConditions{}, testCPK1, nil) c.Assert(err, chk.IsNil) c.Assert(stageResp1.Response().StatusCode, chk.Equals, 201) c.Assert(stageResp1.ContentMD5(), chk.Not(chk.Equals), "") @@ -264,7 +264,7 @@ func (s *aztestsSuite) TestPutBlockFromURLAndCommitWithCPKWithScope(c *chk.C) { c.Assert(stageResp1.Date().IsZero(), chk.Equals, false) c.Assert(stageResp1.IsServerEncrypted(), chk.Equals, "true") - stageResp2, err := destBlob.StageBlockFromURL(ctx, blockID2, srcBlobURLWithSAS, 1*1024, CountToEnd, LeaseAccessConditions{}, ModifiedAccessConditions{}, testCPK1) + stageResp2, err := destBlob.StageBlockFromURL(ctx, blockID2, srcBlobURLWithSAS, 1*1024, CountToEnd, LeaseAccessConditions{}, ModifiedAccessConditions{}, testCPK1, nil) c.Assert(err, chk.IsNil) c.Assert(stageResp2.Response().StatusCode, chk.Equals, 201) c.Assert(stageResp2.ContentMD5(), chk.Not(chk.Equals), "") @@ -453,7 +453,7 @@ func (s *aztestsSuite) TestAppendBlockFromURLWithCPK(c *chk.C) { c.Assert(err, chk.IsNil) c.Assert(cResp2.StatusCode(), chk.Equals, 201) - appendResp, err := destBlob.AppendBlockFromURL(ctx, srcBlobURLWithSAS, 0, int64(testSize), AppendBlobAccessConditions{}, ModifiedAccessConditions{}, nil, testCPK) + appendResp, err := destBlob.AppendBlockFromURL(ctx, srcBlobURLWithSAS, 0, int64(testSize), AppendBlobAccessConditions{}, ModifiedAccessConditions{}, nil, testCPK, nil) c.Assert(err, chk.IsNil) c.Assert(appendResp.ETag(), chk.Not(chk.Equals), ETagNone) c.Assert(appendResp.LastModified().IsZero(), chk.Equals, false) @@ -552,7 +552,7 @@ func (s *aztestsSuite) TestPageBlockFromURLWithCPK(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() - resp, err := destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), nil, PageBlobAccessConditions{}, ModifiedAccessConditions{}, testCPK) + resp, err := destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), nil, PageBlobAccessConditions{}, ModifiedAccessConditions{}, testCPK, nil) c.Assert(err, chk.IsNil) c.Assert(resp.ETag(), chk.NotNil) c.Assert(resp.LastModified(), chk.NotNil) @@ -601,7 +601,7 @@ func (s *aztestsSuite) TestUploadPagesFromURLWithMD5WithCPK(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() destBlob, _ := createNewPageBlobWithCPK(c, container, int64(testSize), testCPK) - uploadResp, err := destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), md5Value[:], PageBlobAccessConditions{}, ModifiedAccessConditions{}, testCPK) + uploadResp, err := destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), md5Value[:], PageBlobAccessConditions{}, ModifiedAccessConditions{}, testCPK, nil) c.Assert(err, chk.IsNil) c.Assert(uploadResp.ETag(), chk.NotNil) c.Assert(uploadResp.LastModified(), chk.NotNil) @@ -617,7 +617,7 @@ func (s *aztestsSuite) TestUploadPagesFromURLWithMD5WithCPK(c *chk.C) { c.Assert(destData, chk.DeepEquals, srcData) _, badMD5 := getRandomDataAndReader(16) - _, err = destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), badMD5[:], PageBlobAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}) + _, err = destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), badMD5[:], PageBlobAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, nil) validateStorageError(c, err, ServiceCodeMd5Mismatch) } diff --git a/azblob/zt_put_blob_from_url_test.go b/azblob/zt_put_blob_from_url_test.go index 09b0244..1f6814a 100644 --- a/azblob/zt_put_blob_from_url_test.go +++ b/azblob/zt_put_blob_from_url_test.go @@ -32,7 +32,7 @@ func (s *aztestsSuite) TestPutBlobFromURLWithIncorrectURL(c *chk.C) { defer deleteContainer(c, container, false) // 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{}) + resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, url.URL{}, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, BlobTagsMap{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.NotNil) c.Assert(resp, chk.IsNil) } @@ -47,7 +47,7 @@ func (s *aztestsSuite) TestPutBlobFromURLWithMissingSAS(c *chk.C) { 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{}) + resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlob.URL(), basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, BlobTagsMap{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.NotNil) c.Assert(resp, chk.IsNil) } @@ -78,7 +78,7 @@ func (s *aztestsSuite) TestSetTierOnPutBlockBlobFromURL(c *chk.C) { 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{}) + resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], tier, BlobTagsMap{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(resp.Response().StatusCode, chk.Equals, 201) @@ -115,7 +115,7 @@ func (s *aztestsSuite) TestPutBlockBlobFromURL(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() // Invoke put blob from URL. - resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, BlobTagsMap{}, ClientProvidedKeyOptions{}) + resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, BlobTagsMap{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(resp.Response().StatusCode, chk.Equals, 201) c.Assert(resp.ETag(), chk.Not(chk.Equals), "") @@ -162,7 +162,7 @@ func (s *aztestsSuite) TestPutBlobFromURLWithSASReturnsVID(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() // Invoke put blob from URL - resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, nil, ClientProvidedKeyOptions{}) + resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, nil, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(resp.Response().StatusCode, chk.Equals, 201) c.Assert(resp.Version(), chk.Not(chk.Equals), "") @@ -179,7 +179,7 @@ func (s *aztestsSuite) TestPutBlobFromURLWithSASReturnsVID(c *chk.C) { 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{}) + resp, err = destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, nil, DefaultAccessTier, nil, ClientProvidedKeyOptions{}, nil) 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) @@ -218,7 +218,7 @@ func (s *aztestsSuite) TestPutBlockBlobFromURLWithTags(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() // Invoke put blob from URL - resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, blobTagsMap, ClientProvidedKeyOptions{}) + resp, err := destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, basicMetadata, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], sourceDataMD5Value[:], DefaultAccessTier, blobTagsMap, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(resp.Response().StatusCode, chk.Equals, 201) c.Assert(resp.ETag(), chk.Not(chk.Equals), "") @@ -239,11 +239,11 @@ func (s *aztestsSuite) TestPutBlockBlobFromURLWithTags(c *chk.C) { // 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{}) + _, err = destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, badMD5, badMD5, DefaultAccessTier, blobTagsMap, ClientProvidedKeyOptions{}, nil) 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{}) + resp, err = destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, nil, DefaultAccessTier, blobTagsMap, ClientProvidedKeyOptions{}, nil) 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) diff --git a/azblob/zt_s2s_oauth_test.go b/azblob/zt_s2s_oauth_test.go new file mode 100644 index 0000000..dcfa77d --- /dev/null +++ b/azblob/zt_s2s_oauth_test.go @@ -0,0 +1,116 @@ +package azblob + +import ( + "encoding/base64" + chk "gopkg.in/check.v1" + "math/rand" + "strings" +) + +func createS2SContainersWithCredential(c *chk.C, credential Credential) (source, dest ContainerURL) { + bsu := getBSU() + bsu.WithPipeline(NewPipeline(credential, PipelineOptions{})) + + source, dest = bsu.NewContainerURL(newUUID().String()), bsu.NewContainerURL(newUUID().String()) + + _, err := source.Create(ctx, nil, PublicAccessNone) + c.Assert(err, chk.IsNil) + _, err = dest.Create(ctx, nil, PublicAccessNone) + c.Assert(err, chk.IsNil) + + return +} + +func (s *aztestsSuite) TestBlockBlobS2SOAuth(c *chk.C) { + ocred, err := getOAuthCredential("", "") + c.Assert(err, chk.IsNil) + source, dest := createS2SContainersWithCredential(c, ocred) + + sourceBlob := source.NewBlockBlobURL("SourceBlob") + + _, err = sourceBlob.Upload(ctx, strings.NewReader("Hello, World!"), BlobHTTPHeaders{}, nil, BlobAccessConditions{}, AccessTierHot, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{}) + c.Assert(err, chk.IsNil) + + destBlob := dest.NewBlockBlobURL("DestBlob") + + _, err = destBlob.PutBlobFromURL(ctx, BlobHTTPHeaders{}, sourceBlob.URL(), nil, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, nil, AccessTierHot, nil, ClientProvidedKeyOptions{}, ocred) + c.Assert(err, chk.IsNil) +} + +func (s *aztestsSuite) TestBlockBlobS2SOAuthByBlock(c *chk.C) { + ocred, err := getOAuthCredential("", "") + c.Assert(err, chk.IsNil) + source, dest := createS2SContainersWithCredential(c, ocred) + + sourceBlob := source.NewBlockBlobURL("SourceBlob") + + _, err = sourceBlob.Upload(ctx, strings.NewReader("Hello, World!"), BlobHTTPHeaders{}, nil, BlobAccessConditions{}, AccessTierHot, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{}) + c.Assert(err, chk.IsNil) + + destBlob := dest.NewBlockBlobURL("DestBlob") + + _, err = destBlob.StageBlockFromURL(ctx, base64.StdEncoding.EncodeToString([]byte(newUUID().String())), sourceBlob.URL(), 0, int64(len("Hello, World!")), LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, ocred) + c.Assert(err, chk.IsNil) +} + +func (s *aztestsSuite) TestBlockBlobS2SOAuthCopyFromURL(c *chk.C) { + ocred, err := getOAuthCredential("", "") + c.Assert(err, chk.IsNil) + source, dest := createS2SContainersWithCredential(c, ocred) + + sourceBlob := source.NewBlockBlobURL("SourceBlob") + + _, err = sourceBlob.Upload(ctx, strings.NewReader("Hello, World!"), BlobHTTPHeaders{}, nil, BlobAccessConditions{}, AccessTierHot, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{}) + c.Assert(err, chk.IsNil) + + destBlob := dest.NewBlockBlobURL("DestBlob") + + _, err = destBlob.CopyFromURL(ctx, sourceBlob.URL(), nil, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, AccessTierHot, nil, ImmutabilityPolicyOptions{}, ocred) + c.Assert(err, chk.IsNil) +} + +func (s *aztestsSuite) TestPageBlobS2SOAuth(c *chk.C) { + ocred, err := getOAuthCredential("", "") + c.Assert(err, chk.IsNil) + source, dest := createS2SContainersWithCredential(c, ocred) + + sourceBlob := source.NewPageBlobURL("SourceBlob") + + _, err = sourceBlob.Create(ctx, 512, 0, BlobHTTPHeaders{}, nil, BlobAccessConditions{}, PremiumPageBlobAccessTierNone, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{}) + c.Assert(err, chk.IsNil) + + page := make([]byte, 512) + for k := range page { + page[k] = byte(rand.Intn(256)) + } + + // bytes.NewBuffer does not work, because bytes.Buffer does not satisfy Seeker. + _, err = sourceBlob.UploadPages(ctx, 0, strings.NewReader(string(page)), PageBlobAccessConditions{}, nil, ClientProvidedKeyOptions{}) + + destBlob := dest.NewPageBlobURL("DestBlob") + + _, err = destBlob.Create(ctx, 512, 0, BlobHTTPHeaders{}, nil, BlobAccessConditions{}, PremiumPageBlobAccessTierNone, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{}) + c.Assert(err, chk.IsNil) + _, err = destBlob.UploadPagesFromURL(ctx, sourceBlob.URL(), 0, 0, 512, nil, PageBlobAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, ocred) + c.Assert(err, chk.IsNil) +} + +func (s *aztestsSuite) TestAppendBlobS2SOAuth(c *chk.C) { + ocred, err := getOAuthCredential("", "") + c.Assert(err, chk.IsNil) + source, dest := createS2SContainersWithCredential(c, ocred) + + sourceBlob := source.NewAppendBlobURL("SourceBlob") + + _, err = sourceBlob.Create(ctx, BlobHTTPHeaders{}, nil, BlobAccessConditions{}, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{}) + c.Assert(err, chk.IsNil) + _, err = sourceBlob.AppendBlock(ctx, strings.NewReader("Hello, World!"), AppendBlobAccessConditions{}, nil, ClientProvidedKeyOptions{}) + c.Assert(err, chk.IsNil) + + destBlob := dest.NewAppendBlobURL("DestBlob") + + _, err = destBlob.Create(ctx, BlobHTTPHeaders{}, nil, BlobAccessConditions{}, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{}) + c.Assert(err, chk.IsNil) + _, err = destBlob.AppendBlockFromURL(ctx, sourceBlob.URL(), 0, int64(len("Hello, World!")), AppendBlobAccessConditions{}, ModifiedAccessConditions{}, nil, ClientProvidedKeyOptions{}, ocred) + c.Assert(err, chk.IsNil) +} diff --git a/azblob/zt_url_append_blob_test.go b/azblob/zt_url_append_blob_test.go index 211261b..4ec967b 100644 --- a/azblob/zt_url_append_blob_test.go +++ b/azblob/zt_url_append_blob_test.go @@ -124,7 +124,7 @@ func (s *aztestsSuite) TestAppendBlockFromURL(c *chk.C) { cResp2, err := destBlob.Create(context.Background(), BlobHTTPHeaders{}, nil, BlobAccessConditions{}, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{}) c.Assert(err, chk.IsNil) c.Assert(cResp2.StatusCode(), chk.Equals, 201) - appendFromURLResp, err := destBlob.AppendBlockFromURL(ctx, srcBlobURLWithSAS, 0, int64(testSize), AppendBlobAccessConditions{}, ModifiedAccessConditions{}, nil, ClientProvidedKeyOptions{}) + appendFromURLResp, err := destBlob.AppendBlockFromURL(ctx, srcBlobURLWithSAS, 0, int64(testSize), AppendBlobAccessConditions{}, ModifiedAccessConditions{}, nil, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(appendFromURLResp.Response().StatusCode, chk.Equals, 201) c.Assert(appendFromURLResp.BlobAppendOffset(), chk.Equals, "0") @@ -196,7 +196,7 @@ func (s *aztestsSuite) TestAppendBlockFromURLWithMD5(c *chk.C) { cResp2, err := destBlob.Create(context.Background(), BlobHTTPHeaders{}, nil, BlobAccessConditions{}, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{}) c.Assert(err, chk.IsNil) c.Assert(cResp2.StatusCode(), chk.Equals, 201) - appendFromURLResp, err := destBlob.AppendBlockFromURL(ctx, srcBlobURLWithSAS, 0, int64(testSize), AppendBlobAccessConditions{}, ModifiedAccessConditions{}, md5Value[:], ClientProvidedKeyOptions{}) + appendFromURLResp, err := destBlob.AppendBlockFromURL(ctx, srcBlobURLWithSAS, 0, int64(testSize), AppendBlobAccessConditions{}, ModifiedAccessConditions{}, md5Value[:], ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(appendFromURLResp.Response().StatusCode, chk.Equals, 201) c.Assert(appendFromURLResp.BlobAppendOffset(), chk.Equals, "0") @@ -217,7 +217,7 @@ func (s *aztestsSuite) TestAppendBlockFromURLWithMD5(c *chk.C) { // Test append block from URL with bad MD5 value _, badMD5 := getRandomDataAndReader(16) - _, err = destBlob.AppendBlockFromURL(ctx, srcBlobURLWithSAS, 0, int64(testSize), AppendBlobAccessConditions{}, ModifiedAccessConditions{}, badMD5, ClientProvidedKeyOptions{}) + _, err = destBlob.AppendBlockFromURL(ctx, srcBlobURLWithSAS, 0, int64(testSize), AppendBlobAccessConditions{}, ModifiedAccessConditions{}, badMD5, ClientProvidedKeyOptions{}, nil) validateStorageError(c, err, ServiceCodeMd5Mismatch) } diff --git a/azblob/zt_url_block_blob_test.go b/azblob/zt_url_block_blob_test.go index 8b724f4..84df0d0 100644 --- a/azblob/zt_url_block_blob_test.go +++ b/azblob/zt_url_block_blob_test.go @@ -108,7 +108,7 @@ func (s *aztestsSuite) TestStageBlockFromURL(c *chk.C) { // Stage blocks from URL. blockID1, blockID2 := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%6d", 0))), base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%6d", 1))) - stageResp1, err := destBlob.StageBlockFromURL(ctx, blockID1, srcBlobURLWithSAS, 0, 4*1024*1024, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}) + stageResp1, err := destBlob.StageBlockFromURL(ctx, blockID1, srcBlobURLWithSAS, 0, 4*1024*1024, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(stageResp1.Response().StatusCode, chk.Equals, 201) c.Assert(stageResp1.ContentMD5(), chk.Not(chk.Equals), "") @@ -116,7 +116,7 @@ func (s *aztestsSuite) TestStageBlockFromURL(c *chk.C) { c.Assert(stageResp1.Version(), chk.Not(chk.Equals), "") c.Assert(stageResp1.Date().IsZero(), chk.Equals, false) - stageResp2, err := destBlob.StageBlockFromURL(ctx, blockID2, srcBlobURLWithSAS, 4*1024*1024, CountToEnd, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}) + stageResp2, err := destBlob.StageBlockFromURL(ctx, blockID2, srcBlobURLWithSAS, 4*1024*1024, CountToEnd, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(stageResp2.Response().StatusCode, chk.Equals, 201) c.Assert(stageResp2.ContentMD5(), chk.Not(chk.Equals), "") @@ -182,7 +182,7 @@ func (s *aztestsSuite) TestCopyBlockBlobFromURL(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() // Invoke copy blob from URL. - resp, err := destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{"foo": "bar"}, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], DefaultAccessTier, nil, ImmutabilityPolicyOptions{}) + resp, err := destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{"foo": "bar"}, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], DefaultAccessTier, nil, ImmutabilityPolicyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(resp.Response().StatusCode, chk.Equals, 202) c.Assert(resp.ETag(), chk.Not(chk.Equals), "") @@ -205,11 +205,11 @@ func (s *aztestsSuite) TestCopyBlockBlobFromURL(c *chk.C) { // Edge case 1: Provide bad MD5 and make sure the copy fails _, badMD5 := getRandomDataAndReader(16) - _, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, badMD5, DefaultAccessTier, nil, ImmutabilityPolicyOptions{}) + _, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, badMD5, DefaultAccessTier, nil, ImmutabilityPolicyOptions{}, nil) c.Assert(err, chk.NotNil) // Edge case 2: Not providing any source MD5 should see the CRC getting returned instead - resp, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, DefaultAccessTier, nil, ImmutabilityPolicyOptions{}) + resp, err = destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, nil, DefaultAccessTier, nil, ImmutabilityPolicyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(resp.Response().StatusCode, chk.Equals, 202) c.Assert(resp.XMsContentCrc64(), chk.Not(chk.Equals), "") @@ -955,7 +955,7 @@ func (s *aztestsSuite) TestSetTierOnCopyBlockBlobFromURL(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() for _, tier := range []AccessTierType{AccessTierArchive, AccessTierCool, AccessTierHot} { destBlob := container.NewBlockBlobURL(generateBlobName()) - resp, err := destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{"foo": "bar"}, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], tier, nil, ImmutabilityPolicyOptions{}) + resp, err := destBlob.CopyFromURL(ctx, srcBlobURLWithSAS, Metadata{"foo": "bar"}, ModifiedAccessConditions{}, BlobAccessConditions{}, sourceDataMD5Value[:], tier, nil, ImmutabilityPolicyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(resp.Response().StatusCode, chk.Equals, 202) c.Assert(string(resp.CopyStatus()), chk.DeepEquals, "success") @@ -1006,7 +1006,7 @@ func (s *aztestsSuite) TestSetTierOnStageBlockFromURL(c *chk.C) { // Stage blocks from URL. blockID1, blockID2 := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%6d", 0))), base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%6d", 1))) - stageResp1, err := destBlob.StageBlockFromURL(ctx, blockID1, srcBlobURLWithSAS, 0, 4*1024*1024, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}) + stageResp1, err := destBlob.StageBlockFromURL(ctx, blockID1, srcBlobURLWithSAS, 0, 4*1024*1024, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(stageResp1.Response().StatusCode, chk.Equals, 201) c.Assert(stageResp1.ContentMD5(), chk.Not(chk.Equals), "") @@ -1014,7 +1014,7 @@ func (s *aztestsSuite) TestSetTierOnStageBlockFromURL(c *chk.C) { c.Assert(stageResp1.Version(), chk.Not(chk.Equals), "") c.Assert(stageResp1.Date().IsZero(), chk.Equals, false) - stageResp2, err := destBlob.StageBlockFromURL(ctx, blockID2, srcBlobURLWithSAS, 4*1024*1024, CountToEnd, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}) + stageResp2, err := destBlob.StageBlockFromURL(ctx, blockID2, srcBlobURLWithSAS, 4*1024*1024, CountToEnd, LeaseAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(stageResp2.Response().StatusCode, chk.Equals, 201) c.Assert(stageResp2.ContentMD5(), chk.Not(chk.Equals), "") diff --git a/azblob/zt_url_page_blob_test.go b/azblob/zt_url_page_blob_test.go index 03a71eb..0474c73 100644 --- a/azblob/zt_url_page_blob_test.go +++ b/azblob/zt_url_page_blob_test.go @@ -80,7 +80,7 @@ func (s *aztestsSuite) TestUploadPagesFromURL(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() // Upload page from URL. - pResp1, err := destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), nil, PageBlobAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}) + pResp1, err := destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), nil, PageBlobAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(pResp1.ETag(), chk.NotNil) c.Assert(pResp1.LastModified(), chk.NotNil) @@ -136,7 +136,7 @@ func (s *aztestsSuite) TestUploadPagesFromURLWithMD5(c *chk.C) { srcBlobURLWithSAS := srcBlobParts.URL() // Upload page from URL with MD5. - pResp1, err := destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), md5Value[:], PageBlobAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}) + pResp1, err := destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), md5Value[:], PageBlobAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, nil) c.Assert(err, chk.IsNil) c.Assert(pResp1.ETag(), chk.NotNil) c.Assert(pResp1.LastModified(), chk.NotNil) @@ -156,7 +156,7 @@ func (s *aztestsSuite) TestUploadPagesFromURLWithMD5(c *chk.C) { // Upload page from URL with bad MD5 _, badMD5 := getRandomDataAndReader(16) - _, err = destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), badMD5[:], PageBlobAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}) + _, err = destBlob.UploadPagesFromURL(ctx, srcBlobURLWithSAS, 0, 0, int64(testSize), badMD5[:], PageBlobAccessConditions{}, ModifiedAccessConditions{}, ClientProvidedKeyOptions{}, nil) validateStorageError(c, err, ServiceCodeMd5Mismatch) } diff --git a/azblob/zz_generated_append_blob.go b/azblob/zz_generated_append_blob.go index 42e9eca..9a0144b 100644 --- a/azblob/zz_generated_append_blob.go +++ b/azblob/zz_generated_append_blob.go @@ -57,7 +57,7 @@ func newAppendBlobClient(url url.URL, p pipeline.Pipeline) appendBlobClient { // 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 appendBlobClient) AppendBlock(ctx context.Context, body io.ReadSeeker, contentLength int64, timeout *int32, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, leaseID *string, maxSize *int64, appendPosition *int64, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (*AppendBlobAppendBlockResponse, error) { +func (client appendBlobClient) AppendBlock(ctx context.Context, body io.ReadSeeker, contentLength int64, timeout *int32, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, leaseID *string, maxSize *int64, appendPosition *int64, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*AppendBlobAppendBlockResponse, error) { if err := validate([]validation{ {targetValue: body, constraints: []constraint{{target: "body", name: null, rule: true, chain: nil}}}, @@ -78,7 +78,7 @@ func (client appendBlobClient) AppendBlock(ctx context.Context, body io.ReadSeek } // appendBlockPreparer prepares the AppendBlock request. -func (client appendBlobClient) appendBlockPreparer(body io.ReadSeeker, contentLength int64, timeout *int32, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, leaseID *string, maxSize *int64, appendPosition *int64, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client appendBlobClient) appendBlockPreparer(body io.ReadSeeker, contentLength int64, timeout *int32, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, leaseID *string, maxSize *int64, appendPosition *int64, 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, body) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -124,10 +124,10 @@ func (client appendBlobClient) appendBlockPreparer(body io.ReadSeeker, contentLe req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -187,7 +187,7 @@ func (client appendBlobClient) appendBlockResponder(resp pipeline.Response) (pip // a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage // analytics logging is enabled. copySourceAuthorization is only Bearer type is supported. Credentials should be a // valid OAuth access token to copy source. -func (client appendBlobClient) AppendBlockFromURL(ctx context.Context, sourceURL string, contentLength int64, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, transactionalContentMD5 []byte, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, maxSize *int64, appendPosition *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, requestID *string, copySourceAuthorization *string) (*AppendBlobAppendBlockFromURLResponse, error) { +func (client appendBlobClient) AppendBlockFromURL(ctx context.Context, sourceURL string, contentLength int64, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, transactionalContentMD5 []byte, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, maxSize *int64, appendPosition *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string, copySourceAuthorization *string) (*AppendBlobAppendBlockFromURLResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -206,7 +206,7 @@ func (client appendBlobClient) AppendBlockFromURL(ctx context.Context, sourceURL } // appendBlockFromURLPreparer prepares the AppendBlockFromURL request. -func (client appendBlobClient) appendBlockFromURLPreparer(sourceURL string, contentLength int64, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, transactionalContentMD5 []byte, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, maxSize *int64, appendPosition *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, requestID *string, copySourceAuthorization *string) (pipeline.Request, error) { +func (client appendBlobClient) appendBlockFromURLPreparer(sourceURL string, contentLength int64, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, transactionalContentMD5 []byte, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, maxSize *int64, appendPosition *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string, copySourceAuthorization *string) (pipeline.Request, error) { req, err := pipeline.NewRequest("PUT", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -259,10 +259,10 @@ func (client appendBlobClient) appendBlockFromURLPreparer(sourceURL string, cont req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -274,10 +274,10 @@ func (client appendBlobClient) appendBlockFromURLPreparer(sourceURL string, cont 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", *sourceIfMatch) + req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch)) } if sourceIfNoneMatch != nil { - req.Header.Set("x-ms-source-if-none-match", *sourceIfNoneMatch) + req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch)) } req.Header.Set("x-ms-version", ServiceVersion) if requestID != nil { @@ -336,7 +336,7 @@ func (client appendBlobClient) appendBlockFromURLResponder(resp pipeline.Respons // blobTagsString is optional. Used to set blob tags in various blob operations. immutabilityPolicyExpiry is specifies // the date time when the blobs immutability policy is set to expire. immutabilityPolicyMode is specifies the // immutability policy mode to set on the blob. legalHold is specified if a legal hold should be set on the blob. -func (client appendBlobClient) Create(ctx context.Context, contentLength int64, timeout *int32, 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, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (*AppendBlobCreateResponse, error) { +func (client appendBlobClient) Create(ctx context.Context, contentLength int64, timeout *int32, 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, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (*AppendBlobCreateResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -355,7 +355,7 @@ func (client appendBlobClient) Create(ctx context.Context, contentLength int64, } // createPreparer prepares the Create request. -func (client appendBlobClient) createPreparer(contentLength int64, timeout *int32, 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, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (pipeline.Request, error) { +func (client appendBlobClient) createPreparer(contentLength int64, timeout *int32, 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, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (pipeline.Request, error) { req, err := pipeline.NewRequest("PUT", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -411,10 +411,10 @@ func (client appendBlobClient) createPreparer(contentLength int64, timeout *int3 req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -465,7 +465,7 @@ func (client appendBlobClient) createResponder(resp pipeline.Response) (pipeline // header, used only for the Append Block operation. A number indicating the byte offset to compare. Append Block will // succeed only if the append position is equal to this number. If it is not, the request will fail with the // AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed). -func (client appendBlobClient) Seal(ctx context.Context, timeout *int32, requestID *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, appendPosition *int64) (*AppendBlobSealResponse, error) { +func (client appendBlobClient) Seal(ctx context.Context, timeout *int32, requestID *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, appendPosition *int64) (*AppendBlobSealResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -484,7 +484,7 @@ func (client appendBlobClient) Seal(ctx context.Context, timeout *int32, request } // sealPreparer prepares the Seal request. -func (client appendBlobClient) sealPreparer(timeout *int32, requestID *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, appendPosition *int64) (pipeline.Request, error) { +func (client appendBlobClient) sealPreparer(timeout *int32, requestID *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, appendPosition *int64) (pipeline.Request, error) { req, err := pipeline.NewRequest("PUT", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -509,10 +509,10 @@ func (client appendBlobClient) sealPreparer(timeout *int32, requestID *string, l req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if appendPosition != nil { req.Header.Set("x-ms-blob-condition-appendpos", strconv.FormatInt(*appendPosition, 10)) diff --git a/azblob/zz_generated_blob.go b/azblob/zz_generated_blob.go index ae8ffaa..6e3b9a2 100644 --- a/azblob/zz_generated_blob.go +++ b/azblob/zz_generated_blob.go @@ -105,7 +105,7 @@ func (client blobClient) abortCopyFromURLResponder(resp pipeline.Response) (pipe // 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) AcquireLease(ctx context.Context, timeout *int32, duration *int32, proposedLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (*BlobAcquireLeaseResponse, error) { +func (client blobClient) AcquireLease(ctx context.Context, timeout *int32, duration *int32, proposedLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*BlobAcquireLeaseResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -124,7 +124,7 @@ func (client blobClient) AcquireLease(ctx context.Context, timeout *int32, durat } // acquireLeasePreparer prepares the AcquireLease request. -func (client blobClient) acquireLeasePreparer(timeout *int32, duration *int32, proposedLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client blobClient) acquireLeasePreparer(timeout *int32, duration *int32, proposedLeaseID *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") @@ -148,10 +148,10 @@ func (client blobClient) acquireLeasePreparer(timeout *int32, duration *int32, p req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -192,7 +192,7 @@ func (client blobClient) acquireLeaseResponder(resp pipeline.Response) (pipeline // 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) BreakLease(ctx context.Context, timeout *int32, breakPeriod *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (*BlobBreakLeaseResponse, error) { +func (client blobClient) BreakLease(ctx context.Context, timeout *int32, breakPeriod *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*BlobBreakLeaseResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -211,7 +211,7 @@ func (client blobClient) BreakLease(ctx context.Context, timeout *int32, breakPe } // breakLeasePreparer prepares the BreakLease request. -func (client blobClient) breakLeasePreparer(timeout *int32, breakPeriod *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client blobClient) breakLeasePreparer(timeout *int32, breakPeriod *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") @@ -232,10 +232,10 @@ func (client blobClient) breakLeasePreparer(timeout *int32, breakPeriod *int32, req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -274,7 +274,7 @@ func (client blobClient) breakLeaseResponder(resp pipeline.Response) (pipeline.R // 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) ChangeLease(ctx context.Context, leaseID string, proposedLeaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (*BlobChangeLeaseResponse, error) { +func (client blobClient) ChangeLease(ctx context.Context, leaseID string, proposedLeaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*BlobChangeLeaseResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -293,7 +293,7 @@ func (client blobClient) ChangeLease(ctx context.Context, leaseID string, propos } // changeLeasePreparer prepares the ChangeLease request. -func (client blobClient) changeLeasePreparer(leaseID string, proposedLeaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client blobClient) changeLeasePreparer(leaseID string, proposedLeaseID 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") @@ -313,10 +313,10 @@ func (client blobClient) changeLeasePreparer(leaseID string, proposedLeaseID str req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -371,7 +371,7 @@ func (client blobClient) changeLeaseResponder(resp pipeline.Response) (pipeline. // immutability policy mode to set on the blob. legalHold is specified if a legal hold should be set on the blob. // copySourceAuthorization is only Bearer type is supported. Credentials should be a valid OAuth access token to copy // source. -func (client blobClient) CopyFromURL(ctx context.Context, copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, leaseID *string, requestID *string, sourceContentMD5 []byte, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool, copySourceAuthorization *string) (*BlobCopyFromURLResponse, error) { +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, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool, copySourceAuthorization *string) (*BlobCopyFromURLResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -390,7 +390,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 *string, sourceIfNoneMatch *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, leaseID *string, requestID *string, sourceContentMD5 []byte, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool, copySourceAuthorization *string) (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, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool, copySourceAuthorization *string) (pipeline.Request, error) { req, err := pipeline.NewRequest("PUT", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -415,10 +415,10 @@ func (client blobClient) copyFromURLPreparer(copySource string, timeout *int32, 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", *sourceIfMatch) + req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch)) } if sourceIfNoneMatch != nil { - req.Header.Set("x-ms-source-if-none-match", *sourceIfNoneMatch) + req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch)) } if ifModifiedSince != nil { req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) @@ -427,10 +427,10 @@ func (client blobClient) copyFromURLPreparer(copySource string, timeout *int32, req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -501,7 +501,7 @@ func (client blobClient) copyFromURLResponder(resp pipeline.Response) (pipeline. // value. leaseID is if specified, the operation 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. -func (client blobClient) CreateSnapshot(ctx context.Context, timeout *int32, metadata map[string]string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, leaseID *string, requestID *string) (*BlobCreateSnapshotResponse, error) { +func (client blobClient) CreateSnapshot(ctx context.Context, timeout *int32, metadata map[string]string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, leaseID *string, requestID *string) (*BlobCreateSnapshotResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -520,7 +520,7 @@ func (client blobClient) CreateSnapshot(ctx context.Context, timeout *int32, met } // createSnapshotPreparer prepares the CreateSnapshot request. -func (client blobClient) createSnapshotPreparer(timeout *int32, metadata map[string]string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, leaseID *string, requestID *string) (pipeline.Request, error) { +func (client blobClient) createSnapshotPreparer(timeout *int32, metadata map[string]string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, leaseID *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") @@ -555,10 +555,10 @@ func (client blobClient) createSnapshotPreparer(timeout *int32, metadata map[str req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -613,7 +613,7 @@ func (client blobClient) createSnapshotResponder(resp pipeline.Response) (pipeli // 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. 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 *string, ifNoneMatch *string, ifTags *string, requestID *string, blobDeleteType BlobDeleteType) (*BlobDeleteResponse, error) { +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, @@ -632,7 +632,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 *string, ifNoneMatch *string, ifTags *string, requestID *string, blobDeleteType BlobDeleteType) (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") @@ -664,10 +664,10 @@ func (client blobClient) deletePreparer(snapshot *string, versionID *string, tim req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -771,7 +771,7 @@ func (client blobClient) deleteImmutabilityPolicyResponder(resp pipeline.Respons // 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) Download(ctx context.Context, snapshot *string, versionID *string, timeout *int32, rangeParameter *string, leaseID *string, rangeGetContentMD5 *bool, rangeGetContentCRC64 *bool, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (*downloadResponse, error) { +func (client blobClient) Download(ctx context.Context, snapshot *string, versionID *string, timeout *int32, rangeParameter *string, leaseID *string, rangeGetContentMD5 *bool, rangeGetContentCRC64 *bool, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*downloadResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -790,7 +790,7 @@ func (client blobClient) Download(ctx context.Context, snapshot *string, version } // downloadPreparer prepares the Download request. -func (client blobClient) downloadPreparer(snapshot *string, versionID *string, timeout *int32, rangeParameter *string, leaseID *string, rangeGetContentMD5 *bool, rangeGetContentCRC64 *bool, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client blobClient) downloadPreparer(snapshot *string, versionID *string, timeout *int32, rangeParameter *string, leaseID *string, rangeGetContentMD5 *bool, rangeGetContentCRC64 *bool, 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("GET", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -834,10 +834,10 @@ func (client blobClient) downloadPreparer(snapshot *string, versionID *string, t req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -919,7 +919,7 @@ func (client blobClient) getAccountInfoResponder(resp pipeline.Response) (pipeli // 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) GetProperties(ctx context.Context, snapshot *string, versionID *string, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (*BlobGetPropertiesResponse, error) { +func (client blobClient) GetProperties(ctx context.Context, snapshot *string, versionID *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) (*BlobGetPropertiesResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -938,7 +938,7 @@ func (client blobClient) GetProperties(ctx context.Context, snapshot *string, ve } // getPropertiesPreparer prepares the GetProperties request. -func (client blobClient) getPropertiesPreparer(snapshot *string, versionID *string, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client blobClient) getPropertiesPreparer(snapshot *string, versionID *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("HEAD", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -973,10 +973,10 @@ func (client blobClient) getPropertiesPreparer(snapshot *string, versionID *stri req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -1086,47 +1086,10 @@ func (client blobClient) getTagsResponder(resp pipeline.Response) (pipeline.Resp return result, nil } +// Query the Query operation enables users to select/project on blob data by providing simple query expressions. // -//// 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 Creating -//// a Snapshot of a Blob. timeout is the timeout parameter is expressed in seconds. For more information, see Setting -//// Timeouts for Blob Service Operations. 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 *string, ifNoneMatch *string, 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 *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +// // 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 *string, ifNoneMatch *string, 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") @@ -1181,16 +1144,16 @@ func (client blobClient) getTagsResponder(resp pipeline.Response) (pipeline.Resp // 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) { +// // 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 @@ -1205,7 +1168,7 @@ func (client blobClient) getTagsResponder(resp pipeline.Response) (pipeline.Resp // 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) ReleaseLease(ctx context.Context, leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (*BlobReleaseLeaseResponse, error) { +func (client blobClient) ReleaseLease(ctx context.Context, leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*BlobReleaseLeaseResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -1224,7 +1187,7 @@ func (client blobClient) ReleaseLease(ctx context.Context, leaseID string, timeo } // releaseLeasePreparer prepares the ReleaseLease request. -func (client blobClient) releaseLeasePreparer(leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client blobClient) releaseLeasePreparer(leaseID 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") @@ -1243,10 +1206,10 @@ func (client blobClient) releaseLeasePreparer(leaseID string, timeout *int32, if req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -1283,7 +1246,7 @@ func (client blobClient) releaseLeaseResponder(resp pipeline.Response) (pipeline // 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) RenewLease(ctx context.Context, leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (*BlobRenewLeaseResponse, error) { +func (client blobClient) RenewLease(ctx context.Context, leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*BlobRenewLeaseResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -1302,7 +1265,7 @@ func (client blobClient) RenewLease(ctx context.Context, leaseID string, timeout } // renewLeasePreparer prepares the RenewLease request. -func (client blobClient) renewLeasePreparer(leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client blobClient) renewLeasePreparer(leaseID 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") @@ -1321,10 +1284,10 @@ func (client blobClient) renewLeasePreparer(leaseID string, timeout *int32, ifMo req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -1427,7 +1390,7 @@ func (client blobClient) setExpiryResponder(resp pipeline.Response) (pipeline.Re // where clause on blob tags to operate only on blobs with a matching value. blobContentDisposition is optional. Sets // the blob's Content-Disposition header. 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) SetHTTPHeaders(ctx context.Context, timeout *int32, blobCacheControl *string, blobContentType *string, blobContentMD5 []byte, blobContentEncoding *string, blobContentLanguage *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, blobContentDisposition *string, requestID *string) (*BlobSetHTTPHeadersResponse, error) { +func (client blobClient) SetHTTPHeaders(ctx context.Context, timeout *int32, blobCacheControl *string, blobContentType *string, blobContentMD5 []byte, blobContentEncoding *string, blobContentLanguage *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, blobContentDisposition *string, requestID *string) (*BlobSetHTTPHeadersResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -1446,7 +1409,7 @@ func (client blobClient) SetHTTPHeaders(ctx context.Context, timeout *int32, blo } // setHTTPHeadersPreparer prepares the SetHTTPHeaders request. -func (client blobClient) setHTTPHeadersPreparer(timeout *int32, blobCacheControl *string, blobContentType *string, blobContentMD5 []byte, blobContentEncoding *string, blobContentLanguage *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, blobContentDisposition *string, requestID *string) (pipeline.Request, error) { +func (client blobClient) setHTTPHeadersPreparer(timeout *int32, blobCacheControl *string, blobContentType *string, blobContentMD5 []byte, blobContentEncoding *string, blobContentLanguage *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, blobContentDisposition *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") @@ -1482,10 +1445,10 @@ func (client blobClient) setHTTPHeadersPreparer(timeout *int32, blobCacheControl req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -1659,7 +1622,7 @@ func (client blobClient) setLegalHoldResponder(resp pipeline.Response) (pipeline // 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) SetMetadata(ctx context.Context, timeout *int32, metadata map[string]string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (*BlobSetMetadataResponse, error) { +func (client blobClient) SetMetadata(ctx context.Context, timeout *int32, metadata map[string]string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*BlobSetMetadataResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -1678,7 +1641,7 @@ func (client blobClient) SetMetadata(ctx context.Context, timeout *int32, metada } // setMetadataPreparer prepares the SetMetadata request. -func (client blobClient) setMetadataPreparer(timeout *int32, metadata map[string]string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client blobClient) setMetadataPreparer(timeout *int32, metadata map[string]string, 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") @@ -1716,10 +1679,10 @@ func (client blobClient) setMetadataPreparer(timeout *int32, metadata map[string req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -1938,7 +1901,7 @@ func (client blobClient) setTierResponder(resp pipeline.Response) (pipeline.Resp // sealed state of the destination blob. Service version 2019-12-12 and newer. immutabilityPolicyExpiry is specifies // the date time when the blobs immutability policy is set to expire. immutabilityPolicyMode is specifies the // immutability policy mode to set on the blob. legalHold is specified if a legal hold should be set on the blob. -func (client blobClient) StartCopyFromURL(ctx context.Context, copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, rehydratePriority RehydratePriorityType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, sourceIfTags *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, leaseID *string, requestID *string, blobTagsString *string, sealBlob *bool, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (*BlobStartCopyFromURLResponse, error) { +func (client blobClient) StartCopyFromURL(ctx context.Context, copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, rehydratePriority RehydratePriorityType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, sourceIfTags *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, leaseID *string, requestID *string, blobTagsString *string, sealBlob *bool, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (*BlobStartCopyFromURLResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -1957,7 +1920,7 @@ func (client blobClient) StartCopyFromURL(ctx context.Context, copySource string } // startCopyFromURLPreparer prepares the StartCopyFromURL request. -func (client blobClient) startCopyFromURLPreparer(copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, rehydratePriority RehydratePriorityType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, sourceIfTags *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, leaseID *string, requestID *string, blobTagsString *string, sealBlob *bool, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (pipeline.Request, error) { +func (client blobClient) startCopyFromURLPreparer(copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, rehydratePriority RehydratePriorityType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, sourceIfTags *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, leaseID *string, requestID *string, blobTagsString *string, sealBlob *bool, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (pipeline.Request, error) { req, err := pipeline.NewRequest("PUT", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -1985,10 +1948,10 @@ func (client blobClient) startCopyFromURLPreparer(copySource string, timeout *in 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", *sourceIfMatch) + req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch)) } if sourceIfNoneMatch != nil { - req.Header.Set("x-ms-source-if-none-match", *sourceIfNoneMatch) + req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch)) } if sourceIfTags != nil { req.Header.Set("x-ms-source-if-tags", *sourceIfTags) @@ -2000,10 +1963,10 @@ func (client blobClient) startCopyFromURLPreparer(copySource string, timeout *in req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) diff --git a/azblob/zz_generated_block_blob.go b/azblob/zz_generated_block_blob.go index 3f4a46a..31067ed 100644 --- a/azblob/zz_generated_block_blob.go +++ b/azblob/zz_generated_block_blob.go @@ -70,7 +70,7 @@ func newBlockBlobClient(url url.URL, p pipeline.Pipeline) blockBlobClient { // operations. immutabilityPolicyExpiry is specifies the date time when the blobs immutability policy is set to expire. // immutabilityPolicyMode is specifies the immutability policy mode to set on the blob. legalHold is specified if a // legal hold should be set on the blob. -func (client blockBlobClient) CommitBlockList(ctx context.Context, blocks BlockLookupList, timeout *int32, blobCacheControl *string, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, 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 *string, ifNoneMatch *string, ifTags *string, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (*BlockBlobCommitBlockListResponse, error) { +func (client blockBlobClient) CommitBlockList(ctx context.Context, blocks BlockLookupList, timeout *int32, blobCacheControl *string, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, 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, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (*BlockBlobCommitBlockListResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -89,7 +89,7 @@ func (client blockBlobClient) CommitBlockList(ctx context.Context, blocks BlockL } // commitBlockListPreparer prepares the CommitBlockList request. -func (client blockBlobClient) commitBlockListPreparer(blocks BlockLookupList, timeout *int32, blobCacheControl *string, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, 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 *string, ifNoneMatch *string, ifTags *string, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (pipeline.Request, error) { +func (client blockBlobClient) commitBlockListPreparer(blocks BlockLookupList, timeout *int32, blobCacheControl *string, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, 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, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (pipeline.Request, error) { req, err := pipeline.NewRequest("PUT", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -154,10 +154,10 @@ func (client blockBlobClient) commitBlockListPreparer(blocks BlockLookupList, ti req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -336,7 +336,7 @@ func (client blockBlobClient) getBlockListResponder(resp pipeline.Response) (pip // copySourceBlobProperties is optional, default is true. Indicates if properties from the source blob should be // copied. copySourceAuthorization is only Bearer type is supported. Credentials should be a valid OAuth access token // to copy source. -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 *string, ifNoneMatch *string, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, sourceIfTags *string, requestID *string, sourceContentMD5 []byte, blobTagsString *string, copySourceBlobProperties *bool, copySourceAuthorization *string) (*BlockBlobPutBlobFromURLResponse, error) { +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, copySourceAuthorization *string) (*BlockBlobPutBlobFromURLResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -355,7 +355,7 @@ func (client blockBlobClient) PutBlobFromURL(ctx context.Context, contentLength } // 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 *string, ifNoneMatch *string, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, sourceIfTags *string, requestID *string, sourceContentMD5 []byte, blobTagsString *string, copySourceBlobProperties *bool, copySourceAuthorization *string) (pipeline.Request, error) { +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, copySourceAuthorization *string) (pipeline.Request, error) { req, err := pipeline.NewRequest("PUT", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -417,10 +417,10 @@ func (client blockBlobClient) putBlobFromURLPreparer(contentLength int64, copySo req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -432,10 +432,10 @@ func (client blockBlobClient) putBlobFromURLPreparer(contentLength int64, copySo 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", *sourceIfMatch) + req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch)) } if sourceIfNoneMatch != nil { - req.Header.Set("x-ms-source-if-none-match", *sourceIfNoneMatch) + req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch)) } if sourceIfTags != nil { req.Header.Set("x-ms-source-if-tags", *sourceIfTags) @@ -593,7 +593,7 @@ func (client blockBlobClient) stageBlockResponder(resp pipeline.Response) (pipel // 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. copySourceAuthorization is only Bearer type is // supported. Credentials should be a valid OAuth access token to copy source. -func (client blockBlobClient) StageBlockFromURL(ctx context.Context, blockID string, contentLength int64, sourceURL string, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, requestID *string, copySourceAuthorization *string) (*BlockBlobStageBlockFromURLResponse, error) { +func (client blockBlobClient) StageBlockFromURL(ctx context.Context, blockID string, contentLength int64, sourceURL string, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string, copySourceAuthorization *string) (*BlockBlobStageBlockFromURLResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -612,7 +612,7 @@ func (client blockBlobClient) StageBlockFromURL(ctx context.Context, blockID str } // stageBlockFromURLPreparer prepares the StageBlockFromURL request. -func (client blockBlobClient) stageBlockFromURLPreparer(blockID string, contentLength int64, sourceURL string, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, requestID *string, copySourceAuthorization *string) (pipeline.Request, error) { +func (client blockBlobClient) stageBlockFromURLPreparer(blockID string, contentLength int64, sourceURL string, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string, copySourceAuthorization *string) (pipeline.Request, error) { req, err := pipeline.NewRequest("PUT", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -657,10 +657,10 @@ func (client blockBlobClient) stageBlockFromURLPreparer(blockID string, contentL 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", *sourceIfMatch) + req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch)) } if sourceIfNoneMatch != nil { - req.Header.Set("x-ms-source-if-none-match", *sourceIfNoneMatch) + req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch)) } req.Header.Set("x-ms-version", ServiceVersion) if requestID != nil { @@ -725,7 +725,7 @@ func (client blockBlobClient) stageBlockFromURLResponder(resp pipeline.Response) // immutabilityPolicyExpiry is specifies the date time when the blobs immutability policy is set to expire. // immutabilityPolicyMode is specifies the immutability policy mode to set on the blob. legalHold is specified if a // legal hold should be set on the blob. -func (client blockBlobClient) Upload(ctx context.Context, body io.ReadSeeker, contentLength int64, 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 *string, ifNoneMatch *string, ifTags *string, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (*BlockBlobUploadResponse, error) { +func (client blockBlobClient) Upload(ctx context.Context, body io.ReadSeeker, contentLength int64, 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, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (*BlockBlobUploadResponse, error) { if err := validate([]validation{ {targetValue: body, constraints: []constraint{{target: "body", name: null, rule: true, chain: nil}}}, @@ -746,7 +746,7 @@ func (client blockBlobClient) Upload(ctx context.Context, body io.ReadSeeker, co } // uploadPreparer prepares the Upload request. -func (client blockBlobClient) uploadPreparer(body io.ReadSeeker, contentLength int64, 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 *string, ifNoneMatch *string, ifTags *string, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (pipeline.Request, error) { +func (client blockBlobClient) uploadPreparer(body io.ReadSeeker, contentLength int64, 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, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (pipeline.Request, error) { req, err := pipeline.NewRequest("PUT", client.url, body) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -808,10 +808,10 @@ func (client blockBlobClient) uploadPreparer(body io.ReadSeeker, contentLength i req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) diff --git a/azblob/zz_generated_directory.go b/azblob/zz_generated_directory.go deleted file mode 100644 index a352d2d..0000000 --- a/azblob/zz_generated_directory.go +++ /dev/null @@ -1,541 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "time" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// directoryClient is the client for the Directory methods of the Azblob service. -type directoryClient struct { - managementClient -} - -// newDirectoryClient creates an instance of the directoryClient client. -func newDirectoryClient(url url.URL, p pipeline.Pipeline) directoryClient { - return directoryClient{newManagementClient(url, p)} -} - -// Create create a directory. 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: "*". -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. 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. 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 directoryClient) Create(ctx context.Context, timeout *int32, directoryProperties *string, posixPermissions *string, posixUmask *string, cacheControl *string, contentType *string, contentEncoding *string, contentLanguage *string, contentDisposition *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, requestID *string) (*DirectoryCreateResponse, 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.createPreparer(timeout, directoryProperties, posixPermissions, posixUmask, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseID, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.createResponder}, req) - if err != nil { - return nil, err - } - return resp.(*DirectoryCreateResponse), err -} - -// createPreparer prepares the Create request. -func (client directoryClient) createPreparer(timeout *int32, directoryProperties *string, posixPermissions *string, posixUmask *string, cacheControl *string, contentType *string, contentEncoding *string, contentLanguage *string, contentDisposition *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *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") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("resource", "directory") - req.URL.RawQuery = params.Encode() - 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 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) - } - return req, nil -} - -// createResponder handles the response to the Create request. -func (client directoryClient) createResponder(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 &DirectoryCreateResponse{rawResponse: resp.Response()}, err -} - -// Delete deletes the directory -// -// recursiveDirectoryDelete is if "true", all paths beneath the directory will be deleted. If "false" and the directory -// is non-empty, an error occurs. timeout is the timeout parameter is expressed in seconds. For more information, see -// Setting -// Timeouts for Blob Service Operations. marker is when renaming a directory, the number of paths that are renamed -// with each invocation is limited. If the number of paths to be renamed exceeds this limit, a continuation token is -// returned in this response header. When a continuation token is returned in the response, it must be specified in a -// subsequent invocation of the rename operation to continue renaming the directory. leaseID is if specified, the -// operation only succeeds if the resource's lease is active and matches this ID. 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 directoryClient) Delete(ctx context.Context, recursiveDirectoryDelete bool, timeout *int32, marker *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, requestID *string) (*DirectoryDeleteResponse, 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(recursiveDirectoryDelete, timeout, marker, leaseID, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.deleteResponder}, req) - if err != nil { - return nil, err - } - return resp.(*DirectoryDeleteResponse), err -} - -// deletePreparer prepares the Delete request. -func (client directoryClient) deletePreparer(recursiveDirectoryDelete bool, timeout *int32, marker *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("DELETE", 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("recursive", strconv.FormatBool(recursiveDirectoryDelete)) - if marker != nil && len(*marker) > 0 { - params.Set("continuation", *marker) - } - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - 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) - } - return req, nil -} - -// deleteResponder handles the response to the Delete request. -func (client directoryClient) deleteResponder(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 &DirectoryDeleteResponse{rawResponse: resp.Response()}, err -} - -// GetAccessControl get the owner, group, permissions, or access control list for a directory. -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. upn is optional. Valid only when Hierarchical Namespace is enabled for the -// account. If "true", the identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response headers will -// be transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be -// returned as Azure Active Directory Object IDs. The default value is false. leaseID is if specified, the operation -// only succeeds if the resource's lease is active and matches this ID. 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. 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. 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 directoryClient) GetAccessControl(ctx context.Context, timeout *int32, upn *bool, leaseID *string, ifMatch *string, ifNoneMatch *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*DirectoryGetAccessControlResponse, 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.getAccessControlPreparer(timeout, upn, leaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getAccessControlResponder}, req) - if err != nil { - return nil, err - } - return resp.(*DirectoryGetAccessControlResponse), err -} - -// getAccessControlPreparer prepares the GetAccessControl request. -func (client directoryClient) getAccessControlPreparer(timeout *int32, upn *bool, leaseID *string, ifMatch *string, ifNoneMatch *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("HEAD", 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 upn != nil { - params.Set("upn", strconv.FormatBool(*upn)) - } - params.Set("action", "getAccessControl") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - 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 requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-version", ServiceVersion) - return req, nil -} - -// getAccessControlResponder handles the response to the GetAccessControl request. -func (client directoryClient) getAccessControlResponder(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 &DirectoryGetAccessControlResponse{rawResponse: resp.Response()}, err -} - -// Rename rename a directory. 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 Setting -// Timeouts for Blob Service Operations. marker is when renaming a directory, the number of paths that are renamed -// with each invocation is limited. If the number of paths to be renamed exceeds this limit, a continuation token is -// returned in this response header. When a continuation token is returned in the response, it must be specified in a -// subsequent invocation of the rename operation to continue renaming the directory. 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 directoryClient) Rename(ctx context.Context, renameSource string, timeout *int32, marker *string, 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 *string, ifNoneMatch *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, requestID *string) (*DirectoryRenameResponse, 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, marker, 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.(*DirectoryRenameResponse), err -} - -// renamePreparer prepares the Rename request. -func (client directoryClient) renamePreparer(renameSource string, timeout *int32, marker *string, 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 *string, ifNoneMatch *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *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") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - if marker != nil && len(*marker) > 0 { - params.Set("continuation", *marker) - } - // 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 directoryClient) 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 &DirectoryRenameResponse{rawResponse: resp.Response()}, err -} - -// SetAccessControl set the owner, group, permissions, or access control list for a directory. -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. owner is optional. The owner of the blob or directory. group is optional. The -// owning group of the blob or directory. 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. posixACL is sets POSIX access control rights on -// files and directories. The value is a comma-separated list of access control entries. Each access control entry -// (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format -// "[scope:][type]:[id]:[permissions]". 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. 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. 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 directoryClient) SetAccessControl(ctx context.Context, timeout *int32, leaseID *string, owner *string, group *string, posixPermissions *string, posixACL *string, ifMatch *string, ifNoneMatch *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*DirectorySetAccessControlResponse, 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.setAccessControlPreparer(timeout, leaseID, owner, group, posixPermissions, posixACL, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setAccessControlResponder}, req) - if err != nil { - return nil, err - } - return resp.(*DirectorySetAccessControlResponse), err -} - -// setAccessControlPreparer prepares the SetAccessControl request. -func (client directoryClient) setAccessControlPreparer(timeout *int32, leaseID *string, owner *string, group *string, posixPermissions *string, posixACL *string, ifMatch *string, ifNoneMatch *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PATCH", 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("action", "setAccessControl") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if owner != nil { - req.Header.Set("x-ms-owner", *owner) - } - if group != nil { - req.Header.Set("x-ms-group", *group) - } - if posixPermissions != nil { - req.Header.Set("x-ms-permissions", *posixPermissions) - } - if posixACL != nil { - req.Header.Set("x-ms-acl", *posixACL) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - 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 requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-version", ServiceVersion) - return req, nil -} - -// setAccessControlResponder handles the response to the SetAccessControl request. -func (client directoryClient) setAccessControlResponder(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 &DirectorySetAccessControlResponse{rawResponse: resp.Response()}, err -} diff --git a/azblob/zz_generated_models.go b/azblob/zz_generated_models.go index 00b939b..ec872a3 100644 --- a/azblob/zz_generated_models.go +++ b/azblob/zz_generated_models.go @@ -16,6 +16,17 @@ import ( "unsafe" ) +// ETag is an entity tag. +type ETag string + +const ( + // ETagNone represents an empty entity tag. + ETagNone ETag = "" + + // ETagAny matches any entity tag. + ETagAny ETag = "*" +) + // Metadata contains metadata key/value pairs. type Metadata map[string]string @@ -2378,7 +2389,7 @@ type BlobPropertiesInternal struct { XMLName xml.Name `xml:"Properties"` CreationTime *time.Time `xml:"Creation-Time"` LastModified time.Time `xml:"Last-Modified"` - Etag string `xml:"Etag"` + Etag ETag `xml:"Etag"` // ContentLength - Size in bytes ContentLength *int64 `xml:"Content-Length"` ContentType *string `xml:"Content-Type"` @@ -4456,7 +4467,7 @@ type ContainerItem struct { // ContainerProperties - Properties of a container type ContainerProperties struct { LastModified time.Time `xml:"Last-Modified"` - Etag string `xml:"Etag"` + Etag ETag `xml:"Etag"` // LeaseStatus - Possible values include: 'LeaseStatusLocked', 'LeaseStatusUnlocked', 'LeaseStatusNone' LeaseStatus LeaseStatusType `xml:"LeaseStatus"` // LeaseState - Possible values include: 'LeaseStateAvailable', 'LeaseStateLeased', 'LeaseStateExpired', 'LeaseStateBreaking', 'LeaseStateBroken', 'LeaseStateNone' @@ -4914,374 +4925,6 @@ type DelimitedTextConfiguration struct { HeadersPresent *bool `xml:"HasHeaders"` } -// DirectoryCreateResponse ... -type DirectoryCreateResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (dcr DirectoryCreateResponse) Response() *http.Response { - return dcr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (dcr DirectoryCreateResponse) StatusCode() int { - return dcr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (dcr DirectoryCreateResponse) Status() string { - return dcr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (dcr DirectoryCreateResponse) ClientRequestID() string { - return dcr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentLength returns the value for header Content-Length. -func (dcr DirectoryCreateResponse) ContentLength() int64 { - s := dcr.rawResponse.Header.Get("Content-Length") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// Date returns the value for header Date. -func (dcr DirectoryCreateResponse) Date() time.Time { - s := dcr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ETag returns the value for header ETag. -func (dcr DirectoryCreateResponse) ETag() ETag { - return ETag(dcr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (dcr DirectoryCreateResponse) LastModified() time.Time { - s := dcr.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 (dcr DirectoryCreateResponse) RequestID() string { - return dcr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (dcr DirectoryCreateResponse) Version() string { - return dcr.rawResponse.Header.Get("x-ms-version") -} - -// DirectoryDeleteResponse ... -type DirectoryDeleteResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (ddr DirectoryDeleteResponse) Response() *http.Response { - return ddr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (ddr DirectoryDeleteResponse) StatusCode() int { - return ddr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (ddr DirectoryDeleteResponse) Status() string { - return ddr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (ddr DirectoryDeleteResponse) ClientRequestID() string { - return ddr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (ddr DirectoryDeleteResponse) Date() time.Time { - s := ddr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// Marker returns the value for header x-ms-continuation. -func (ddr DirectoryDeleteResponse) Marker() string { - return ddr.rawResponse.Header.Get("x-ms-continuation") -} - -// RequestID returns the value for header x-ms-request-id. -func (ddr DirectoryDeleteResponse) RequestID() string { - return ddr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (ddr DirectoryDeleteResponse) Version() string { - return ddr.rawResponse.Header.Get("x-ms-version") -} - -// DirectoryGetAccessControlResponse ... -type DirectoryGetAccessControlResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (dgacr DirectoryGetAccessControlResponse) Response() *http.Response { - return dgacr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (dgacr DirectoryGetAccessControlResponse) StatusCode() int { - return dgacr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (dgacr DirectoryGetAccessControlResponse) Status() string { - return dgacr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (dgacr DirectoryGetAccessControlResponse) ClientRequestID() string { - return dgacr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (dgacr DirectoryGetAccessControlResponse) Date() time.Time { - s := dgacr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ETag returns the value for header ETag. -func (dgacr DirectoryGetAccessControlResponse) ETag() ETag { - return ETag(dgacr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (dgacr DirectoryGetAccessControlResponse) LastModified() time.Time { - s := dgacr.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 (dgacr DirectoryGetAccessControlResponse) RequestID() string { - return dgacr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (dgacr DirectoryGetAccessControlResponse) Version() string { - return dgacr.rawResponse.Header.Get("x-ms-version") -} - -// XMsACL returns the value for header x-ms-acl. -func (dgacr DirectoryGetAccessControlResponse) XMsACL() string { - return dgacr.rawResponse.Header.Get("x-ms-acl") -} - -// XMsGroup returns the value for header x-ms-group. -func (dgacr DirectoryGetAccessControlResponse) XMsGroup() string { - return dgacr.rawResponse.Header.Get("x-ms-group") -} - -// XMsOwner returns the value for header x-ms-owner. -func (dgacr DirectoryGetAccessControlResponse) XMsOwner() string { - return dgacr.rawResponse.Header.Get("x-ms-owner") -} - -// XMsPermissions returns the value for header x-ms-permissions. -func (dgacr DirectoryGetAccessControlResponse) XMsPermissions() string { - return dgacr.rawResponse.Header.Get("x-ms-permissions") -} - -// DirectoryRenameResponse ... -type DirectoryRenameResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (drr DirectoryRenameResponse) Response() *http.Response { - return drr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (drr DirectoryRenameResponse) StatusCode() int { - return drr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (drr DirectoryRenameResponse) Status() string { - return drr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (drr DirectoryRenameResponse) ClientRequestID() string { - return drr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentLength returns the value for header Content-Length. -func (drr DirectoryRenameResponse) ContentLength() int64 { - s := drr.rawResponse.Header.Get("Content-Length") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// Date returns the value for header Date. -func (drr DirectoryRenameResponse) Date() time.Time { - s := drr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ETag returns the value for header ETag. -func (drr DirectoryRenameResponse) ETag() ETag { - return ETag(drr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (drr DirectoryRenameResponse) LastModified() time.Time { - s := drr.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 -} - -// Marker returns the value for header x-ms-continuation. -func (drr DirectoryRenameResponse) Marker() string { - return drr.rawResponse.Header.Get("x-ms-continuation") -} - -// RequestID returns the value for header x-ms-request-id. -func (drr DirectoryRenameResponse) RequestID() string { - return drr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (drr DirectoryRenameResponse) Version() string { - return drr.rawResponse.Header.Get("x-ms-version") -} - -// DirectorySetAccessControlResponse ... -type DirectorySetAccessControlResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (dsacr DirectorySetAccessControlResponse) Response() *http.Response { - return dsacr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (dsacr DirectorySetAccessControlResponse) StatusCode() int { - return dsacr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (dsacr DirectorySetAccessControlResponse) Status() string { - return dsacr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (dsacr DirectorySetAccessControlResponse) ClientRequestID() string { - return dsacr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (dsacr DirectorySetAccessControlResponse) Date() time.Time { - s := dsacr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ETag returns the value for header ETag. -func (dsacr DirectorySetAccessControlResponse) ETag() ETag { - return ETag(dsacr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (dsacr DirectorySetAccessControlResponse) LastModified() time.Time { - s := dsacr.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 (dsacr DirectorySetAccessControlResponse) RequestID() string { - return dsacr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (dsacr DirectorySetAccessControlResponse) Version() string { - return dsacr.rawResponse.Header.Get("x-ms-version") -} - // downloadResponse - Wraps the response from the blobClient.Download method. type downloadResponse struct { rawResponse *http.Response @@ -6655,6 +6298,7 @@ type PageList struct { rawResponse *http.Response PageRange []PageRange `xml:"PageRange"` ClearRange []ClearRange `xml:"ClearRange"` + NextMarker Marker `xml:"NextMarker"` } // Response returns the raw HTTP response object. @@ -7590,7 +7234,7 @@ type blobPropertiesInternal struct { XMLName xml.Name `xml:"Properties"` CreationTime *timeRFC1123 `xml:"Creation-Time"` LastModified timeRFC1123 `xml:"Last-Modified"` - Etag string `xml:"Etag"` + Etag ETag `xml:"Etag"` ContentLength *int64 `xml:"Content-Length"` ContentType *string `xml:"Content-Type"` ContentEncoding *string `xml:"Content-Encoding"` @@ -7637,7 +7281,7 @@ type blobPropertiesInternal struct { // internal type used for marshalling type containerProperties struct { LastModified timeRFC1123 `xml:"Last-Modified"` - Etag string `xml:"Etag"` + Etag ETag `xml:"Etag"` LeaseStatus LeaseStatusType `xml:"LeaseStatus"` LeaseState LeaseStateType `xml:"LeaseState"` LeaseDuration LeaseDurationType `xml:"LeaseDuration"` diff --git a/azblob/zz_generated_page_blob.go b/azblob/zz_generated_page_blob.go index 601f38d..01a81fd 100644 --- a/azblob/zz_generated_page_blob.go +++ b/azblob/zz_generated_page_blob.go @@ -51,7 +51,7 @@ func newPageBlobClient(url url.URL, p pipeline.Pipeline) pageBlobClient { // 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 *string, ifNoneMatch *string, ifTags *string, requestID *string) (*PageBlobClearPagesResponse, error) { +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, @@ -70,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 *string, ifNoneMatch *string, ifTags *string, 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") @@ -116,10 +116,10 @@ func (client pageBlobClient) clearPagesPreparer(contentLength int64, timeout *in req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -160,7 +160,7 @@ func (client pageBlobClient) clearPagesResponder(resp pipeline.Response) (pipeli // 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 *string, ifNoneMatch *string, ifTags *string, requestID *string) (*PageBlobCopyIncrementalResponse, error) { +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, @@ -179,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 *string, ifNoneMatch *string, ifTags *string, 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,10 +197,10 @@ func (client pageBlobClient) copyIncrementalPreparer(copySource string, timeout req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -264,7 +264,7 @@ func (client pageBlobClient) copyIncrementalResponder(resp pipeline.Response) (p // immutabilityPolicyExpiry is specifies the date time when the blobs immutability policy is set to expire. // immutabilityPolicyMode is specifies the immutability policy mode to set on the blob. legalHold is specified if a // legal hold should be set on the blob. -func (client pageBlobClient) Create(ctx context.Context, contentLength int64, blobContentLength int64, timeout *int32, tier PremiumPageBlobAccessTierType, 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, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, blobSequenceNumber *int64, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (*PageBlobCreateResponse, error) { +func (client pageBlobClient) Create(ctx context.Context, contentLength int64, blobContentLength int64, timeout *int32, tier PremiumPageBlobAccessTierType, 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, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, blobSequenceNumber *int64, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (*PageBlobCreateResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -283,7 +283,7 @@ func (client pageBlobClient) Create(ctx context.Context, contentLength int64, bl } // createPreparer prepares the Create request. -func (client pageBlobClient) createPreparer(contentLength int64, blobContentLength int64, timeout *int32, tier PremiumPageBlobAccessTierType, 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, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, blobSequenceNumber *int64, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (pipeline.Request, error) { +func (client pageBlobClient) createPreparer(contentLength int64, blobContentLength int64, timeout *int32, tier PremiumPageBlobAccessTierType, 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, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, blobSequenceNumber *int64, requestID *string, blobTagsString *string, immutabilityPolicyExpiry *time.Time, immutabilityPolicyMode BlobImmutabilityPolicyModeType, legalHold *bool) (pipeline.Request, error) { req, err := pipeline.NewRequest("PUT", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -342,10 +342,10 @@ func (client pageBlobClient) createPreparer(contentLength int64, blobContentLeng req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -402,7 +402,7 @@ func (client pageBlobClient) createResponder(resp pipeline.Response) (pipeline.R // 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) GetPageRanges(ctx context.Context, snapshot *string, timeout *int32, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (*PageList, error) { +func (client pageBlobClient) GetPageRanges(ctx context.Context, snapshot *string, timeout *int32, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*PageList, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -421,7 +421,7 @@ func (client pageBlobClient) GetPageRanges(ctx context.Context, snapshot *string } // getPageRangesPreparer prepares the GetPageRanges request. -func (client pageBlobClient) getPageRangesPreparer(snapshot *string, timeout *int32, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client pageBlobClient) getPageRangesPreparer(snapshot *string, timeout *int32, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (pipeline.Request, error) { req, err := pipeline.NewRequest("GET", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -448,10 +448,10 @@ func (client pageBlobClient) getPageRangesPreparer(snapshot *string, timeout *in req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -511,7 +511,7 @@ func (client pageBlobClient) getPageRangesResponder(resp pipeline.Response) (pip // 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) GetPageRangesDiff(ctx context.Context, snapshot *string, timeout *int32, prevsnapshot *string, prevSnapshotURL *string, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (*PageList, error) { +func (client pageBlobClient) GetPageRangesDiff(ctx context.Context, snapshot *string, timeout *int32, prevsnapshot *string, prevSnapshotURL *string, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (*PageList, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -530,7 +530,7 @@ func (client pageBlobClient) GetPageRangesDiff(ctx context.Context, snapshot *st } // getPageRangesDiffPreparer prepares the GetPageRangesDiff request. -func (client pageBlobClient) getPageRangesDiffPreparer(snapshot *string, timeout *int32, prevsnapshot *string, prevSnapshotURL *string, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client pageBlobClient) getPageRangesDiffPreparer(snapshot *string, timeout *int32, prevsnapshot *string, prevSnapshotURL *string, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, requestID *string) (pipeline.Request, error) { req, err := pipeline.NewRequest("GET", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -563,10 +563,10 @@ func (client pageBlobClient) getPageRangesDiffPreparer(snapshot *string, timeout req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -625,7 +625,7 @@ func (client pageBlobClient) getPageRangesDiffResponder(resp pipeline.Response) // 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 *string, ifNoneMatch *string, ifTags *string, 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, @@ -644,7 +644,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 *string, ifNoneMatch *string, ifTags *string, 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") @@ -677,10 +677,10 @@ func (client pageBlobClient) resizePreparer(blobContentLength int64, timeout *in req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -719,7 +719,7 @@ func (client pageBlobClient) resizeResponder(resp pipeline.Response) (pipeline.R // 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 *string, ifNoneMatch *string, ifTags *string, blobSequenceNumber *int64, requestID *string) (*PageBlobUpdateSequenceNumberResponse, error) { +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, @@ -738,7 +738,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 *string, ifNoneMatch *string, ifTags *string, 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") @@ -759,10 +759,10 @@ func (client pageBlobClient) updateSequenceNumberPreparer(sequenceNumberAction S req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -816,7 +816,7 @@ func (client pageBlobClient) updateSequenceNumberResponder(resp pipeline.Respons // 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) UploadPages(ctx context.Context, body io.ReadSeeker, contentLength int64, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, 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 *string, ifNoneMatch *string, ifTags *string, requestID *string) (*PageBlobUploadPagesResponse, error) { +func (client pageBlobClient) UploadPages(ctx context.Context, body io.ReadSeeker, contentLength int64, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, 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) (*PageBlobUploadPagesResponse, error) { if err := validate([]validation{ {targetValue: body, constraints: []constraint{{target: "body", name: null, rule: true, chain: nil}}}, @@ -837,7 +837,7 @@ func (client pageBlobClient) UploadPages(ctx context.Context, body io.ReadSeeker } // uploadPagesPreparer prepares the UploadPages request. -func (client pageBlobClient) uploadPagesPreparer(body io.ReadSeeker, contentLength int64, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, 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 *string, ifNoneMatch *string, ifTags *string, requestID *string) (pipeline.Request, error) { +func (client pageBlobClient) uploadPagesPreparer(body io.ReadSeeker, contentLength int64, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, 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, body) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -889,10 +889,10 @@ func (client pageBlobClient) uploadPagesPreparer(body io.ReadSeeker, contentLeng req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -951,7 +951,7 @@ func (client pageBlobClient) uploadPagesResponder(resp pipeline.Response) (pipel // 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. copySourceAuthorization is only // Bearer type is supported. Credentials should be a valid OAuth access token to copy source. -func (client pageBlobClient) UploadPagesFromURL(ctx context.Context, sourceURL string, sourceRange string, contentLength int64, rangeParameter string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, requestID *string, copySourceAuthorization *string) (*PageBlobUploadPagesFromURLResponse, error) { +func (client pageBlobClient) UploadPagesFromURL(ctx context.Context, sourceURL string, sourceRange string, contentLength int64, rangeParameter string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string, copySourceAuthorization *string) (*PageBlobUploadPagesFromURLResponse, error) { if err := validate([]validation{ {targetValue: timeout, constraints: []constraint{{target: "timeout", name: null, rule: false, @@ -970,7 +970,7 @@ func (client pageBlobClient) UploadPagesFromURL(ctx context.Context, sourceURL s } // uploadPagesFromURLPreparer prepares the UploadPagesFromURL request. -func (client pageBlobClient) uploadPagesFromURLPreparer(sourceURL string, sourceRange string, contentLength int64, rangeParameter string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *string, ifNoneMatch *string, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *string, sourceIfNoneMatch *string, requestID *string, copySourceAuthorization *string) (pipeline.Request, error) { +func (client pageBlobClient) uploadPagesFromURLPreparer(sourceURL string, sourceRange string, contentLength int64, rangeParameter string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, encryptionScope *string, leaseID *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, ifTags *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string, copySourceAuthorization *string) (pipeline.Request, error) { req, err := pipeline.NewRequest("PUT", client.url, nil) if err != nil { return req, pipeline.NewError(err, "failed to create request") @@ -1022,10 +1022,10 @@ func (client pageBlobClient) uploadPagesFromURLPreparer(sourceURL string, source req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) } if ifMatch != nil { - req.Header.Set("If-Match", *ifMatch) + req.Header.Set("If-Match", string(*ifMatch)) } if ifNoneMatch != nil { - req.Header.Set("If-None-Match", *ifNoneMatch) + req.Header.Set("If-None-Match", string(*ifNoneMatch)) } if ifTags != nil { req.Header.Set("x-ms-if-tags", *ifTags) @@ -1037,10 +1037,10 @@ func (client pageBlobClient) uploadPagesFromURLPreparer(sourceURL string, source 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", *sourceIfMatch) + req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch)) } if sourceIfNoneMatch != nil { - req.Header.Set("x-ms-source-if-none-match", *sourceIfNoneMatch) + req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch)) } req.Header.Set("x-ms-version", ServiceVersion) if requestID != nil { diff --git a/azblob/zz_response_helpers.go b/azblob/zz_response_helpers.go index 6f76c83..45be7e0 100644 --- a/azblob/zz_response_helpers.go +++ b/azblob/zz_response_helpers.go @@ -29,7 +29,7 @@ func (bgpr BlobGetPropertiesResponse) NewHTTPHeaders() BlobHTTPHeaders { } } -/////////////////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////////////// // NewHTTPHeaders returns the user-modifiable properties for this blob. func (dr downloadResponse) NewHTTPHeaders() BlobHTTPHeaders { @@ -43,7 +43,7 @@ func (dr downloadResponse) NewHTTPHeaders() BlobHTTPHeaders { } } -/////////////////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////////////// // DownloadResponse wraps AutoRest generated downloadResponse and helps to provide info for retry. type DownloadResponse struct { @@ -238,13 +238,3 @@ func (r DownloadResponse) Version() string { func (r DownloadResponse) NewMetadata() Metadata { return r.r.NewMetadata() } - -type ETag string - -const ( - // ETagNone represents an empty entity tag. - ETagNone ETag = "" - - // ETagAny matches any entity tag. - ETagAny ETag = "*" -) diff --git a/swagger/README.md b/swagger/README.md index 08a3118..026e359 100644 --- a/swagger/README.md +++ b/swagger/README.md @@ -131,5 +131,94 @@ directive: }; ``` +### ETags + +#### Headers +```yaml +directive: + - from: swagger-document + where: $["x-ms-paths"].*.*.responses.*.headers["ETag"] + transform: > + $.format = "etag" +``` + +#### Properties +```yaml +directive: + - from: swagger-document + where: $.definitions.BlobPropertiesInternal.properties.Etag + transform: > + $.format = "etag" +``` + +```yaml +directive: + - from: swagger-document + where: $.definitions.ContainerProperties.properties.Etag + transform: > + $.format = "etag" +``` + +#### \[Source\]If*Match +```yaml +directive: + - from: swagger-document + where: $.parameters.IfMatch + transform: > + $.format = "etag" +``` + +```yaml +directive: + - from: swagger-document + where: $.parameters.IfNoneMatch + transform: > + $.format = "etag" +``` + +```yaml +directive: + - from: swagger-document + where: $.parameters.SourceIfMatch + transform: > + $.format = "etag" +``` + +```yaml +directive: + - from: swagger-document + where: $.parameters.SourceIfNoneMatch + transform: > + $.format = "etag" +``` + +### Remove BlobName & ContainerName parameters + +```yaml +directive: + - from: swagger-document + where: $["x-ms-paths"].* + transform: > + $.parameters = $.parameters.filter(x => x["$ref"] == undefined || !(x["$ref"] == "#/parameters/ContainerName" || x["$ref"] == "#/parameters/Blob")) +``` + +### Remove Marker & MaxResults from GetPageRange & GetPageRangeDiff + +```yaml +directive: + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=pagelist"]["get"] + transform: > + $.parameters = $.parameters.filter(x => x["$ref"] == undefined || !(x["$ref"] == "#/parameters/Marker" || x["$ref"] == "#/parameters/MaxResults")) +``` + +```yaml +directive: + - from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=pagelist&diff"]["get"] + transform: > + $.parameters = $.parameters.filter(x => x["$ref"] == undefined || !(x["$ref"] == "#/parameters/Marker" || x["$ref"] == "#/parameters/MaxResults")) +``` + ### TODO: Get rid of StorageError since we define it ### TODO: rfc3339Format = "2006-01-02T15:04:05Z" //This was wrong in the generated code