Esempio n. 1
0
func getKeys() (string, string) {
	if secret != "" && access != "" {
		return secret, access
	}
	if keyFile != "" {
		var err error
		secret, access, err = aws.KeysFromFile(keyFile)
		if err == nil {
			return secret, access
		}
	}
	return aws.KeysFromEnviroment()
}
Esempio n. 2
0
func testConnection(t *testing.T) *Connection {
	secret, access := aws.KeysFromEnviroment()
	if secret == "" || access == "" {
		t.Skipf("%s or %s is not provided.", envAWSAccess, envAWSSecret)
	}
	regionStr := os.Getenv(envGlacierRegion)
	if regionStr == "" {
		t.Skipf("%s is not provided.", envGlacierRegion)
	}
	var region *aws.Region
	for _, r := range aws.Regions {
		if r.Name == regionStr {
			region = r
			break
		}
	}
	if region == nil {
		t.Skipf("%s is invalid.", envGlacierRegion)
	}
	return NewConnection(secret, access, region)
}