Sha256: 8d1d39625e75999d5463ffcbcfa383b77040f4481ef4251d25b93e9fceafc008

Contents?: true

Size: 932 Bytes

Versions: 16

Compression:

Stored size: 932 Bytes

Contents

package defaults

import (
	"github.com/aws/aws-sdk-go-v2/aws"
	"runtime"
	"strings"
)

var getGOOS = func() string {
	return runtime.GOOS
}

// ResolveDefaultsModeAuto is used to determine the effective aws.DefaultsMode when the mode
// is set to aws.DefaultsModeAuto.
func ResolveDefaultsModeAuto(region string, environment aws.RuntimeEnvironment) aws.DefaultsMode {
	goos := getGOOS()
	if goos == "android" || goos == "ios" {
		return aws.DefaultsModeMobile
	}

	var currentRegion string
	if len(environment.EnvironmentIdentifier) > 0 {
		currentRegion = environment.Region
	}

	if len(currentRegion) == 0 && len(environment.EC2InstanceMetadataRegion) > 0 {
		currentRegion = environment.EC2InstanceMetadataRegion
	}

	if len(region) > 0 && len(currentRegion) > 0 {
		if strings.EqualFold(region, currentRegion) {
			return aws.DefaultsModeInRegion
		}
		return aws.DefaultsModeCrossRegion
	}

	return aws.DefaultsModeStandard
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/auto.go