Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## vNext

**BREAKING CHANGES**
- Fix `--principle-id` flag to be `principal-id`
- Remove MasterAccountCreds from dce.yml. Use default AWS CLI creds instead
- Indent JSON output from CLI commands

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ This is the CLI for [DCE](https://github.com/Optum/dce) by Optum. For usage info
10. Now that your accounts pool isn't emtpy, you can create your first lease using the `dce leases create` command

```
➜ ~ dce leases create --budget-amount 100.0 --budget-currency USD --email [email protected] --principle-id jdoe99
➜ ~ dce leases create --budget-amount 100.0 --budget-currency USD --email [email protected] --principal-id jdoe99
```

11. Type `dce leases list` to verify that a lease has been created
Expand Down Expand Up @@ -118,7 +118,7 @@ Opening AWS Console in Web Browser

14. You can end a lease using the `dce leases end` command
```
➜ ~ dce leases end --account-id 555555555555 --principle-id jdoe99
➜ ~ dce leases end --account-id 555555555555 --principal-id jdoe99
```

15. You can remove an account from the accounts pool using the `dce accounts remove` command
Expand Down
18 changes: 9 additions & 9 deletions cmd/leases.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var loginOpenBrowser bool
var loginPrintCreds bool
var loginProfile string

var principleID string
var principalID string
var budgetAmount float64
var budgetCurrency string
var email []string
Expand All @@ -30,23 +30,23 @@ func init() {
leasesListCmd.Flags().Int64VarP(&pagLimit, "limit", "l", defaultPagLiimt, "Max number of leases to return at once. Will include url to next page if there is one.")
leasesListCmd.Flags().StringVarP(&nextAcctID, "next-account-id", "", "", "Account ID with which to begin the scan operation. This is used to traverse through paginated results.")
leasesListCmd.Flags().StringVarP(&nextPrincipalID, "next-principal-id", "", "", "Principal ID with which to begin the scan operation. This is used to traverse through paginated results.")
leasesListCmd.Flags().StringVarP(&principleID, "principle-id", "p", "", "Principle ID of a user")
leasesListCmd.Flags().StringVarP(&principalID, "principal-id", "p", "", "Principle ID of a user")
leasesListCmd.Flags().StringVarP(&leaseStatus, "status", "s", "", "Lease status")
leasesCmd.AddCommand(leasesListCmd)

leasesCreateCmd.Flags().StringVarP(&principleID, "principle-id", "p", "", "Principle ID for the user of the leased account")
leasesCreateCmd.Flags().StringVarP(&principalID, "principal-id", "p", "", "Principle ID for the user of the leased account")
leasesCreateCmd.Flags().Float64VarP(&budgetAmount, "budget-amount", "b", 0, "The leased accounts budget amount")
leasesCreateCmd.Flags().StringVarP(&budgetCurrency, "budget-currency", "c", "USD", "The leased accounts budget currency")
leasesCreateCmd.Flags().StringArrayVarP(&email, "email", "e", nil, "The email address that budget notifications will be sent to")
leasesCreateCmd.MarkFlagRequired("principle-id")
leasesCreateCmd.MarkFlagRequired("principal-id")
leasesCreateCmd.MarkFlagRequired("budget-amount")
leasesCreateCmd.MarkFlagRequired("budget-currency")
leasesCreateCmd.MarkFlagRequired("email")
leasesCmd.AddCommand(leasesCreateCmd)

leasesEndCmd.Flags().StringVarP(&principleID, "principle-id", "p", "", "Principle ID for the user of the leased account")
leasesEndCmd.Flags().StringVarP(&principalID, "principal-id", "p", "", "Principle ID for the user of the leased account")
leasesEndCmd.Flags().StringVarP(&accountID, "account-id", "a", "", "Account ID associated with the lease you wish to end")
leasesEndCmd.MarkFlagRequired("principle-id")
leasesEndCmd.MarkFlagRequired("principal-id")
leasesEndCmd.MarkFlagRequired("account-id")
leasesCmd.AddCommand(leasesEndCmd)

Expand Down Expand Up @@ -77,7 +77,7 @@ var leasesListCmd = &cobra.Command{
Short: "List leases using various query filters.",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
service.ListLeases(acctID, principleID, nextAcctID, nextPrincipalID, leaseStatus, pagLimit)
service.ListLeases(acctID, principalID, nextAcctID, nextPrincipalID, leaseStatus, pagLimit)
},
}

Expand All @@ -86,7 +86,7 @@ var leasesCreateCmd = &cobra.Command{
Short: "Create a lease.",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
service.CreateLease(principleID, budgetAmount, budgetCurrency, email)
service.CreateLease(principalID, budgetAmount, budgetCurrency, email)
},
}

