([]string)
| 24 | } |
| 25 | |
| 26 | func (cmd CreateSpaceQuotaCommand) Execute([]string) error { |
| 27 | err := cmd.SharedActor.CheckTarget(true, false) |
| 28 | if err != nil { |
| 29 | return err |
| 30 | } |
| 31 | |
| 32 | user, err := cmd.Actor.GetCurrentUser() |
| 33 | if err != nil { |
| 34 | return err |
| 35 | } |
| 36 | |
| 37 | cmd.UI.DisplayTextWithFlavor("Creating space quota {{.SpaceQuota}} for org {{.CurrentOrg}} as {{.CurrentUser}}...", map[string]interface{}{ |
| 38 | "SpaceQuota": cmd.RequiredArgs.SpaceQuota, |
| 39 | "CurrentOrg": cmd.Config.TargetedOrganization().Name, |
| 40 | "CurrentUser": user.Name, |
| 41 | }) |
| 42 | |
| 43 | warnings, err := cmd.Actor.CreateSpaceQuota( |
| 44 | cmd.RequiredArgs.SpaceQuota, |
| 45 | cmd.Config.TargetedOrganization().GUID, |
| 46 | v7action.QuotaLimits{ |
| 47 | TotalMemoryInMB: convertMegabytesFlagToNullInt(cmd.TotalMemory), |
| 48 | PerProcessMemoryInMB: convertMegabytesFlagToNullInt(cmd.PerProcessMemory), |
| 49 | TotalInstances: convertIntegerLimitFlagToNullInt(cmd.NumAppInstances), |
| 50 | PaidServicesAllowed: &cmd.PaidServicePlans, |
| 51 | TotalServiceInstances: convertIntegerLimitFlagToNullInt(cmd.TotalServiceInstances), |
| 52 | TotalRoutes: convertIntegerLimitFlagToNullInt(cmd.TotalRoutes), |
| 53 | TotalReservedPorts: convertIntegerLimitFlagToNullInt(cmd.TotalReservedPorts), |
| 54 | TotalLogVolume: convertBytesFlagToNullInt(cmd.TotalLogVolume), |
| 55 | }, |
| 56 | ) |
| 57 | |
| 58 | cmd.UI.DisplayWarnings(warnings) |
| 59 | if err != nil { |
| 60 | switch err.(type) { |
| 61 | case ccerror.QuotaAlreadyExists: |
| 62 | cmd.UI.DisplayWarning(err.Error()) |
| 63 | default: |
| 64 | return err |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | cmd.UI.DisplayOK() |
| 69 | |
| 70 | return nil |
| 71 | } |
nothing calls this directly
no test coverage detected