github.com/sleungcy-sap/cli@v7.1.0+incompatible/command/v7/share_private_domain_command.go (about) 1 package v7 2 3 import ( 4 "code.cloudfoundry.org/cli/command/flag" 5 ) 6 7 type SharePrivateDomainCommand struct { 8 BaseCommand 9 10 RequiredArgs flag.OrgDomain `positional-args:"yes"` 11 usage interface{} `usage:"CF_NAME share-private-domain ORG DOMAIN"` 12 relatedCommands interface{} `related_commands:"create-private-domain, domains, unshare-private-domain"` 13 } 14 15 func (cmd SharePrivateDomainCommand) Execute(args []string) error { 16 err := cmd.SharedActor.CheckTarget(false, 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 domain := cmd.RequiredArgs.Domain 27 orgName := cmd.RequiredArgs.Organization 28 29 cmd.UI.DisplayTextWithFlavor("Sharing domain {{.Domain}} with org {{.Organization}} as {{.User}}...", 30 map[string]interface{}{ 31 "Domain": domain, 32 "User": user.Name, 33 "Organization": orgName, 34 }) 35 36 warnings, err := cmd.Actor.SharePrivateDomain(domain, orgName) 37 cmd.UI.DisplayWarnings(warnings) 38 if err != nil { 39 return err 40 } 41 42 cmd.UI.DisplayOK() 43 44 return nil 45 }