fix: use madmin.Credentials for gateway interface (#12493)

the main reason is to de-couple the project from
depending on MinIO's internal/auth package, other
changes will subsequently follow.
This commit is contained in:
Harshavardhana
2021-06-14 12:53:49 -07:00
committed by GitHub
parent 0d1d26a4ea
commit 0d1fb10940
7 changed files with 19 additions and 55 deletions

View File

@@ -43,7 +43,6 @@ import (
"github.com/minio/madmin-go"
miniogopolicy "github.com/minio/minio-go/v7/pkg/policy"
minio "github.com/minio/minio/cmd"
"github.com/minio/minio/internal/auth"
"github.com/minio/minio/internal/logger"
"github.com/minio/pkg/bucket/policy"
"github.com/minio/pkg/bucket/policy/condition"
@@ -138,14 +137,14 @@ func (g *Azure) Name() string {
}
// NewGatewayLayer initializes azure blob storage client and returns AzureObjects.
func (g *Azure) NewGatewayLayer(creds auth.Credentials) (minio.ObjectLayer, error) {
func (g *Azure) NewGatewayLayer(creds madmin.Credentials) (minio.ObjectLayer, error) {
var err error
// Override credentials from the Azure storage environment variables if specified
if acc, key := env.Get("AZURE_STORAGE_ACCOUNT", creds.AccessKey), env.Get("AZURE_STORAGE_KEY", creds.SecretKey); acc != "" && key != "" {
creds, err = auth.CreateCredentials(acc, key)
if err != nil {
return nil, err
creds = madmin.Credentials{
AccessKey: acc,
SecretKey: key,
}
}
@@ -244,11 +243,6 @@ func parseStorageEndpoint(host string, accountName string) (*url.URL, error) {
return url.Parse(endpoint)
}
// Production - Azure gateway is production ready.
func (g *Azure) Production() bool {
return true
}
// s3MetaToAzureProperties converts metadata meant for S3 PUT/COPY
// object into Azure data structures - BlobMetadata and
// BlobProperties.