github.com/sleungcy-sap/cli@v7.1.0+incompatible/command/v7/space_ssh_allowed_command.go (about) 1 package v7 2 3 import ( 4 "code.cloudfoundry.org/cli/command/flag" 5 "code.cloudfoundry.org/cli/command/v7/shared" 6 ) 7 8 type SpaceSSHAllowedCommand struct { 9 BaseCommand 10 11 RequiredArgs flag.Space `positional-args:"yes"` 12 usage interface{} `usage:"CF_NAME space-ssh-allowed SPACE_NAME"` 13 relatedCommands interface{} `related_commands:"allow-space-ssh, ssh-enabled, ssh"` 14 } 15 16 func (cmd SpaceSSHAllowedCommand) Execute(args []string) error { 17 err := cmd.SharedActor.CheckTarget(true, false) 18 if err != nil { 19 return err 20 } 21 22 enabled, warnings, err := cmd.Actor.GetSpaceFeature(cmd.RequiredArgs.Space, cmd.Config.TargetedOrganization().GUID, "ssh") 23 cmd.UI.DisplayWarnings(warnings) 24 if err != nil { 25 return err 26 } 27 28 displayVal := shared.FlagBoolToString(enabled) 29 30 cmd.UI.DisplayText( 31 "ssh support is {{.DisplayVal}} in space '{{.SpaceName}}'.", 32 map[string]interface{}{ 33 "SpaceName": cmd.RequiredArgs.Space, 34 "DisplayVal": displayVal, 35 }, 36 ) 37 38 return nil 39 }