forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unset_space_quota_command.go
43 lines (33 loc) · 1.09 KB
/
unset_space_quota_command.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package v7
import (
"code.cloudfoundry.org/cli/command/flag"
)
type UnsetSpaceQuotaCommand struct {
BaseCommand
RequiredArgs flag.UnsetSpaceQuotaArgs `positional-args:"yes"`
usage interface{} `usage:"CF_NAME unset-space-quota SPACE SPACE_QUOTA"`
relatedCommands interface{} `related_commands:"space"`
}
func (cmd *UnsetSpaceQuotaCommand) Execute(args []string) error {
err := cmd.SharedActor.CheckTarget(true, false)
if err != nil {
return err
}
currentUser, err := cmd.Config.CurrentUserName()
if err != nil {
return err
}
targetedOrgGUID := cmd.Config.TargetedOrganization().GUID
cmd.UI.DisplayTextWithFlavor("Unassigning space quota {{.QuotaName}} from space {{.SpaceName}} as {{.UserName}}...", map[string]interface{}{
"QuotaName": cmd.RequiredArgs.SpaceQuota,
"SpaceName": cmd.RequiredArgs.Space,
"UserName": currentUser,
})
warnings, err := cmd.Actor.UnsetSpaceQuota(cmd.RequiredArgs.SpaceQuota, cmd.RequiredArgs.Space, targetedOrgGUID)
cmd.UI.DisplayWarnings(warnings)
if err != nil {
return err
}
cmd.UI.DisplayOK()
return nil
}