github.com/loafoe/cli@v7.1.0+incompatible/command/v7/enable_org_isolation_command.go (about) 1 package v7 2 3 import ( 4 "code.cloudfoundry.org/cli/command/flag" 5 ) 6 7 type EnableOrgIsolationCommand struct { 8 BaseCommand 9 RequiredArgs flag.OrgIsolationArgs `positional-args:"yes"` 10 usage interface{} `usage:"CF_NAME enable-org-isolation ORG_NAME SEGMENT_NAME"` 11 relatedCommands interface{} `related_commands:"create-isolation-segment, isolation-segments, set-org-default-isolation-segment, set-space-isolation-segment"` 12 } 13 14 func (cmd EnableOrgIsolationCommand) Execute(args []string) error { 15 err := cmd.SharedActor.CheckTarget(false, false) 16 if err != nil { 17 return err 18 } 19 20 user, err := cmd.Config.CurrentUser() 21 if err != nil { 22 return err 23 } 24 25 cmd.UI.DisplayTextWithFlavor("Enabling isolation segment {{.SegmentName}} for org {{.OrgName}} as {{.CurrentUser}}...", map[string]interface{}{ 26 "SegmentName": cmd.RequiredArgs.IsolationSegmentName, 27 "OrgName": cmd.RequiredArgs.OrganizationName, 28 "CurrentUser": user.Name, 29 }) 30 31 warnings, err := cmd.Actor.EntitleIsolationSegmentToOrganizationByName(cmd.RequiredArgs.IsolationSegmentName, cmd.RequiredArgs.OrganizationName) 32 cmd.UI.DisplayWarnings(warnings) 33 if err != nil { 34 return err 35 } 36 37 cmd.UI.DisplayOK() 38 39 return nil 40 }