(args []string)
| 26 | } |
| 27 | |
| 28 | func (cmd UpdateOrgQuotaCommand) Execute(args []string) error { |
| 29 | if cmd.PaidServicePlans && cmd.NoPaidServicePlans { |
| 30 | return translatableerror.ArgumentCombinationError{ |
| 31 | Args: []string{"--allow-paid-service-plans", "--disallow-paid-service-plans"}, |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | err := cmd.SharedActor.CheckTarget(false, false) |
| 36 | if err != nil { |
| 37 | return err |
| 38 | } |
| 39 | |
| 40 | user, err := cmd.Actor.GetCurrentUser() |
| 41 | if err != nil { |
| 42 | return err |
| 43 | } |
| 44 | |
| 45 | oldQuotaName := cmd.RequiredArgs.OrganizationQuotaName |
| 46 | |
| 47 | cmd.UI.DisplayTextWithFlavor("Updating org quota {{.OrganizationQuotaName}} as {{.User}}...", |
| 48 | map[string]interface{}{ |
| 49 | "OrganizationQuotaName": oldQuotaName, |
| 50 | "User": user.Name, |
| 51 | }) |
| 52 | |
| 53 | var paidServicesAllowed *bool |
| 54 | if cmd.PaidServicePlans || cmd.NoPaidServicePlans { |
| 55 | paidServicesAllowed = &cmd.PaidServicePlans |
| 56 | } |
| 57 | |
| 58 | updatedQuotaLimits := v7action.QuotaLimits{ |
| 59 | TotalMemoryInMB: convertMegabytesFlagToNullInt(cmd.TotalMemory), |
| 60 | PerProcessMemoryInMB: convertMegabytesFlagToNullInt(cmd.PerProcessMemory), |
| 61 | TotalInstances: convertIntegerLimitFlagToNullInt(cmd.NumAppInstances), |
| 62 | PaidServicesAllowed: paidServicesAllowed, |
| 63 | TotalServiceInstances: convertIntegerLimitFlagToNullInt(cmd.TotalServiceInstances), |
| 64 | TotalRoutes: convertIntegerLimitFlagToNullInt(cmd.TotalRoutes), |
| 65 | TotalReservedPorts: convertIntegerLimitFlagToNullInt(cmd.TotalReservedPorts), |
| 66 | TotalLogVolume: convertBytesFlagToNullInt(cmd.TotalLogVolume), |
| 67 | } |
| 68 | |
| 69 | warnings, err := cmd.Actor.UpdateOrganizationQuota(oldQuotaName, cmd.NewName, updatedQuotaLimits) |
| 70 | cmd.UI.DisplayWarnings(warnings) |
| 71 | if err != nil { |
| 72 | return err |
| 73 | } |
| 74 | |
| 75 | cmd.UI.DisplayOK() |
| 76 | |
| 77 | return nil |
| 78 | } |
nothing calls this directly
no test coverage detected