Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add profile support #92

Closed
wants to merge 4 commits into from
Closed

Add profile support #92

wants to merge 4 commits into from

Conversation

jamesls
Copy link
Member

@jamesls jamesls commented Dec 30, 2015

This PR adds profile support:

Using the new argument:

$ aws-shell --profile prod

Using the dot command:

$ aws-shell
aws> .profile
Current shell profile: no profile configured
You can change profiles using: .profile profile-name
aws> .profile demo
Current shell profile changed to: demo
aws> .profile
Current shell profile: demo
aws> s3api list-buckets       # <---- will use the "demo" profile.  Also server side completion will use the "demo" profile

Because this is using the updated internal APIs from the server side completion fix, this PR is using server-side-fix as the base branch to make it easier to review.

@jamesls jamesls mentioned this pull request Dec 30, 2015
@donnemartin
Copy link
Collaborator

Awesome, this will be a great addition. Couple questions:

$ aws-shell
aws> .profile
Current shell profile: no profile configured
You can change profiles using: .profile profile-name

If the user doesn't specify a profile, should the default profile automatically be chosen? Or is that what is meant by "no profile configured"?

Curious what the user sees if an invalid profile is specified. Let's say 'default' and 'prod' are available but 'beta' is chosen.

I'm a little short on time this morning, lots of PRs to review :) usually I'd do more testing myself.

:shipit:

@jamesls
Copy link
Member Author

jamesls commented Dec 30, 2015

If the user doesn't specify a profile, should the default profile automatically be chosen? Or is that what is meant by "no profile configured"?

If no profile is specified in the shell (via aws-shell --profile or .profile), then we'll fall back to the logic in the AWS CLI, which will first look at AWS_DEFAULT_PROFILE before falling back to the default profile if it exists. If there's no default profile we'll start looking at other credential providers for credentials.

Curious what the user sees if an invalid profile is specified. Let's say 'default' and 'prod' are available but 'beta' is chosen.

There's no validation at the time of switching profiles that the profile does not exist, you'll just get an error when you try to make a CLI call. The previous PR fixes the issue with crashing if we can't create a client, which would also cover this case. I think it'd be cool to autocomplete profile names in the future.

Right now, here's the behavior:

$ aws-shell
aws> .profile badprofile
Current shell profile changed to: badprofile
aws> s3 ls

The config profile (badprofile) could not be found
aws> iam delete-user --user-name        #<--- no autocomplete happens because we can't create a client for the "badprofile" profile

@jamesls
Copy link
Member Author

jamesls commented Dec 30, 2015

Merged via 65d4917

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants