-
Notifications
You must be signed in to change notification settings - Fork 20
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
Deploy & other basic commands #4
Conversation
|
||
func (s *LeasesService) LoginToLease(loginAcctID, loginLeaseID string, loginOpenBrowser bool) { | ||
if loginAcctID != "" && loginLeaseID != "" { | ||
log.Println("Please specify either --lease-id or --acctount-id, not both.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The endpoint for this will only be based on the lease ID. I guess we could go the other way too but that isn't the current plan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You working on testing?
pkg/service/accounts.go
Outdated
}) | ||
|
||
body, _ := ioutil.ReadAll(response.Body) | ||
fmt.Println("Response: ", response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer the output to only be json. Then I can pipe it our output it more easily.
fmt.Println("Posting to: ", accountsFullURL) | ||
fmt.Println("Post body: ", requestBody) | ||
|
||
response := s.Util.Request(&util.ApiRequestInput{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be looking for an err here? What happens if this request fails?
Exit codes should not be 0 and the appropriate error message printed.
} | ||
|
||
// Create API request | ||
req, err := http.NewRequest(input.Method, input.Url, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where we are collecting an err we should be testing that its null before continuing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll clean up the error handling and logging once I write some tests for this. I neglected those things since there was a lot of discovery work here and because we've gone back and forth a bit on the requirements for the CLI.
@kddejong, @joshmarsh - Let's call this sufficient as a POC. Please have tests and error handling as a follow up in your coming PR. |
Goal
POC the core functionality of the CLI.
Important Notes
Current Functionality:
dce init
uses an interactive prompt to generate a config filedce deploy
deploys dce to a new master account based on credentials in the config file. Terraform and code artifacts are downloaded from the latest github release.dce auth
opens a web browser to the authentication (SSO) url provided in the config file. User is instructed to login and then copy/paste their API credentials into the terminal. This is not yet integrated with the backend auth solution.dce accounts add --account-id <string> --admin-role-arn <string>
adds an existing account to the accounts pool Bug: The codebuild reset is currently failing to trigger on master accounts deployed by the cli.dce leases create --budget-amount <float> --budget-currency <string> --email <stringArray> --principle-id <string>
creates a leasedce leases login [--account-id <string> | --lease-id <string>] --open-browser
returns temporary credentials for a leased account. Opens a browser to the console if the --open-browser flag is present. This is not yet integrated with the backend auth solution.dce leases end --account-id <string> --principle-id <string>
ends a leasedce accounts remove --account-id <string>
Next Steps:
dce deploy
flags/interactive prompt from variables.tf and API client code/commands from swagger.