Skip to content

Commit

Permalink
Rename service to Path
Browse files Browse the repository at this point in the history
  • Loading branch information
frezbo committed Oct 5, 2018
1 parent 7299c1b commit 2bc260f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions cli/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type LoginCommandInput struct {
FederationTokenDuration time.Duration
AssumeRoleDuration time.Duration
Region string
Service string
Path string
}

func ConfigureLoginCommand(app *kingpin.Application) {
Expand All @@ -47,8 +47,8 @@ func ConfigureLoginCommand(app *kingpin.Application) {
Short('t').
StringVar(&input.MfaToken)

cmd.Flag("service", "The AWS service you would like access").
StringVar(&input.Service)
cmd.Flag("path", "The AWS service you would like access").
StringVar(&input.Path)

cmd.Flag("federation-token-ttl", "Expiration time for aws console session").
Default("12h").
Expand Down Expand Up @@ -84,7 +84,7 @@ func LoginCommand(app *kingpin.Application, input LoginCommandInput) {
AssumeRoleDuration: input.AssumeRoleDuration,
MfaToken: input.MfaToken,
MfaPrompt: input.MfaPrompt,
Service: input.Service,
Path: input.Path,
NoSession: true,
Config: awsConfig,
Region: profile.Region,
Expand Down Expand Up @@ -129,7 +129,7 @@ func LoginCommand(app *kingpin.Application, input LoginCommandInput) {
return
}

loginURLPrefix, destination := generateLoginURL(provider.Region, input.Service)
loginURLPrefix, destination := generateLoginURL(provider.Region, input.Path)

req, err := http.NewRequest("GET", loginURLPrefix, nil)
if err != nil {
Expand Down Expand Up @@ -223,7 +223,7 @@ func getFederationToken(creds credentials.Value, d time.Duration, region string)
return resp.Credentials, nil
}

func generateLoginURL(region string, service string) (string, string) {
func generateLoginURL(region string, path string) (string, string) {
loginURLPrefix := "https://signin.aws.amazon.com/federation"
destination := "https://console.aws.amazon.com/"

Expand All @@ -237,10 +237,10 @@ func generateLoginURL(region string, service string) (string, string) {
loginURLPrefix = "https://signin.amazonaws-us-gov.com/federation"
destinationDomain = "console.amazonaws-us-gov.com"
}
if service != "" {
if path != "" {
destination = fmt.Sprintf(
"https://%s.%s/%s?region=%s",
region, destinationDomain, service, region,
region, destinationDomain, path, region,
)
} else {
destination = fmt.Sprintf(
Expand Down
2 changes: 1 addition & 1 deletion vault/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type VaultOptions struct {
Config *Config
MasterCreds *credentials.Value
Region string
Service string
Path string
}

func (o VaultOptions) Validate() error {
Expand Down

0 comments on commit 2bc260f

Please sign in to comment.