github.com/loafoe/cli@v7.1.0+incompatible/command/v7/reset_org_default_isolation_segment_command.go (about) 1 package v7 2 3 import ( 4 "code.cloudfoundry.org/cli/command/flag" 5 ) 6 7 type ResetOrgDefaultIsolationSegmentCommand struct { 8 BaseCommand 9 10 RequiredArgs flag.ResetOrgDefaultIsolationArgs `positional-args:"yes"` 11 usage interface{} `usage:"CF_NAME reset-org-default-isolation-segment ORG_NAME"` 12 relatedCommands interface{} `related_commands:"org, restart"` 13 } 14 15 func (cmd ResetOrgDefaultIsolationSegmentCommand) Execute(args []string) error { 16 err := cmd.SharedActor.CheckTarget(true, false) 17 if err != nil { 18 return err 19 } 20 21 user, err := cmd.Config.CurrentUser() 22 if err != nil { 23 return err 24 } 25 26 cmd.UI.DisplayTextWithFlavor("Resetting default isolation segment of org {{.OrgName}} as {{.CurrentUser}}...", map[string]interface{}{ 27 "OrgName": cmd.RequiredArgs.OrgName, 28 "CurrentUser": user.Name, 29 }) 30 31 organization, warnings, err := cmd.Actor.GetOrganizationByName(cmd.RequiredArgs.OrgName) 32 cmd.UI.DisplayWarnings(warnings) 33 if err != nil { 34 return err 35 } 36 37 warnings, err = cmd.Actor.ResetOrganizationDefaultIsolationSegment(organization.GUID) 38 cmd.UI.DisplayWarnings(warnings) 39 if err != nil { 40 return err 41 } 42 43 cmd.UI.DisplayOK() 44 cmd.UI.DisplayText("TIP: Restart applications in spaces without assigned isolation segments to move them to the platform default.") 45 46 return nil 47 }