mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
Include tier name in MinIO/S3 target user-agent (#16630)
This commit is contained in:
parent
d136ac0596
commit
a1dd08f2e6
@ -108,7 +108,7 @@ func (az *warmBackendAzure) InUse(ctx context.Context) (bool, error) {
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newWarmBackendAzure(conf madmin.TierAzure) (*warmBackendAzure, error) {
|
func newWarmBackendAzure(conf madmin.TierAzure, _ string) (*warmBackendAzure, error) {
|
||||||
credential, err := azblob.NewSharedKeyCredential(conf.AccountName, conf.AccountKey)
|
credential, err := azblob.NewSharedKeyCredential(conf.AccountName, conf.AccountKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if _, ok := err.(base64.CorruptInputError); ok {
|
if _, ok := err.(base64.CorruptInputError); ok {
|
||||||
|
@ -101,7 +101,7 @@ func (gcs *warmBackendGCS) InUse(ctx context.Context) (bool, error) {
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newWarmBackendGCS(conf madmin.TierGCS) (*warmBackendGCS, error) {
|
func newWarmBackendGCS(conf madmin.TierGCS, _ string) (*warmBackendGCS, error) {
|
||||||
credsJSON, err := conf.GetCredentialJSON()
|
credsJSON, err := conf.GetCredentialJSON()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -33,7 +34,7 @@ type warmBackendMinIO struct {
|
|||||||
|
|
||||||
var _ WarmBackend = (*warmBackendMinIO)(nil)
|
var _ WarmBackend = (*warmBackendMinIO)(nil)
|
||||||
|
|
||||||
func newWarmBackendMinIO(conf madmin.TierMinIO) (*warmBackendMinIO, error) {
|
func newWarmBackendMinIO(conf madmin.TierMinIO, tier string) (*warmBackendMinIO, error) {
|
||||||
u, err := url.Parse(conf.Endpoint)
|
u, err := url.Parse(conf.Endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -53,7 +54,7 @@ func newWarmBackendMinIO(conf madmin.TierMinIO) (*warmBackendMinIO, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
client.SetAppInfo("minio-tier-target", ReleaseTag)
|
client.SetAppInfo(fmt.Sprintf("minio-tier-%s", tier), ReleaseTag)
|
||||||
|
|
||||||
core := &minio.Core{Client: client}
|
core := &minio.Core{Client: client}
|
||||||
return &warmBackendMinIO{
|
return &warmBackendMinIO{
|
||||||
|
@ -105,7 +105,7 @@ func (s3 *warmBackendS3) InUse(ctx context.Context) (bool, error) {
|
|||||||
return len(result.CommonPrefixes) > 0 || len(result.Contents) > 0, nil
|
return len(result.CommonPrefixes) > 0 || len(result.Contents) > 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newWarmBackendS3(conf madmin.TierS3) (*warmBackendS3, error) {
|
func newWarmBackendS3(conf madmin.TierS3, tier string) (*warmBackendS3, error) {
|
||||||
u, err := url.Parse(conf.Endpoint)
|
u, err := url.Parse(conf.Endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -128,7 +128,7 @@ func newWarmBackendS3(conf madmin.TierS3) (*warmBackendS3, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
client.SetAppInfo("s3-tier-target", ReleaseTag)
|
client.SetAppInfo(fmt.Sprintf("s3-tier-%s", tier), ReleaseTag)
|
||||||
|
|
||||||
core := &minio.Core{Client: client}
|
core := &minio.Core{Client: client}
|
||||||
return &warmBackendS3{
|
return &warmBackendS3{
|
||||||
|
@ -137,13 +137,13 @@ type remoteVersionID string
|
|||||||
func newWarmBackend(ctx context.Context, tier madmin.TierConfig) (d WarmBackend, err error) {
|
func newWarmBackend(ctx context.Context, tier madmin.TierConfig) (d WarmBackend, err error) {
|
||||||
switch tier.Type {
|
switch tier.Type {
|
||||||
case madmin.S3:
|
case madmin.S3:
|
||||||
d, err = newWarmBackendS3(*tier.S3)
|
d, err = newWarmBackendS3(*tier.S3, tier.Name)
|
||||||
case madmin.Azure:
|
case madmin.Azure:
|
||||||
d, err = newWarmBackendAzure(*tier.Azure)
|
d, err = newWarmBackendAzure(*tier.Azure, tier.Name)
|
||||||
case madmin.GCS:
|
case madmin.GCS:
|
||||||
d, err = newWarmBackendGCS(*tier.GCS)
|
d, err = newWarmBackendGCS(*tier.GCS, tier.Name)
|
||||||
case madmin.MinIO:
|
case madmin.MinIO:
|
||||||
d, err = newWarmBackendMinIO(*tier.MinIO)
|
d, err = newWarmBackendMinIO(*tier.MinIO, tier.Name)
|
||||||
default:
|
default:
|
||||||
return nil, errTierTypeUnsupported
|
return nil, errTierTypeUnsupported
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user