@@ -40,7 +40,7 @@ const (
40
40
yamlConfigVersion = 1
41
41
)
42
42
43
- // CLIConfig is the top level struct representing the configuration information
43
+ // CLIConfig is the top level struct representing the local ECS configuration
44
44
type CLIConfig struct {
45
45
Version int // which format version was the config file that was read. 1 == yaml, 0 == old ini
46
46
Cluster string
@@ -56,14 +56,14 @@ type CLIConfig struct {
56
56
DefaultLaunchType string
57
57
}
58
58
59
- // Profile is a simple struct for storing a single profile config
59
+ // Profile is a simple struct for storing a single AWS profile config
60
60
type Profile struct {
61
61
AWSAccessKey string `yaml:"aws_access_key_id"`
62
62
AWSSecretKey string `yaml:"aws_secret_access_key"`
63
63
AWSSessionToken string `yaml:"aws_session_token,omitempty"`
64
64
}
65
65
66
- // Cluster is a simple struct for storing a single cluster config
66
+ // Cluster is a simple struct for storing a single ECS cluster config
67
67
type Cluster struct {
68
68
Cluster string `yaml:"cluster"`
69
69
Region string `yaml:"region"`
@@ -92,7 +92,6 @@ func NewCLIConfig(cluster string) *CLIConfig {
92
92
}
93
93
94
94
// ToAWSSession creates a new Session object from the CliConfig object.
95
- //
96
95
// Region: Order of resolution
97
96
// 1) ECS CLI Flags
98
97
// a) Region Flag --region
@@ -140,7 +139,6 @@ func (cfg *CLIConfig) ToAWSSession(context *cli.Context) (*session.Session, erro
140
139
// The argument svcConfig is needed to allow important unit tests to work
141
140
// (for example: assume role)
142
141
func (cfg * CLIConfig ) toAWSSessionWithConfig (context * cli.Context , svcConfig * aws.Config ) (* session.Session , error ) {
143
-
144
142
region , err := cfg .getRegion ()
145
143
146
144
if err != nil || region == "" {
@@ -209,6 +207,7 @@ func sessionFromProfile(profile string, region string, svcConfig *aws.Config) (*
209
207
func sessionFromKeys (region string , awsAccess string , awsSecret string , sessionToken string , svcConfig * aws.Config ) (* session.Session , error ) {
210
208
svcConfig .Region = aws .String (region )
211
209
svcConfig .Credentials = credentials .NewStaticCredentials (awsAccess , awsSecret , sessionToken )
210
+
212
211
return session .NewSession (svcConfig )
213
212
}
214
213
@@ -241,6 +240,7 @@ func (cfg *CLIConfig) getRegion() (string, error) {
241
240
if region == "" {
242
241
region , err = cfg .getRegionFromAWSProfile ()
243
242
}
243
+
244
244
return region , err
245
245
}
246
246
@@ -259,6 +259,6 @@ func (cfg *CLIConfig) getRegionFromAWSProfile() (string, error) {
259
259
if err != nil {
260
260
return "" , err
261
261
}
262
- return aws .StringValue (s .Config .Region ), nil
263
262
263
+ return aws .StringValue (s .Config .Region ), nil
264
264
}
0 commit comments