Skip to content

Commit

Permalink
Feedback + Service Client (#21096)
Browse files Browse the repository at this point in the history
* Enable gocritic during linting (#20715)

Enabled gocritic's evalOrder to catch dependencies on undefined behavior
on return statements.
Updated to latest version of golangci-lint.
Fixed issue in azblob flagged by latest linter.

* Cosmos DB: Enable merge support (#20716)

* Adding header and value

* Wiring and tests

* format

* Fixing value

* change log

* [azservicebus, azeventhubs] Stress test and logging improvement (#20710)

Logging improvements:

* Updating the logging to print more tracing information (per-link) in prep for the bigger release coming up.
* Trimming out some of the verbose logging, seeing if I can get it a bit more reasonable.

Stress tests:

* Add a timestamp to the log name we generate and also default to append, not overwrite.
* Use 0.5 cores, 0.5GB as our baseline. Some pods use more and I'll tune them more later.

* update proxy version (#20712)

Co-authored-by: Scott Beddall <[email protected]>

* Return an error when you try to send a message that's too large. (#20721)

This now works just like the message batch - you'll get an ErrMessageTooLarge
if you attempt to send a message that's too large for the link's configured
size.

NOTE: there's a patch to `internal/go-amqp/Sender.go` to match what's in go-amqp's
main so it returns a programmatically useful error when the message is too large.

Fixes #20647

* Changes in test that is failing in pipeline (#20693)

* [azservicebus, azeventhubs] Treat 'entity full' as a fatal error (#20722)

When the remote entity is full we get a resource-limit-exceeded condition. This isn't something we should keep retrying on and it's best to just abort and let the user know immediately, rather than hoping it might eventually clear out.

This affected both Event Hubs and Service Bus.

Fixes #20647

* [azservicebus/azeventhubs] Redirect stderr and stdout to tee (#20726)

* Update changelog with latest features (#20730)

* Update changelog with latest features

Prepare for upcoming release.

* bump minor version

* pass along the artifact name so we can override it later (#20732)

Co-authored-by: scbedd <[email protected]>

* [azeventhubs] Fixing checkpoint store race condition (#20727)

The checkpoint store wasn't guarding against multiple owners claiming for the first time - fixing this by using IfNoneMatch

Fixes #20717

* Fix azidentity troubleshooting guide link (#20736)

* [Release] sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/0.1.0 (#20437)

* [Release] sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/0.1.0 generation from spec commit: 85fb4ac6f8bfefd179e6c2632976a154b5c9ff04

* client factory

* fix

* fix

* update

* add sdk/resourcemanager/postgresql/armpostgresql live test (#20685)

* add sdk/resourcemanager/postgresql/armpostgresql live test

* update assets.json

* set subscriptionId default value

* format

* add sdk/resourcemanager/eventhub/armeventhub live test (#20686)

* add sdk/resourcemanager/eventhub/armeventhub live test

* update assets

* add sdk/resourcemanager/compute/armcompute live test (#20048)

* add sdk/resourcemanager/compute/armcompute live test

* skus filter

* fix subscriptionId default value

* fix

* gofmt

* update recording

* sdk/resourcemanager/network/armnetwork live test (#20331)

* sdk/resourcemanager/network/armnetwork live test

* update subscriptionId default value

* update recording

* add sdk/resourcemanager/cosmos/armcosmos live test (#20705)

* add sdk/resourcemanager/cosmos/armcosmos live test

* update assets.json

* update assets.json

* update assets.json

* update assets.json

* Increment package version after release of azcore (#20740)

* [azeventhubs] Improperly resetting etag in the checkpoint store (#20737)

We shouldn't be resetting the etag to nil - it's what we use to enforce a "single winner" when doing ownership claims.

The bug here was two-fold: I had bad logic in my previous claim ownership, which I fixed in a previous PR, but we need to reflect that same constraint properly in our in-memory checkpoint store for these tests.

* Eng workflows sync and branch cleanup additions (#20743)

Co-authored-by: James Suplizio <[email protected]>

* [azeventhubs] Latest start position can also be inclusive (ie, get the latest message) (#20744)

* Update GitHubEventProcessor version and remove pull_request_review procesing (#20751)

Co-authored-by: James Suplizio <[email protected]>

* Rename DisableAuthorityValidationAndInstanceDiscovery (#20746)

* fix (#20707)

* AzFile (#20739)

* azfile: Fixing connection string parsing logic (#20798)

* Fixing connection string parse logic

* Update README

* [azadmin] fix flaky test (#20758)

* fix flaky test

* charles suggestion

* Prepare azidentity v1.3.0 for release (#20756)

* Fix broken podman link (#20801)

Co-authored-by: Wes Haggard <[email protected]>

* [azquery] update doc comments (#20755)

* update doc comments

* update statistics and visualization generation

* prep-for-release

* Fixed contribution section (#20752)

Co-authored-by: Bob Tabor <[email protected]>

* [azeventhubs,azservicebus] Some API cleanup, renames (#20754)

* Adding options to UpdateCheckpoint(), just for future potential expansion
* Make Offset an int64, not a *int64 (it's not optional, it'll always come back with ReceivedEvents)
* Adding more logging into the checkpoint store.
* Point all imports at the production go-amqp

* Add supporting features to enable distributed tracing (#20301) (#20708)

* Add supporting features to enable distributed tracing

This includes new internal pipeline policies and other supporting types.
See the changelog for a full description.
Added some missing doc comments.

* fix linter issue

* add net.peer.name trace attribute

sequence custom HTTP header policy before logging policy.
sequence logging policy after HTTP trace policy.
keep body download policy at the end.

* add span for iterating over pages

* Restore ARM CAE support for azcore beta (#20657)

This reverts commit 9020972.

* Upgrade to stable azcore (#20808)

* Increment package version after release of data/azcosmos (#20807)

* Updating changelog (#20810)

* Add fake package to azcore (#20711)

* Add fake package to azcore

This is the supporting infrastructure for the generated SDK fakes.

* fix doc comment

* Updating CHANGELOG.md (#20809)

* changelog (#20811)

* Increment package version after release of storage/azfile (#20813)

* Update changelog (azblob) (#20815)

* Updating CHANGELOG.md

* Update the changelog with correct version

* [azquery] migration guide (#20742)

* migration guide

* Charles feedback

* Richard feedback

---------

Co-authored-by: Charles Lowell <[email protected]>

* Increment package version after release of monitor/azquery (#20820)

* [keyvault] prep for release (#20819)

* prep for release

* perf tests

* update date

* added new client methods

* moved access conditions and wrote first test

* added more tests

* added path listing

* list deleted paths

* fixed formatter and added more tests

* added more tests

* marker fix

* log

* fixed constructor validation

* comment

* assets update:

* some cleanup

* missing models and log

* cleanup, resolved apiview feedback

* test

* cleanup

* added service tests

* implemented listing

* cleanup

* cleanup

---------

Co-authored-by: Joel Hendrix <[email protected]>
Co-authored-by: Matias Quaranta <[email protected]>
Co-authored-by: Richard Park <[email protected]>
Co-authored-by: Azure SDK Bot <[email protected]>
Co-authored-by: Scott Beddall <[email protected]>
Co-authored-by: siminsavani-msft <[email protected]>
Co-authored-by: scbedd <[email protected]>
Co-authored-by: Charles Lowell <[email protected]>
Co-authored-by: Peng Jiahui <[email protected]>
Co-authored-by: James Suplizio <[email protected]>
Co-authored-by: Sourav Gupta <[email protected]>
Co-authored-by: gracewilcox <[email protected]>
Co-authored-by: Wes Haggard <[email protected]>
Co-authored-by: Bob Tabor <[email protected]>
Co-authored-by: Bob Tabor <[email protected]>
  • Loading branch information
16 people authored Jul 7, 2023
1 parent 6fe421e commit 79f06e1
Show file tree
Hide file tree
Showing 20 changed files with 1,234 additions and 217 deletions.
19 changes: 9 additions & 10 deletions sdk/storage/azdatalake/directory/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/internal/exported"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/internal/generated"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/internal/shared"
"strings"
)

// ClientOptions contains the optional parameters when creating a Client.
Expand All @@ -30,10 +29,9 @@ type Client base.CompositeClient[generated.PathClient, generated.PathClient, blo
// - cred - an Azure AD credential, typically obtained via the azidentity module
// - options - client options; pass nil to accept the default values
func NewClient(directoryURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) {
blobURL := strings.Replace(directoryURL, ".dfs.", ".blob.", 1)
directoryURL = strings.Replace(directoryURL, ".blob.", ".dfs.", 1)
blobURL, directoryURL := shared.GetURLs(directoryURL)

authPolicy := shared.NewStorageChallengePolicy(cred)
authPolicy := runtime.NewBearerTokenPolicy(cred, []string{shared.TokenScope}, nil)
conOptions := shared.GetClientOptions(options)
plOpts := runtime.PipelineOptions{
PerRetry: []policy.Policy{authPolicy},
Expand Down Expand Up @@ -62,8 +60,7 @@ func NewClient(directoryURL string, cred azcore.TokenCredential, options *Client
// - directoryURL - the URL of the storage account e.g. https://<account>.dfs.core.windows.net/fs/dir?<sas token>
// - options - client options; pass nil to accept the default values
func NewClientWithNoCredential(directoryURL string, options *ClientOptions) (*Client, error) {
blobURL := strings.Replace(directoryURL, ".dfs.", ".blob.", 1)
directoryURL = strings.Replace(directoryURL, ".blob.", ".dfs.", 1)
blobURL, directoryURL := shared.GetURLs(directoryURL)

conOptions := shared.GetClientOptions(options)
plOpts := runtime.PipelineOptions{}
Expand Down Expand Up @@ -91,8 +88,7 @@ func NewClientWithNoCredential(directoryURL string, options *ClientOptions) (*Cl
// - cred - a SharedKeyCredential created with the matching storage account and access key
// - options - client options; pass nil to accept the default values
func NewClientWithSharedKeyCredential(directoryURL string, cred *SharedKeyCredential, options *ClientOptions) (*Client, error) {
blobURL := strings.Replace(directoryURL, ".dfs.", ".blob.", 1)
directoryURL = strings.Replace(directoryURL, ".blob.", ".dfs.", 1)
blobURL, directoryURL := shared.GetURLs(directoryURL)

authPolicy := exported.NewSharedKeyCredPolicy(cred)
conOptions := shared.GetClientOptions(options)
Expand All @@ -112,8 +108,11 @@ func NewClientWithSharedKeyCredential(directoryURL string, cred *SharedKeyCreden
blobClientOpts := blob.ClientOptions{
ClientOptions: options.ClientOptions,
}
blobSharedKeyCredential, _ := blob.NewSharedKeyCredential(cred.AccountName(), cred.AccountKey())
blobClient, _ := blob.NewClientWithSharedKeyCredential(blobURL, blobSharedKeyCredential, &blobClientOpts)
blobSharedKey, err := cred.ConvertToBlobSharedKey()
if err != nil {
return nil, err
}
blobClient, _ := blob.NewClientWithSharedKeyCredential(blobURL, blobSharedKey, &blobClientOpts)
dirClient := base.NewPathClient(directoryURL, blobURL, blobClient, azClient, nil, (*base.ClientOptions)(conOptions))

return (*Client)(dirClient), nil
Expand Down
20 changes: 9 additions & 11 deletions sdk/storage/azdatalake/file/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/internal/exported"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/internal/generated"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/internal/shared"
"strings"
)

// ClientOptions contains the optional parameters when creating a Client.
Expand All @@ -30,10 +29,8 @@ type Client base.CompositeClient[generated.PathClient, generated.PathClient, blo
// - cred - an Azure AD credential, typically obtained via the azidentity module
// - options - client options; pass nil to accept the default values
func NewClient(fileURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) {
blobURL := strings.Replace(fileURL, ".dfs.", ".blob.", 1)
fileURL = strings.Replace(fileURL, ".blob.", ".dfs.", 1)

authPolicy := shared.NewStorageChallengePolicy(cred)
blobURL, fileURL := shared.GetURLs(fileURL)
authPolicy := runtime.NewBearerTokenPolicy(cred, []string{shared.TokenScope}, nil)
conOptions := shared.GetClientOptions(options)
plOpts := runtime.PipelineOptions{
PerRetry: []policy.Policy{authPolicy},
Expand Down Expand Up @@ -62,8 +59,7 @@ func NewClient(fileURL string, cred azcore.TokenCredential, options *ClientOptio
// - fileURL - the URL of the storage account e.g. https://<account>.dfs.core.windows.net/fs/file.txt?<sas token>
// - options - client options; pass nil to accept the default values
func NewClientWithNoCredential(fileURL string, options *ClientOptions) (*Client, error) {
blobURL := strings.Replace(fileURL, ".dfs.", ".blob.", 1)
fileURL = strings.Replace(fileURL, ".blob.", ".dfs.", 1)
blobURL, fileURL := shared.GetURLs(fileURL)

conOptions := shared.GetClientOptions(options)
plOpts := runtime.PipelineOptions{}
Expand Down Expand Up @@ -91,8 +87,7 @@ func NewClientWithNoCredential(fileURL string, options *ClientOptions) (*Client,
// - cred - a SharedKeyCredential created with the matching storage account and access key
// - options - client options; pass nil to accept the default values
func NewClientWithSharedKeyCredential(fileURL string, cred *SharedKeyCredential, options *ClientOptions) (*Client, error) {
blobURL := strings.Replace(fileURL, ".dfs.", ".blob.", 1)
fileURL = strings.Replace(fileURL, ".blob.", ".dfs.", 1)
blobURL, fileURL := shared.GetURLs(fileURL)

authPolicy := exported.NewSharedKeyCredPolicy(cred)
conOptions := shared.GetClientOptions(options)
Expand All @@ -112,8 +107,11 @@ func NewClientWithSharedKeyCredential(fileURL string, cred *SharedKeyCredential,
blobClientOpts := blob.ClientOptions{
ClientOptions: options.ClientOptions,
}
blobSharedKeyCredential, _ := blob.NewSharedKeyCredential(cred.AccountName(), cred.AccountKey())
blobClient, _ := blob.NewClientWithSharedKeyCredential(blobURL, blobSharedKeyCredential, &blobClientOpts)
blobSharedKey, err := cred.ConvertToBlobSharedKey()
if err != nil {
return nil, err
}
blobClient, _ := blob.NewClientWithSharedKeyCredential(blobURL, blobSharedKey, &blobClientOpts)
fileClient := base.NewPathClient(fileURL, blobURL, blobClient, azClient, nil, (*base.ClientOptions)(conOptions))

return (*Client)(fileClient), nil
Expand Down
23 changes: 9 additions & 14 deletions sdk/storage/azdatalake/filesystem/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"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/blob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/datalakeerror"
Expand All @@ -21,7 +20,6 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/internal/shared"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/sas"
"net/http"
"strings"
"time"
)

Expand All @@ -36,10 +34,8 @@ type Client base.CompositeClient[generated.FileSystemClient, generated.FileSyste
// - cred - an Azure AD credential, typically obtained via the azidentity module
// - options - client options; pass nil to accept the default values
func NewClient(filesystemURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) {
containerURL := strings.Replace(filesystemURL, ".dfs.", ".blob.", 1)
filesystemURL = strings.Replace(filesystemURL, ".blob.", ".dfs.", 1)

authPolicy := shared.NewStorageChallengePolicy(cred)
containerURL, filesystemURL := shared.GetURLs(filesystemURL)
authPolicy := runtime.NewBearerTokenPolicy(cred, []string{shared.TokenScope}, nil)
conOptions := shared.GetClientOptions(options)
plOpts := runtime.PipelineOptions{
PerRetry: []policy.Policy{authPolicy},
Expand Down Expand Up @@ -68,9 +64,7 @@ func NewClient(filesystemURL string, cred azcore.TokenCredential, options *Clien
// - filesystemURL - the URL of the storage account e.g. https://<account>.dfs.core.windows.net/fs?<sas token>
// - options - client options; pass nil to accept the default values
func NewClientWithNoCredential(filesystemURL string, options *ClientOptions) (*Client, error) {
containerURL := strings.Replace(filesystemURL, ".dfs.", ".blob.", 1)
filesystemURL = strings.Replace(filesystemURL, ".blob.", ".dfs.", 1)

containerURL, filesystemURL := shared.GetURLs(filesystemURL)
conOptions := shared.GetClientOptions(options)
plOpts := runtime.PipelineOptions{}
base.SetPipelineOptions((*base.ClientOptions)(conOptions), &plOpts)
Expand All @@ -97,9 +91,7 @@ func NewClientWithNoCredential(filesystemURL string, options *ClientOptions) (*C
// - cred - a SharedKeyCredential created with the matching storage account and access key
// - options - client options; pass nil to accept the default values
func NewClientWithSharedKeyCredential(filesystemURL string, cred *SharedKeyCredential, options *ClientOptions) (*Client, error) {
containerURL := strings.Replace(filesystemURL, ".dfs.", ".blob.", 1)
filesystemURL = strings.Replace(filesystemURL, ".blob.", ".dfs.", 1)

containerURL, filesystemURL := shared.GetURLs(filesystemURL)
authPolicy := exported.NewSharedKeyCredPolicy(cred)
conOptions := shared.GetClientOptions(options)
plOpts := runtime.PipelineOptions{
Expand All @@ -118,8 +110,11 @@ func NewClientWithSharedKeyCredential(filesystemURL string, cred *SharedKeyCrede
containerClientOpts := container.ClientOptions{
ClientOptions: options.ClientOptions,
}
blobSharedKeyCredential, _ := blob.NewSharedKeyCredential(cred.AccountName(), cred.AccountKey())
blobContainerClient, _ := container.NewClientWithSharedKeyCredential(containerURL, blobSharedKeyCredential, &containerClientOpts)
blobSharedKey, err := cred.ConvertToBlobSharedKey()
if err != nil {
return nil, err
}
blobContainerClient, _ := container.NewClientWithSharedKeyCredential(containerURL, blobSharedKey, &containerClientOpts)
fsClient := base.NewFilesystemClient(filesystemURL, containerURL, blobContainerClient, azClient, cred, (*base.ClientOptions)(conOptions))

return (*Client)(fsClient), nil
Expand Down
2 changes: 2 additions & 0 deletions sdk/storage/azdatalake/filesystem/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const (
Filesystem PublicAccessType = azblob.PublicAccessTypeContainer
)

// TODO: figure out a way to import this from datalake rather than blob again

// StatusType defines values for StatusType
type StatusType = lease.StatusType

Expand Down
6 changes: 6 additions & 0 deletions sdk/storage/azdatalake/filesystem/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,9 @@ type LeaseAccessConditions = exported.LeaseAccessConditions

// ModifiedAccessConditions contains a group of parameters for specifying access conditions.
type ModifiedAccessConditions = exported.ModifiedAccessConditions

// PathList contains the path list
type PathList = generated.PathList

// Path contains the path properties
type Path = generated.Path
19 changes: 11 additions & 8 deletions sdk/storage/azdatalake/filesystem/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@ type SetAccessPolicyResponse = container.SetAccessPolicyResponse
// GetAccessPolicyResponse contains the response from method FilesystemClient.GetAccessPolicy.
type GetAccessPolicyResponse struct {
// PublicAccess contains the information returned from the x-ms-blob-public-access header response.
PublicAccess *PublicAccessType `xml:"BlobPublicAccess"`
PublicAccess *PublicAccessType

// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
ClientRequestID *string `xml:"ClientRequestID"`
ClientRequestID *string

// Date contains the information returned from the Date header response.
Date *time.Time `xml:"Date"`
Date *time.Time

// ETag contains the information returned from the ETag header response.
ETag *azcore.ETag `xml:"ETag"`
ETag *azcore.ETag

// LastModified contains the information returned from the Last-Modified header response.
LastModified *time.Time `xml:"LastModified"`
LastModified *time.Time

// RequestID contains the information returned from the x-ms-request-id header response.
RequestID *string `xml:"RequestID"`
RequestID *string

// a collection of signed identifiers
SignedIdentifiers []*SignedIdentifier `xml:"SignedIdentifier"`
SignedIdentifiers []*SignedIdentifier

// Version contains the information returned from the x-ms-version header response.
Version *string `xml:"Version"`
Version *string
}

// since we want to remove the blob prefix in access type
Expand Down Expand Up @@ -140,3 +140,6 @@ type ListPathsSegmentResponse = generated.FileSystemClientListPathsResponse

// ListDeletedPathsSegmentResponse contains the response from method FilesystemClient.ListPathsSegment.
type ListDeletedPathsSegmentResponse = generated.FileSystemClientListBlobHierarchySegmentResponse

// ListBlobsHierarchySegmentResponse contains the response from method FilesystemClient.ListBlobsHierarchySegment.
type ListBlobsHierarchySegmentResponse = generated.ListBlobsHierarchySegmentResponse
2 changes: 1 addition & 1 deletion sdk/storage/azdatalake/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake
go 1.18

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.5.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
github.com/stretchr/testify v1.7.1
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/azdatalake/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.5.0 h1:xGLAFFd9D3iLGxYiUGPdITSzsFmU1K8VtfuUHWAoN7M=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.5.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.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8=
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=
Expand Down
22 changes: 4 additions & 18 deletions sdk/storage/azdatalake/internal/base/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,6 @@ type ClientOptions struct {
pipelineOptions *runtime.PipelineOptions
}

type Client[T any] struct {
inner *T
sharedKey *exported.SharedKeyCredential
options *ClientOptions
}

func InnerClient[T any](client *Client[T]) *T {
return client.inner
}

func SharedKey[T any](client *Client[T]) *exported.SharedKeyCredential {
return client.sharedKey
}

func GetClientOptions[T any](client *Client[T]) *ClientOptions {
return client.options
}

func GetPipelineOptions(clOpts *ClientOptions) *runtime.PipelineOptions {
return clOpts.pipelineOptions
}
Expand Down Expand Up @@ -96,3 +78,7 @@ func NewPathClient(dirURL string, dirURLWithBlobEndpoint string, client *blob.Cl
options: options,
}
}

func GetCompositeClientOptions[T, K, U any](client *CompositeClient[T, K, U]) *ClientOptions {
return client.options
}
20 changes: 20 additions & 0 deletions sdk/storage/azdatalake/internal/exported/log_events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//go:build go1.18
// +build go1.18

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

package exported

import (
"github.com/Azure/azure-sdk-for-go/sdk/internal/log"
)

// NOTE: these are publicly exported via type-aliasing in azdatalake/log.go
const (
// EventUpload is used when we compute number of chunks to upload and size of each chunk.
EventUpload log.Event = "azdatalake.Upload"

// EventError is used for logging errors.
EventError log.Event = "azdatalake.Error"
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"crypto/sha256"
"encoding/base64"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
"net/http"
"net/url"
"sort"
Expand Down Expand Up @@ -48,9 +49,12 @@ func (c *SharedKeyCredential) AccountName() string {
return c.accountName
}

// AccountKey returns the Storage account's name.
func (c *SharedKeyCredential) AccountKey() string {
return c.accountKeyString
func (c *SharedKeyCredential) ConvertToBlobSharedKey() (*azblob.SharedKeyCredential, error) {
cred, err := azblob.NewSharedKeyCredential(c.accountName, c.accountKeyString)
if err != nil {
return nil, err
}
return cred, nil
}

// SetAccountKey replaces the existing account key with the specified account key.
Expand Down
Loading

0 comments on commit 79f06e1

Please sign in to comment.