Skip to content

Commit

Permalink
Use region subdomain on console URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
ipmb committed Jan 26, 2021
1 parent a79f3b8 commit 3665242
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ var accountCmd = &cobra.Command{
changeSet, err := createChangeSetAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL = fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*changeSet.ChangeSetId))
statusURL = fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*changeSet.ChangeSetId))
if *changeSet.Status != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack ChangeSet creation Failed.\nView status at %s", statusURL))
} else {
Expand All @@ -484,7 +484,7 @@ var accountCmd = &cobra.Command{
stack, err := createStackAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL := fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*stack.StackId))
statusURL := fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*stack.StackId))
if *stack.StackStatus != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack creation Failed.\nView status at %s", statusURL))
} else {
Expand Down Expand Up @@ -551,7 +551,7 @@ var createRegionCmd = &cobra.Command{
changeSet, err := createChangeSetAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL = fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*changeSet.ChangeSetId))
statusURL = fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*changeSet.ChangeSetId))
if *changeSet.Status != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack ChangeSet creation Failed.\nView status at %s", statusURL))
} else {
Expand All @@ -562,7 +562,7 @@ var createRegionCmd = &cobra.Command{
stack, err := createStackAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL := fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*stack.StackId))
statusURL := fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*stack.StackId))
if *stack.StackStatus != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack creation Failed.\nView status at %s", statusURL))
} else {
Expand Down Expand Up @@ -642,7 +642,7 @@ var createClusterCmd = &cobra.Command{
changeSet, err := createChangeSetAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL = fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*changeSet.ChangeSetId))
statusURL = fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*changeSet.ChangeSetId))
if *changeSet.Status != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack ChangeSet creation Failed.\nView status at %s", statusURL))
} else {
Expand All @@ -653,7 +653,7 @@ var createClusterCmd = &cobra.Command{
stack, err := createStackAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL := fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*stack.StackId))
statusURL := fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*stack.StackId))
if *stack.StackStatus != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack creation Failed.\nView status at %s", statusURL))
} else {
Expand Down Expand Up @@ -763,7 +763,7 @@ var createDatabaseCmd = &cobra.Command{
changeSet, err := createChangeSetAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL = fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*changeSet.ChangeSetId))
statusURL = fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*changeSet.ChangeSetId))
if *changeSet.Status != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack ChangeSet creation Failed.\nView status at %s", statusURL))
} else {
Expand All @@ -774,7 +774,7 @@ var createDatabaseCmd = &cobra.Command{
stack, err := createStackAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL := fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*stack.StackId))
statusURL := fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*stack.StackId))
if *stack.StackStatus != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack creation Failed.\nView status at %s", statusURL))
} else {
Expand Down Expand Up @@ -879,7 +879,7 @@ var createRedisCmd = &cobra.Command{
changeSet, err := createChangeSetAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL = fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*changeSet.ChangeSetId))
statusURL = fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*changeSet.ChangeSetId))
if *changeSet.Status != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack ChangeSet creation Failed.\nView status at %s", statusURL))
} else {
Expand All @@ -890,7 +890,7 @@ var createRedisCmd = &cobra.Command{
stack, err := createStackAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL := fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*stack.StackId))
statusURL := fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*stack.StackId))
if *stack.StackStatus != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack creation Failed.\nView status at %s", statusURL))
} else {
Expand Down Expand Up @@ -928,7 +928,7 @@ func verifySourceCredentials(sess *session.Session, repositoryType string, inter
fmt.Printf(" 3. Keep the default %s\n", aurora.Bold("Connect using OAuth"))
fmt.Printf(" 4. Click %s\n", aurora.Bold(fmt.Sprintf("Connect to %s", friendlySourceName)))
fmt.Printf(" 5. Click %s in the popup window\n\n", aurora.Bold("Confirm"))
newProjectURL := "https://console.aws.amazon.com/codesuite/codebuild/project/new"
newProjectURL := fmt.Sprintf("https://%s.console.aws.amazon.com/codesuite/codebuild/project/new", *sess.Config.Region)
if !interactive {
fmt.Printf("Visit %s to complete the authentication\n", newProjectURL)
fmt.Println("No further steps are necessary. After you've completed the authentication, re-run this command.")
Expand Down Expand Up @@ -1139,7 +1139,7 @@ var appCmd = &cobra.Command{
changeSet, err := createChangeSetAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL = fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*changeSet.ChangeSetId))
statusURL = fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*changeSet.ChangeSetId))
if *changeSet.Status != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack ChangeSet creation Failed.\nView status at %s", statusURL))
} else {
Expand All @@ -1150,7 +1150,7 @@ var appCmd = &cobra.Command{
stack, err := createStackAndWait(sess, &input)
Spinner.Stop()
checkErr(err)
statusURL := fmt.Sprintf("https://console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", url.QueryEscape(*stack.StackId))
statusURL := fmt.Sprintf("https://%s.console.aws.amazon.com/cloudformation/home#/stacks/events?stackId=%s", *sess.Config.Region, url.QueryEscape(*stack.StackId))
if *stack.StackStatus != "CREATE_COMPLETE" {
checkErr(fmt.Errorf("Stack creation Failed.\nView status at %s", statusURL))
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var logsOpenCmd = &cobra.Command{
logGroupParam := strings.ReplaceAll(url.QueryEscape(a.Settings.LogGroup.Name), "%", "*")
queryParam := strings.ReplaceAll(url.QueryEscape("fields @timestamp, @message\n| sort @timestamp desc\n| limit 200"), "%", "*")
region := *a.Session.Config.Region
destinationURL := fmt.Sprintf("https://console.aws.amazon.com/cloudwatch/home?region=%s#logsV2:logs-insights$3FqueryDetail$3D~(editorString~'%s~source~(~'%s))", region, queryParam, logGroupParam)
destinationURL := fmt.Sprintf("https://%s.console.aws.amazon.com/cloudwatch/home#logsV2:logs-insights$3FqueryDetail$3D~(editorString~'%s~source~(~'%s))", region, queryParam, logGroupParam)
signinURL, err := a.GetConsoleURL(destinationURL)
checkErr(err)
browser.OpenURL(*signinURL)
Expand Down

0 comments on commit 3665242

Please sign in to comment.