mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-25 15:50:20 +00:00
e5015c0f68
Bumps the github-dependencies group with 2 updates: [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) and [github.com/aws/aws-sdk-go-v2/service/sts](https://github.com/aws/aws-sdk-go-v2). Updates `github.com/aws/aws-sdk-go` from 1.46.4 to 1.47.4 - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.46.4...v1.47.4) Updates `github.com/aws/aws-sdk-go-v2/service/sts` from 1.23.2 to 1.25.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/service/s3/v1.25.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/ecs/v1.23.2...service/s3/v1.25.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-dependencies - dependency-name: github.com/aws/aws-sdk-go-v2/service/sts dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
58 lines
1.9 KiB
Go
58 lines
1.9 KiB
Go
package configsources
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// ServiceBaseEndpointProvider is needed to search for all providers
|
|
// that provide a configured service endpoint
|
|
type ServiceBaseEndpointProvider interface {
|
|
GetServiceBaseEndpoint(ctx context.Context, sdkID string) (string, bool, error)
|
|
}
|
|
|
|
// IgnoreConfiguredEndpointsProvider is needed to search for all providers
|
|
// that provide a flag to disable configured endpoints.
|
|
//
|
|
// Currently duplicated from github.com/aws/aws-sdk-go-v2/config because
|
|
// service packages cannot import github.com/aws/aws-sdk-go-v2/config
|
|
// due to result import cycle error.
|
|
type IgnoreConfiguredEndpointsProvider interface {
|
|
GetIgnoreConfiguredEndpoints(ctx context.Context) (bool, bool, error)
|
|
}
|
|
|
|
// GetIgnoreConfiguredEndpoints is used in knowing when to disable configured
|
|
// endpoints feature.
|
|
//
|
|
// Currently duplicated from github.com/aws/aws-sdk-go-v2/config because
|
|
// service packages cannot import github.com/aws/aws-sdk-go-v2/config
|
|
// due to result import cycle error.
|
|
func GetIgnoreConfiguredEndpoints(ctx context.Context, configs []interface{}) (value bool, found bool, err error) {
|
|
for _, cfg := range configs {
|
|
if p, ok := cfg.(IgnoreConfiguredEndpointsProvider); ok {
|
|
value, found, err = p.GetIgnoreConfiguredEndpoints(ctx)
|
|
if err != nil || found {
|
|
break
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResolveServiceBaseEndpoint is used to retrieve service endpoints from configured sources
|
|
// while allowing for configured endpoints to be disabled
|
|
func ResolveServiceBaseEndpoint(ctx context.Context, sdkID string, configs []interface{}) (value string, found bool, err error) {
|
|
if val, found, _ := GetIgnoreConfiguredEndpoints(ctx, configs); found && val {
|
|
return "", false, nil
|
|
}
|
|
|
|
for _, cs := range configs {
|
|
if p, ok := cs.(ServiceBaseEndpointProvider); ok {
|
|
value, found, err = p.GetServiceBaseEndpoint(context.Background(), sdkID)
|
|
if err != nil || found {
|
|
break
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|