Expand All @@ -95,7 +95,7 @@ var leasesEndCmd = &cobra.Command{
Short: "Cause a lease to immediately expire",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
service.EndLease(accountID, principleID)
service.EndLease(accountID, principalID)
},
}

Expand Down
2 changes: 1 addition & 1 deletion docs/dce_leases_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dce leases create [flags]
-c, --budget-currency string The leased accounts budget currency (default "USD")
-e, --email stringArray The email address that budget notifications will be sent to
-h, --help help for create
-p, --principle-id string Principle ID for the user of the leased account
-p, --principal-id string Principle ID for the user of the leased account
```

### Options inherited from parent commands
Expand Down
2 changes: 1 addition & 1 deletion docs/dce_leases_end.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dce leases end [Lease ID] [flags]
```
-a, --account-id string Account ID associated with the lease you wish to end
-h, --help help for end
-p, --principle-id string Principle ID for the user of the leased account
-p, --principal-id string Principle ID for the user of the leased account
```

### Options inherited from parent commands
Expand Down
2 changes: 1 addition & 1 deletion docs/dce_leases_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dce leases list [flags]
-l, --limit int Max number of leases to return at once. Will include url to next page if there is one. (default 25)
--next-account-id string Account ID with which to begin the scan operation. This is used to traverse through paginated results.
--next-principal-id string Principal ID with which to begin the scan operation. This is used to traverse through paginated results.
-p, --principle-id string Principle ID of a user
-p, --principal-id string Principle ID of a user
-s, --status string Lease status
```

Expand Down
18 changes: 9 additions & 9 deletions mocks/Leaser.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pkg/service/leases.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ type LeasesService struct {
Util *utl.UtilContainer
}

func (s *LeasesService) CreateLease(principleID string, budgetAmount float64, budgetCurrency string, email []string) {
func (s *LeasesService) CreateLease(principalID string, budgetAmount float64, budgetCurrency string, email []string) {
params := &operations.PostLeasesParams{
Lease: operations.PostLeasesBody{
PrincipalID: &principleID,
PrincipalID: &principalID,
BudgetAmount: &budgetAmount,
BudgetCurrency: &budgetCurrency,
BudgetNotificationEmails: email,
Expand All @@ -42,11 +42,11 @@ func (s *LeasesService) CreateLease(principleID string, budgetAmount float64, bu
log.Infoln("Lease created:", string(jsonPayload))
}

func (s *LeasesService) EndLease(accountID, principleID string) {
func (s *LeasesService) EndLease(accountID, principalID string) {
params := &operations.DeleteLeasesParams{
Lease: operations.DeleteLeasesBody{
AccountID: &accountID,
PrincipalID: &principleID,
PrincipalID: &principalID,
},
}
params.SetTimeout(5 * time.Second)
Expand Down Expand Up @@ -74,13 +74,13 @@ func (s *LeasesService) GetLease(leaseID string) {

}

func (s *LeasesService) ListLeases(acctID, principleID, nextAcctID, nextPrincipalID, leaseStatus string, pagLimit int64) {
func (s *LeasesService) ListLeases(acctID, principalID, nextAcctID, nextPrincipalID, leaseStatus string, pagLimit int64) {
params := &operations.GetLeasesParams{
AccountID: &acctID,
Limit: &pagLimit,
NextAccountID: &nextAcctID,
NextPrincipalID: &nextPrincipalID,
PrincipalID: &principleID,
PrincipalID: &principalID,
Status: &leaseStatus,
}
params.SetTimeout(5 * time.Second)
Expand Down
6 changes: 3 additions & 3 deletions pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ type Accounter interface {
}

type Leaser interface {
CreateLease(principleID string, budgetAmount float64, budgetCurrency string, email []string)
EndLease(accountID, principleID string)
CreateLease(principalID string, budgetAmount float64, budgetCurrency string, email []string)
EndLease(accountID, principalID string)
LoginToLease(leaseID, profile string, loginOpenBrowser, loginPrintCreds bool)
ListLeases(acctID, principleID, nextAcctID, nextPrincipalID, leaseStatus string, pagLimit int64)
ListLeases(acctID, principalID, nextAcctID, nextPrincipalID, leaseStatus string, pagLimit int64)
GetLease(leaseID string)
}

Expand Down