MCPcopy Create free account
hub / github.com/cloudfoundry/cli / Execute

Method Execute

cf/commands/space/allow_space_ssh.go:61–87  ·  view source on GitHub ↗
(fc flags.FlagContext)

Source from the content-addressed store, hash-verified

59}
60
61func (cmd *AllowSpaceSSH) Execute(fc flags.FlagContext) error {
62 space := cmd.spaceReq.GetSpace()
63
64 if space.AllowSSH {
65 cmd.ui.Say(T("ssh support is already enabled in space '{{.SpaceName}}'",
66 map[string]interface{}{
67 "SpaceName": space.Name,
68 },
69 ))
70 return nil
71 }
72
73 cmd.ui.Say(T("Enabling ssh support for space '{{.SpaceName}}'...",
74 map[string]interface{}{
75 "SpaceName": space.Name,
76 },
77 ))
78 cmd.ui.Say("")
79
80 err := cmd.spaceRepo.SetAllowSSH(space.GUID, true)
81 if err != nil {
82 return errors.New(T("Error enabling ssh support for space ") + space.Name + ": " + err.Error())
83 }
84
85 cmd.ui.Ok()
86 return nil
87}

Callers

nothing calls this directly

Calls 5

GetSpaceMethod · 0.65
SayMethod · 0.65
SetAllowSSHMethod · 0.65
ErrorMethod · 0.65
OkMethod · 0.65

Tested by

no test coverage detected