From 7b65a42d2e5fbec44daa6921e484d14fe387bb54 Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Tue, 2 May 2023 13:32:44 -0400 Subject: [PATCH 01/24] Regenerating azblob to stg 85/86 --- .../azblob/internal/generated/autorest.md | 2 +- .../generated/zz_appendblob_client.go | 16 +- .../internal/generated/zz_blob_client.go | 112 ++++++++------ .../internal/generated/zz_blockblob_client.go | 30 ++-- .../azblob/internal/generated/zz_constants.go | 32 ++++ .../internal/generated/zz_container_client.go | 146 ++++++++++++++---- .../azblob/internal/generated/zz_models.go | 50 +++++- .../internal/generated/zz_pageblob_client.go | 36 ++--- .../internal/generated/zz_response_types.go | 19 +++ .../internal/generated/zz_service_client.go | 35 +++-- 10 files changed, 334 insertions(+), 144 deletions(-) diff --git a/sdk/storage/azblob/internal/generated/autorest.md b/sdk/storage/azblob/internal/generated/autorest.md index 3044a608a21c..82334b459044 100644 --- a/sdk/storage/azblob/internal/generated/autorest.md +++ b/sdk/storage/azblob/internal/generated/autorest.md @@ -7,7 +7,7 @@ go: true clear-output-folder: false version: "^3.0.0" license-header: MICROSOFT_MIT_NO_VERSION -input-file: "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/e515b6251fdc21015282d2e84b85beec7c091763/specification/storage/data-plane/Microsoft.BlobStorage/preview/2020-10-02/blob.json" +input-file: "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/080b332b7572514a2e100dd2fa1fb86cb8edcb08/specification/storage/data-plane/Microsoft.BlobStorage/preview/2021-12-02/blob.json" credential-scope: "https://storage.azure.com/.default" output-folder: ../generated file-prefix: "zz_" diff --git a/sdk/storage/azblob/internal/generated/zz_appendblob_client.go b/sdk/storage/azblob/internal/generated/zz_appendblob_client.go index d0ddb9064d85..9ee5a4f6da55 100644 --- a/sdk/storage/azblob/internal/generated/zz_appendblob_client.go +++ b/sdk/storage/azblob/internal/generated/zz_appendblob_client.go @@ -44,7 +44,7 @@ func NewAppendBlobClient(endpoint string, pl runtime.Pipeline) *AppendBlobClient // AppendBlob. Append Block is supported only on version 2015-02-21 version or later. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - contentLength - The length of the request. // - body - Initial data // - options - AppendBlobClientAppendBlockOptions contains the optional parameters for the AppendBlobClient.AppendBlock method. @@ -124,7 +124,7 @@ func (client *AppendBlobClient) appendBlockCreateRequest(ctx context.Context, co if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -207,7 +207,7 @@ func (client *AppendBlobClient) appendBlockHandleResponse(resp *http.Response) ( // created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - sourceURL - Specify a URL to the copy source. // - contentLength - The length of the request. // - options - AppendBlobClientAppendBlockFromURLOptions contains the optional parameters for the AppendBlobClient.AppendBlockFromURL @@ -309,7 +309,7 @@ func (client *AppendBlobClient) appendBlockFromURLCreateRequest(ctx context.Cont if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfNoneMatch != nil { req.Raw().Header["x-ms-source-if-none-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfNoneMatch)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -390,7 +390,7 @@ func (client *AppendBlobClient) appendBlockFromURLHandleResponse(resp *http.Resp // Create - The Create Append Blob operation creates a new append blob. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - contentLength - The length of the request. // - options - AppendBlobClientCreateOptions contains the optional parameters for the AppendBlobClient.Create method. // - BlobHTTPHeaders - BlobHTTPHeaders contains a group of parameters for the BlobClient.SetHTTPHeaders method. @@ -481,7 +481,7 @@ func (client *AppendBlobClient) createCreateRequest(ctx context.Context, content if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -560,7 +560,7 @@ func (client *AppendBlobClient) createHandleResponse(resp *http.Response) (Appen // or later. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - AppendBlobClientSealOptions contains the optional parameters for the AppendBlobClient.Seal method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. @@ -593,7 +593,7 @@ func (client *AppendBlobClient) sealCreateRequest(ctx context.Context, options * reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } diff --git a/sdk/storage/azblob/internal/generated/zz_blob_client.go b/sdk/storage/azblob/internal/generated/zz_blob_client.go index 67402b5a5ab3..eb6a50136363 100644 --- a/sdk/storage/azblob/internal/generated/zz_blob_client.go +++ b/sdk/storage/azblob/internal/generated/zz_blob_client.go @@ -44,7 +44,7 @@ func NewBlobClient(endpoint string, pl runtime.Pipeline) *BlobClient { // blob with zero length and full metadata. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - copyID - The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. // - options - BlobClientAbortCopyFromURLOptions contains the optional parameters for the BlobClient.AbortCopyFromURL method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. @@ -80,7 +80,7 @@ func (client *BlobClient) abortCopyFromURLCreateRequest(ctx context.Context, cop if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -113,7 +113,7 @@ func (client *BlobClient) abortCopyFromURLHandleResponse(resp *http.Response) (B // AcquireLease - [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - duration - Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite // lease can be between 15 and 60 seconds. A lease duration cannot be changed using // renew or change. @@ -166,7 +166,7 @@ func (client *BlobClient) acquireLeaseCreateRequest(ctx context.Context, duratio if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -212,7 +212,7 @@ func (client *BlobClient) acquireLeaseHandleResponse(resp *http.Response) (BlobC // BreakLease - [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientBreakLeaseOptions contains the optional parameters for the BlobClient.BreakLease method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. func (client *BlobClient) BreakLease(ctx context.Context, options *BlobClientBreakLeaseOptions, modifiedAccessConditions *ModifiedAccessConditions) (BlobClientBreakLeaseResponse, error) { @@ -261,7 +261,7 @@ func (client *BlobClient) breakLeaseCreateRequest(ctx context.Context, options * if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -312,7 +312,7 @@ func (client *BlobClient) breakLeaseHandleResponse(resp *http.Response) (BlobCli // ChangeLease - [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - leaseID - Specifies the current lease ID on the resource. // - proposedLeaseID - Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed // lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID @@ -364,7 +364,7 @@ func (client *BlobClient) changeLeaseCreateRequest(ctx context.Context, leaseID if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -411,7 +411,7 @@ func (client *BlobClient) changeLeaseHandleResponse(resp *http.Response) (BlobCl // until the copy is complete. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - copySource - Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies // a page blob snapshot. The value should be URL-encoded as it would appear in a request // URI. The source blob must either be public or must be authenticated via a shared access signature. @@ -420,8 +420,9 @@ func (client *BlobClient) changeLeaseHandleResponse(resp *http.Response) (BlobCl // method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. -func (client *BlobClient) CopyFromURL(ctx context.Context, copySource string, options *BlobClientCopyFromURLOptions, sourceModifiedAccessConditions *SourceModifiedAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, leaseAccessConditions *LeaseAccessConditions) (BlobClientCopyFromURLResponse, error) { - req, err := client.copyFromURLCreateRequest(ctx, copySource, options, sourceModifiedAccessConditions, modifiedAccessConditions, leaseAccessConditions) +// - CPKScopeInfo - CPKScopeInfo contains a group of parameters for the BlobClient.SetMetadata method. +func (client *BlobClient) CopyFromURL(ctx context.Context, copySource string, options *BlobClientCopyFromURLOptions, sourceModifiedAccessConditions *SourceModifiedAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, leaseAccessConditions *LeaseAccessConditions, cpkScopeInfo *CPKScopeInfo) (BlobClientCopyFromURLResponse, error) { + req, err := client.copyFromURLCreateRequest(ctx, copySource, options, sourceModifiedAccessConditions, modifiedAccessConditions, leaseAccessConditions, cpkScopeInfo) if err != nil { return BlobClientCopyFromURLResponse{}, err } @@ -436,7 +437,7 @@ func (client *BlobClient) CopyFromURL(ctx context.Context, copySource string, op } // copyFromURLCreateRequest creates the CopyFromURL request. -func (client *BlobClient) copyFromURLCreateRequest(ctx context.Context, copySource string, options *BlobClientCopyFromURLOptions, sourceModifiedAccessConditions *SourceModifiedAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, leaseAccessConditions *LeaseAccessConditions) (*policy.Request, error) { +func (client *BlobClient) copyFromURLCreateRequest(ctx context.Context, copySource string, options *BlobClientCopyFromURLOptions, sourceModifiedAccessConditions *SourceModifiedAccessConditions, modifiedAccessConditions *ModifiedAccessConditions, leaseAccessConditions *LeaseAccessConditions, cpkScopeInfo *CPKScopeInfo) (*policy.Request, error) { req, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint) if err != nil { return nil, err @@ -488,7 +489,7 @@ func (client *BlobClient) copyFromURLCreateRequest(ctx context.Context, copySour if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -510,6 +511,12 @@ func (client *BlobClient) copyFromURLCreateRequest(ctx context.Context, copySour if options != nil && options.CopySourceAuthorization != nil { req.Raw().Header["x-ms-copy-source-authorization"] = []string{*options.CopySourceAuthorization} } + if cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil { + req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope} + } + if options != nil && options.CopySourceTags != nil { + req.Raw().Header["x-ms-copy-source-tag-option"] = []string{string(*options.CopySourceTags)} + } req.Raw().Header["Accept"] = []string{"application/xml"} return req, nil } @@ -566,13 +573,16 @@ func (client *BlobClient) copyFromURLHandleResponse(resp *http.Response) (BlobCl } result.ContentCRC64 = contentCRC64 } + if val := resp.Header.Get("x-ms-encryption-scope"); val != "" { + result.EncryptionScope = &val + } return result, nil } // CreateSnapshot - The Create Snapshot operation creates a read-only snapshot of a blob // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientCreateSnapshotOptions contains the optional parameters for the BlobClient.CreateSnapshot method. // - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method. // - CPKScopeInfo - CPKScopeInfo contains a group of parameters for the BlobClient.SetMetadata method. @@ -642,7 +652,7 @@ func (client *BlobClient) createSnapshotCreateRequest(ctx context.Context, optio if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -708,7 +718,7 @@ func (client *BlobClient) createSnapshotHandleResponse(resp *http.Response) (Blo // return an HTTP status code of 404 (ResourceNotFound). // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientDeleteOptions contains the optional parameters for the BlobClient.Delete method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. @@ -768,7 +778,7 @@ func (client *BlobClient) deleteCreateRequest(ctx context.Context, options *Blob if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -801,7 +811,7 @@ func (client *BlobClient) deleteHandleResponse(resp *http.Response) (BlobClientD // DeleteImmutabilityPolicy - The Delete Immutability Policy operation deletes the immutability policy on the blob // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientDeleteImmutabilityPolicyOptions contains the optional parameters for the BlobClient.DeleteImmutabilityPolicy // method. func (client *BlobClient) DeleteImmutabilityPolicy(ctx context.Context, options *BlobClientDeleteImmutabilityPolicyOptions) (BlobClientDeleteImmutabilityPolicyResponse, error) { @@ -831,7 +841,7 @@ func (client *BlobClient) deleteImmutabilityPolicyCreateRequest(ctx context.Cont reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -865,7 +875,7 @@ func (client *BlobClient) deleteImmutabilityPolicyHandleResponse(resp *http.Resp // can also call Download to read a snapshot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientDownloadOptions contains the optional parameters for the BlobClient.Download method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. // - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method. @@ -939,7 +949,7 @@ func (client *BlobClient) downloadCreateRequest(ctx context.Context, options *Bl if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1163,7 +1173,7 @@ func (client *BlobClient) downloadHandleResponse(resp *http.Response) (BlobClien // GetAccountInfo - Returns the sku name and account kind // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientGetAccountInfoOptions contains the optional parameters for the BlobClient.GetAccountInfo method. func (client *BlobClient) GetAccountInfo(ctx context.Context, options *BlobClientGetAccountInfoOptions) (BlobClientGetAccountInfoResponse, error) { req, err := client.getAccountInfoCreateRequest(ctx, options) @@ -1190,7 +1200,7 @@ func (client *BlobClient) getAccountInfoCreateRequest(ctx context.Context, optio reqQP.Set("restype", "account") reqQP.Set("comp", "properties") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} req.Raw().Header["Accept"] = []string{"application/xml"} return req, nil } @@ -1227,7 +1237,7 @@ func (client *BlobClient) getAccountInfoHandleResponse(resp *http.Response) (Blo // for the blob. It does not return the content of the blob. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientGetPropertiesOptions contains the optional parameters for the BlobClient.GetProperties method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. // - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method. @@ -1291,7 +1301,7 @@ func (client *BlobClient) getPropertiesCreateRequest(ctx context.Context, option if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1542,7 +1552,7 @@ func (client *BlobClient) getPropertiesHandleResponse(resp *http.Response) (Blob // GetTags - The Get Tags operation enables users to get the tags associated with a blob. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientGetTagsOptions contains the optional parameters for the BlobClient.GetTags method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. @@ -1579,7 +1589,7 @@ func (client *BlobClient) getTagsCreateRequest(ctx context.Context, options *Blo reqQP.Set("versionid", *options.VersionID) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1621,7 +1631,7 @@ func (client *BlobClient) getTagsHandleResponse(resp *http.Response) (BlobClient // Query - The Query operation enables users to select/project on blob data by providing simple query expressions. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientQueryOptions contains the optional parameters for the BlobClient.Query method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. // - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method. @@ -1684,7 +1694,7 @@ func (client *BlobClient) queryCreateRequest(ctx context.Context, options *BlobC if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1849,7 +1859,7 @@ func (client *BlobClient) queryHandleResponse(resp *http.Response) (BlobClientQu // ReleaseLease - [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - leaseID - Specifies the current lease ID on the resource. // - options - BlobClientReleaseLeaseOptions contains the optional parameters for the BlobClient.ReleaseLease method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. @@ -1897,7 +1907,7 @@ func (client *BlobClient) releaseLeaseCreateRequest(ctx context.Context, leaseID if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1940,7 +1950,7 @@ func (client *BlobClient) releaseLeaseHandleResponse(resp *http.Response) (BlobC // RenewLease - [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - leaseID - Specifies the current lease ID on the resource. // - options - BlobClientRenewLeaseOptions contains the optional parameters for the BlobClient.RenewLease method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. @@ -1988,7 +1998,7 @@ func (client *BlobClient) renewLeaseCreateRequest(ctx context.Context, leaseID s if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -2034,7 +2044,7 @@ func (client *BlobClient) renewLeaseHandleResponse(resp *http.Response) (BlobCli // SetExpiry - Sets the time a blob will expire and be deleted. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - expiryOptions - Required. Indicates mode of the expiry time // - options - BlobClientSetExpiryOptions contains the optional parameters for the BlobClient.SetExpiry method. func (client *BlobClient) SetExpiry(ctx context.Context, expiryOptions ExpiryOptions, options *BlobClientSetExpiryOptions) (BlobClientSetExpiryResponse, error) { @@ -2064,7 +2074,7 @@ func (client *BlobClient) setExpiryCreateRequest(ctx context.Context, expiryOpti reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -2111,7 +2121,7 @@ func (client *BlobClient) setExpiryHandleResponse(resp *http.Response) (BlobClie // SetHTTPHeaders - The Set HTTP Headers operation sets system properties on the blob // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientSetHTTPHeadersOptions contains the optional parameters for the BlobClient.SetHTTPHeaders method. // - BlobHTTPHeaders - BlobHTTPHeaders contains a group of parameters for the BlobClient.SetHTTPHeaders method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. @@ -2179,7 +2189,7 @@ func (client *BlobClient) setHTTPHeadersCreateRequest(ctx context.Context, optio if blobHTTPHeaders != nil && blobHTTPHeaders.BlobContentDisposition != nil { req.Raw().Header["x-ms-blob-content-disposition"] = []string{*blobHTTPHeaders.BlobContentDisposition} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -2229,7 +2239,7 @@ func (client *BlobClient) setHTTPHeadersHandleResponse(resp *http.Response) (Blo // SetImmutabilityPolicy - The Set Immutability Policy operation sets the immutability policy on the blob // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientSetImmutabilityPolicyOptions contains the optional parameters for the BlobClient.SetImmutabilityPolicy // method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. @@ -2260,7 +2270,7 @@ func (client *BlobClient) setImmutabilityPolicyCreateRequest(ctx context.Context reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -2312,7 +2322,7 @@ func (client *BlobClient) setImmutabilityPolicyHandleResponse(resp *http.Respons // SetLegalHold - The Set Legal Hold operation sets a legal hold on the blob. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - legalHold - Specified if a legal hold should be set on the blob. // - options - BlobClientSetLegalHoldOptions contains the optional parameters for the BlobClient.SetLegalHold method. func (client *BlobClient) SetLegalHold(ctx context.Context, legalHold bool, options *BlobClientSetLegalHoldOptions) (BlobClientSetLegalHoldResponse, error) { @@ -2342,7 +2352,7 @@ func (client *BlobClient) setLegalHoldCreateRequest(ctx context.Context, legalHo reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -2384,7 +2394,7 @@ func (client *BlobClient) setLegalHoldHandleResponse(resp *http.Response) (BlobC // pairs // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientSetMetadataOptions contains the optional parameters for the BlobClient.SetMetadata method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. // - CPKInfo - CPKInfo contains a group of parameters for the BlobClient.Download method. @@ -2454,7 +2464,7 @@ func (client *BlobClient) setMetadataCreateRequest(ctx context.Context, options if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -2513,7 +2523,7 @@ func (client *BlobClient) setMetadataHandleResponse(resp *http.Response) (BlobCl // SetTags - The Set Tags operation enables users to set tags on a blob. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - tags - Blob tags // - options - BlobClientSetTagsOptions contains the optional parameters for the BlobClient.SetTags method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. @@ -2548,7 +2558,7 @@ func (client *BlobClient) setTagsCreateRequest(ctx context.Context, tags BlobTag reqQP.Set("versionid", *options.VersionID) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.TransactionalContentMD5 != nil { req.Raw().Header["Content-MD5"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentMD5)} } @@ -2596,7 +2606,7 @@ func (client *BlobClient) setTagsHandleResponse(resp *http.Response) (BlobClient // storage type. This operation does not update the blob's ETag. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - tier - Indicates the tier to be set on the blob. // - options - BlobClientSetTierOptions contains the optional parameters for the BlobClient.SetTier method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. @@ -2638,7 +2648,7 @@ func (client *BlobClient) setTierCreateRequest(ctx context.Context, tier AccessT if options != nil && options.RehydratePriority != nil { req.Raw().Header["x-ms-rehydrate-priority"] = []string{string(*options.RehydratePriority)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -2670,7 +2680,7 @@ func (client *BlobClient) setTierHandleResponse(resp *http.Response) (BlobClient // StartCopyFromURL - The Start Copy From URL operation copies a blob or an internet resource to a new blob. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - copySource - Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies // a page blob snapshot. The value should be URL-encoded as it would appear in a request // URI. The source blob must either be public or must be authenticated via a shared access signature. @@ -2752,7 +2762,7 @@ func (client *BlobClient) startCopyFromURLCreateRequest(ctx context.Context, cop if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -2819,7 +2829,7 @@ func (client *BlobClient) startCopyFromURLHandleResponse(resp *http.Response) (B // Undelete - Undelete a blob that was previously soft deleted // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - BlobClientUndeleteOptions contains the optional parameters for the BlobClient.Undelete method. func (client *BlobClient) Undelete(ctx context.Context, options *BlobClientUndeleteOptions) (BlobClientUndeleteResponse, error) { req, err := client.undeleteCreateRequest(ctx, options) @@ -2848,7 +2858,7 @@ func (client *BlobClient) undeleteCreateRequest(ctx context.Context, options *Bl reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } diff --git a/sdk/storage/azblob/internal/generated/zz_blockblob_client.go b/sdk/storage/azblob/internal/generated/zz_blockblob_client.go index 7e81d15403d9..5e8b085f3a3d 100644 --- a/sdk/storage/azblob/internal/generated/zz_blockblob_client.go +++ b/sdk/storage/azblob/internal/generated/zz_blockblob_client.go @@ -48,7 +48,7 @@ func NewBlockBlobClient(endpoint string, pl runtime.Pipeline) *BlockBlobClient { // belong to. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - blocks - Blob Blocks. // - options - BlockBlobClientCommitBlockListOptions contains the optional parameters for the BlockBlobClient.CommitBlockList // method. @@ -148,7 +148,7 @@ func (client *BlockBlobClient) commitBlockListCreateRequest(ctx context.Context, if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -233,7 +233,7 @@ func (client *BlockBlobClient) commitBlockListHandleResponse(resp *http.Response // GetBlockList - The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - listType - Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together. // - options - BlockBlobClientGetBlockListOptions contains the optional parameters for the BlockBlobClient.GetBlockList method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. @@ -275,7 +275,7 @@ func (client *BlockBlobClient) getBlockListCreateRequest(ctx context.Context, li if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -335,7 +335,7 @@ func (client *BlockBlobClient) getBlockListHandleResponse(resp *http.Response) ( // Block from URL API in conjunction with Put Block List. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - contentLength - The length of the request. // - copySource - Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies // a page blob snapshot. The value should be URL-encoded as it would appear in a request @@ -453,7 +453,7 @@ func (client *BlockBlobClient) putBlobFromURLCreateRequest(ctx context.Context, if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfTags != nil { req.Raw().Header["x-ms-source-if-tags"] = []string{*sourceModifiedAccessConditions.SourceIfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -470,6 +470,9 @@ func (client *BlockBlobClient) putBlobFromURLCreateRequest(ctx context.Context, if options != nil && options.CopySourceAuthorization != nil { req.Raw().Header["x-ms-copy-source-authorization"] = []string{*options.CopySourceAuthorization} } + if options != nil && options.CopySourceTags != nil { + req.Raw().Header["x-ms-copy-source-tag-option"] = []string{string(*options.CopySourceTags)} + } req.Raw().Header["Accept"] = []string{"application/xml"} return req, nil } @@ -532,7 +535,7 @@ func (client *BlockBlobClient) putBlobFromURLHandleResponse(resp *http.Response) // StageBlock - The Stage Block operation creates a new block to be committed as part of a blob // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - blockID - A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal // to 64 bytes in size. For a given blob, the length of the value specified for the blockid // parameter must be the same size for each block. @@ -592,7 +595,7 @@ func (client *BlockBlobClient) stageBlockCreateRequest(ctx context.Context, bloc if cpkScopeInfo != nil && cpkScopeInfo.EncryptionScope != nil { req.Raw().Header["x-ms-encryption-scope"] = []string{*cpkScopeInfo.EncryptionScope} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -653,7 +656,7 @@ func (client *BlockBlobClient) stageBlockHandleResponse(resp *http.Response) (Bl // are read from a URL. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - blockID - A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal // to 64 bytes in size. For a given blob, the length of the value specified for the blockid // parameter must be the same size for each block. @@ -732,7 +735,7 @@ func (client *BlockBlobClient) stageBlockFromURLCreateRequest(ctx context.Contex if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfNoneMatch != nil { req.Raw().Header["x-ms-source-if-none-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfNoneMatch)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -798,7 +801,7 @@ func (client *BlockBlobClient) stageBlockFromURLHandleResponse(resp *http.Respon // the content of a block blob, use the Put Block List operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - contentLength - The length of the request. // - body - Initial data // - options - BlockBlobClientUploadOptions contains the optional parameters for the BlockBlobClient.Upload method. @@ -896,7 +899,7 @@ func (client *BlockBlobClient) uploadCreateRequest(ctx context.Context, contentL if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -912,6 +915,9 @@ func (client *BlockBlobClient) uploadCreateRequest(ctx context.Context, contentL if options != nil && options.LegalHold != nil { req.Raw().Header["x-ms-legal-hold"] = []string{strconv.FormatBool(*options.LegalHold)} } + if options != nil && options.TransactionalContentCRC64 != nil { + req.Raw().Header["x-ms-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentCRC64)} + } req.Raw().Header["Accept"] = []string{"application/xml"} return req, req.SetBody(body, "application/octet-stream") } diff --git a/sdk/storage/azblob/internal/generated/zz_constants.go b/sdk/storage/azblob/internal/generated/zz_constants.go index 74e6cf1e8590..5e86727fb2c0 100644 --- a/sdk/storage/azblob/internal/generated/zz_constants.go +++ b/sdk/storage/azblob/internal/generated/zz_constants.go @@ -13,6 +13,7 @@ type AccessTier string const ( AccessTierArchive AccessTier = "Archive" + AccessTierCold AccessTier = "Cold" AccessTierCool AccessTier = "Cool" AccessTierHot AccessTier = "Hot" AccessTierP10 AccessTier = "P10" @@ -33,6 +34,7 @@ const ( func PossibleAccessTierValues() []AccessTier { return []AccessTier{ AccessTierArchive, + AccessTierCold, AccessTierCool, AccessTierHot, AccessTierP10, @@ -86,6 +88,21 @@ func PossibleArchiveStatusValues() []ArchiveStatus { } } +type BlobCopySourceTags string + +const ( + BlobCopySourceTagsREPLACE BlobCopySourceTags = "REPLACE" + BlobCopySourceTagsCOPY BlobCopySourceTags = "COPY" +) + +// PossibleBlobCopySourceTagsValues returns the possible values for the BlobCopySourceTags const type. +func PossibleBlobCopySourceTagsValues() []BlobCopySourceTags { + return []BlobCopySourceTags{ + BlobCopySourceTagsREPLACE, + BlobCopySourceTagsCOPY, + } +} + // BlobGeoReplicationStatus - The status of the secondary location type BlobGeoReplicationStatus string @@ -221,6 +238,21 @@ func PossibleExpiryOptionsValues() []ExpiryOptions { } } +type FilterBlobsIncludeItem string + +const ( + FilterBlobsIncludeItemNone FilterBlobsIncludeItem = "none" + FilterBlobsIncludeItemVersions FilterBlobsIncludeItem = "versions" +) + +// PossibleFilterBlobsIncludeItemValues returns the possible values for the FilterBlobsIncludeItem const type. +func PossibleFilterBlobsIncludeItemValues() []FilterBlobsIncludeItem { + return []FilterBlobsIncludeItem{ + FilterBlobsIncludeItemNone, + FilterBlobsIncludeItemVersions, + } +} + type ImmutabilityPolicyMode string const ( diff --git a/sdk/storage/azblob/internal/generated/zz_container_client.go b/sdk/storage/azblob/internal/generated/zz_container_client.go index 5fcac5135f53..22170e9d9e16 100644 --- a/sdk/storage/azblob/internal/generated/zz_container_client.go +++ b/sdk/storage/azblob/internal/generated/zz_container_client.go @@ -46,7 +46,7 @@ func NewContainerClient(endpoint string, pl runtime.Pipeline) *ContainerClient { // to 60 seconds, or can be infinite // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - duration - Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite // lease can be between 15 and 60 seconds. A lease duration cannot be changed using // renew or change. @@ -91,7 +91,7 @@ func (client *ContainerClient) acquireLeaseCreateRequest(ctx context.Context, du if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -138,7 +138,7 @@ func (client *ContainerClient) acquireLeaseHandleResponse(resp *http.Response) ( // to 60 seconds, or can be infinite // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ContainerClientBreakLeaseOptions contains the optional parameters for the ContainerClient.BreakLease method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. func (client *ContainerClient) BreakLease(ctx context.Context, options *ContainerClientBreakLeaseOptions, modifiedAccessConditions *ModifiedAccessConditions) (ContainerClientBreakLeaseResponse, error) { @@ -179,7 +179,7 @@ func (client *ContainerClient) breakLeaseCreateRequest(ctx context.Context, opti if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -231,7 +231,7 @@ func (client *ContainerClient) breakLeaseHandleResponse(resp *http.Response) (Co // to 60 seconds, or can be infinite // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - leaseID - Specifies the current lease ID on the resource. // - proposedLeaseID - Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed // lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID @@ -275,7 +275,7 @@ func (client *ContainerClient) changeLeaseCreateRequest(ctx context.Context, lea if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -322,7 +322,7 @@ func (client *ContainerClient) changeLeaseHandleResponse(resp *http.Response) (C // fails // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ContainerClientCreateOptions contains the optional parameters for the ContainerClient.Create method. // - ContainerCPKScopeInfo - ContainerCPKScopeInfo contains a group of parameters for the ContainerClient.Create method. func (client *ContainerClient) Create(ctx context.Context, options *ContainerClientCreateOptions, containerCPKScopeInfo *ContainerCPKScopeInfo) (ContainerClientCreateResponse, error) { @@ -362,7 +362,7 @@ func (client *ContainerClient) createCreateRequest(ctx context.Context, options if options != nil && options.Access != nil { req.Raw().Header["x-ms-blob-public-access"] = []string{string(*options.Access)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -412,7 +412,7 @@ func (client *ContainerClient) createHandleResponse(resp *http.Response) (Contai // deleted during garbage collection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ContainerClientDeleteOptions contains the optional parameters for the ContainerClient.Delete method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. @@ -452,7 +452,7 @@ func (client *ContainerClient) deleteCreateRequest(ctx context.Context, options if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -482,11 +482,89 @@ func (client *ContainerClient) deleteHandleResponse(resp *http.Response) (Contai return result, nil } +// FilterBlobs - The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search expression. +// Filter blobs searches within the given container. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-02 +// - where - Filters the results to return only to return only blobs whose tags match the specified expression. +// - options - ContainerClientFilterBlobsOptions contains the optional parameters for the ContainerClient.FilterBlobs method. +func (client *ContainerClient) FilterBlobs(ctx context.Context, where string, options *ContainerClientFilterBlobsOptions) (ContainerClientFilterBlobsResponse, error) { + req, err := client.filterBlobsCreateRequest(ctx, where, options) + if err != nil { + return ContainerClientFilterBlobsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContainerClientFilterBlobsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContainerClientFilterBlobsResponse{}, runtime.NewResponseError(resp) + } + return client.filterBlobsHandleResponse(resp) +} + +// filterBlobsCreateRequest creates the FilterBlobs request. +func (client *ContainerClient) filterBlobsCreateRequest(ctx context.Context, where string, options *ContainerClientFilterBlobsOptions) (*policy.Request, error) { + req, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("restype", "container") + reqQP.Set("comp", "blobs") + if options != nil && options.Timeout != nil { + reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) + } + reqQP.Set("where", where) + if options != nil && options.Marker != nil { + reqQP.Set("marker", *options.Marker) + } + if options != nil && options.Maxresults != nil { + reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) + } + if options != nil && options.Include != nil { + reqQP.Set("include", strings.Join(strings.Fields(strings.Trim(fmt.Sprint(options.Include), "[]")), ",")) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} + if options != nil && options.RequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} + } + req.Raw().Header["Accept"] = []string{"application/xml"} + return req, nil +} + +// filterBlobsHandleResponse handles the FilterBlobs response. +func (client *ContainerClient) filterBlobsHandleResponse(resp *http.Response) (ContainerClientFilterBlobsResponse, error) { + result := ContainerClientFilterBlobsResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.ClientRequestID = &val + } + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.RequestID = &val + } + if val := resp.Header.Get("x-ms-version"); val != "" { + result.Version = &val + } + if val := resp.Header.Get("Date"); val != "" { + date, err := time.Parse(time.RFC1123, val) + if err != nil { + return ContainerClientFilterBlobsResponse{}, err + } + result.Date = &date + } + if err := runtime.UnmarshalAsXML(resp, &result.FilterBlobSegment); err != nil { + return ContainerClientFilterBlobsResponse{}, err + } + return result, nil +} + // GetAccessPolicy - gets the permissions for the specified container. The permissions indicate whether container data may // be accessed publicly. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ContainerClientGetAccessPolicyOptions contains the optional parameters for the ContainerClient.GetAccessPolicy // method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. @@ -521,7 +599,7 @@ func (client *ContainerClient) getAccessPolicyCreateRequest(ctx context.Context, if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -570,7 +648,7 @@ func (client *ContainerClient) getAccessPolicyHandleResponse(resp *http.Response // GetAccountInfo - Returns the sku name and account kind // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ContainerClientGetAccountInfoOptions contains the optional parameters for the ContainerClient.GetAccountInfo // method. func (client *ContainerClient) GetAccountInfo(ctx context.Context, options *ContainerClientGetAccountInfoOptions) (ContainerClientGetAccountInfoResponse, error) { @@ -598,7 +676,7 @@ func (client *ContainerClient) getAccountInfoCreateRequest(ctx context.Context, reqQP.Set("restype", "account") reqQP.Set("comp", "properties") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} req.Raw().Header["Accept"] = []string{"application/xml"} return req, nil } @@ -635,7 +713,7 @@ func (client *ContainerClient) getAccountInfoHandleResponse(resp *http.Response) // does not include the container's list of blobs // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ContainerClientGetPropertiesOptions contains the optional parameters for the ContainerClient.GetProperties method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. func (client *ContainerClient) GetProperties(ctx context.Context, options *ContainerClientGetPropertiesOptions, leaseAccessConditions *LeaseAccessConditions) (ContainerClientGetPropertiesResponse, error) { @@ -668,7 +746,7 @@ func (client *ContainerClient) getPropertiesCreateRequest(ctx context.Context, o if leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil { req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -761,7 +839,7 @@ func (client *ContainerClient) getPropertiesHandleResponse(resp *http.Response) // NewListBlobFlatSegmentPager - [Update] The List Blobs operation returns a list of the blobs under the specified container // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ContainerClientListBlobFlatSegmentOptions contains the optional parameters for the ContainerClient.NewListBlobFlatSegmentPager // method. // @@ -790,7 +868,7 @@ func (client *ContainerClient) ListBlobFlatSegmentCreateRequest(ctx context.Cont reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -828,7 +906,7 @@ func (client *ContainerClient) ListBlobFlatSegmentHandleResponse(resp *http.Resp // NewListBlobHierarchySegmentPager - [Update] The List Blobs operation returns a list of the blobs under the specified container // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - delimiter - When the request includes this parameter, the operation returns a BlobPrefix element in the response body that // acts as a placeholder for all blobs whose names begin with the same substring up to the // appearance of the delimiter character. The delimiter may be a single character or a string. @@ -888,7 +966,7 @@ func (client *ContainerClient) ListBlobHierarchySegmentCreateRequest(ctx context reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -928,7 +1006,7 @@ func (client *ContainerClient) ListBlobHierarchySegmentHandleResponse(resp *http // to 60 seconds, or can be infinite // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - leaseID - Specifies the current lease ID on the resource. // - options - ContainerClientReleaseLeaseOptions contains the optional parameters for the ContainerClient.ReleaseLease method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. @@ -968,7 +1046,7 @@ func (client *ContainerClient) releaseLeaseCreateRequest(ctx context.Context, le if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1011,7 +1089,7 @@ func (client *ContainerClient) releaseLeaseHandleResponse(resp *http.Response) ( // Rename - Renames an existing container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - sourceContainerName - Required. Specifies the name of the container to rename. // - options - ContainerClientRenameOptions contains the optional parameters for the ContainerClient.Rename method. func (client *ContainerClient) Rename(ctx context.Context, sourceContainerName string, options *ContainerClientRenameOptions) (ContainerClientRenameResponse, error) { @@ -1042,7 +1120,7 @@ func (client *ContainerClient) renameCreateRequest(ctx context.Context, sourceCo reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1080,7 +1158,7 @@ func (client *ContainerClient) renameHandleResponse(resp *http.Response) (Contai // to 60 seconds, or can be infinite // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - leaseID - Specifies the current lease ID on the resource. // - options - ContainerClientRenewLeaseOptions contains the optional parameters for the ContainerClient.RenewLease method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. @@ -1120,7 +1198,7 @@ func (client *ContainerClient) renewLeaseCreateRequest(ctx context.Context, leas if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1166,7 +1244,7 @@ func (client *ContainerClient) renewLeaseHandleResponse(resp *http.Response) (Co // Restore - Restores a previously-deleted container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ContainerClientRestoreOptions contains the optional parameters for the ContainerClient.Restore method. func (client *ContainerClient) Restore(ctx context.Context, options *ContainerClientRestoreOptions) (ContainerClientRestoreResponse, error) { req, err := client.restoreCreateRequest(ctx, options) @@ -1196,7 +1274,7 @@ func (client *ContainerClient) restoreCreateRequest(ctx context.Context, options reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1236,7 +1314,7 @@ func (client *ContainerClient) restoreHandleResponse(resp *http.Response) (Conta // may be accessed publicly. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - containerACL - the acls for the container // - options - ContainerClientSetAccessPolicyOptions contains the optional parameters for the ContainerClient.SetAccessPolicy // method. @@ -1282,7 +1360,7 @@ func (client *ContainerClient) setAccessPolicyCreateRequest(ctx context.Context, if modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil { req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1329,7 +1407,7 @@ func (client *ContainerClient) setAccessPolicyHandleResponse(resp *http.Response // SetMetadata - operation sets one or more user-defined name-value pairs for the specified container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ContainerClientSetMetadataOptions contains the optional parameters for the ContainerClient.SetMetadata method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. // - ModifiedAccessConditions - ModifiedAccessConditions contains a group of parameters for the ContainerClient.Delete method. @@ -1374,7 +1452,7 @@ func (client *ContainerClient) setMetadataCreateRequest(ctx context.Context, opt if modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil { req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1417,7 +1495,7 @@ func (client *ContainerClient) setMetadataHandleResponse(resp *http.Response) (C // SubmitBatch - The Batch operation allows multiple API calls to be embedded into a single HTTP request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - contentLength - The length of the request. // - multipartContentType - Required. The value of this header must be multipart/mixed with a batch boundary. Example header // value: multipart/mixed; boundary=batch_ @@ -1454,7 +1532,7 @@ func (client *ContainerClient) submitBatchCreateRequest(ctx context.Context, con runtime.SkipBodyDownload(req) req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)} req.Raw().Header["Content-Type"] = []string{multipartContentType} - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } diff --git a/sdk/storage/azblob/internal/generated/zz_models.go b/sdk/storage/azblob/internal/generated/zz_models.go index 022807f53c5f..a32110a4a50d 100644 --- a/sdk/storage/azblob/internal/generated/zz_models.go +++ b/sdk/storage/azblob/internal/generated/zz_models.go @@ -181,6 +181,8 @@ type BlobClientCopyFromURLOptions struct { BlobTagsString *string // Only Bearer type is supported. Credentials should be a valid OAuth access token to copy source. CopySourceAuthorization *string + // Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by x-ms-tags. + CopySourceTags *BlobCopySourceTags // Specifies the date time when the blobs immutability policy is set to expire. ImmutabilityPolicyExpiry *time.Time // Specifies the immutability policy mode to set on the blob. @@ -533,7 +535,7 @@ type BlobItem struct { Deleted *bool `xml:"Deleted"` // REQUIRED - Name *string `xml:"Name"` + Name *BlobName `xml:"Name"` // REQUIRED; Properties of a blob Properties *BlobProperties `xml:"Properties"` @@ -554,9 +556,17 @@ type BlobItem struct { VersionID *string `xml:"VersionId"` } +type BlobName struct { + // The name of the blob. + Content *string `xml:"content"` + + // Indicates if the blob name is encoded. + Encoded *bool `xml:"Encoded,attr"` +} + type BlobPrefix struct { // REQUIRED - Name *string `xml:"Name"` + Name *BlobName `xml:"Name"` } // BlobProperties - Properties of a blob @@ -689,6 +699,8 @@ type BlockBlobClientPutBlobFromURLOptions struct { CopySourceAuthorization *string // Optional, default is true. Indicates if properties from the source blob should be copied. CopySourceBlobProperties *bool + // Optional, default 'replace'. Indicates if source tags should be copied or replaced with the tags specified by x-ms-tags. + CopySourceTags *BlobCopySourceTags // Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the // operation will copy the metadata from the source blob or file to the destination // blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata @@ -767,6 +779,8 @@ type BlockBlobClientUploadOptions struct { // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] Timeout *int32 + // Specify the transactional crc64 for the body, to be validated by the service. + TransactionalContentCRC64 []byte // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte } @@ -860,6 +874,30 @@ type ContainerClientDeleteOptions struct { Timeout *int32 } +// ContainerClientFilterBlobsOptions contains the optional parameters for the ContainerClient.FilterBlobs method. +type ContainerClientFilterBlobsOptions struct { + // Include this parameter to specify one or more datasets to include in the response. + Include []FilterBlobsIncludeItem + // A string value that identifies the portion of the list of containers to be returned with the next listing operation. The + // operation returns the NextMarker value within the response body if the listing + // operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used + // as the value for the marker parameter in a subsequent call to request the next + // page of list items. The marker value is opaque to the client. + Marker *string + // Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value + // greater than 5000, the server will return up to 5000 items. Note that if the + // listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder + // of the results. For this reason, it is possible that the service will + // return fewer results than specified by maxresults, or than the default of 5000. + Maxresults *int32 + // 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. + RequestID *string + // The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. + // [https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations] + Timeout *int32 +} + // ContainerClientGetAccessPolicyOptions contains the optional parameters for the ContainerClient.GetAccessPolicy method. type ContainerClientGetAccessPolicyOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage @@ -1140,10 +1178,12 @@ type FilterBlobItem struct { ContainerName *string `xml:"ContainerName"` // REQUIRED - Name *string `xml:"Name"` + Name *string `xml:"Name"` + IsCurrentVersion *bool `xml:"IsCurrentVersion"` // Blob tags - Tags *BlobTags `xml:"Tags"` + Tags *BlobTags `xml:"Tags"` + VersionID *string `xml:"VersionId"` } // FilterBlobSegment - The result of a Filter Blobs API call @@ -1533,6 +1573,8 @@ type SequenceNumberAccessConditions struct { // ServiceClientFilterBlobsOptions contains the optional parameters for the ServiceClient.FilterBlobs method. type ServiceClientFilterBlobsOptions struct { + // Include this parameter to specify one or more datasets to include in the response. + Include []FilterBlobsIncludeItem // A string value that identifies the portion of the list of containers to be returned with the next listing operation. The // operation returns the NextMarker value within the response body if the listing // operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used diff --git a/sdk/storage/azblob/internal/generated/zz_pageblob_client.go b/sdk/storage/azblob/internal/generated/zz_pageblob_client.go index b209e99f0232..e5eec310ee98 100644 --- a/sdk/storage/azblob/internal/generated/zz_pageblob_client.go +++ b/sdk/storage/azblob/internal/generated/zz_pageblob_client.go @@ -42,7 +42,7 @@ func NewPageBlobClient(endpoint string, pl runtime.Pipeline) *PageBlobClient { // ClearPages - The Clear Pages operation clears a set of pages from a page blob // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - contentLength - The length of the request. // - options - PageBlobClientClearPagesOptions contains the optional parameters for the PageBlobClient.ClearPages method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. @@ -122,7 +122,7 @@ func (client *PageBlobClient) clearPagesCreateRequest(ctx context.Context, conte if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -190,7 +190,7 @@ func (client *PageBlobClient) clearPagesHandleResponse(resp *http.Response) (Pag // 2016-05-31. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - copySource - Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies // a page blob snapshot. The value should be URL-encoded as it would appear in a request // URI. The source blob must either be public or must be authenticated via a shared access signature. @@ -240,7 +240,7 @@ func (client *PageBlobClient) copyIncrementalCreateRequest(ctx context.Context, req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } req.Raw().Header["x-ms-copy-source"] = []string{copySource} - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -289,7 +289,7 @@ func (client *PageBlobClient) copyIncrementalHandleResponse(resp *http.Response) // Create - The Create operation creates a new page blob. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - contentLength - The length of the request. // - blobContentLength - This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned // to a 512-byte boundary. @@ -389,7 +389,7 @@ func (client *PageBlobClient) createCreateRequest(ctx context.Context, contentLe if options != nil && options.BlobSequenceNumber != nil { req.Raw().Header["x-ms-blob-sequence-number"] = []string{strconv.FormatInt(*options.BlobSequenceNumber, 10)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -467,7 +467,7 @@ func (client *PageBlobClient) createHandleResponse(resp *http.Response) (PageBlo // NewGetPageRangesPager - The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot // of a page blob // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - PageBlobClientGetPageRangesOptions contains the optional parameters for the PageBlobClient.NewGetPageRangesPager // method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. @@ -542,7 +542,7 @@ func (client *PageBlobClient) GetPageRangesCreateRequest(ctx context.Context, op if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -595,7 +595,7 @@ func (client *PageBlobClient) GetPageRangesHandleResponse(resp *http.Response) ( // NewGetPageRangesDiffPager - The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that // were changed between target blob and previous snapshot. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - PageBlobClientGetPageRangesDiffOptions contains the optional parameters for the PageBlobClient.NewGetPageRangesDiffPager // method. // - LeaseAccessConditions - LeaseAccessConditions contains a group of parameters for the ContainerClient.GetProperties method. @@ -676,7 +676,7 @@ func (client *PageBlobClient) GetPageRangesDiffCreateRequest(ctx context.Context if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -729,7 +729,7 @@ func (client *PageBlobClient) GetPageRangesDiffHandleResponse(resp *http.Respons // Resize - Resize the Blob // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - blobContentLength - This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned // to a 512-byte boundary. // - options - PageBlobClientResizeOptions contains the optional parameters for the PageBlobClient.Resize method. @@ -795,7 +795,7 @@ func (client *PageBlobClient) resizeCreateRequest(ctx context.Context, blobConte req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } req.Raw().Header["x-ms-blob-content-length"] = []string{strconv.FormatInt(blobContentLength, 10)} - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -845,7 +845,7 @@ func (client *PageBlobClient) resizeHandleResponse(resp *http.Response) (PageBlo // UpdateSequenceNumber - Update the sequence number of the blob // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - sequenceNumberAction - Required if the x-ms-blob-sequence-number header is set for the request. This property applies to // page blobs only. This property indicates how the service should modify the blob's sequence number // - options - PageBlobClientUpdateSequenceNumberOptions contains the optional parameters for the PageBlobClient.UpdateSequenceNumber @@ -901,7 +901,7 @@ func (client *PageBlobClient) updateSequenceNumberCreateRequest(ctx context.Cont if options != nil && options.BlobSequenceNumber != nil { req.Raw().Header["x-ms-blob-sequence-number"] = []string{strconv.FormatInt(*options.BlobSequenceNumber, 10)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -951,7 +951,7 @@ func (client *PageBlobClient) updateSequenceNumberHandleResponse(resp *http.Resp // UploadPages - The Upload Pages operation writes a range of pages to a page blob // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - contentLength - The length of the request. // - body - Initial data // - options - PageBlobClientUploadPagesOptions contains the optional parameters for the PageBlobClient.UploadPages method. @@ -1038,7 +1038,7 @@ func (client *PageBlobClient) uploadPagesCreateRequest(ctx context.Context, cont if modifiedAccessConditions != nil && modifiedAccessConditions.IfTags != nil { req.Raw().Header["x-ms-if-tags"] = []string{*modifiedAccessConditions.IfTags} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -1116,7 +1116,7 @@ func (client *PageBlobClient) uploadPagesHandleResponse(resp *http.Response) (Pa // a URL // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - sourceURL - Specify a URL to the copy source. // - sourceRange - Bytes of source data in the specified range. The length of this range should match the ContentLength header // and x-ms-range/Range destination range header. @@ -1222,7 +1222,7 @@ func (client *PageBlobClient) uploadPagesFromURLCreateRequest(ctx context.Contex if sourceModifiedAccessConditions != nil && sourceModifiedAccessConditions.SourceIfNoneMatch != nil { req.Raw().Header["x-ms-source-if-none-match"] = []string{string(*sourceModifiedAccessConditions.SourceIfNoneMatch)} } - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } diff --git a/sdk/storage/azblob/internal/generated/zz_response_types.go b/sdk/storage/azblob/internal/generated/zz_response_types.go index 386c943e4105..625f3133fedc 100644 --- a/sdk/storage/azblob/internal/generated/zz_response_types.go +++ b/sdk/storage/azblob/internal/generated/zz_response_types.go @@ -266,6 +266,9 @@ type BlobClientCopyFromURLResponse struct { // ETag contains the information returned from the ETag header response. ETag *azcore.ETag + // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. + EncryptionScope *string + // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time @@ -1310,6 +1313,22 @@ type ContainerClientDeleteResponse struct { Version *string } +// ContainerClientFilterBlobsResponse contains the response from method ContainerClient.FilterBlobs. +type ContainerClientFilterBlobsResponse struct { + FilterBlobSegment + // ClientRequestID contains the information returned from the x-ms-client-request-id header response. + ClientRequestID *string `xml:"ClientRequestID"` + + // Date contains the information returned from the Date header response. + Date *time.Time `xml:"Date"` + + // RequestID contains the information returned from the x-ms-request-id header response. + RequestID *string `xml:"RequestID"` + + // Version contains the information returned from the x-ms-version header response. + Version *string `xml:"Version"` +} + // ContainerClientGetAccessPolicyResponse contains the response from method ContainerClient.GetAccessPolicy. type ContainerClientGetAccessPolicyResponse struct { // BlobPublicAccess contains the information returned from the x-ms-blob-public-access header response. diff --git a/sdk/storage/azblob/internal/generated/zz_service_client.go b/sdk/storage/azblob/internal/generated/zz_service_client.go index b700211c5e0d..961dae0735fe 100644 --- a/sdk/storage/azblob/internal/generated/zz_service_client.go +++ b/sdk/storage/azblob/internal/generated/zz_service_client.go @@ -44,7 +44,7 @@ func NewServiceClient(endpoint string, pl runtime.Pipeline) *ServiceClient { // be scoped within the expression to a single container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - where - Filters the results to return only to return only blobs whose tags match the specified expression. // - options - ServiceClientFilterBlobsOptions contains the optional parameters for the ServiceClient.FilterBlobs method. func (client *ServiceClient) FilterBlobs(ctx context.Context, where string, options *ServiceClientFilterBlobsOptions) (ServiceClientFilterBlobsResponse, error) { @@ -80,8 +80,11 @@ func (client *ServiceClient) filterBlobsCreateRequest(ctx context.Context, where if options != nil && options.Maxresults != nil { reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) } + if options != nil && options.Include != nil { + reqQP.Set("include", strings.Join(strings.Fields(strings.Trim(fmt.Sprint(options.Include), "[]")), ",")) + } req.Raw().URL.RawQuery = strings.Replace(reqQP.Encode(), "+", "%20", -1) - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -117,7 +120,7 @@ func (client *ServiceClient) filterBlobsHandleResponse(resp *http.Response) (Ser // GetAccountInfo - Returns the sku name and account kind // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ServiceClientGetAccountInfoOptions contains the optional parameters for the ServiceClient.GetAccountInfo method. func (client *ServiceClient) GetAccountInfo(ctx context.Context, options *ServiceClientGetAccountInfoOptions) (ServiceClientGetAccountInfoResponse, error) { req, err := client.getAccountInfoCreateRequest(ctx, options) @@ -144,7 +147,7 @@ func (client *ServiceClient) getAccountInfoCreateRequest(ctx context.Context, op reqQP.Set("restype", "account") reqQP.Set("comp", "properties") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} req.Raw().Header["Accept"] = []string{"application/xml"} return req, nil } @@ -188,7 +191,7 @@ func (client *ServiceClient) getAccountInfoHandleResponse(resp *http.Response) ( // CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ServiceClientGetPropertiesOptions contains the optional parameters for the ServiceClient.GetProperties method. func (client *ServiceClient) GetProperties(ctx context.Context, options *ServiceClientGetPropertiesOptions) (ServiceClientGetPropertiesResponse, error) { req, err := client.getPropertiesCreateRequest(ctx, options) @@ -218,7 +221,7 @@ func (client *ServiceClient) getPropertiesCreateRequest(ctx context.Context, opt reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -248,7 +251,7 @@ func (client *ServiceClient) getPropertiesHandleResponse(resp *http.Response) (S // location endpoint when read-access geo-redundant replication is enabled for the storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ServiceClientGetStatisticsOptions contains the optional parameters for the ServiceClient.GetStatistics method. func (client *ServiceClient) GetStatistics(ctx context.Context, options *ServiceClientGetStatisticsOptions) (ServiceClientGetStatisticsResponse, error) { req, err := client.getStatisticsCreateRequest(ctx, options) @@ -278,7 +281,7 @@ func (client *ServiceClient) getStatisticsCreateRequest(ctx context.Context, opt reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -315,7 +318,7 @@ func (client *ServiceClient) getStatisticsHandleResponse(resp *http.Response) (S // bearer token authentication. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - keyInfo - Key information // - options - ServiceClientGetUserDelegationKeyOptions contains the optional parameters for the ServiceClient.GetUserDelegationKey // method. @@ -347,7 +350,7 @@ func (client *ServiceClient) getUserDelegationKeyCreateRequest(ctx context.Conte reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -383,7 +386,7 @@ func (client *ServiceClient) getUserDelegationKeyHandleResponse(resp *http.Respo // NewListContainersSegmentPager - The List Containers Segment operation returns a list of the containers under the specified // account // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - options - ServiceClientListContainersSegmentOptions contains the optional parameters for the ServiceClient.NewListContainersSegmentPager // method. // @@ -411,7 +414,7 @@ func (client *ServiceClient) ListContainersSegmentCreateRequest(ctx context.Cont reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -441,7 +444,7 @@ func (client *ServiceClient) ListContainersSegmentHandleResponse(resp *http.Resp // and CORS (Cross-Origin Resource Sharing) rules // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - storageServiceProperties - The StorageService properties. // - options - ServiceClientSetPropertiesOptions contains the optional parameters for the ServiceClient.SetProperties method. func (client *ServiceClient) SetProperties(ctx context.Context, storageServiceProperties StorageServiceProperties, options *ServiceClientSetPropertiesOptions) (ServiceClientSetPropertiesResponse, error) { @@ -472,7 +475,7 @@ func (client *ServiceClient) setPropertiesCreateRequest(ctx context.Context, sto reqQP.Set("timeout", strconv.FormatInt(int64(*options.Timeout), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } @@ -498,7 +501,7 @@ func (client *ServiceClient) setPropertiesHandleResponse(resp *http.Response) (S // SubmitBatch - The Batch operation allows multiple API calls to be embedded into a single HTTP request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-02 +// Generated from API version 2021-12-02 // - contentLength - The length of the request. // - multipartContentType - Required. The value of this header must be multipart/mixed with a batch boundary. Example header // value: multipart/mixed; boundary=batch_ @@ -534,7 +537,7 @@ func (client *ServiceClient) submitBatchCreateRequest(ctx context.Context, conte runtime.SkipBodyDownload(req) req.Raw().Header["Content-Length"] = []string{strconv.FormatInt(contentLength, 10)} req.Raw().Header["Content-Type"] = []string{multipartContentType} - req.Raw().Header["x-ms-version"] = []string{"2020-10-02"} + req.Raw().Header["x-ms-version"] = []string{"2021-12-02"} if options != nil && options.RequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } From e449fab95406b02234abbb124cb4ad4be461cd8e Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Tue, 2 May 2023 13:57:08 -0400 Subject: [PATCH 02/24] Updating CopyFromURL --- sdk/storage/azblob/blob/client.go | 4 ++-- sdk/storage/azblob/blob/models.go | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sdk/storage/azblob/blob/client.go b/sdk/storage/azblob/blob/client.go index 817107d0edac..805b5aa340f3 100644 --- a/sdk/storage/azblob/blob/client.go +++ b/sdk/storage/azblob/blob/client.go @@ -263,8 +263,8 @@ func (b *Client) SetLegalHold(ctx context.Context, legalHold bool, options *SetL // 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 (b *Client) CopyFromURL(ctx context.Context, copySource string, options *CopyFromURLOptions) (CopyFromURLResponse, error) { - copyOptions, smac, mac, lac := options.format() - resp, err := b.generated().CopyFromURL(ctx, copySource, copyOptions, smac, mac, lac) + copyOptions, smac, mac, lac, cpkScopeInfo := options.format() + resp, err := b.generated().CopyFromURL(ctx, copySource, copyOptions, smac, mac, lac, cpkScopeInfo) return resp, err } diff --git a/sdk/storage/azblob/blob/models.go b/sdk/storage/azblob/blob/models.go index fea2f1ec505b..9ff5f24f5c0f 100644 --- a/sdk/storage/azblob/blob/models.go +++ b/sdk/storage/azblob/blob/models.go @@ -544,11 +544,13 @@ type CopyFromURLOptions struct { SourceModifiedAccessConditions *SourceModifiedAccessConditions BlobAccessConditions *AccessConditions + + CPKScopeInfo *CPKScopeInfo } -func (o *CopyFromURLOptions) format() (*generated.BlobClientCopyFromURLOptions, *generated.SourceModifiedAccessConditions, *generated.ModifiedAccessConditions, *generated.LeaseAccessConditions) { +func (o *CopyFromURLOptions) format() (*generated.BlobClientCopyFromURLOptions, *generated.SourceModifiedAccessConditions, *generated.ModifiedAccessConditions, *generated.LeaseAccessConditions, *generated.CPKScopeInfo) { if o == nil { - return nil, nil, nil, nil + return nil, nil, nil, nil, nil } options := &generated.BlobClientCopyFromURLOptions{ @@ -563,7 +565,7 @@ func (o *CopyFromURLOptions) format() (*generated.BlobClientCopyFromURLOptions, } leaseAccessConditions, modifiedAccessConditions := exported.FormatBlobAccessConditions(o.BlobAccessConditions) - return options, o.SourceModifiedAccessConditions, modifiedAccessConditions, leaseAccessConditions + return options, o.SourceModifiedAccessConditions, modifiedAccessConditions, leaseAccessConditions, o.CPKScopeInfo } // --------------------------------------------------------------------------------------------------------------------- From 703f8bf383e8f5ab553a2e92259880e84e1ee454 Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Tue, 2 May 2023 14:26:21 -0400 Subject: [PATCH 03/24] minor change --- sdk/storage/azblob/blob/examples_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/azblob/blob/examples_test.go b/sdk/storage/azblob/blob/examples_test.go index 4b19c74c0f2d..710957362731 100644 --- a/sdk/storage/azblob/blob/examples_test.go +++ b/sdk/storage/azblob/blob/examples_test.go @@ -188,7 +188,7 @@ func Example_blob_Client_CreateSnapshot() { if blob.Snapshot != nil { snapTime = *blob.Snapshot } - fmt.Printf("Blob name: %s, Snapshot: %s\n", *blob.Name, snapTime) + fmt.Printf("Blob name: %s, Snapshot: %s\n", *blob.Name.Content, snapTime) } } From 1eb380f3a4ce561789a09d047f4823c5dcb513f5 Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Tue, 2 May 2023 14:58:14 -0400 Subject: [PATCH 04/24] minor fixes --- sdk/storage/azblob/container/client_test.go | 6 +++--- sdk/storage/azblob/container/examples_test.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/storage/azblob/container/client_test.go b/sdk/storage/azblob/container/client_test.go index a49c058dc48b..35eea32c14c4 100644 --- a/sdk/storage/azblob/container/client_test.go +++ b/sdk/storage/azblob/container/client_test.go @@ -990,7 +990,7 @@ func (s *ContainerRecordedTestsSuite) TestContainerListBlobsMaxResultsExact() { _require.Nil(err) for _, blob := range resp.Segment.BlobItems { - _require.Equal(nameMap[*blob.Name], true) + _require.Equal(nameMap[*blob.Name.Content], true) } if err != nil { break @@ -1027,7 +1027,7 @@ func (s *ContainerRecordedTestsSuite) TestContainerListBlobsMaxResultsSufficient _require.Nil(err) for _, blob := range resp.Segment.BlobItems { - _require.Equal(nameMap[*blob.Name], true) + _require.Equal(nameMap[*blob.Name.Content], true) } if err != nil { break @@ -1328,7 +1328,7 @@ func (s *ContainerRecordedTestsSuite) TestBlobListWrapper() { _require.NoError(err) for _, blob := range resp.Segment.BlobItems { - found = append(found, *blob.Name) + found = append(found, *blob.Name.Content) } } diff --git a/sdk/storage/azblob/container/examples_test.go b/sdk/storage/azblob/container/examples_test.go index c3516e07c72d..c0d910945f73 100644 --- a/sdk/storage/azblob/container/examples_test.go +++ b/sdk/storage/azblob/container/examples_test.go @@ -236,7 +236,7 @@ func Example_container_ClientListBlobsFlat() { log.Fatal(err) } for _, blob := range resp.Segment.BlobItems { - fmt.Println(*blob.Name) + fmt.Println(*blob.Name.Content) } } } @@ -267,7 +267,7 @@ func Example_container_ClientListBlobsHierarchy() { log.Fatal(err) } for _, blob := range resp.ListBlobsHierarchySegmentResponse.Segment.BlobItems { - fmt.Println(*blob.Name) + fmt.Println(*blob.Name.Content) } } } From b83f0d714a2d3f222f2134a0af9ad3e57dfc102c Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Tue, 2 May 2023 15:48:17 -0400 Subject: [PATCH 05/24] undo some minor fixes --- sdk/storage/azblob/container/client_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/storage/azblob/container/client_test.go b/sdk/storage/azblob/container/client_test.go index 35eea32c14c4..a49c058dc48b 100644 --- a/sdk/storage/azblob/container/client_test.go +++ b/sdk/storage/azblob/container/client_test.go @@ -990,7 +990,7 @@ func (s *ContainerRecordedTestsSuite) TestContainerListBlobsMaxResultsExact() { _require.Nil(err) for _, blob := range resp.Segment.BlobItems { - _require.Equal(nameMap[*blob.Name.Content], true) + _require.Equal(nameMap[*blob.Name], true) } if err != nil { break @@ -1027,7 +1027,7 @@ func (s *ContainerRecordedTestsSuite) TestContainerListBlobsMaxResultsSufficient _require.Nil(err) for _, blob := range resp.Segment.BlobItems { - _require.Equal(nameMap[*blob.Name.Content], true) + _require.Equal(nameMap[*blob.Name], true) } if err != nil { break @@ -1328,7 +1328,7 @@ func (s *ContainerRecordedTestsSuite) TestBlobListWrapper() { _require.NoError(err) for _, blob := range resp.Segment.BlobItems { - found = append(found, *blob.Name.Content) + found = append(found, *blob.Name) } } From a1b9a2738d1206b897e25c801f29421d2185a3eb Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Fri, 19 May 2023 11:27:58 -0400 Subject: [PATCH 06/24] Updating Go code generator --- .../azblob/internal/generated/autorest.md | 2 +- .../generated/zz_appendblob_client.go | 28 ++---- .../internal/generated/zz_blob_client.go | 73 +++++++------- .../internal/generated/zz_blockblob_client.go | 42 ++++---- .../azblob/internal/generated/zz_constants.go | 96 +++++++++---------- .../internal/generated/zz_container_client.go | 59 ++++++------ .../azblob/internal/generated/zz_models.go | 4 +- .../internal/generated/zz_models_serde.go | 10 ++ .../internal/generated/zz_pageblob_client.go | 38 +++----- .../internal/generated/zz_service_client.go | 45 +++++---- 10 files changed, 189 insertions(+), 208 deletions(-) diff --git a/sdk/storage/azblob/internal/generated/autorest.md b/sdk/storage/azblob/internal/generated/autorest.md index 82334b459044..8ad959690b8f 100644 --- a/sdk/storage/azblob/internal/generated/autorest.md +++ b/sdk/storage/azblob/internal/generated/autorest.md @@ -19,7 +19,7 @@ modelerfour: seal-single-value-enum-by-default: true lenient-model-deduplication: true export-clients: true -use: "@autorest/go@4.0.0-preview.45" +use: "@autorest/go@4.0.0-preview.49" ``` ### Remove pager methods and export various generated methods in container client diff --git a/sdk/storage/azblob/internal/generated/zz_appendblob_client.go b/sdk/storage/azblob/internal/generated/zz_appendblob_client.go index 9ee5a4f6da55..ea666ea50284 100644 --- a/sdk/storage/azblob/internal/generated/zz_appendblob_client.go +++ b/sdk/storage/azblob/internal/generated/zz_appendblob_client.go @@ -22,21 +22,10 @@ import ( ) // AppendBlobClient contains the methods for the AppendBlob group. -// Don't use this type directly, use NewAppendBlobClient() instead. +// Don't use this type directly, use a constructor function instead. type AppendBlobClient struct { + internal *azcore.Client endpoint string - pl runtime.Pipeline -} - -// NewAppendBlobClient creates a new instance of AppendBlobClient with the specified values. -// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. -// - pl - the pipeline used for sending requests and handling responses. -func NewAppendBlobClient(endpoint string, pl runtime.Pipeline) *AppendBlobClient { - client := &AppendBlobClient{ - endpoint: endpoint, - pl: pl, - } - return client } // AppendBlock - The Append Block operation commits a new block of data to the end of an existing append blob. The Append @@ -59,7 +48,7 @@ func (client *AppendBlobClient) AppendBlock(ctx context.Context, contentLength i if err != nil { return AppendBlobClientAppendBlockResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AppendBlobClientAppendBlockResponse{}, err } @@ -129,7 +118,10 @@ func (client *AppendBlobClient) appendBlockCreateRequest(ctx context.Context, co req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } req.Raw().Header["Accept"] = []string{"application/xml"} - return req, req.SetBody(body, "application/octet-stream") + if err := req.SetBody(body, "application/octet-stream"); err != nil { + return nil, err + } + return req, nil } // appendBlockHandleResponse handles the AppendBlock response. @@ -225,7 +217,7 @@ func (client *AppendBlobClient) AppendBlockFromURL(ctx context.Context, sourceUR if err != nil { return AppendBlobClientAppendBlockFromURLResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AppendBlobClientAppendBlockFromURLResponse{}, err } @@ -403,7 +395,7 @@ func (client *AppendBlobClient) Create(ctx context.Context, contentLength int64, if err != nil { return AppendBlobClientCreateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AppendBlobClientCreateResponse{}, err } @@ -571,7 +563,7 @@ func (client *AppendBlobClient) Seal(ctx context.Context, options *AppendBlobCli if err != nil { return AppendBlobClientSealResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AppendBlobClientSealResponse{}, err } diff --git a/sdk/storage/azblob/internal/generated/zz_blob_client.go b/sdk/storage/azblob/internal/generated/zz_blob_client.go index eb6a50136363..8e8ed79c7df5 100644 --- a/sdk/storage/azblob/internal/generated/zz_blob_client.go +++ b/sdk/storage/azblob/internal/generated/zz_blob_client.go @@ -23,21 +23,10 @@ import ( ) // BlobClient contains the methods for the Blob group. -// Don't use this type directly, use NewBlobClient() instead. +// Don't use this type directly, use a constructor function instead. type BlobClient struct { + internal *azcore.Client endpoint string - pl runtime.Pipeline -} - -// NewBlobClient creates a new instance of BlobClient with the specified values. -// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. -// - pl - the pipeline used for sending requests and handling responses. -func NewBlobClient(endpoint string, pl runtime.Pipeline) *BlobClient { - client := &BlobClient{ - endpoint: endpoint, - pl: pl, - } - return client } // AbortCopyFromURL - The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination @@ -53,7 +42,7 @@ func (client *BlobClient) AbortCopyFromURL(ctx context.Context, copyID string, o if err != nil { return BlobClientAbortCopyFromURLResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientAbortCopyFromURLResponse{}, err } @@ -124,7 +113,7 @@ func (client *BlobClient) AcquireLease(ctx context.Context, duration int32, opti if err != nil { return BlobClientAcquireLeaseResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientAcquireLeaseResponse{}, err } @@ -220,7 +209,7 @@ func (client *BlobClient) BreakLease(ctx context.Context, options *BlobClientBre if err != nil { return BlobClientBreakLeaseResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientBreakLeaseResponse{}, err } @@ -324,7 +313,7 @@ func (client *BlobClient) ChangeLease(ctx context.Context, leaseID string, propo if err != nil { return BlobClientChangeLeaseResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientChangeLeaseResponse{}, err } @@ -426,7 +415,7 @@ func (client *BlobClient) CopyFromURL(ctx context.Context, copySource string, op if err != nil { return BlobClientCopyFromURLResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientCopyFromURLResponse{}, err } @@ -593,7 +582,7 @@ func (client *BlobClient) CreateSnapshot(ctx context.Context, options *BlobClien if err != nil { return BlobClientCreateSnapshotResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientCreateSnapshotResponse{}, err } @@ -727,7 +716,7 @@ func (client *BlobClient) Delete(ctx context.Context, options *BlobClientDeleteO if err != nil { return BlobClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientDeleteResponse{}, err } @@ -819,7 +808,7 @@ func (client *BlobClient) DeleteImmutabilityPolicy(ctx context.Context, options if err != nil { return BlobClientDeleteImmutabilityPolicyResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientDeleteImmutabilityPolicyResponse{}, err } @@ -885,7 +874,7 @@ func (client *BlobClient) Download(ctx context.Context, options *BlobClientDownl if err != nil { return BlobClientDownloadResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientDownloadResponse{}, err } @@ -1180,7 +1169,7 @@ func (client *BlobClient) GetAccountInfo(ctx context.Context, options *BlobClien if err != nil { return BlobClientGetAccountInfoResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientGetAccountInfoResponse{}, err } @@ -1247,7 +1236,7 @@ func (client *BlobClient) GetProperties(ctx context.Context, options *BlobClient if err != nil { return BlobClientGetPropertiesResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientGetPropertiesResponse{}, err } @@ -1561,7 +1550,7 @@ func (client *BlobClient) GetTags(ctx context.Context, options *BlobClientGetTag if err != nil { return BlobClientGetTagsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientGetTagsResponse{}, err } @@ -1641,7 +1630,7 @@ func (client *BlobClient) Query(ctx context.Context, options *BlobClientQueryOpt if err != nil { return BlobClientQueryResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientQueryResponse{}, err } @@ -1700,7 +1689,10 @@ func (client *BlobClient) queryCreateRequest(ctx context.Context, options *BlobC } req.Raw().Header["Accept"] = []string{"application/xml"} if options != nil && options.QueryRequest != nil { - return req, runtime.MarshalAsXML(req, *options.QueryRequest) + if err := runtime.MarshalAsXML(req, *options.QueryRequest); err != nil { + return nil, err + } + return req, nil } return req, nil } @@ -1868,7 +1860,7 @@ func (client *BlobClient) ReleaseLease(ctx context.Context, leaseID string, opti if err != nil { return BlobClientReleaseLeaseResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientReleaseLeaseResponse{}, err } @@ -1959,7 +1951,7 @@ func (client *BlobClient) RenewLease(ctx context.Context, leaseID string, option if err != nil { return BlobClientRenewLeaseResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientRenewLeaseResponse{}, err } @@ -2052,7 +2044,7 @@ func (client *BlobClient) SetExpiry(ctx context.Context, expiryOptions ExpiryOpt if err != nil { return BlobClientSetExpiryResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientSetExpiryResponse{}, err } @@ -2131,7 +2123,7 @@ func (client *BlobClient) SetHTTPHeaders(ctx context.Context, options *BlobClien if err != nil { return BlobClientSetHTTPHeadersResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientSetHTTPHeadersResponse{}, err } @@ -2248,7 +2240,7 @@ func (client *BlobClient) SetImmutabilityPolicy(ctx context.Context, options *Bl if err != nil { return BlobClientSetImmutabilityPolicyResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientSetImmutabilityPolicyResponse{}, err } @@ -2330,7 +2322,7 @@ func (client *BlobClient) SetLegalHold(ctx context.Context, legalHold bool, opti if err != nil { return BlobClientSetLegalHoldResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientSetLegalHoldResponse{}, err } @@ -2405,7 +2397,7 @@ func (client *BlobClient) SetMetadata(ctx context.Context, options *BlobClientSe if err != nil { return BlobClientSetMetadataResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientSetMetadataResponse{}, err } @@ -2533,7 +2525,7 @@ func (client *BlobClient) SetTags(ctx context.Context, tags BlobTags, options *B if err != nil { return BlobClientSetTagsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientSetTagsResponse{}, err } @@ -2575,7 +2567,10 @@ func (client *BlobClient) setTagsCreateRequest(ctx context.Context, tags BlobTag req.Raw().Header["x-ms-lease-id"] = []string{*leaseAccessConditions.LeaseID} } req.Raw().Header["Accept"] = []string{"application/xml"} - return req, runtime.MarshalAsXML(req, tags) + if err := runtime.MarshalAsXML(req, tags); err != nil { + return nil, err + } + return req, nil } // setTagsHandleResponse handles the SetTags response. @@ -2616,7 +2611,7 @@ func (client *BlobClient) SetTier(ctx context.Context, tier AccessTier, options if err != nil { return BlobClientSetTierResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientSetTierResponse{}, err } @@ -2694,7 +2689,7 @@ func (client *BlobClient) StartCopyFromURL(ctx context.Context, copySource strin if err != nil { return BlobClientStartCopyFromURLResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientStartCopyFromURLResponse{}, err } @@ -2836,7 +2831,7 @@ func (client *BlobClient) Undelete(ctx context.Context, options *BlobClientUndel if err != nil { return BlobClientUndeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlobClientUndeleteResponse{}, err } diff --git a/sdk/storage/azblob/internal/generated/zz_blockblob_client.go b/sdk/storage/azblob/internal/generated/zz_blockblob_client.go index 5e8b085f3a3d..8fbd03a84965 100644 --- a/sdk/storage/azblob/internal/generated/zz_blockblob_client.go +++ b/sdk/storage/azblob/internal/generated/zz_blockblob_client.go @@ -22,21 +22,10 @@ import ( ) // BlockBlobClient contains the methods for the BlockBlob group. -// Don't use this type directly, use NewBlockBlobClient() instead. +// Don't use this type directly, use a constructor function instead. type BlockBlobClient struct { + internal *azcore.Client endpoint string - pl runtime.Pipeline -} - -// NewBlockBlobClient creates a new instance of BlockBlobClient with the specified values. -// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. -// - pl - the pipeline used for sending requests and handling responses. -func NewBlockBlobClient(endpoint string, pl runtime.Pipeline) *BlockBlobClient { - client := &BlockBlobClient{ - endpoint: endpoint, - pl: pl, - } - return client } // CommitBlockList - The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. @@ -62,7 +51,7 @@ func (client *BlockBlobClient) CommitBlockList(ctx context.Context, blocks Block if err != nil { return BlockBlobClientCommitBlockListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlockBlobClientCommitBlockListResponse{}, err } @@ -165,7 +154,10 @@ func (client *BlockBlobClient) commitBlockListCreateRequest(ctx context.Context, req.Raw().Header["x-ms-legal-hold"] = []string{strconv.FormatBool(*options.LegalHold)} } req.Raw().Header["Accept"] = []string{"application/xml"} - return req, runtime.MarshalAsXML(req, blocks) + if err := runtime.MarshalAsXML(req, blocks); err != nil { + return nil, err + } + return req, nil } // commitBlockListHandleResponse handles the CommitBlockList response. @@ -243,7 +235,7 @@ func (client *BlockBlobClient) GetBlockList(ctx context.Context, listType BlockL if err != nil { return BlockBlobClientGetBlockListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlockBlobClientGetBlockListResponse{}, err } @@ -354,7 +346,7 @@ func (client *BlockBlobClient) PutBlobFromURL(ctx context.Context, contentLength if err != nil { return BlockBlobClientPutBlobFromURLResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlockBlobClientPutBlobFromURLResponse{}, err } @@ -550,7 +542,7 @@ func (client *BlockBlobClient) StageBlock(ctx context.Context, blockID string, c if err != nil { return BlockBlobClientStageBlockResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlockBlobClientStageBlockResponse{}, err } @@ -600,7 +592,10 @@ func (client *BlockBlobClient) stageBlockCreateRequest(ctx context.Context, bloc req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } req.Raw().Header["Accept"] = []string{"application/xml"} - return req, req.SetBody(body, "application/octet-stream") + if err := req.SetBody(body, "application/octet-stream"); err != nil { + return nil, err + } + return req, nil } // stageBlockHandleResponse handles the StageBlock response. @@ -674,7 +669,7 @@ func (client *BlockBlobClient) StageBlockFromURL(ctx context.Context, blockID st if err != nil { return BlockBlobClientStageBlockFromURLResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlockBlobClientStageBlockFromURLResponse{}, err } @@ -815,7 +810,7 @@ func (client *BlockBlobClient) Upload(ctx context.Context, contentLength int64, if err != nil { return BlockBlobClientUploadResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlockBlobClientUploadResponse{}, err } @@ -919,7 +914,10 @@ func (client *BlockBlobClient) uploadCreateRequest(ctx context.Context, contentL req.Raw().Header["x-ms-content-crc64"] = []string{base64.StdEncoding.EncodeToString(options.TransactionalContentCRC64)} } req.Raw().Header["Accept"] = []string{"application/xml"} - return req, req.SetBody(body, "application/octet-stream") + if err := req.SetBody(body, "application/octet-stream"); err != nil { + return nil, err + } + return req, nil } // uploadHandleResponse handles the Upload response. diff --git a/sdk/storage/azblob/internal/generated/zz_constants.go b/sdk/storage/azblob/internal/generated/zz_constants.go index 5e86727fb2c0..c1c89ec99e82 100644 --- a/sdk/storage/azblob/internal/generated/zz_constants.go +++ b/sdk/storage/azblob/internal/generated/zz_constants.go @@ -55,21 +55,21 @@ func PossibleAccessTierValues() []AccessTier { type AccountKind string const ( - AccountKindStorage AccountKind = "Storage" AccountKindBlobStorage AccountKind = "BlobStorage" - AccountKindStorageV2 AccountKind = "StorageV2" - AccountKindFileStorage AccountKind = "FileStorage" AccountKindBlockBlobStorage AccountKind = "BlockBlobStorage" + AccountKindFileStorage AccountKind = "FileStorage" + AccountKindStorage AccountKind = "Storage" + AccountKindStorageV2 AccountKind = "StorageV2" ) // PossibleAccountKindValues returns the possible values for the AccountKind const type. func PossibleAccountKindValues() []AccountKind { return []AccountKind{ - AccountKindStorage, AccountKindBlobStorage, - AccountKindStorageV2, - AccountKindFileStorage, AccountKindBlockBlobStorage, + AccountKindFileStorage, + AccountKindStorage, + AccountKindStorageV2, } } @@ -91,15 +91,15 @@ func PossibleArchiveStatusValues() []ArchiveStatus { type BlobCopySourceTags string const ( - BlobCopySourceTagsREPLACE BlobCopySourceTags = "REPLACE" BlobCopySourceTagsCOPY BlobCopySourceTags = "COPY" + BlobCopySourceTagsREPLACE BlobCopySourceTags = "REPLACE" ) // PossibleBlobCopySourceTagsValues returns the possible values for the BlobCopySourceTags const type. func PossibleBlobCopySourceTagsValues() []BlobCopySourceTags { return []BlobCopySourceTags{ - BlobCopySourceTagsREPLACE, BlobCopySourceTagsCOPY, + BlobCopySourceTagsREPLACE, } } @@ -107,16 +107,16 @@ func PossibleBlobCopySourceTagsValues() []BlobCopySourceTags { type BlobGeoReplicationStatus string const ( - BlobGeoReplicationStatusLive BlobGeoReplicationStatus = "live" BlobGeoReplicationStatusBootstrap BlobGeoReplicationStatus = "bootstrap" + BlobGeoReplicationStatusLive BlobGeoReplicationStatus = "live" BlobGeoReplicationStatusUnavailable BlobGeoReplicationStatus = "unavailable" ) // PossibleBlobGeoReplicationStatusValues returns the possible values for the BlobGeoReplicationStatus const type. func PossibleBlobGeoReplicationStatusValues() []BlobGeoReplicationStatus { return []BlobGeoReplicationStatus{ - BlobGeoReplicationStatusLive, BlobGeoReplicationStatusBootstrap, + BlobGeoReplicationStatusLive, BlobGeoReplicationStatusUnavailable, } } @@ -124,53 +124,53 @@ func PossibleBlobGeoReplicationStatusValues() []BlobGeoReplicationStatus { type BlobType string const ( + BlobTypeAppendBlob BlobType = "AppendBlob" BlobTypeBlockBlob BlobType = "BlockBlob" BlobTypePageBlob BlobType = "PageBlob" - BlobTypeAppendBlob BlobType = "AppendBlob" ) // PossibleBlobTypeValues returns the possible values for the BlobType const type. func PossibleBlobTypeValues() []BlobType { return []BlobType{ + BlobTypeAppendBlob, BlobTypeBlockBlob, BlobTypePageBlob, - BlobTypeAppendBlob, } } type BlockListType string const ( + BlockListTypeAll BlockListType = "all" BlockListTypeCommitted BlockListType = "committed" BlockListTypeUncommitted BlockListType = "uncommitted" - BlockListTypeAll BlockListType = "all" ) // PossibleBlockListTypeValues returns the possible values for the BlockListType const type. func PossibleBlockListTypeValues() []BlockListType { return []BlockListType{ + BlockListTypeAll, BlockListTypeCommitted, BlockListTypeUncommitted, - BlockListTypeAll, } } type CopyStatusType string const ( - CopyStatusTypePending CopyStatusType = "pending" - CopyStatusTypeSuccess CopyStatusType = "success" CopyStatusTypeAborted CopyStatusType = "aborted" CopyStatusTypeFailed CopyStatusType = "failed" + CopyStatusTypePending CopyStatusType = "pending" + CopyStatusTypeSuccess CopyStatusType = "success" ) // PossibleCopyStatusTypeValues returns the possible values for the CopyStatusType const type. func PossibleCopyStatusTypeValues() []CopyStatusType { return []CopyStatusType{ - CopyStatusTypePending, - CopyStatusTypeSuccess, CopyStatusTypeAborted, CopyStatusTypeFailed, + CopyStatusTypePending, + CopyStatusTypeSuccess, } } @@ -207,15 +207,15 @@ func PossibleDeleteTypeValues() []DeleteType { type EncryptionAlgorithmType string const ( - EncryptionAlgorithmTypeNone EncryptionAlgorithmType = "None" EncryptionAlgorithmTypeAES256 EncryptionAlgorithmType = "AES256" + EncryptionAlgorithmTypeNone EncryptionAlgorithmType = "None" ) // PossibleEncryptionAlgorithmTypeValues returns the possible values for the EncryptionAlgorithmType const type. func PossibleEncryptionAlgorithmTypeValues() []EncryptionAlgorithmType { return []EncryptionAlgorithmType{ - EncryptionAlgorithmTypeNone, EncryptionAlgorithmTypeAES256, + EncryptionAlgorithmTypeNone, } } @@ -256,47 +256,47 @@ func PossibleFilterBlobsIncludeItemValues() []FilterBlobsIncludeItem { type ImmutabilityPolicyMode string const ( + ImmutabilityPolicyModeLocked ImmutabilityPolicyMode = "Locked" ImmutabilityPolicyModeMutable ImmutabilityPolicyMode = "Mutable" ImmutabilityPolicyModeUnlocked ImmutabilityPolicyMode = "Unlocked" - ImmutabilityPolicyModeLocked ImmutabilityPolicyMode = "Locked" ) // PossibleImmutabilityPolicyModeValues returns the possible values for the ImmutabilityPolicyMode const type. func PossibleImmutabilityPolicyModeValues() []ImmutabilityPolicyMode { return []ImmutabilityPolicyMode{ + ImmutabilityPolicyModeLocked, ImmutabilityPolicyModeMutable, ImmutabilityPolicyModeUnlocked, - ImmutabilityPolicyModeLocked, } } type ImmutabilityPolicySetting string const ( - ImmutabilityPolicySettingUnlocked ImmutabilityPolicySetting = "Unlocked" ImmutabilityPolicySettingLocked ImmutabilityPolicySetting = "Locked" + ImmutabilityPolicySettingUnlocked ImmutabilityPolicySetting = "Unlocked" ) // PossibleImmutabilityPolicySettingValues returns the possible values for the ImmutabilityPolicySetting const type. func PossibleImmutabilityPolicySettingValues() []ImmutabilityPolicySetting { return []ImmutabilityPolicySetting{ - ImmutabilityPolicySettingUnlocked, ImmutabilityPolicySettingLocked, + ImmutabilityPolicySettingUnlocked, } } type LeaseDurationType string const ( - LeaseDurationTypeInfinite LeaseDurationType = "infinite" LeaseDurationTypeFixed LeaseDurationType = "fixed" + LeaseDurationTypeInfinite LeaseDurationType = "infinite" ) // PossibleLeaseDurationTypeValues returns the possible values for the LeaseDurationType const type. func PossibleLeaseDurationTypeValues() []LeaseDurationType { return []LeaseDurationType{ - LeaseDurationTypeInfinite, LeaseDurationTypeFixed, + LeaseDurationTypeInfinite, } } @@ -304,20 +304,20 @@ type LeaseStateType string const ( LeaseStateTypeAvailable LeaseStateType = "available" - LeaseStateTypeLeased LeaseStateType = "leased" - LeaseStateTypeExpired LeaseStateType = "expired" LeaseStateTypeBreaking LeaseStateType = "breaking" LeaseStateTypeBroken LeaseStateType = "broken" + LeaseStateTypeExpired LeaseStateType = "expired" + LeaseStateTypeLeased LeaseStateType = "leased" ) // PossibleLeaseStateTypeValues returns the possible values for the LeaseStateType const type. func PossibleLeaseStateTypeValues() []LeaseStateType { return []LeaseStateType{ LeaseStateTypeAvailable, - LeaseStateTypeLeased, - LeaseStateTypeExpired, LeaseStateTypeBreaking, LeaseStateTypeBroken, + LeaseStateTypeExpired, + LeaseStateTypeLeased, } } @@ -341,14 +341,14 @@ type ListBlobsIncludeItem string const ( ListBlobsIncludeItemCopy ListBlobsIncludeItem = "copy" ListBlobsIncludeItemDeleted ListBlobsIncludeItem = "deleted" + ListBlobsIncludeItemDeletedwithversions ListBlobsIncludeItem = "deletedwithversions" + ListBlobsIncludeItemImmutabilitypolicy ListBlobsIncludeItem = "immutabilitypolicy" + ListBlobsIncludeItemLegalhold ListBlobsIncludeItem = "legalhold" ListBlobsIncludeItemMetadata ListBlobsIncludeItem = "metadata" ListBlobsIncludeItemSnapshots ListBlobsIncludeItem = "snapshots" + ListBlobsIncludeItemTags ListBlobsIncludeItem = "tags" ListBlobsIncludeItemUncommittedblobs ListBlobsIncludeItem = "uncommittedblobs" ListBlobsIncludeItemVersions ListBlobsIncludeItem = "versions" - ListBlobsIncludeItemTags ListBlobsIncludeItem = "tags" - ListBlobsIncludeItemImmutabilitypolicy ListBlobsIncludeItem = "immutabilitypolicy" - ListBlobsIncludeItemLegalhold ListBlobsIncludeItem = "legalhold" - ListBlobsIncludeItemDeletedwithversions ListBlobsIncludeItem = "deletedwithversions" ) // PossibleListBlobsIncludeItemValues returns the possible values for the ListBlobsIncludeItem const type. @@ -356,30 +356,30 @@ func PossibleListBlobsIncludeItemValues() []ListBlobsIncludeItem { return []ListBlobsIncludeItem{ ListBlobsIncludeItemCopy, ListBlobsIncludeItemDeleted, + ListBlobsIncludeItemDeletedwithversions, + ListBlobsIncludeItemImmutabilitypolicy, + ListBlobsIncludeItemLegalhold, ListBlobsIncludeItemMetadata, ListBlobsIncludeItemSnapshots, + ListBlobsIncludeItemTags, ListBlobsIncludeItemUncommittedblobs, ListBlobsIncludeItemVersions, - ListBlobsIncludeItemTags, - ListBlobsIncludeItemImmutabilitypolicy, - ListBlobsIncludeItemLegalhold, - ListBlobsIncludeItemDeletedwithversions, } } type ListContainersIncludeType string const ( - ListContainersIncludeTypeMetadata ListContainersIncludeType = "metadata" ListContainersIncludeTypeDeleted ListContainersIncludeType = "deleted" + ListContainersIncludeTypeMetadata ListContainersIncludeType = "metadata" ListContainersIncludeTypeSystem ListContainersIncludeType = "system" ) // PossibleListContainersIncludeTypeValues returns the possible values for the ListContainersIncludeType const type. func PossibleListContainersIncludeTypeValues() []ListContainersIncludeType { return []ListContainersIncludeType{ - ListContainersIncludeTypeMetadata, ListContainersIncludeTypeDeleted, + ListContainersIncludeTypeMetadata, ListContainersIncludeTypeSystem, } } @@ -436,18 +436,18 @@ func PossiblePublicAccessTypeValues() []PublicAccessType { type QueryFormatType string const ( + QueryFormatTypeArrow QueryFormatType = "arrow" QueryFormatTypeDelimited QueryFormatType = "delimited" QueryFormatTypeJSON QueryFormatType = "json" - QueryFormatTypeArrow QueryFormatType = "arrow" QueryFormatTypeParquet QueryFormatType = "parquet" ) // PossibleQueryFormatTypeValues returns the possible values for the QueryFormatType const type. func PossibleQueryFormatTypeValues() []QueryFormatType { return []QueryFormatType{ + QueryFormatTypeArrow, QueryFormatTypeDelimited, QueryFormatTypeJSON, - QueryFormatTypeArrow, QueryFormatTypeParquet, } } @@ -472,38 +472,38 @@ func PossibleRehydratePriorityValues() []RehydratePriority { type SKUName string const ( - SKUNameStandardLRS SKUName = "Standard_LRS" + SKUNamePremiumLRS SKUName = "Premium_LRS" SKUNameStandardGRS SKUName = "Standard_GRS" + SKUNameStandardLRS SKUName = "Standard_LRS" SKUNameStandardRAGRS SKUName = "Standard_RAGRS" SKUNameStandardZRS SKUName = "Standard_ZRS" - SKUNamePremiumLRS SKUName = "Premium_LRS" ) // PossibleSKUNameValues returns the possible values for the SKUName const type. func PossibleSKUNameValues() []SKUName { return []SKUName{ - SKUNameStandardLRS, + SKUNamePremiumLRS, SKUNameStandardGRS, + SKUNameStandardLRS, SKUNameStandardRAGRS, SKUNameStandardZRS, - SKUNamePremiumLRS, } } type SequenceNumberActionType string const ( + SequenceNumberActionTypeIncrement SequenceNumberActionType = "increment" SequenceNumberActionTypeMax SequenceNumberActionType = "max" SequenceNumberActionTypeUpdate SequenceNumberActionType = "update" - SequenceNumberActionTypeIncrement SequenceNumberActionType = "increment" ) // PossibleSequenceNumberActionTypeValues returns the possible values for the SequenceNumberActionType const type. func PossibleSequenceNumberActionTypeValues() []SequenceNumberActionType { return []SequenceNumberActionType{ + SequenceNumberActionTypeIncrement, SequenceNumberActionTypeMax, SequenceNumberActionTypeUpdate, - SequenceNumberActionTypeIncrement, } } diff --git a/sdk/storage/azblob/internal/generated/zz_container_client.go b/sdk/storage/azblob/internal/generated/zz_container_client.go index 22170e9d9e16..8942fd6a5b10 100644 --- a/sdk/storage/azblob/internal/generated/zz_container_client.go +++ b/sdk/storage/azblob/internal/generated/zz_container_client.go @@ -25,21 +25,10 @@ import ( ) // ContainerClient contains the methods for the Container group. -// Don't use this type directly, use NewContainerClient() instead. +// Don't use this type directly, use a constructor function instead. type ContainerClient struct { + internal *azcore.Client endpoint string - pl runtime.Pipeline -} - -// NewContainerClient creates a new instance of ContainerClient with the specified values. -// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. -// - pl - the pipeline used for sending requests and handling responses. -func NewContainerClient(endpoint string, pl runtime.Pipeline) *ContainerClient { - client := &ContainerClient{ - endpoint: endpoint, - pl: pl, - } - return client } // AcquireLease - [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 @@ -57,7 +46,7 @@ func (client *ContainerClient) AcquireLease(ctx context.Context, duration int32, if err != nil { return ContainerClientAcquireLeaseResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientAcquireLeaseResponse{}, err } @@ -146,7 +135,7 @@ func (client *ContainerClient) BreakLease(ctx context.Context, options *Containe if err != nil { return ContainerClientBreakLeaseResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientBreakLeaseResponse{}, err } @@ -243,7 +232,7 @@ func (client *ContainerClient) ChangeLease(ctx context.Context, leaseID string, if err != nil { return ContainerClientChangeLeaseResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientChangeLeaseResponse{}, err } @@ -330,7 +319,7 @@ func (client *ContainerClient) Create(ctx context.Context, options *ContainerCli if err != nil { return ContainerClientCreateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientCreateResponse{}, err } @@ -421,7 +410,7 @@ func (client *ContainerClient) Delete(ctx context.Context, options *ContainerCli if err != nil { return ContainerClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientDeleteResponse{}, err } @@ -494,7 +483,7 @@ func (client *ContainerClient) FilterBlobs(ctx context.Context, where string, op if err != nil { return ContainerClientFilterBlobsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientFilterBlobsResponse{}, err } @@ -573,7 +562,7 @@ func (client *ContainerClient) GetAccessPolicy(ctx context.Context, options *Con if err != nil { return ContainerClientGetAccessPolicyResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientGetAccessPolicyResponse{}, err } @@ -656,7 +645,7 @@ func (client *ContainerClient) GetAccountInfo(ctx context.Context, options *Cont if err != nil { return ContainerClientGetAccountInfoResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientGetAccountInfoResponse{}, err } @@ -721,7 +710,7 @@ func (client *ContainerClient) GetProperties(ctx context.Context, options *Conta if err != nil { return ContainerClientGetPropertiesResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientGetPropertiesResponse{}, err } @@ -928,7 +917,7 @@ func (client *ContainerClient) NewListBlobHierarchySegmentPager(delimiter string if err != nil { return ContainerClientListBlobHierarchySegmentResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientListBlobHierarchySegmentResponse{}, err } @@ -1015,7 +1004,7 @@ func (client *ContainerClient) ReleaseLease(ctx context.Context, leaseID string, if err != nil { return ContainerClientReleaseLeaseResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientReleaseLeaseResponse{}, err } @@ -1097,7 +1086,7 @@ func (client *ContainerClient) Rename(ctx context.Context, sourceContainerName s if err != nil { return ContainerClientRenameResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientRenameResponse{}, err } @@ -1167,7 +1156,7 @@ func (client *ContainerClient) RenewLease(ctx context.Context, leaseID string, o if err != nil { return ContainerClientRenewLeaseResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientRenewLeaseResponse{}, err } @@ -1251,7 +1240,7 @@ func (client *ContainerClient) Restore(ctx context.Context, options *ContainerCl if err != nil { return ContainerClientRestoreResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientRestoreResponse{}, err } @@ -1325,7 +1314,7 @@ func (client *ContainerClient) SetAccessPolicy(ctx context.Context, containerACL if err != nil { return ContainerClientSetAccessPolicyResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientSetAccessPolicyResponse{}, err } @@ -1369,7 +1358,10 @@ func (client *ContainerClient) setAccessPolicyCreateRequest(ctx context.Context, XMLName xml.Name `xml:"SignedIdentifiers"` ContainerACL *[]*SignedIdentifier `xml:"SignedIdentifier"` } - return req, runtime.MarshalAsXML(req, wrapper{ContainerACL: &containerACL}) + if err := runtime.MarshalAsXML(req, wrapper{ContainerACL: &containerACL}); err != nil { + return nil, err + } + return req, nil } // setAccessPolicyHandleResponse handles the SetAccessPolicy response. @@ -1416,7 +1408,7 @@ func (client *ContainerClient) SetMetadata(ctx context.Context, options *Contain if err != nil { return ContainerClientSetMetadataResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientSetMetadataResponse{}, err } @@ -1506,7 +1498,7 @@ func (client *ContainerClient) SubmitBatch(ctx context.Context, contentLength in if err != nil { return ContainerClientSubmitBatchResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContainerClientSubmitBatchResponse{}, err } @@ -1537,7 +1529,10 @@ func (client *ContainerClient) submitBatchCreateRequest(ctx context.Context, con req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } req.Raw().Header["Accept"] = []string{"application/xml"} - return req, req.SetBody(body, multipartContentType) + if err := req.SetBody(body, multipartContentType); err != nil { + return nil, err + } + return req, nil } // submitBatchHandleResponse handles the SubmitBatch response. diff --git a/sdk/storage/azblob/internal/generated/zz_models.go b/sdk/storage/azblob/internal/generated/zz_models.go index a32110a4a50d..93f94bc5b92c 100644 --- a/sdk/storage/azblob/internal/generated/zz_models.go +++ b/sdk/storage/azblob/internal/generated/zz_models.go @@ -558,7 +558,7 @@ type BlobItem struct { type BlobName struct { // The name of the blob. - Content *string `xml:"content"` + Content *string `xml:",chardata"` // Indicates if the blob name is encoded. Encoded *bool `xml:"Encoded,attr"` @@ -1716,7 +1716,7 @@ type StaticWebsite struct { } type StorageError struct { - Message *string `json:"Message,omitempty"` + Message *string } // StorageServiceProperties - Storage Service Properties. diff --git a/sdk/storage/azblob/internal/generated/zz_models_serde.go b/sdk/storage/azblob/internal/generated/zz_models_serde.go index e5b6cda2b913..b78b3225bd48 100644 --- a/sdk/storage/azblob/internal/generated/zz_models_serde.go +++ b/sdk/storage/azblob/internal/generated/zz_models_serde.go @@ -470,6 +470,16 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil diff --git a/sdk/storage/azblob/internal/generated/zz_pageblob_client.go b/sdk/storage/azblob/internal/generated/zz_pageblob_client.go index e5eec310ee98..9fd39f0c9630 100644 --- a/sdk/storage/azblob/internal/generated/zz_pageblob_client.go +++ b/sdk/storage/azblob/internal/generated/zz_pageblob_client.go @@ -22,21 +22,10 @@ import ( ) // PageBlobClient contains the methods for the PageBlob group. -// Don't use this type directly, use NewPageBlobClient() instead. +// Don't use this type directly, use a constructor function instead. type PageBlobClient struct { + internal *azcore.Client endpoint string - pl runtime.Pipeline -} - -// NewPageBlobClient creates a new instance of PageBlobClient with the specified values. -// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. -// - pl - the pipeline used for sending requests and handling responses. -func NewPageBlobClient(endpoint string, pl runtime.Pipeline) *PageBlobClient { - client := &PageBlobClient{ - endpoint: endpoint, - pl: pl, - } - return client } // ClearPages - The Clear Pages operation clears a set of pages from a page blob @@ -56,7 +45,7 @@ func (client *PageBlobClient) ClearPages(ctx context.Context, contentLength int6 if err != nil { return PageBlobClientClearPagesResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PageBlobClientClearPagesResponse{}, err } @@ -202,7 +191,7 @@ func (client *PageBlobClient) CopyIncremental(ctx context.Context, copySource st if err != nil { return PageBlobClientCopyIncrementalResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PageBlobClientCopyIncrementalResponse{}, err } @@ -304,7 +293,7 @@ func (client *PageBlobClient) Create(ctx context.Context, contentLength int64, b if err != nil { return PageBlobClientCreateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PageBlobClientCreateResponse{}, err } @@ -488,7 +477,7 @@ func (client *PageBlobClient) NewGetPageRangesPager(options *PageBlobClientGetPa if err != nil { return PageBlobClientGetPageRangesResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PageBlobClientGetPageRangesResponse{}, err } @@ -616,7 +605,7 @@ func (client *PageBlobClient) NewGetPageRangesDiffPager(options *PageBlobClientG if err != nil { return PageBlobClientGetPageRangesDiffResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PageBlobClientGetPageRangesDiffResponse{}, err } @@ -742,7 +731,7 @@ func (client *PageBlobClient) Resize(ctx context.Context, blobContentLength int6 if err != nil { return PageBlobClientResizeResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PageBlobClientResizeResponse{}, err } @@ -857,7 +846,7 @@ func (client *PageBlobClient) UpdateSequenceNumber(ctx context.Context, sequence if err != nil { return PageBlobClientUpdateSequenceNumberResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PageBlobClientUpdateSequenceNumberResponse{}, err } @@ -966,7 +955,7 @@ func (client *PageBlobClient) UploadPages(ctx context.Context, contentLength int if err != nil { return PageBlobClientUploadPagesResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PageBlobClientUploadPagesResponse{}, err } @@ -1043,7 +1032,10 @@ func (client *PageBlobClient) uploadPagesCreateRequest(ctx context.Context, cont req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } req.Raw().Header["Accept"] = []string{"application/xml"} - return req, req.SetBody(body, "application/octet-stream") + if err := req.SetBody(body, "application/octet-stream"); err != nil { + return nil, err + } + return req, nil } // uploadPagesHandleResponse handles the UploadPages response. @@ -1138,7 +1130,7 @@ func (client *PageBlobClient) UploadPagesFromURL(ctx context.Context, sourceURL if err != nil { return PageBlobClientUploadPagesFromURLResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PageBlobClientUploadPagesFromURLResponse{}, err } diff --git a/sdk/storage/azblob/internal/generated/zz_service_client.go b/sdk/storage/azblob/internal/generated/zz_service_client.go index 961dae0735fe..57c59a684c59 100644 --- a/sdk/storage/azblob/internal/generated/zz_service_client.go +++ b/sdk/storage/azblob/internal/generated/zz_service_client.go @@ -12,6 +12,7 @@ package generated import ( "context" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "io" @@ -22,21 +23,10 @@ import ( ) // ServiceClient contains the methods for the Service group. -// Don't use this type directly, use NewServiceClient() instead. +// Don't use this type directly, use a constructor function instead. type ServiceClient struct { + internal *azcore.Client endpoint string - pl runtime.Pipeline -} - -// NewServiceClient creates a new instance of ServiceClient with the specified values. -// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. -// - pl - the pipeline used for sending requests and handling responses. -func NewServiceClient(endpoint string, pl runtime.Pipeline) *ServiceClient { - client := &ServiceClient{ - endpoint: endpoint, - pl: pl, - } - return client } // FilterBlobs - The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search @@ -52,7 +42,7 @@ func (client *ServiceClient) FilterBlobs(ctx context.Context, where string, opti if err != nil { return ServiceClientFilterBlobsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServiceClientFilterBlobsResponse{}, err } @@ -127,7 +117,7 @@ func (client *ServiceClient) GetAccountInfo(ctx context.Context, options *Servic if err != nil { return ServiceClientGetAccountInfoResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServiceClientGetAccountInfoResponse{}, err } @@ -198,7 +188,7 @@ func (client *ServiceClient) GetProperties(ctx context.Context, options *Service if err != nil { return ServiceClientGetPropertiesResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServiceClientGetPropertiesResponse{}, err } @@ -258,7 +248,7 @@ func (client *ServiceClient) GetStatistics(ctx context.Context, options *Service if err != nil { return ServiceClientGetStatisticsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServiceClientGetStatisticsResponse{}, err } @@ -327,7 +317,7 @@ func (client *ServiceClient) GetUserDelegationKey(ctx context.Context, keyInfo K if err != nil { return ServiceClientGetUserDelegationKeyResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServiceClientGetUserDelegationKeyResponse{}, err } @@ -355,7 +345,10 @@ func (client *ServiceClient) getUserDelegationKeyCreateRequest(ctx context.Conte req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } req.Raw().Header["Accept"] = []string{"application/xml"} - return req, runtime.MarshalAsXML(req, keyInfo) + if err := runtime.MarshalAsXML(req, keyInfo); err != nil { + return nil, err + } + return req, nil } // getUserDelegationKeyHandleResponse handles the GetUserDelegationKey response. @@ -452,7 +445,7 @@ func (client *ServiceClient) SetProperties(ctx context.Context, storageServicePr if err != nil { return ServiceClientSetPropertiesResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServiceClientSetPropertiesResponse{}, err } @@ -480,7 +473,10 @@ func (client *ServiceClient) setPropertiesCreateRequest(ctx context.Context, sto req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } req.Raw().Header["Accept"] = []string{"application/xml"} - return req, runtime.MarshalAsXML(req, storageServiceProperties) + if err := runtime.MarshalAsXML(req, storageServiceProperties); err != nil { + return nil, err + } + return req, nil } // setPropertiesHandleResponse handles the SetProperties response. @@ -512,7 +508,7 @@ func (client *ServiceClient) SubmitBatch(ctx context.Context, contentLength int6 if err != nil { return ServiceClientSubmitBatchResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServiceClientSubmitBatchResponse{}, err } @@ -542,7 +538,10 @@ func (client *ServiceClient) submitBatchCreateRequest(ctx context.Context, conte req.Raw().Header["x-ms-client-request-id"] = []string{*options.RequestID} } req.Raw().Header["Accept"] = []string{"application/xml"} - return req, req.SetBody(body, multipartContentType) + if err := req.SetBody(body, multipartContentType); err != nil { + return nil, err + } + return req, nil } // submitBatchHandleResponse handles the SubmitBatch response. From 7faac50c2fdf816e9e1361a2671fc33ebeb76946 Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Fri, 19 May 2023 11:41:08 -0400 Subject: [PATCH 07/24] Fixing calls to pipeline --- sdk/storage/azblob/internal/generated/appendblob_client.go | 2 +- sdk/storage/azblob/internal/generated/blob_client.go | 2 +- sdk/storage/azblob/internal/generated/block_blob_client.go | 2 +- sdk/storage/azblob/internal/generated/container_client.go | 2 +- sdk/storage/azblob/internal/generated/pageblob_client.go | 2 +- sdk/storage/azblob/internal/generated/service_client.go | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/storage/azblob/internal/generated/appendblob_client.go b/sdk/storage/azblob/internal/generated/appendblob_client.go index 3b6184fea67c..8940a917c706 100644 --- a/sdk/storage/azblob/internal/generated/appendblob_client.go +++ b/sdk/storage/azblob/internal/generated/appendblob_client.go @@ -15,5 +15,5 @@ func (client *AppendBlobClient) Endpoint() string { } func (client *AppendBlobClient) Pipeline() runtime.Pipeline { - return client.pl + return client.internal.Pipeline() } diff --git a/sdk/storage/azblob/internal/generated/blob_client.go b/sdk/storage/azblob/internal/generated/blob_client.go index 478962de1552..d09a177d920e 100644 --- a/sdk/storage/azblob/internal/generated/blob_client.go +++ b/sdk/storage/azblob/internal/generated/blob_client.go @@ -21,7 +21,7 @@ func (client *BlobClient) Endpoint() string { } func (client *BlobClient) Pipeline() runtime.Pipeline { - return client.pl + return client.internal.Pipeline() } func (client *BlobClient) DeleteCreateRequest(ctx context.Context, options *BlobClientDeleteOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) { diff --git a/sdk/storage/azblob/internal/generated/block_blob_client.go b/sdk/storage/azblob/internal/generated/block_blob_client.go index a43e327ec44d..8319ab38f8fd 100644 --- a/sdk/storage/azblob/internal/generated/block_blob_client.go +++ b/sdk/storage/azblob/internal/generated/block_blob_client.go @@ -15,5 +15,5 @@ func (client *BlockBlobClient) Endpoint() string { } func (client *BlockBlobClient) Pipeline() runtime.Pipeline { - return client.pl + return client.internal.Pipeline() } diff --git a/sdk/storage/azblob/internal/generated/container_client.go b/sdk/storage/azblob/internal/generated/container_client.go index bbbf828a07af..d50e12f95b0f 100644 --- a/sdk/storage/azblob/internal/generated/container_client.go +++ b/sdk/storage/azblob/internal/generated/container_client.go @@ -13,5 +13,5 @@ func (client *ContainerClient) Endpoint() string { } func (client *ContainerClient) Pipeline() runtime.Pipeline { - return client.pl + return client.internal.Pipeline() } diff --git a/sdk/storage/azblob/internal/generated/pageblob_client.go b/sdk/storage/azblob/internal/generated/pageblob_client.go index 8a212cc3d4e2..5ab82a0f6c03 100644 --- a/sdk/storage/azblob/internal/generated/pageblob_client.go +++ b/sdk/storage/azblob/internal/generated/pageblob_client.go @@ -13,5 +13,5 @@ func (client *PageBlobClient) Endpoint() string { } func (client *PageBlobClient) Pipeline() runtime.Pipeline { - return client.pl + return client.internal.Pipeline() } diff --git a/sdk/storage/azblob/internal/generated/service_client.go b/sdk/storage/azblob/internal/generated/service_client.go index 1f449b955e82..22f11c20a9fd 100644 --- a/sdk/storage/azblob/internal/generated/service_client.go +++ b/sdk/storage/azblob/internal/generated/service_client.go @@ -13,5 +13,5 @@ func (client *ServiceClient) Endpoint() string { } func (client *ServiceClient) Pipeline() runtime.Pipeline { - return client.pl + return client.internal.Pipeline() } From 948b091f0f78ae5d06b72b43de8e4d559a587873 Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Tue, 23 May 2023 12:33:19 -0400 Subject: [PATCH 08/24] Adding custom UnmarshalXML for BlobItem and BlobPrefix --- .../azblob/internal/generated/autorest.md | 19 ++++++ .../azblob/internal/generated/models.go | 64 +++++++++++++++++++ .../azblob/internal/generated/zz_models.go | 4 +- .../internal/generated/zz_models_serde.go | 18 ------ 4 files changed, 85 insertions(+), 20 deletions(-) diff --git a/sdk/storage/azblob/internal/generated/autorest.md b/sdk/storage/azblob/internal/generated/autorest.md index 8ad959690b8f..28485e4b8bfa 100644 --- a/sdk/storage/azblob/internal/generated/autorest.md +++ b/sdk/storage/azblob/internal/generated/autorest.md @@ -22,6 +22,25 @@ export-clients: true use: "@autorest/go@4.0.0-preview.49" ``` +### Undo breaking change with BlobName +``` yaml +directive: +- from: zz_models.go + where: $ + transform: >- + return $. + replace(/Name\s+\*BlobName/g, `Name *string`); +``` + +### Removing UnmarshalXML for BlobItems to create customer UnmarshalXML function +```yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + $.BlobItemInternal["x-ms-go-omit-serde-methods"] = true; +``` + ### Remove pager methods and export various generated methods in container client ``` yaml diff --git a/sdk/storage/azblob/internal/generated/models.go b/sdk/storage/azblob/internal/generated/models.go index 759d92630f56..2bfb97ff873b 100644 --- a/sdk/storage/azblob/internal/generated/models.go +++ b/sdk/storage/azblob/internal/generated/models.go @@ -6,6 +6,12 @@ package generated +import ( + "encoding/base64" + "encoding/xml" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" +) + type TransactionalContentSetter interface { SetCRC64([]byte) SetMD5([]byte) @@ -63,3 +69,61 @@ func (p *PageBlobClientUploadPagesFromURLOptions) SetSourceContentCRC64(v []byte func (p *PageBlobClientUploadPagesFromURLOptions) SetSourceContentMD5(v []byte) { p.SourceContentMD5 = v } + +// Custom UnmarshalXML functions for types that need special handling. + +// UnmarshalXML implements the xml.Unmarshaller interface for type BlobPrefix. +func (b *BlobPrefix) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error { + type alias BlobPrefix + aux := &struct { + *alias + BlobName *BlobName `xml:"Name"` + }{ + alias: (*alias)(b), + } + if err := dec.DecodeElement(aux, &start); err != nil { + return err + } + if aux.BlobName != nil { + if aux.BlobName.Encoded != nil && *aux.BlobName.Encoded { + name, err := base64.StdEncoding.DecodeString(*aux.BlobName.Content) + if err != nil { + return err + } + b.Name = to.Ptr(string(name)) + } else { + b.Name = aux.BlobName.Content + } + } + return nil +} + +// UnmarshalXML implements the xml.Unmarshaller interface for type BlobItem. +func (b *BlobItem) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error { + type alias BlobItem + aux := &struct { + *alias + BlobName *BlobName `xml:"Name"` + Metadata additionalProperties `xml:"Metadata"` + OrMetadata additionalProperties `xml:"OrMetadata"` + }{ + alias: (*alias)(b), + } + if err := dec.DecodeElement(aux, &start); err != nil { + return err + } + b.Metadata = (map[string]*string)(aux.Metadata) + b.OrMetadata = (map[string]*string)(aux.OrMetadata) + if aux.BlobName != nil { + if aux.BlobName.Encoded != nil && *aux.BlobName.Encoded { + name, err := base64.StdEncoding.DecodeString(*aux.BlobName.Content) + if err != nil { + return err + } + b.Name = to.Ptr(string(name)) + } else { + b.Name = aux.BlobName.Content + } + } + return nil +} diff --git a/sdk/storage/azblob/internal/generated/zz_models.go b/sdk/storage/azblob/internal/generated/zz_models.go index 93f94bc5b92c..1fed5f630bd0 100644 --- a/sdk/storage/azblob/internal/generated/zz_models.go +++ b/sdk/storage/azblob/internal/generated/zz_models.go @@ -535,7 +535,7 @@ type BlobItem struct { Deleted *bool `xml:"Deleted"` // REQUIRED - Name *BlobName `xml:"Name"` + Name *string `xml:"Name"` // REQUIRED; Properties of a blob Properties *BlobProperties `xml:"Properties"` @@ -566,7 +566,7 @@ type BlobName struct { type BlobPrefix struct { // REQUIRED - Name *BlobName `xml:"Name"` + Name *string `xml:"Name"` } // BlobProperties - Properties of a blob diff --git a/sdk/storage/azblob/internal/generated/zz_models_serde.go b/sdk/storage/azblob/internal/generated/zz_models_serde.go index b78b3225bd48..dc5dba1037a5 100644 --- a/sdk/storage/azblob/internal/generated/zz_models_serde.go +++ b/sdk/storage/azblob/internal/generated/zz_models_serde.go @@ -101,24 +101,6 @@ func (b BlobHierarchyListSegment) MarshalXML(enc *xml.Encoder, start xml.StartEl return enc.EncodeElement(aux, start) } -// UnmarshalXML implements the xml.Unmarshaller interface for type BlobItem. -func (b *BlobItem) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error { - type alias BlobItem - aux := &struct { - *alias - Metadata additionalProperties `xml:"Metadata"` - OrMetadata additionalProperties `xml:"OrMetadata"` - }{ - alias: (*alias)(b), - } - if err := dec.DecodeElement(aux, &start); err != nil { - return err - } - b.Metadata = (map[string]*string)(aux.Metadata) - b.OrMetadata = (map[string]*string)(aux.OrMetadata) - return nil -} - // MarshalXML implements the xml.Marshaller interface for type BlobProperties. func (b BlobProperties) MarshalXML(enc *xml.Encoder, start xml.StartElement) error { type alias BlobProperties From c61c73e6646aa12e7fee620c4d44cd820348d60b Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Tue, 23 May 2023 16:47:35 -0400 Subject: [PATCH 09/24] Updating constructor method for AppendBlobClient --- sdk/storage/azblob/appendblob/client.go | 21 +++++-------------- .../internal/generated/appendblob_client.go | 20 +++++++++++++++++- .../azblob/internal/generated/blob_client.go | 16 ++++++++++++++ 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/sdk/storage/azblob/appendblob/client.go b/sdk/storage/azblob/appendblob/client.go index 1b253628c1f8..4d6e86748141 100644 --- a/sdk/storage/azblob/appendblob/client.go +++ b/sdk/storage/azblob/appendblob/client.go @@ -38,11 +38,8 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, - exported.ModuleVersion, runtime.PipelineOptions{}, - &conOptions.ClientOptions) - return (*Client)(base.NewAppendBlobClient(blobURL, pl, nil)), nil + return (*Client)(base.NewAppendBlobClient(blobURL, runtime.PipelineOptions{}, &conOptions.ClientOptions, nil)), nil } // NewClientWithNoCredential creates an instance of Client with the specified values. @@ -51,12 +48,8 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio // - options - client options; pass nil to accept the default values func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - pl := runtime.NewPipeline(exported.ModuleName, - exported.ModuleVersion, - runtime.PipelineOptions{}, - &conOptions.ClientOptions) - return (*Client)(base.NewAppendBlobClient(blobURL, pl, nil)), nil + return (*Client)(base.NewAppendBlobClient(blobURL, runtime.PipelineOptions{}, &conOptions.ClientOptions, nil)), nil } // NewClientWithSharedKeyCredential creates an instance of Client with the specified values. @@ -67,12 +60,8 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, - exported.ModuleVersion, - runtime.PipelineOptions{}, - &conOptions.ClientOptions) - return (*Client)(base.NewAppendBlobClient(blobURL, pl, cred)), nil + return (*Client)(base.NewAppendBlobClient(blobURL, runtime.PipelineOptions{}, &conOptions.ClientOptions, cred)), nil } // NewClientFromConnectionString creates an instance of Client with the specified values. @@ -132,7 +121,7 @@ func (ab *Client) WithSnapshot(snapshot string) (*Client, error) { } p.Snapshot = snapshot - return (*Client)(base.NewAppendBlobClient(p.String(), ab.generated().Pipeline(), ab.sharedKey())), nil + return (*Client)(base.NewAppendBlobClient(p.String(), runtime.PipelineOptions{}, nil, ab.sharedKey())), nil } // WithVersionID creates a new AppendBlobURL object identical to the source but with the specified version id. @@ -144,7 +133,7 @@ func (ab *Client) WithVersionID(versionID string) (*Client, error) { } p.VersionID = versionID - return (*Client)(base.NewAppendBlobClient(p.String(), ab.generated().Pipeline(), ab.sharedKey())), nil + return (*Client)(base.NewAppendBlobClient(p.String(), runtime.PipelineOptions{}, nil, ab.sharedKey())), nil } // Create creates a 0-size append blob. Call AppendBlock to append data to an append blob. diff --git a/sdk/storage/azblob/internal/generated/appendblob_client.go b/sdk/storage/azblob/internal/generated/appendblob_client.go index 8940a917c706..75da55c3841a 100644 --- a/sdk/storage/azblob/internal/generated/appendblob_client.go +++ b/sdk/storage/azblob/internal/generated/appendblob_client.go @@ -8,7 +8,11 @@ package generated -import "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported" +) func (client *AppendBlobClient) Endpoint() string { return client.endpoint @@ -17,3 +21,17 @@ func (client *AppendBlobClient) Endpoint() string { func (client *AppendBlobClient) Pipeline() runtime.Pipeline { return client.internal.Pipeline() } + +// NewAppendBlobClient creates a new instance of AppendBlobClient with the specified values. +// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. +func NewAppendBlobClient(endpoint string, pl runtime.PipelineOptions, clientOptions *azcore.ClientOptions) (*AppendBlobClient, error) { + azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, pl, clientOptions) + if err != nil { + return nil, err + } + client := &AppendBlobClient{ + endpoint: endpoint, + internal: azClient, + } + return client, nil +} diff --git a/sdk/storage/azblob/internal/generated/blob_client.go b/sdk/storage/azblob/internal/generated/blob_client.go index d09a177d920e..ae3eca581da4 100644 --- a/sdk/storage/azblob/internal/generated/blob_client.go +++ b/sdk/storage/azblob/internal/generated/blob_client.go @@ -8,8 +8,10 @@ package generated import ( "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported" "time" ) @@ -31,3 +33,17 @@ func (client *BlobClient) DeleteCreateRequest(ctx context.Context, options *Blob func (client *BlobClient) SetTierCreateRequest(ctx context.Context, tier AccessTier, options *BlobClientSetTierOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) { return client.setTierCreateRequest(ctx, tier, options, leaseAccessConditions, modifiedAccessConditions) } + +// NewBlobClient creates a new instance of BlobClient with the specified values. +// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. +func NewBlobClient(endpoint string, pl runtime.PipelineOptions, clientOptions *azcore.ClientOptions) (*BlobClient, error) { + azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, pl, clientOptions) + if err != nil { + return nil, err + } + client := &BlobClient{ + endpoint: endpoint, + internal: azClient, + } + return client, nil +} From 9b5966cca8f161c007d298b83c6fc64afa5adb8c Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Mon, 5 Jun 2023 16:37:07 -0400 Subject: [PATCH 10/24] Updating Client constructors --- sdk/storage/azblob/appendblob/client.go | 25 +++++++++++--- sdk/storage/azblob/blob/client.go | 25 +++++++++----- sdk/storage/azblob/blockblob/client.go | 27 ++++++++++----- sdk/storage/azblob/container/client.go | 33 ++++++++++++------- sdk/storage/azblob/internal/base/clients.go | 32 +++++++++--------- .../internal/generated/appendblob_client.go | 17 ++++------ .../azblob/internal/generated/blob_client.go | 17 ++++------ .../internal/generated/block_blob_client.go | 19 +++++++++-- .../internal/generated/container_client.go | 19 +++++++++-- .../internal/generated/pageblob_client.go | 19 +++++++++-- .../internal/generated/service_client.go | 19 +++++++++-- sdk/storage/azblob/pageblob/client.go | 29 ++++++++++------ sdk/storage/azblob/service/client.go | 27 ++++++++++----- 13 files changed, 207 insertions(+), 101 deletions(-) diff --git a/sdk/storage/azblob/appendblob/client.go b/sdk/storage/azblob/appendblob/client.go index 4d6e86748141..88651aca0e4b 100644 --- a/sdk/storage/azblob/appendblob/client.go +++ b/sdk/storage/azblob/appendblob/client.go @@ -39,7 +39,12 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - return (*Client)(base.NewAppendBlobClient(blobURL, runtime.PipelineOptions{}, &conOptions.ClientOptions, nil)), nil + azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + + return (*Client)(base.NewAppendBlobClient(blobURL, azClient, nil)), nil } // NewClientWithNoCredential creates an instance of Client with the specified values. @@ -49,7 +54,12 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - return (*Client)(base.NewAppendBlobClient(blobURL, runtime.PipelineOptions{}, &conOptions.ClientOptions, nil)), nil + azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + + return (*Client)(base.NewAppendBlobClient(blobURL, azClient, nil)), nil } // NewClientWithSharedKeyCredential creates an instance of Client with the specified values. @@ -61,7 +71,12 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - return (*Client)(base.NewAppendBlobClient(blobURL, runtime.PipelineOptions{}, &conOptions.ClientOptions, cred)), nil + azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + + return (*Client)(base.NewAppendBlobClient(blobURL, azClient, cred)), nil } // NewClientFromConnectionString creates an instance of Client with the specified values. @@ -121,7 +136,7 @@ func (ab *Client) WithSnapshot(snapshot string) (*Client, error) { } p.Snapshot = snapshot - return (*Client)(base.NewAppendBlobClient(p.String(), runtime.PipelineOptions{}, nil, ab.sharedKey())), nil + return (*Client)(base.NewAppendBlobClient(p.String(), ab.generated().InternalClient(), ab.sharedKey())), nil } // WithVersionID creates a new AppendBlobURL object identical to the source but with the specified version id. @@ -133,7 +148,7 @@ func (ab *Client) WithVersionID(versionID string) (*Client, error) { } p.VersionID = versionID - return (*Client)(base.NewAppendBlobClient(p.String(), runtime.PipelineOptions{}, nil, ab.sharedKey())), nil + return (*Client)(base.NewAppendBlobClient(p.String(), ab.generated().InternalClient(), ab.sharedKey())), nil } // Create creates a 0-size append blob. Call AppendBlock to append data to an append blob. diff --git a/sdk/storage/azblob/blob/client.go b/sdk/storage/azblob/blob/client.go index 805b5aa340f3..118b78cbf82d 100644 --- a/sdk/storage/azblob/blob/client.go +++ b/sdk/storage/azblob/blob/client.go @@ -40,9 +40,12 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewBlobClient(blobURL, pl, &cred)), nil + azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + return (*Client)(base.NewBlobClient(blobURL, azClient, &cred)), nil } // NewClientWithNoCredential creates an instance of Client with the specified values. @@ -51,9 +54,12 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio // - options - client options; pass nil to accept the default values func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewBlobClient(blobURL, pl, nil)), nil + azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + return (*Client)(base.NewBlobClient(blobURL, azClient, nil)), nil } // NewClientWithSharedKeyCredential creates an instance of Client with the specified values. @@ -64,9 +70,12 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *SharedKeyCredential, authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewBlobClient(blobURL, pl, cred)), nil + azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + return (*Client)(base.NewBlobClient(blobURL, azClient, cred)), nil } // NewClientFromConnectionString creates an instance of Client with the specified values. @@ -118,7 +127,7 @@ func (b *Client) WithSnapshot(snapshot string) (*Client, error) { } p.Snapshot = snapshot - return (*Client)(base.NewBlobClient(p.String(), b.generated().Pipeline(), b.credential())), nil + return (*Client)(base.NewBlobClient(p.String(), b.generated().InternalClient(), b.credential())), nil } // WithVersionID creates a new AppendBlobURL object identical to the source but with the specified version id. @@ -130,7 +139,7 @@ func (b *Client) WithVersionID(versionID string) (*Client, error) { } p.VersionID = versionID - return (*Client)(base.NewBlobClient(p.String(), b.generated().Pipeline(), b.credential())), nil + return (*Client)(base.NewBlobClient(p.String(), b.generated().InternalClient(), b.credential())), nil } // Delete marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection. diff --git a/sdk/storage/azblob/blockblob/client.go b/sdk/storage/azblob/blockblob/client.go index 09203cbf4801..a1ad994a0231 100644 --- a/sdk/storage/azblob/blockblob/client.go +++ b/sdk/storage/azblob/blockblob/client.go @@ -45,9 +45,12 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewBlockBlobClient(blobURL, pl, nil)), nil + azClient, err := azcore.NewClient("blockblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + return (*Client)(base.NewBlockBlobClient(blobURL, azClient, nil)), nil } // NewClientWithNoCredential creates an instance of Client with the specified values. @@ -56,9 +59,13 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio // - options - client options; pass nil to accept the default values func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewBlockBlobClient(blobURL, pl, nil)), nil + azClient, err := azcore.NewClient("blockblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + + return (*Client)(base.NewBlockBlobClient(blobURL, azClient, nil)), nil } // NewClientWithSharedKeyCredential creates an instance of Client with the specified values. @@ -69,9 +76,13 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewBlockBlobClient(blobURL, pl, cred)), nil + azClient, err := azcore.NewClient("blockblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + + return (*Client)(base.NewBlockBlobClient(blobURL, azClient, cred)), nil } // NewClientFromConnectionString creates an instance of Client with the specified values. @@ -131,7 +142,7 @@ func (bb *Client) WithSnapshot(snapshot string) (*Client, error) { } p.Snapshot = snapshot - return (*Client)(base.NewBlockBlobClient(p.String(), bb.generated().Pipeline(), bb.sharedKey())), nil + return (*Client)(base.NewBlockBlobClient(p.String(), bb.generated().Internal(), bb.sharedKey())), nil } // WithVersionID creates a new AppendBlobURL object identical to the source but with the specified version id. @@ -143,7 +154,7 @@ func (bb *Client) WithVersionID(versionID string) (*Client, error) { } p.VersionID = versionID - return (*Client)(base.NewBlockBlobClient(p.String(), bb.generated().Pipeline(), bb.sharedKey())), nil + return (*Client)(base.NewBlockBlobClient(p.String(), bb.generated().Internal(), bb.sharedKey())), nil } // Upload creates a new block blob or overwrites an existing block blob. diff --git a/sdk/storage/azblob/container/client.go b/sdk/storage/azblob/container/client.go index b697175f3ca1..b3cf459be0f0 100644 --- a/sdk/storage/azblob/container/client.go +++ b/sdk/storage/azblob/container/client.go @@ -47,9 +47,12 @@ func NewClient(containerURL string, cred azcore.TokenCredential, options *Client authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewContainerClient(containerURL, pl, &cred)), nil + azClient, err := azcore.NewClient("container.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + return (*Client)(base.NewContainerClient(containerURL, azClient, &cred)), nil } // NewClientWithNoCredential creates an instance of Client with the specified values. @@ -58,9 +61,12 @@ func NewClient(containerURL string, cred azcore.TokenCredential, options *Client // - options - client options; pass nil to accept the default values func NewClientWithNoCredential(containerURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewContainerClient(containerURL, pl, nil)), nil + azClient, err := azcore.NewClient("container.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + return (*Client)(base.NewContainerClient(containerURL, azClient, nil)), nil } // NewClientWithSharedKeyCredential creates an instance of Client with the specified values. @@ -71,9 +77,12 @@ func NewClientWithSharedKeyCredential(containerURL string, cred *SharedKeyCreden authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewContainerClient(containerURL, pl, cred)), nil + azClient, err := azcore.NewClient("container.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + return (*Client)(base.NewContainerClient(containerURL, azClient, cred)), nil } // NewClientFromConnectionString creates an instance of Client with the specified values. @@ -126,7 +135,7 @@ func (c *Client) URL() string { func (c *Client) NewBlobClient(blobName string) *blob.Client { blobName = url.PathEscape(blobName) blobURL := runtime.JoinPaths(c.URL(), blobName) - return (*blob.Client)(base.NewBlobClient(blobURL, c.generated().Pipeline(), c.credential())) + return (*blob.Client)(base.NewBlobClient(blobURL, c.generated().InternalClient(), c.credential())) } // NewAppendBlobClient creates a new appendblob.Client object by concatenating blobName to the end of @@ -135,7 +144,7 @@ func (c *Client) NewBlobClient(blobName string) *blob.Client { func (c *Client) NewAppendBlobClient(blobName string) *appendblob.Client { blobName = url.PathEscape(blobName) blobURL := runtime.JoinPaths(c.URL(), blobName) - return (*appendblob.Client)(base.NewAppendBlobClient(blobURL, c.generated().Pipeline(), c.sharedKey())) + return (*appendblob.Client)(base.NewAppendBlobClient(blobURL, c.generated().InternalClient(), c.sharedKey())) } // NewBlockBlobClient creates a new blockblob.Client object by concatenating blobName to the end of @@ -144,7 +153,7 @@ func (c *Client) NewAppendBlobClient(blobName string) *appendblob.Client { func (c *Client) NewBlockBlobClient(blobName string) *blockblob.Client { blobName = url.PathEscape(blobName) blobURL := runtime.JoinPaths(c.URL(), blobName) - return (*blockblob.Client)(base.NewBlockBlobClient(blobURL, c.generated().Pipeline(), c.sharedKey())) + return (*blockblob.Client)(base.NewBlockBlobClient(blobURL, c.generated().InternalClient(), c.sharedKey())) } // NewPageBlobClient creates a new pageblob.Client object by concatenating blobName to the end of @@ -153,7 +162,7 @@ func (c *Client) NewBlockBlobClient(blobName string) *blockblob.Client { func (c *Client) NewPageBlobClient(blobName string) *pageblob.Client { blobName = url.PathEscape(blobName) blobURL := runtime.JoinPaths(c.URL(), blobName) - return (*pageblob.Client)(base.NewPageBlobClient(blobURL, c.generated().Pipeline(), c.sharedKey())) + return (*pageblob.Client)(base.NewPageBlobClient(blobURL, c.generated().InternalClient(), c.sharedKey())) } // Create creates a new container within a storage account. If a container with the same name already exists, the operation fails. @@ -274,7 +283,7 @@ func (c *Client) NewListBlobsFlatPager(o *ListBlobsFlatOptions) *runtime.Pager[L if err != nil { return ListBlobsFlatResponse{}, err } - resp, err := c.generated().Pipeline().Do(req) + resp, err := c.generated().InternalClient().Pipeline().Do(req) if err != nil { return ListBlobsFlatResponse{}, err } @@ -310,7 +319,7 @@ func (c *Client) NewListBlobsHierarchyPager(delimiter string, o *ListBlobsHierar if err != nil { return ListBlobsHierarchyResponse{}, err } - resp, err := c.generated().Pipeline().Do(req) + resp, err := c.generated().InternalClient().Pipeline().Do(req) if err != nil { return ListBlobsHierarchyResponse{}, err } diff --git a/sdk/storage/azblob/internal/base/clients.go b/sdk/storage/azblob/internal/base/clients.go index 561dc358cda1..499f9880e0f2 100644 --- a/sdk/storage/azblob/internal/base/clients.go +++ b/sdk/storage/azblob/internal/base/clients.go @@ -7,7 +7,7 @@ package base import ( - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/generated" ) @@ -38,23 +38,23 @@ func NewClient[T any](inner *T) *Client[T] { return &Client[T]{inner: inner} } -func NewServiceClient(containerURL string, pipeline runtime.Pipeline, credential any) *Client[generated.ServiceClient] { +func NewServiceClient(containerURL string, azClient *azcore.Client, credential any) *Client[generated.ServiceClient] { return &Client[generated.ServiceClient]{ - inner: generated.NewServiceClient(containerURL, pipeline), + inner: generated.NewServiceClient(containerURL, azClient), credential: credential, } } -func NewContainerClient(containerURL string, pipeline runtime.Pipeline, credential any) *Client[generated.ContainerClient] { +func NewContainerClient(containerURL string, azClient *azcore.Client, credential any) *Client[generated.ContainerClient] { return &Client[generated.ContainerClient]{ - inner: generated.NewContainerClient(containerURL, pipeline), + inner: generated.NewContainerClient(containerURL, azClient), credential: credential, } } -func NewBlobClient(blobURL string, pipeline runtime.Pipeline, credential any) *Client[generated.BlobClient] { +func NewBlobClient(blobURL string, azClient *azcore.Client, credential any) *Client[generated.BlobClient] { return &Client[generated.BlobClient]{ - inner: generated.NewBlobClient(blobURL, pipeline), + inner: generated.NewBlobClient(blobURL, azClient), credential: credential, } } @@ -69,26 +69,26 @@ func InnerClients[T, U any](client *CompositeClient[T, U]) (*Client[T], *U) { return &Client[T]{inner: client.innerT}, client.innerU } -func NewAppendBlobClient(blobURL string, pipeline runtime.Pipeline, sharedKey *exported.SharedKeyCredential) *CompositeClient[generated.BlobClient, generated.AppendBlobClient] { +func NewAppendBlobClient(blobURL string, azClient *azcore.Client, sharedKey *exported.SharedKeyCredential) *CompositeClient[generated.BlobClient, generated.AppendBlobClient] { return &CompositeClient[generated.BlobClient, generated.AppendBlobClient]{ - innerT: generated.NewBlobClient(blobURL, pipeline), - innerU: generated.NewAppendBlobClient(blobURL, pipeline), + innerT: generated.NewBlobClient(blobURL, azClient), + innerU: generated.NewAppendBlobClient(blobURL, azClient), sharedKey: sharedKey, } } -func NewBlockBlobClient(blobURL string, pipeline runtime.Pipeline, sharedKey *exported.SharedKeyCredential) *CompositeClient[generated.BlobClient, generated.BlockBlobClient] { +func NewBlockBlobClient(blobURL string, azClient *azcore.Client, sharedKey *exported.SharedKeyCredential) *CompositeClient[generated.BlobClient, generated.BlockBlobClient] { return &CompositeClient[generated.BlobClient, generated.BlockBlobClient]{ - innerT: generated.NewBlobClient(blobURL, pipeline), - innerU: generated.NewBlockBlobClient(blobURL, pipeline), + innerT: generated.NewBlobClient(blobURL, azClient), + innerU: generated.NewBlockBlobClient(blobURL, azClient), sharedKey: sharedKey, } } -func NewPageBlobClient(blobURL string, pipeline runtime.Pipeline, sharedKey *exported.SharedKeyCredential) *CompositeClient[generated.BlobClient, generated.PageBlobClient] { +func NewPageBlobClient(blobURL string, azClient *azcore.Client, sharedKey *exported.SharedKeyCredential) *CompositeClient[generated.BlobClient, generated.PageBlobClient] { return &CompositeClient[generated.BlobClient, generated.PageBlobClient]{ - innerT: generated.NewBlobClient(blobURL, pipeline), - innerU: generated.NewPageBlobClient(blobURL, pipeline), + innerT: generated.NewBlobClient(blobURL, azClient), + innerU: generated.NewPageBlobClient(blobURL, azClient), sharedKey: sharedKey, } } diff --git a/sdk/storage/azblob/internal/generated/appendblob_client.go b/sdk/storage/azblob/internal/generated/appendblob_client.go index 75da55c3841a..288df7edda47 100644 --- a/sdk/storage/azblob/internal/generated/appendblob_client.go +++ b/sdk/storage/azblob/internal/generated/appendblob_client.go @@ -10,28 +10,23 @@ package generated import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported" ) func (client *AppendBlobClient) Endpoint() string { return client.endpoint } -func (client *AppendBlobClient) Pipeline() runtime.Pipeline { - return client.internal.Pipeline() +func (client *AppendBlobClient) InternalClient() *azcore.Client { + return client.internal } // NewAppendBlobClient creates a new instance of AppendBlobClient with the specified values. // - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. -func NewAppendBlobClient(endpoint string, pl runtime.PipelineOptions, clientOptions *azcore.ClientOptions) (*AppendBlobClient, error) { - azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, pl, clientOptions) - if err != nil { - return nil, err - } +// - azClient - azcore.Client is a basic HTTP client. It consists of a pipeline and tracing provider. +func NewAppendBlobClient(endpoint string, azClient *azcore.Client) *AppendBlobClient { client := &AppendBlobClient{ - endpoint: endpoint, internal: azClient, + endpoint: endpoint, } - return client, nil + return client } diff --git a/sdk/storage/azblob/internal/generated/blob_client.go b/sdk/storage/azblob/internal/generated/blob_client.go index ae3eca581da4..343073b2e660 100644 --- a/sdk/storage/azblob/internal/generated/blob_client.go +++ b/sdk/storage/azblob/internal/generated/blob_client.go @@ -10,8 +10,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/exported" "time" ) @@ -22,8 +20,8 @@ func (client *BlobClient) Endpoint() string { return client.endpoint } -func (client *BlobClient) Pipeline() runtime.Pipeline { - return client.internal.Pipeline() +func (client *BlobClient) InternalClient() *azcore.Client { + return client.internal } func (client *BlobClient) DeleteCreateRequest(ctx context.Context, options *BlobClientDeleteOptions, leaseAccessConditions *LeaseAccessConditions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) { @@ -36,14 +34,11 @@ func (client *BlobClient) SetTierCreateRequest(ctx context.Context, tier AccessT // NewBlobClient creates a new instance of BlobClient with the specified values. // - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. -func NewBlobClient(endpoint string, pl runtime.PipelineOptions, clientOptions *azcore.ClientOptions) (*BlobClient, error) { - azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, pl, clientOptions) - if err != nil { - return nil, err - } +// - azClient - azcore.Client is a basic HTTP client. It consists of a pipeline and tracing provider. +func NewBlobClient(endpoint string, azClient *azcore.Client) *BlobClient { client := &BlobClient{ - endpoint: endpoint, internal: azClient, + endpoint: endpoint, } - return client, nil + return client } diff --git a/sdk/storage/azblob/internal/generated/block_blob_client.go b/sdk/storage/azblob/internal/generated/block_blob_client.go index 8319ab38f8fd..873d9a419fb4 100644 --- a/sdk/storage/azblob/internal/generated/block_blob_client.go +++ b/sdk/storage/azblob/internal/generated/block_blob_client.go @@ -8,12 +8,25 @@ package generated -import "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" +) func (client *BlockBlobClient) Endpoint() string { return client.endpoint } -func (client *BlockBlobClient) Pipeline() runtime.Pipeline { - return client.internal.Pipeline() +func (client *BlockBlobClient) Internal() *azcore.Client { + return client.internal +} + +// NewBlockBlobClient creates a new instance of BlockBlobClient with the specified values. +// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. +// - azClient - azcore.Client is a basic HTTP client. It consists of a pipeline and tracing provider. +func NewBlockBlobClient(endpoint string, azClient *azcore.Client) *BlockBlobClient { + client := &BlockBlobClient{ + internal: azClient, + endpoint: endpoint, + } + return client } diff --git a/sdk/storage/azblob/internal/generated/container_client.go b/sdk/storage/azblob/internal/generated/container_client.go index d50e12f95b0f..d43b2c782590 100644 --- a/sdk/storage/azblob/internal/generated/container_client.go +++ b/sdk/storage/azblob/internal/generated/container_client.go @@ -6,12 +6,25 @@ package generated -import "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" +) func (client *ContainerClient) Endpoint() string { return client.endpoint } -func (client *ContainerClient) Pipeline() runtime.Pipeline { - return client.internal.Pipeline() +func (client *ContainerClient) InternalClient() *azcore.Client { + return client.internal +} + +// NewContainerClient creates a new instance of ContainerClient with the specified values. +// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. +// - pl - the pipeline used for sending requests and handling responses. +func NewContainerClient(endpoint string, azClient *azcore.Client) *ContainerClient { + client := &ContainerClient{ + internal: azClient, + endpoint: endpoint, + } + return client } diff --git a/sdk/storage/azblob/internal/generated/pageblob_client.go b/sdk/storage/azblob/internal/generated/pageblob_client.go index 5ab82a0f6c03..a7c76208aa25 100644 --- a/sdk/storage/azblob/internal/generated/pageblob_client.go +++ b/sdk/storage/azblob/internal/generated/pageblob_client.go @@ -6,12 +6,25 @@ package generated -import "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" +) func (client *PageBlobClient) Endpoint() string { return client.endpoint } -func (client *PageBlobClient) Pipeline() runtime.Pipeline { - return client.internal.Pipeline() +func (client *PageBlobClient) InternalClient() *azcore.Client { + return client.internal +} + +// NewPageBlobClient creates a new instance of PageBlobClient with the specified values. +// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. +// - azClient - azcore.Client is a basic HTTP client. It consists of a pipeline and tracing provider. +func NewPageBlobClient(endpoint string, azClient *azcore.Client) *PageBlobClient { + client := &PageBlobClient{ + internal: azClient, + endpoint: endpoint, + } + return client } diff --git a/sdk/storage/azblob/internal/generated/service_client.go b/sdk/storage/azblob/internal/generated/service_client.go index 22f11c20a9fd..32c15a2b097c 100644 --- a/sdk/storage/azblob/internal/generated/service_client.go +++ b/sdk/storage/azblob/internal/generated/service_client.go @@ -6,12 +6,25 @@ package generated -import "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" +) func (client *ServiceClient) Endpoint() string { return client.endpoint } -func (client *ServiceClient) Pipeline() runtime.Pipeline { - return client.internal.Pipeline() +func (client *ServiceClient) InternalClient() *azcore.Client { + return client.internal +} + +// NewServiceClient creates a new instance of ServiceClient with the specified values. +// - endpoint - The URL of the service account, container, or blob that is the target of the desired operation. +// - azClient - azcore.Client is a basic HTTP client. It consists of a pipeline and tracing provider. +func NewServiceClient(endpoint string, azClient *azcore.Client) *ServiceClient { + client := &ServiceClient{ + internal: azClient, + endpoint: endpoint, + } + return client } diff --git a/sdk/storage/azblob/pageblob/client.go b/sdk/storage/azblob/pageblob/client.go index b9598d5b1809..6dc1404c7845 100644 --- a/sdk/storage/azblob/pageblob/client.go +++ b/sdk/storage/azblob/pageblob/client.go @@ -40,9 +40,12 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewPageBlobClient(blobURL, pl, nil)), nil + azClient, err := azcore.NewClient("pageblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + return (*Client)(base.NewPageBlobClient(blobURL, azClient, nil)), nil } // NewClientWithNoCredential creates an instance of Client with the specified values. @@ -51,9 +54,12 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio // - options - client options; pass nil to accept the default values func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewPageBlobClient(blobURL, pl, nil)), nil + azClient, err := azcore.NewClient("pageblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + return (*Client)(base.NewPageBlobClient(blobURL, azClient, nil)), nil } // NewClientWithSharedKeyCredential creates an instance of Client with the specified values. @@ -64,9 +70,12 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewPageBlobClient(blobURL, pl, cred)), nil + azClient, err := azcore.NewClient("pageblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + return (*Client)(base.NewPageBlobClient(blobURL, azClient, cred)), nil } // NewClientFromConnectionString creates an instance of Client with the specified values. @@ -121,7 +130,7 @@ func (pb *Client) WithSnapshot(snapshot string) (*Client, error) { } p.Snapshot = snapshot - return (*Client)(base.NewPageBlobClient(p.String(), pb.generated().Pipeline(), pb.sharedKey())), nil + return (*Client)(base.NewPageBlobClient(p.String(), pb.generated().InternalClient(), pb.sharedKey())), nil } // WithVersionID creates a new PageBlobURL object identical to the source but with the specified snapshot timestamp. @@ -133,7 +142,7 @@ func (pb *Client) WithVersionID(versionID string) (*Client, error) { } p.VersionID = versionID - return (*Client)(base.NewPageBlobClient(p.String(), pb.generated().Pipeline(), pb.sharedKey())), nil + return (*Client)(base.NewPageBlobClient(p.String(), pb.generated().InternalClient(), pb.sharedKey())), nil } // Create creates a page blob of the specified length. Call PutPage to upload data to a page blob. @@ -230,7 +239,7 @@ func (pb *Client) NewGetPageRangesPager(o *GetPageRangesOptions) *runtime.Pager[ if err != nil { return GetPageRangesResponse{}, err } - resp, err := pb.generated().Pipeline().Do(req) + resp, err := pb.generated().InternalClient().Pipeline().Do(req) if err != nil { return GetPageRangesResponse{}, err } @@ -263,7 +272,7 @@ func (pb *Client) NewGetPageRangesDiffPager(o *GetPageRangesDiffOptions) *runtim if err != nil { return GetPageRangesDiffResponse{}, err } - resp, err := pb.generated().Pipeline().Do(req) + resp, err := pb.generated().InternalClient().Pipeline().Do(req) if err != nil { return GetPageRangesDiffResponse{}, err } diff --git a/sdk/storage/azblob/service/client.go b/sdk/storage/azblob/service/client.go index 6de64ccf3bb8..80e03c2f29c0 100644 --- a/sdk/storage/azblob/service/client.go +++ b/sdk/storage/azblob/service/client.go @@ -45,9 +45,12 @@ func NewClient(serviceURL string, cred azcore.TokenCredential, options *ClientOp authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewServiceClient(serviceURL, pl, &cred)), nil + azClient, err := azcore.NewClient("service.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + return (*Client)(base.NewServiceClient(serviceURL, azClient, &cred)), nil } // NewClientWithNoCredential creates an instance of Client with the specified values. @@ -56,9 +59,13 @@ func NewClient(serviceURL string, cred azcore.TokenCredential, options *ClientOp // - options - client options; pass nil to accept the default values func NewClientWithNoCredential(serviceURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewServiceClient(serviceURL, pl, nil)), nil + azClient, err := azcore.NewClient("service.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + + return (*Client)(base.NewServiceClient(serviceURL, azClient, nil)), nil } // NewClientWithSharedKeyCredential creates an instance of Client with the specified values. @@ -69,9 +76,13 @@ func NewClientWithSharedKeyCredential(serviceURL string, cred *SharedKeyCredenti authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) - pl := runtime.NewPipeline(exported.ModuleName, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) - return (*Client)(base.NewServiceClient(serviceURL, pl, cred)), nil + azClient, err := azcore.NewClient("service.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + if err != nil { + return nil, err + } + + return (*Client)(base.NewServiceClient(serviceURL, azClient, cred)), nil } // NewClientFromConnectionString creates an instance of Client with the specified values. @@ -137,7 +148,7 @@ func (s *Client) URL() string { // this Client's URL. The new container.Client uses the same request policy pipeline as the Client. func (s *Client) NewContainerClient(containerName string) *container.Client { containerURL := runtime.JoinPaths(s.generated().Endpoint(), containerName) - return (*container.Client)(base.NewContainerClient(containerURL, s.generated().Pipeline(), s.credential())) + return (*container.Client)(base.NewContainerClient(containerURL, s.generated().InternalClient(), s.credential())) } // CreateContainer is a lifecycle method to creates a new container under the specified account. @@ -206,7 +217,7 @@ func (s *Client) NewListContainersPager(o *ListContainersOptions) *runtime.Pager if err != nil { return ListContainersResponse{}, err } - resp, err := s.generated().Pipeline().Do(req) + resp, err := s.generated().InternalClient().Pipeline().Do(req) if err != nil { return ListContainersResponse{}, err } From 41276276bd1a730f5928af954a0a81b6d22d77db Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Mon, 5 Jun 2023 16:40:17 -0400 Subject: [PATCH 11/24] Undoing minor fixes to blob examples --- sdk/storage/azblob/blob/examples_test.go | 2 +- sdk/storage/azblob/container/examples_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/storage/azblob/blob/examples_test.go b/sdk/storage/azblob/blob/examples_test.go index 710957362731..4b19c74c0f2d 100644 --- a/sdk/storage/azblob/blob/examples_test.go +++ b/sdk/storage/azblob/blob/examples_test.go @@ -188,7 +188,7 @@ func Example_blob_Client_CreateSnapshot() { if blob.Snapshot != nil { snapTime = *blob.Snapshot } - fmt.Printf("Blob name: %s, Snapshot: %s\n", *blob.Name.Content, snapTime) + fmt.Printf("Blob name: %s, Snapshot: %s\n", *blob.Name, snapTime) } } diff --git a/sdk/storage/azblob/container/examples_test.go b/sdk/storage/azblob/container/examples_test.go index c0d910945f73..c3516e07c72d 100644 --- a/sdk/storage/azblob/container/examples_test.go +++ b/sdk/storage/azblob/container/examples_test.go @@ -236,7 +236,7 @@ func Example_container_ClientListBlobsFlat() { log.Fatal(err) } for _, blob := range resp.Segment.BlobItems { - fmt.Println(*blob.Name.Content) + fmt.Println(*blob.Name) } } } @@ -267,7 +267,7 @@ func Example_container_ClientListBlobsHierarchy() { log.Fatal(err) } for _, blob := range resp.ListBlobsHierarchySegmentResponse.Segment.BlobItems { - fmt.Println(*blob.Name.Content) + fmt.Println(*blob.Name) } } } From 35d01b94434369adf306bbbe887f9caf332051b9 Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Mon, 12 Jun 2023 12:50:01 -0400 Subject: [PATCH 12/24] Fixing authpolicy --- sdk/storage/azblob/appendblob/client.go | 7 +++++-- sdk/storage/azblob/blob/client.go | 7 +++++-- sdk/storage/azblob/blockblob/client.go | 7 +++++-- sdk/storage/azblob/container/client.go | 6 ++++-- sdk/storage/azblob/pageblob/client.go | 6 ++++-- sdk/storage/azblob/service/client.go | 6 ++++-- 6 files changed, 27 insertions(+), 12 deletions(-) diff --git a/sdk/storage/azblob/appendblob/client.go b/sdk/storage/azblob/appendblob/client.go index d4e1133b5336..efade1febb6d 100644 --- a/sdk/storage/azblob/appendblob/client.go +++ b/sdk/storage/azblob/appendblob/client.go @@ -9,6 +9,7 @@ package appendblob import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "io" "os" "time" @@ -36,8 +37,9 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -68,8 +70,9 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/blob/client.go b/sdk/storage/azblob/blob/client.go index 2e4011dcb529..d0d015f1bac2 100644 --- a/sdk/storage/azblob/blob/client.go +++ b/sdk/storage/azblob/blob/client.go @@ -8,6 +8,7 @@ package blob import ( "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror" "io" "os" @@ -38,8 +39,9 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -68,8 +70,9 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *SharedKeyCredential, authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/blockblob/client.go b/sdk/storage/azblob/blockblob/client.go index a1246297b101..2fe6a0f1f73e 100644 --- a/sdk/storage/azblob/blockblob/client.go +++ b/sdk/storage/azblob/blockblob/client.go @@ -11,6 +11,7 @@ import ( "context" "encoding/base64" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "io" "math" "os" @@ -44,8 +45,9 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("blockblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("blockblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -75,8 +77,9 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("blockblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("blockblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/container/client.go b/sdk/storage/azblob/container/client.go index 814fc90d5b48..9cfe6456cba2 100644 --- a/sdk/storage/azblob/container/client.go +++ b/sdk/storage/azblob/container/client.go @@ -45,8 +45,9 @@ func NewClient(containerURL string, cred azcore.TokenCredential, options *Client authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("container.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("container.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -75,8 +76,9 @@ func NewClientWithSharedKeyCredential(containerURL string, cred *SharedKeyCreden authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("container.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("container.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/pageblob/client.go b/sdk/storage/azblob/pageblob/client.go index 0cc2a8e9ad64..e7e99dca5f3b 100644 --- a/sdk/storage/azblob/pageblob/client.go +++ b/sdk/storage/azblob/pageblob/client.go @@ -38,8 +38,9 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("pageblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("pageblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -68,8 +69,9 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("pageblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("pageblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/service/client.go b/sdk/storage/azblob/service/client.go index 75a13f490bcd..78c02db6e61e 100644 --- a/sdk/storage/azblob/service/client.go +++ b/sdk/storage/azblob/service/client.go @@ -43,8 +43,9 @@ func NewClient(serviceURL string, cred azcore.TokenCredential, options *ClientOp authPolicy := shared.NewStorageChallengePolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("service.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("service.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -74,8 +75,9 @@ func NewClientWithSharedKeyCredential(serviceURL string, cred *SharedKeyCredenti authPolicy := exported.NewSharedKeyCredPolicy(cred) conOptions := shared.GetClientOptions(options) conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) + plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("service.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient("service.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } From 1f78a6f30591f476673ca339eda04d5219a8deef Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Mon, 12 Jun 2023 12:52:24 -0400 Subject: [PATCH 13/24] Updating azcore version --- sdk/storage/azblob/go.mod | 4 ++-- sdk/storage/azblob/go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/storage/azblob/go.mod b/sdk/storage/azblob/go.mod index 5376927d71d4..d9261b6566b6 100644 --- a/sdk/storage/azblob/go.mod +++ b/sdk/storage/azblob/go.mod @@ -3,9 +3,9 @@ module github.com/Azure/azure-sdk-for-go/sdk/storage/azblob go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0 github.com/stretchr/testify v1.7.1 ) diff --git a/sdk/storage/azblob/go.sum b/sdk/storage/azblob/go.sum index e90fe395aed0..e4f9b6e659d2 100644 --- a/sdk/storage/azblob/go.sum +++ b/sdk/storage/azblob/go.sum @@ -1,9 +1,9 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0 h1:lMW1lD/17LUA5z1XTURo7LcVG2ICBPlyMHjIUrcFZNQ= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0 h1:Ma67P/GGprNwsslzEH6+Kb8nybI8jpDTm4Wmzu2ReK8= From d1b507f5c681c788264d317a7afa458cf6298b6f Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Mon, 12 Jun 2023 13:05:50 -0400 Subject: [PATCH 14/24] Fixing client strings --- sdk/storage/azblob/appendblob/client.go | 8 +++++--- sdk/storage/azblob/blob/client.go | 8 +++++--- sdk/storage/azblob/blockblob/client.go | 8 +++++--- sdk/storage/azblob/container/client.go | 8 +++++--- sdk/storage/azblob/pageblob/client.go | 8 +++++--- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/sdk/storage/azblob/appendblob/client.go b/sdk/storage/azblob/appendblob/client.go index efade1febb6d..c945331a6653 100644 --- a/sdk/storage/azblob/appendblob/client.go +++ b/sdk/storage/azblob/appendblob/client.go @@ -29,6 +29,8 @@ type ClientOptions base.ClientOptions // Client represents a client to an Azure Storage append blob; type Client base.CompositeClient[generated.BlobClient, generated.AppendBlobClient] +const abClient = "azblob/appendblob.Client" + // NewClient creates an instance of Client with the specified values. // - blobURL - the URL of the blob e.g. https://.blob.core.windows.net/container/blob.txt // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -39,7 +41,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(abClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -54,7 +56,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(abClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -72,7 +74,7 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("appendblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(abClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/blob/client.go b/sdk/storage/azblob/blob/client.go index d0d015f1bac2..20d051398d8e 100644 --- a/sdk/storage/azblob/blob/client.go +++ b/sdk/storage/azblob/blob/client.go @@ -31,6 +31,8 @@ type ClientOptions base.ClientOptions // Client represents a URL to an Azure Storage blob; the blob may be a block blob, append blob, or page blob. type Client base.Client[generated.BlobClient] +const blobClient = "azblob/blob.Client" + // NewClient creates an instance of Client with the specified values. // - blobURL - the URL of the blob e.g. https://.blob.core.windows.net/container/blob.txt // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -41,7 +43,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(blobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -55,7 +57,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(blobClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -72,7 +74,7 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *SharedKeyCredential, conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("blob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(blobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/blockblob/client.go b/sdk/storage/azblob/blockblob/client.go index 2fe6a0f1f73e..8bf1d6d5cc6b 100644 --- a/sdk/storage/azblob/blockblob/client.go +++ b/sdk/storage/azblob/blockblob/client.go @@ -37,6 +37,8 @@ type ClientOptions base.ClientOptions // Client defines a set of operations applicable to block blobs. type Client base.CompositeClient[generated.BlobClient, generated.BlockBlobClient] +const bbClient = "azblob/blockblob.Client" + // NewClient creates an instance of Client with the specified values. // - blobURL - the URL of the blob e.g. https://.blob.core.windows.net/container/blob.txt // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -47,7 +49,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("blockblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(bbClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -61,7 +63,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient("blockblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(bbClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -79,7 +81,7 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("blockblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(bbClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/container/client.go b/sdk/storage/azblob/container/client.go index 9cfe6456cba2..01a71a89e6ba 100644 --- a/sdk/storage/azblob/container/client.go +++ b/sdk/storage/azblob/container/client.go @@ -37,6 +37,8 @@ type ClientOptions base.ClientOptions // Client represents a URL to the Azure Storage container allowing you to manipulate its blobs. type Client base.Client[generated.ContainerClient] +const containerClient = "azblob/container.Client" + // NewClient creates an instance of Client with the specified values. // - containerURL - the URL of the container e.g. https://.blob.core.windows.net/container // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -47,7 +49,7 @@ func NewClient(containerURL string, cred azcore.TokenCredential, options *Client conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("container.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(containerClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -61,7 +63,7 @@ func NewClient(containerURL string, cred azcore.TokenCredential, options *Client func NewClientWithNoCredential(containerURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient("container.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(containerClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -78,7 +80,7 @@ func NewClientWithSharedKeyCredential(containerURL string, cred *SharedKeyCreden conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("container.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(containerClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/pageblob/client.go b/sdk/storage/azblob/pageblob/client.go index e7e99dca5f3b..daa7a5a667c8 100644 --- a/sdk/storage/azblob/pageblob/client.go +++ b/sdk/storage/azblob/pageblob/client.go @@ -30,6 +30,8 @@ type ClientOptions base.ClientOptions // Client represents a client to an Azure Storage page blob; type Client base.CompositeClient[generated.BlobClient, generated.PageBlobClient] +const pbClient = "azblob/pageblob.Client" + // NewClient creates an instance of Client with the specified values. // - blobURL - the URL of the blob e.g. https://.blob.core.windows.net/container/blob.txt // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -40,7 +42,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("pageblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(pbClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -54,7 +56,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient("pageblob.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(pbClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -71,7 +73,7 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("pageblob.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(pbClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } From b1538dd14bdd0ed7701676fa52b9b55b174f1b58 Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Mon, 12 Jun 2023 13:25:25 -0400 Subject: [PATCH 15/24] Const for service client --- sdk/storage/azblob/service/client.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sdk/storage/azblob/service/client.go b/sdk/storage/azblob/service/client.go index 78c02db6e61e..b841fff65ca7 100644 --- a/sdk/storage/azblob/service/client.go +++ b/sdk/storage/azblob/service/client.go @@ -35,6 +35,8 @@ type ClientOptions base.ClientOptions // Client represents a URL to the Azure Blob Storage service allowing you to manipulate blob containers. type Client base.Client[generated.ServiceClient] +const serviceClient = "service.Client" + // NewClient creates an instance of Client with the specified values. // - serviceURL - the URL of the storage account e.g. https://.blob.core.windows.net/ // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -45,7 +47,7 @@ func NewClient(serviceURL string, cred azcore.TokenCredential, options *ClientOp conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("service.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(serviceClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -59,7 +61,7 @@ func NewClient(serviceURL string, cred azcore.TokenCredential, options *ClientOp func NewClientWithNoCredential(serviceURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient("service.Client", exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(serviceClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -77,7 +79,7 @@ func NewClientWithSharedKeyCredential(serviceURL string, cred *SharedKeyCredenti conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient("service.Client", exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(serviceClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } From 059f99ab152404bfcc5640a9a1dc9375a774d427 Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:04:37 -0400 Subject: [PATCH 16/24] Minor fix --- sdk/storage/azblob/service/client.go | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/storage/azblob/service/client.go b/sdk/storage/azblob/service/client.go index b841fff65ca7..c453a0226ffc 100644 --- a/sdk/storage/azblob/service/client.go +++ b/sdk/storage/azblob/service/client.go @@ -65,7 +65,6 @@ func NewClientWithNoCredential(serviceURL string, options *ClientOptions) (*Clie if err != nil { return nil, err } - return (*Client)(base.NewServiceClient(serviceURL, azClient, nil)), nil } From 2338566accdb7d589783a02e7cc15c9b2f18c813 Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Mon, 12 Jun 2023 16:00:03 -0400 Subject: [PATCH 17/24] fixing go mod files --- sdk/storage/azblob/testdata/perf/go.mod | 2 +- sdk/storage/azblob/testdata/perf/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/storage/azblob/testdata/perf/go.mod b/sdk/storage/azblob/testdata/perf/go.mod index 1ccc0daea6b1..a14a3fe6d127 100644 --- a/sdk/storage/azblob/testdata/perf/go.mod +++ b/sdk/storage/azblob/testdata/perf/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/testdata/perf go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0 ) diff --git a/sdk/storage/azblob/testdata/perf/go.sum b/sdk/storage/azblob/testdata/perf/go.sum index 9a7a73da061e..d58ca184fd0f 100644 --- a/sdk/storage/azblob/testdata/perf/go.sum +++ b/sdk/storage/azblob/testdata/perf/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= From 20775e9ce6515292f00dae4c7ac8876eae2f9c0e Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Tue, 13 Jun 2023 15:26:05 -0400 Subject: [PATCH 18/24] Shared constants client name --- sdk/storage/azblob/appendblob/client.go | 8 +++----- sdk/storage/azblob/blob/client.go | 8 +++----- sdk/storage/azblob/blockblob/client.go | 8 +++----- sdk/storage/azblob/container/client.go | 8 +++----- sdk/storage/azblob/internal/shared/shared.go | 9 +++++++++ sdk/storage/azblob/pageblob/client.go | 8 +++----- sdk/storage/azblob/service/client.go | 8 +++----- 7 files changed, 27 insertions(+), 30 deletions(-) diff --git a/sdk/storage/azblob/appendblob/client.go b/sdk/storage/azblob/appendblob/client.go index c945331a6653..b9ff02ec798b 100644 --- a/sdk/storage/azblob/appendblob/client.go +++ b/sdk/storage/azblob/appendblob/client.go @@ -29,8 +29,6 @@ type ClientOptions base.ClientOptions // Client represents a client to an Azure Storage append blob; type Client base.CompositeClient[generated.BlobClient, generated.AppendBlobClient] -const abClient = "azblob/appendblob.Client" - // NewClient creates an instance of Client with the specified values. // - blobURL - the URL of the blob e.g. https://.blob.core.windows.net/container/blob.txt // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -41,7 +39,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(abClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.AppendBlobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -56,7 +54,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient(abClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.AppendBlobClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -74,7 +72,7 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(abClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.AppendBlobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/blob/client.go b/sdk/storage/azblob/blob/client.go index 20d051398d8e..713851272cad 100644 --- a/sdk/storage/azblob/blob/client.go +++ b/sdk/storage/azblob/blob/client.go @@ -31,8 +31,6 @@ type ClientOptions base.ClientOptions // Client represents a URL to an Azure Storage blob; the blob may be a block blob, append blob, or page blob. type Client base.Client[generated.BlobClient] -const blobClient = "azblob/blob.Client" - // NewClient creates an instance of Client with the specified values. // - blobURL - the URL of the blob e.g. https://.blob.core.windows.net/container/blob.txt // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -43,7 +41,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(blobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.BlobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -57,7 +55,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient(blobClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.BlobClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -74,7 +72,7 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *SharedKeyCredential, conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(blobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.BlobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/blockblob/client.go b/sdk/storage/azblob/blockblob/client.go index 8bf1d6d5cc6b..863240746db4 100644 --- a/sdk/storage/azblob/blockblob/client.go +++ b/sdk/storage/azblob/blockblob/client.go @@ -37,8 +37,6 @@ type ClientOptions base.ClientOptions // Client defines a set of operations applicable to block blobs. type Client base.CompositeClient[generated.BlobClient, generated.BlockBlobClient] -const bbClient = "azblob/blockblob.Client" - // NewClient creates an instance of Client with the specified values. // - blobURL - the URL of the blob e.g. https://.blob.core.windows.net/container/blob.txt // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -49,7 +47,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(bbClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.BlockBlobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -63,7 +61,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient(bbClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.BlockBlobClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -81,7 +79,7 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(bbClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.BlockBlobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/container/client.go b/sdk/storage/azblob/container/client.go index 01a71a89e6ba..df6bcbe3f9c8 100644 --- a/sdk/storage/azblob/container/client.go +++ b/sdk/storage/azblob/container/client.go @@ -37,8 +37,6 @@ type ClientOptions base.ClientOptions // Client represents a URL to the Azure Storage container allowing you to manipulate its blobs. type Client base.Client[generated.ContainerClient] -const containerClient = "azblob/container.Client" - // NewClient creates an instance of Client with the specified values. // - containerURL - the URL of the container e.g. https://.blob.core.windows.net/container // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -49,7 +47,7 @@ func NewClient(containerURL string, cred azcore.TokenCredential, options *Client conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(containerClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.ContainerClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -63,7 +61,7 @@ func NewClient(containerURL string, cred azcore.TokenCredential, options *Client func NewClientWithNoCredential(containerURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient(containerClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.ContainerClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -80,7 +78,7 @@ func NewClientWithSharedKeyCredential(containerURL string, cred *SharedKeyCreden conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(containerClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.ContainerClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/internal/shared/shared.go b/sdk/storage/azblob/internal/shared/shared.go index 02936ad0362b..c6a8310cdacd 100644 --- a/sdk/storage/azblob/internal/shared/shared.go +++ b/sdk/storage/azblob/internal/shared/shared.go @@ -44,6 +44,15 @@ const ( const crc64Polynomial uint64 = 0x9A6C9329AC4BC9B5 +const ( + AppendBlobClient = "azblob/appendblob.Client" + BlobClient = "azblob/blob.Client" + BlockBlobClient = "azblob/blockblob.Client" + ContainerClient = "azblob/container.Client" + PageBlobClient = "azblob/pageblob.Client" + ServiceClient = "service.Client" +) + var CRC64Table = crc64.MakeTable(crc64Polynomial) // CopyOptions returns a zero-value T if opts is nil. diff --git a/sdk/storage/azblob/pageblob/client.go b/sdk/storage/azblob/pageblob/client.go index daa7a5a667c8..4e7de5dffd8c 100644 --- a/sdk/storage/azblob/pageblob/client.go +++ b/sdk/storage/azblob/pageblob/client.go @@ -30,8 +30,6 @@ type ClientOptions base.ClientOptions // Client represents a client to an Azure Storage page blob; type Client base.CompositeClient[generated.BlobClient, generated.PageBlobClient] -const pbClient = "azblob/pageblob.Client" - // NewClient creates an instance of Client with the specified values. // - blobURL - the URL of the blob e.g. https://.blob.core.windows.net/container/blob.txt // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -42,7 +40,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(pbClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.PageBlobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -56,7 +54,7 @@ func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptio func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient(pbClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.PageBlobClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -73,7 +71,7 @@ func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCreden conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(pbClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.PageBlobClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } diff --git a/sdk/storage/azblob/service/client.go b/sdk/storage/azblob/service/client.go index c453a0226ffc..7dcc8d79482d 100644 --- a/sdk/storage/azblob/service/client.go +++ b/sdk/storage/azblob/service/client.go @@ -35,8 +35,6 @@ type ClientOptions base.ClientOptions // Client represents a URL to the Azure Blob Storage service allowing you to manipulate blob containers. type Client base.Client[generated.ServiceClient] -const serviceClient = "service.Client" - // NewClient creates an instance of Client with the specified values. // - serviceURL - the URL of the storage account e.g. https://.blob.core.windows.net/ // - cred - an Azure AD credential, typically obtained via the azidentity module @@ -47,7 +45,7 @@ func NewClient(serviceURL string, cred azcore.TokenCredential, options *ClientOp conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(serviceClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.ServiceClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -61,7 +59,7 @@ func NewClient(serviceURL string, cred azcore.TokenCredential, options *ClientOp func NewClientWithNoCredential(serviceURL string, options *ClientOptions) (*Client, error) { conOptions := shared.GetClientOptions(options) - azClient, err := azcore.NewClient(serviceClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.ServiceClient, exported.ModuleVersion, runtime.PipelineOptions{}, &conOptions.ClientOptions) if err != nil { return nil, err } @@ -78,7 +76,7 @@ func NewClientWithSharedKeyCredential(serviceURL string, cred *SharedKeyCredenti conOptions.PerRetryPolicies = append(conOptions.PerRetryPolicies, authPolicy) plOpts := runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}} - azClient, err := azcore.NewClient(serviceClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) + azClient, err := azcore.NewClient(shared.ServiceClient, exported.ModuleVersion, plOpts, &conOptions.ClientOptions) if err != nil { return nil, err } From 0042d66540dda4cdfa00284c2deaf06352f2b92a Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Thu, 15 Jun 2023 14:40:26 -0400 Subject: [PATCH 19/24] Adding Cold Tier + tests --- sdk/storage/azblob/blob/client_test.go | 147 +++++++----------- sdk/storage/azblob/blob/constants.go | 1 + sdk/storage/azblob/blockblob/client_test.go | 89 ++++++++++- sdk/storage/azblob/container/client_test.go | 54 +++++++ .../internal/testcommon/clients_auth.go | 10 ++ 5 files changed, 209 insertions(+), 92 deletions(-) diff --git a/sdk/storage/azblob/blob/client_test.go b/sdk/storage/azblob/blob/client_test.go index 1d3040713a51..8d14714cc514 100644 --- a/sdk/storage/azblob/blob/client_test.go +++ b/sdk/storage/azblob/blob/client_test.go @@ -3274,95 +3274,64 @@ func (s *BlobRecordedTestsSuite) TestPermanentDeleteWithoutPermission() { return nil }*/ -// -////func (s *BlobRecordedTestsSuite) TestBlobTierInferred() { -//// svcClient, err := getPremiumserviceClient() -//// if err != nil { -//// c.Skip(err.Error()) -//// } -//// -//// containerClient, _ := testcommon.CreateNewContainer(c, svcClient) -//// defer testcommon.DeleteContainer(context.Background(), _require, containerClient) -//// bbClient, _ := createNewPageBlob(c, containerClient) -//// -//// resp, err := bbClient.GetProperties(context.Background(), nil) -//// _require.Nil(err) -//// _assert(resp.AccessTierInferred(), chk.Equals, "true") -//// -//// resp2, err := containerClient.NewListBlobsFlatPager(ctx, Marker{}, ListBlobsSegmentOptions{}) -//// _require.Nil(err) -//// _assert(resp2.Segment.BlobItems[0].Properties.AccessTierInferred, chk.NotNil) -//// _assert(resp2.Segment.BlobItems[0].Properties.AccessTier, chk.Not(chk.Equals), "") -//// -//// _, err = bbClient.SetTier(ctx, AccessTierP4, LeaseAccessConditions{}) -//// _require.Nil(err) -//// -//// resp, err = bbClient.GetProperties(context.Background(), nil) -//// _require.Nil(err) -//// _assert(resp.AccessTierInferred(), chk.Equals, "") -//// -//// resp2, err = containerClient.NewListBlobsFlatPager(ctx, Marker{}, ListBlobsSegmentOptions{}) -//// _require.Nil(err) -//// _assert(resp2.Segment.BlobItems[0].Properties.AccessTierInferred, chk.IsNil) // AccessTierInferred never returned if false -////} -//// -////func (s *BlobRecordedTestsSuite) TestBlobArchiveStatus() { -//// svcClient, err := getBlobStorageserviceClient() -//// if err != nil { -//// c.Skip(err.Error()) -//// } -//// -//// containerClient, _ := testcommon.CreateNewContainer(c, svcClient) -//// defer testcommon.DeleteContainer(context.Background(), _require, containerClient) -//// bbClient, _ := createNewBlockBlob(c, containerClient) -//// -//// _, err = bbClient.SetTier(ctx, AccessTierArchive, LeaseAccessConditions{}) -//// _require.Nil(err) -//// _, err = bbClient.SetTier(ctx, AccessTierCool, LeaseAccessConditions{}) -//// _require.Nil(err) -//// -//// resp, err := bbClient.GetProperties(context.Background(), nil) -//// _require.Nil(err) -//// _assert(resp.ArchiveStatus(), chk.Equals, string(ArchiveStatusRehydratePendingToCool)) -//// -//// resp2, err := containerClient.NewListBlobsFlatPager(ctx, Marker{}, ListBlobsSegmentOptions{}) -//// _require.Nil(err) -//// _assert(resp2.Segment.BlobItems[0].Properties.ArchiveStatus, chk.Equals, ArchiveStatusRehydratePendingToCool) -//// -//// // delete first blob -//// _, err = bbClient.Delete(context.Background(), DeleteSnapshotsOptionNone, nil) -//// _require.Nil(err) -//// -//// bbClient, _ = createNewBlockBlob(c, containerClient) -//// -//// _, err = bbClient.SetTier(ctx, AccessTierArchive, LeaseAccessConditions{}) -//// _require.Nil(err) -//// _, err = bbClient.SetTier(ctx, AccessTierHot, LeaseAccessConditions{}) -//// _require.Nil(err) -//// -//// resp, err = bbClient.GetProperties(context.Background(), nil) -//// _require.Nil(err) -//// _assert(resp.ArchiveStatus(), chk.Equals, string(ArchiveStatusRehydratePendingToHot)) -//// -//// resp2, err = containerClient.NewListBlobsFlatPager(ctx, Marker{}, ListBlobsSegmentOptions{}) -//// _require.Nil(err) -//// _assert(resp2.Segment.BlobItems[0].Properties.ArchiveStatus, chk.Equals, ArchiveStatusRehydratePendingToHot) -////} -//// -////func (s *BlobRecordedTestsSuite) TestBlobTierInvalidValue() { -//// svcClient, err := getBlobStorageserviceClient() -//// if err != nil { -//// c.Skip(err.Error()) -//// } -//// -//// containerClient, _ := testcommon.CreateNewContainer(c, svcClient) -//// defer testcommon.DeleteContainer(context.Background(), _require, containerClient) -//// bbClient, _ := createNewBlockBlob(c, containerClient) -//// -//// _, err = bbClient.SetTier(ctx, AccessTierType("garbage"), LeaseAccessConditions{}) -//// testcommon.ValidateBlobErrorCode(c, err, bloberror.InvalidHeaderValue) -////} -//// +// //func (s *BlobRecordedTestsSuite) TestBlobTierInferred() { +// // svcClient, err := getPremiumserviceClient() +// // if err != nil { +// // c.Skip(err.Error()) +// // } +// // +// // containerClient, _ := testcommon.CreateNewContainer(c, svcClient) +// // defer testcommon.DeleteContainer(context.Background(), _require, containerClient) +// // bbClient, _ := createNewPageBlob(c, containerClient) +// // +// // resp, err := bbClient.GetProperties(context.Background(), nil) +// // _require.Nil(err) +// // _assert(resp.AccessTierInferred(), chk.Equals, "true") +// // +// // resp2, err := containerClient.NewListBlobsFlatPager(ctx, Marker{}, ListBlobsSegmentOptions{}) +// // _require.Nil(err) +// // _assert(resp2.Segment.BlobItems[0].Properties.AccessTierInferred, chk.NotNil) +// // _assert(resp2.Segment.BlobItems[0].Properties.AccessTier, chk.Not(chk.Equals), "") +// // +// // _, err = bbClient.SetTier(ctx, AccessTierP4, LeaseAccessConditions{}) +// // _require.Nil(err) +// // +// // resp, err = bbClient.GetProperties(context.Background(), nil) +// // _require.Nil(err) +// // _assert(resp.AccessTierInferred(), chk.Equals, "") +// // +// // resp2, err = containerClient.NewListBlobsFlatPager(ctx, Marker{}, ListBlobsSegmentOptions{}) +// // _require.Nil(err) +// // _assert(resp2.Segment.BlobItems[0].Properties.AccessTierInferred, chk.IsNil) // AccessTierInferred never returned if false +// //} +// // + +func (s *BlobRecordedTestsSuite) TestBlobSetTierInvalidAndValid() { + _require := require.New(s.T()) + testName := s.T().Name() + svcClient, err := testcommon.GetServiceClient(s.T(), testcommon.TestAccountDefault, nil) + _require.NoError(err) + + containerName := testcommon.GenerateContainerName(testName) + containerClient := testcommon.CreateNewContainer(context.Background(), _require, containerName, svcClient) + defer testcommon.DeleteContainer(context.Background(), _require, containerClient) + + blockBlobName := testcommon.GenerateBlobName(testName) + bbClient := testcommon.CreateNewBlockBlob(context.Background(), _require, blockBlobName, containerClient) + + _, err = bbClient.SetTier(context.Background(), blob.AccessTier("nothing"), nil) + _require.Error(err) + testcommon.ValidateBlobErrorCode(_require, err, bloberror.InvalidHeaderValue) + + for _, tier := range []blob.AccessTier{blob.AccessTierCool, blob.AccessTierHot, blob.AccessTierCold, blob.AccessTierArchive} { + _, err = bbClient.SetTier(context.Background(), tier, nil) + _require.NoError(err) + + getResp, err := bbClient.GetProperties(context.Background(), nil) + _require.NoError(err) + _require.Equal(*getResp.AccessTier, string(tier)) + } +} func (s *BlobRecordedTestsSuite) TestBlobClientPartsSASQueryTimes() { _require := require.New(s.T()) diff --git a/sdk/storage/azblob/blob/constants.go b/sdk/storage/azblob/blob/constants.go index c15635448ef9..8a9107954381 100644 --- a/sdk/storage/azblob/blob/constants.go +++ b/sdk/storage/azblob/blob/constants.go @@ -53,6 +53,7 @@ type AccessTier = generated.AccessTier const ( AccessTierArchive AccessTier = generated.AccessTierArchive AccessTierCool AccessTier = generated.AccessTierCool + AccessTierCold AccessTier = generated.AccessTierCold AccessTierHot AccessTier = generated.AccessTierHot AccessTierP10 AccessTier = generated.AccessTierP10 AccessTierP15 AccessTier = generated.AccessTierP15 diff --git a/sdk/storage/azblob/blockblob/client_test.go b/sdk/storage/azblob/blockblob/client_test.go index edafdf0622b7..49f79556a4ac 100644 --- a/sdk/storage/azblob/blockblob/client_test.go +++ b/sdk/storage/azblob/blockblob/client_test.go @@ -1247,6 +1247,56 @@ func (s *BlockBlobRecordedTestsSuite) TestPutBlobFromURLCopySourceAuthNegative() testcommon.ValidateBlobErrorCode(_require, err, bloberror.CannotVerifyCopySource) } +func (s *BlockBlobUnrecordedTestsSuite) TestPutBlobFromURLWithTier() { + _require := require.New(s.T()) + testName := s.T().Name() + svcClient, err := testcommon.GetServiceClient(s.T(), testcommon.TestAccountDefault, nil) + _require.NoError(err) + + containerName := testcommon.GenerateContainerName(testName) + containerClient := testcommon.CreateNewContainer(context.Background(), _require, containerName, svcClient) + defer testcommon.DeleteContainer(context.Background(), _require, containerClient) + + src := testcommon.GenerateBlobName("src" + testName) + srcBlob := testcommon.CreateNewBlockBlob(context.Background(), _require, src, containerClient) + + // Create SAS for source and get SAS URL + expiryTime := time.Now().UTC().Add(15 * time.Minute) + _require.Nil(err) + + credential, err := testcommon.GetGenericSharedKeyCredential(testcommon.TestAccountDefault) + _require.NoError(err) + + sasQueryParams, err := sas.AccountSignatureValues{ + Protocol: sas.ProtocolHTTPS, + ExpiryTime: expiryTime, + Permissions: to.Ptr(sas.AccountPermissions{Read: true, List: true}).String(), + ResourceTypes: to.Ptr(sas.AccountResourceTypes{Container: true, Object: true}).String(), + }.SignWithSharedKey(credential) + _require.Nil(err) + + srcBlobParts, _ := blob.ParseURL(srcBlob.URL()) + srcBlobParts.SAS = sasQueryParams + srcBlobURLWithSAS := srcBlobParts.String() + + for _, tier := range []blob.AccessTier{blob.AccessTierArchive, blob.AccessTierCool, blob.AccessTierHot, blob.AccessTierCold} { + dest := testcommon.GenerateBlobName("dest" + string(tier) + testName) + destBlob := testcommon.CreateNewBlockBlob(context.Background(), _require, dest, containerClient) + + opts := blockblob.UploadBlobFromURLOptions{ + Tier: &tier, + } + // Invoke UploadBlobFromURL + pbResp, err := destBlob.UploadBlobFromURL(context.Background(), srcBlobURLWithSAS, &opts) + _require.NotNil(pbResp) + _require.NoError(err) + + getResp, err := destBlob.GetProperties(context.Background(), nil) + _require.Nil(err) + _require.Equal(*getResp.AccessTier, string(tier)) + } +} + func (s *BlockBlobRecordedTestsSuite) TestPutBlockListWithImmutabilityPolicy() { _require := require.New(s.T()) testName := s.T().Name() @@ -1909,7 +1959,7 @@ func (s *BlockBlobRecordedTestsSuite) TestSetTierOnBlobUpload() { containerClient := testcommon.CreateNewContainer(context.Background(), _require, containerName, svcClient) defer testcommon.DeleteContainer(context.Background(), _require, containerClient) - for _, tier := range []blob.AccessTier{blob.AccessTierArchive, blob.AccessTierCool, blob.AccessTierHot} { + for _, tier := range []blob.AccessTier{blob.AccessTierArchive, blob.AccessTierCool, blob.AccessTierHot, blob.AccessTierCold} { blobName := strings.ToLower(string(tier)) + testcommon.GenerateBlobName(testName) bbClient := testcommon.GetBlockBlobClient(blobName, containerClient) @@ -1936,7 +1986,7 @@ func (s *BlockBlobRecordedTestsSuite) TestBlobSetTierOnCommit() { containerClient := testcommon.CreateNewContainer(context.Background(), _require, containerName, svcClient) defer testcommon.DeleteContainer(context.Background(), _require, containerClient) - for _, tier := range []blob.AccessTier{blob.AccessTierCool, blob.AccessTierHot} { + for _, tier := range []blob.AccessTier{blob.AccessTierArchive, blob.AccessTierCool, blob.AccessTierHot, blob.AccessTierCold} { blobName := strings.ToLower(string(tier)) + testcommon.GenerateBlobName(testName) bbClient := testcommon.GetBlockBlobClient(blobName, containerClient) @@ -1955,6 +2005,10 @@ func (s *BlockBlobRecordedTestsSuite) TestBlobSetTierOnCommit() { _require.NotNil(resp.BlockList.CommittedBlocks) _require.Nil(resp.BlockList.UncommittedBlocks) _require.Len(resp.BlockList.CommittedBlocks, 1) + + getResp, err := bbClient.GetProperties(context.Background(), nil) + _require.NoError(err) + _require.Equal(*getResp.AccessTier, string(tier)) } } @@ -1998,7 +2052,7 @@ func (s *BlockBlobUnrecordedTestsSuite) TestSetTierOnCopyBlockBlobFromURL() { srcBlobParts.SAS = sasQueryParams srcBlobURLWithSAS := srcBlobParts.String() - for _, tier := range []blob.AccessTier{blob.AccessTierArchive, blob.AccessTierCool, blob.AccessTierHot} { + for _, tier := range []blob.AccessTier{blob.AccessTierArchive, blob.AccessTierCool, blob.AccessTierHot, blob.AccessTierCold} { destBlobName := strings.ToLower(string(tier)) + testcommon.GenerateBlobName(testName) destBlob := containerClient.NewBlockBlobClient(testcommon.GenerateBlobName(destBlobName)) @@ -2247,6 +2301,34 @@ func (s *BlockBlobRecordedTestsSuite) TestCopyBlobWithRehydratePriority() { _require.Equal(*getResp2.ArchiveStatus, string(blob.ArchiveStatusRehydratePendingToHot)) } +func (s *BlockBlobRecordedTestsSuite) TestCopyWithTier() { + _require := require.New(s.T()) + testName := s.T().Name() + svcClient, err := testcommon.GetServiceClient(s.T(), testcommon.TestAccountDefault, nil) + _require.NoError(err) + + containerName := testcommon.GenerateContainerName(testName) + containerClient := testcommon.CreateNewContainer(context.Background(), _require, containerName, svcClient) + defer testcommon.DeleteContainer(context.Background(), _require, containerClient) + + for _, tier := range []blob.AccessTier{blob.AccessTierArchive, blob.AccessTierCool, blob.AccessTierHot, blob.AccessTierCold} { + src := testcommon.GenerateBlobName("src" + string(tier) + testName) + srcBlob := testcommon.CreateNewBlockBlob(context.Background(), _require, src, containerClient) + + dest := testcommon.GenerateBlobName("dest" + string(tier) + testName) + destBlob := testcommon.CreateNewBlockBlob(context.Background(), _require, dest, containerClient) + + _, err = destBlob.StartCopyFromURL(context.Background(), srcBlob.URL(), &blob.StartCopyFromURLOptions{ + Tier: &tier, + }) + _require.NoError(err) + + getResp, err := destBlob.GetProperties(context.Background(), nil) + _require.Nil(err) + _require.Equal(*getResp.AccessTier, string(tier)) + } +} + func (s *BlockBlobRecordedTestsSuite) TestBlobServiceClientDelete() { _require := require.New(s.T()) svcClient, err := testcommon.GetServiceClient(s.T(), testcommon.TestAccountDefault, nil) @@ -2279,6 +2361,7 @@ func (s *BlockBlobRecordedTestsSuite) TestBlobSetTierAllTiersOnBlockBlob() { blockBlobName := testcommon.GenerateBlobName(testName) bbClient := testcommon.CreateNewBlockBlob(context.Background(), _require, blockBlobName, containerClient) + setAndCheckBlockBlobTier(_require, bbClient, blob.AccessTierCold) setAndCheckBlockBlobTier(_require, bbClient, blob.AccessTierHot) setAndCheckBlockBlobTier(_require, bbClient, blob.AccessTierCool) setAndCheckBlockBlobTier(_require, bbClient, blob.AccessTierArchive) diff --git a/sdk/storage/azblob/container/client_test.go b/sdk/storage/azblob/container/client_test.go index 21261c4e4931..83ae74707dd9 100644 --- a/sdk/storage/azblob/container/client_test.go +++ b/sdk/storage/azblob/container/client_test.go @@ -1344,6 +1344,60 @@ func (s *ContainerRecordedTestsSuite) TestBlobListWrapper() { _require.EqualValues(files, found) } +func (s *ContainerRecordedTestsSuite) TestBlobListColdTier() { + _require := require.New(s.T()) + testName := s.T().Name() + svcClient, err := testcommon.GetServiceClient(s.T(), testcommon.TestAccountDefault, nil) + _require.NoError(err) + + containerName := testcommon.GenerateContainerName(testName) + containerClient := testcommon.GetContainerClient(containerName, svcClient) + + _, err = containerClient.Create(context.Background(), nil) + _require.NoError(err) + defer testcommon.DeleteContainer(context.Background(), _require, containerClient) + + for _, tier := range []blob.AccessTier{blob.AccessTierCool, blob.AccessTierHot, blob.AccessTierCold, blob.AccessTierArchive} { + files := []string{"a123", "b234", "c345"} + testcommon.CreateNewBlobsListTier(context.Background(), _require, files, containerClient, &tier) + + // List blobs flat + found := make([]string, 0) + pager := containerClient.NewListBlobsFlatPager(nil) + for pager.More() { + resp, err := pager.NextPage(context.Background()) + _require.NoError(err) + + for _, blob := range resp.Segment.BlobItems { + _require.Equal(blob.Properties.AccessTier, &tier) + found = append(found, *blob.Name) + } + } + + sort.Strings(files) + sort.Strings(found) + _require.EqualValues(files, found) + + // Try listing blobs with hierarchical listing + found = make([]string, 0) + pg := containerClient.NewListBlobsHierarchyPager("/", nil) + for pg.More() { + resp, err := pg.NextPage(context.Background()) + _require.NoError(err) + + for _, blob := range resp.Segment.BlobItems { + _require.Equal(blob.Properties.AccessTier, &tier) + found = append(found, *blob.Name) + } + } + + sort.Strings(files) + sort.Strings(found) + _require.EqualValues(files, found) + + } +} + func (s *ContainerRecordedTestsSuite) TestBlobListWrapperListingError() { _require := require.New(s.T()) testName := s.T().Name() diff --git a/sdk/storage/azblob/internal/testcommon/clients_auth.go b/sdk/storage/azblob/internal/testcommon/clients_auth.go index 687c7e8a5fee..bb027c06d691 100644 --- a/sdk/storage/azblob/internal/testcommon/clients_auth.go +++ b/sdk/storage/azblob/internal/testcommon/clients_auth.go @@ -236,6 +236,16 @@ func CreateNewBlobs(ctx context.Context, _require *require.Assertions, blobNames } } +func CreateNewBlobsListTier(ctx context.Context, _require *require.Assertions, blobNames []string, containerClient *container.Client, tier *blob.AccessTier) { + var bbClientList []*blockblob.Client + for _, blobName := range blobNames { + bbClient := CreateNewBlockBlob(ctx, _require, blobName, containerClient) + _, err := bbClient.SetTier(ctx, *tier, nil) + _require.NoError(err) + bbClientList = append(bbClientList, bbClient) + } +} + func GetBlockBlobClient(blockBlobName string, containerClient *container.Client) *blockblob.Client { return containerClient.NewBlockBlobClient(blockBlobName) } From 8fbd3b5304aee9d3ed140ee077aab9ee7b6ae36a Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Sun, 18 Jun 2023 23:37:20 -0400 Subject: [PATCH 20/24] Recorded tests --- sdk/storage/azblob/assets.json | 2 +- sdk/storage/azblob/blockblob/client_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/storage/azblob/assets.json b/sdk/storage/azblob/assets.json index 4db1d7209d92..3eb5d2db94d9 100644 --- a/sdk/storage/azblob/assets.json +++ b/sdk/storage/azblob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/storage/azblob", - "Tag": "go/storage/azblob_a772b9c866" + "Tag": "go/storage/azblob_ec88f3fc4f" } diff --git a/sdk/storage/azblob/blockblob/client_test.go b/sdk/storage/azblob/blockblob/client_test.go index 49f79556a4ac..691cbef49cb8 100644 --- a/sdk/storage/azblob/blockblob/client_test.go +++ b/sdk/storage/azblob/blockblob/client_test.go @@ -1986,7 +1986,7 @@ func (s *BlockBlobRecordedTestsSuite) TestBlobSetTierOnCommit() { containerClient := testcommon.CreateNewContainer(context.Background(), _require, containerName, svcClient) defer testcommon.DeleteContainer(context.Background(), _require, containerClient) - for _, tier := range []blob.AccessTier{blob.AccessTierArchive, blob.AccessTierCool, blob.AccessTierHot, blob.AccessTierCold} { + for _, tier := range []blob.AccessTier{blob.AccessTierCool, blob.AccessTierHot, blob.AccessTierCold} { blobName := strings.ToLower(string(tier)) + testcommon.GenerateBlobName(testName) bbClient := testcommon.GetBlockBlobClient(blobName, containerClient) From 267be2f1d6840d0fba433fdec6b31d0b92298fd5 Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Sun, 18 Jun 2023 23:48:46 -0400 Subject: [PATCH 21/24] Updated CHANGELOG.md --- sdk/storage/azblob/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/storage/azblob/CHANGELOG.md b/sdk/storage/azblob/CHANGELOG.md index 567682e02c38..118a5bb0c99b 100644 --- a/sdk/storage/azblob/CHANGELOG.md +++ b/sdk/storage/azblob/CHANGELOG.md @@ -3,6 +3,7 @@ ## 1.1.0-beta.2 (Unreleased) ### Features Added +* Added `AccessTierCold`. ### Breaking Changes From 6c7558ba5d017a16b117f3ad338895d812ac0ebb Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Mon, 19 Jun 2023 00:15:33 -0400 Subject: [PATCH 22/24] Added recording --- sdk/storage/azblob/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/azblob/assets.json b/sdk/storage/azblob/assets.json index 3eb5d2db94d9..06df60df4c1f 100644 --- a/sdk/storage/azblob/assets.json +++ b/sdk/storage/azblob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/storage/azblob", - "Tag": "go/storage/azblob_ec88f3fc4f" + "Tag": "go/storage/azblob_c4379737f9" } From ab7f8328c6ea15397c9934db4e78b55f0635f278 Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Mon, 19 Jun 2023 00:24:49 -0400 Subject: [PATCH 23/24] Fixing linting issues --- sdk/storage/azblob/internal/testcommon/clients_auth.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/sdk/storage/azblob/internal/testcommon/clients_auth.go b/sdk/storage/azblob/internal/testcommon/clients_auth.go index bb027c06d691..c4179f73d05d 100644 --- a/sdk/storage/azblob/internal/testcommon/clients_auth.go +++ b/sdk/storage/azblob/internal/testcommon/clients_auth.go @@ -237,12 +237,10 @@ func CreateNewBlobs(ctx context.Context, _require *require.Assertions, blobNames } func CreateNewBlobsListTier(ctx context.Context, _require *require.Assertions, blobNames []string, containerClient *container.Client, tier *blob.AccessTier) { - var bbClientList []*blockblob.Client for _, blobName := range blobNames { bbClient := CreateNewBlockBlob(ctx, _require, blobName, containerClient) _, err := bbClient.SetTier(ctx, *tier, nil) _require.NoError(err) - bbClientList = append(bbClientList, bbClient) } } From c1526fbcada4696cc242e570c51da7b055407ecd Mon Sep 17 00:00:00 2001 From: siminsavani-msft <77068571+siminsavani-msft@users.noreply.github.com> Date: Mon, 19 Jun 2023 11:46:38 -0400 Subject: [PATCH 24/24] Fixing CI issues with test --- sdk/storage/azblob/assets.json | 2 +- sdk/storage/azblob/blockblob/client_test.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/storage/azblob/assets.json b/sdk/storage/azblob/assets.json index 06df60df4c1f..2f2da0dc64dd 100644 --- a/sdk/storage/azblob/assets.json +++ b/sdk/storage/azblob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/storage/azblob", - "Tag": "go/storage/azblob_c4379737f9" + "Tag": "go/storage/azblob_5cbc6d263b" } diff --git a/sdk/storage/azblob/blockblob/client_test.go b/sdk/storage/azblob/blockblob/client_test.go index 691cbef49cb8..981f0d9ec855 100644 --- a/sdk/storage/azblob/blockblob/client_test.go +++ b/sdk/storage/azblob/blockblob/client_test.go @@ -2361,7 +2361,6 @@ func (s *BlockBlobRecordedTestsSuite) TestBlobSetTierAllTiersOnBlockBlob() { blockBlobName := testcommon.GenerateBlobName(testName) bbClient := testcommon.CreateNewBlockBlob(context.Background(), _require, blockBlobName, containerClient) - setAndCheckBlockBlobTier(_require, bbClient, blob.AccessTierCold) setAndCheckBlockBlobTier(_require, bbClient, blob.AccessTierHot) setAndCheckBlockBlobTier(_require, bbClient, blob.AccessTierCool) setAndCheckBlockBlobTier(_require, bbClient, blob.AccessTierArchive)