MCPcopy Index your code
hub / github.com/cloudfoundry/cli / Execute

Method Execute

command/v7/share_service_command.go:23–56  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

21}
22
23func (cmd ShareServiceCommand) Execute(args []string) error {
24 if err := cmd.SharedActor.CheckTarget(true, true); err != nil {
25 return err
26 }
27
28 if err := cmd.displayIntro(); err != nil {
29 return err
30 }
31
32 warnings, err := cmd.Actor.ShareServiceInstanceToSpaceAndOrg(
33 string(cmd.RequiredArgs.ServiceInstance),
34 cmd.Config.TargetedSpace().GUID,
35 cmd.Config.TargetedOrganization().GUID,
36 v7action.ServiceInstanceSharingParams{
37 SpaceName: cmd.SpaceName,
38 OrgName: types.OptionalString(cmd.OrgName),
39 })
40
41 cmd.UI.DisplayWarnings(warnings)
42
43 switch err.(type) {
44 case nil:
45 case ccerror.ServiceInstanceAlreadySharedError:
46 cmd.UI.DisplayOK()
47 cmd.UI.DisplayTextWithFlavor("A service instance called {{.ServiceInstanceName}} has already been shared", map[string]interface{}{"ServiceInstanceName": cmd.RequiredArgs.ServiceInstance})
48 return nil
49 default:
50 return err
51 }
52
53 cmd.UI.DisplayOK()
54
55 return nil
56}
57
58func (cmd ShareServiceCommand) displayIntro() error {
59 user, err := cmd.Actor.GetCurrentUser()

Callers

nothing calls this directly

Calls 9

displayIntroMethod · 0.95
OptionalStringStruct · 0.92
CheckTargetMethod · 0.65
TargetedSpaceMethod · 0.65
TargetedOrganizationMethod · 0.65
DisplayWarningsMethod · 0.65
DisplayOKMethod · 0.65
DisplayTextWithFlavorMethod · 0.65

Tested by

no test coverage detected