github.com/niteshexa/cloudfoundry_cli@v7.1.0+incompatible/command/v7/disable_org_isolation_command.go (about)

     1  package v7
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/command/flag"
     5  )
     6  
     7  type DisableOrgIsolationCommand struct {
     8  	BaseCommand
     9  
    10  	RequiredArgs    flag.OrgIsolationArgs `positional-args:"yes"`
    11  	usage           interface{}           `usage:"CF_NAME disable-org-isolation ORG_NAME SEGMENT_NAME"`
    12  	relatedCommands interface{}           `related_commands:"enable-org-isolation, isolation-segments"`
    13  }
    14  
    15  func (cmd DisableOrgIsolationCommand) Execute(args []string) error {
    16  	err := cmd.SharedActor.CheckTarget(false, false)
    17  	if err != nil {
    18  		return err
    19  	}
    20  	user, err := cmd.Config.CurrentUser()
    21  	if err != nil {
    22  		return err
    23  	}
    24  
    25  	cmd.UI.DisplayTextWithFlavor("Removing entitlement to isolation segment {{.SegmentName}} from 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.DeleteIsolationSegmentOrganizationByName(cmd.RequiredArgs.IsolationSegmentName, cmd.RequiredArgs.OrganizationName)
    32  
    33  	cmd.UI.DisplayWarnings(warnings)
    34  
    35  	if err != nil {
    36  		return err
    37  	}
    38  
    39  	cmd.UI.DisplayOK()
    40  
    41  	return nil
    42  }