MCPcopy
hub / github.com/wal-g/wal-g / containerClientWithAccessKey

Function containerClientWithAccessKey

pkg/storages/azure/storage.go:108–129  ·  view source on GitHub ↗
(config *Config)

Source from the content-addressed store, hash-verified

106}
107
108func containerClientWithAccessKey(config *Config) (*container.Client, error) {
109 credential, err := azblob.NewSharedKeyCredential(config.AccountName, config.Secrets.AccessKey)
110 if err != nil {
111 return nil, fmt.Errorf("create shared key credentials: %w", err)
112 }
113 containerURLString := fmt.Sprintf(
114 "https://%s.blob.%s/%s",
115 config.AccountName,
116 config.EndpointSuffix,
117 config.Container,
118 )
119 if _, err := url.Parse(containerURLString); err != nil {
120 return nil, fmt.Errorf("parse service URL: %w", err)
121 }
122
123 containerClient, err := container.NewClientWithSharedKeyCredential(containerURLString, credential, &container.ClientOptions{
124 ClientOptions: policy.ClientOptions{
125 Retry: policy.RetryOptions{TryTimeout: config.TryTimeout},
126 },
127 })
128 return containerClient, err
129}
130
131func containerClientWithDefaultAuth(config *Config) (*container.Client, error) {
132 defaultCredential, err := azidentity.NewDefaultAzureCredential(nil)

Callers 1

NewStorageFunction · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected