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

Method Execute

cf/commands/service/unbind_service.go:64–89  ·  view source on GitHub ↗
(c flags.FlagContext)

Source from the content-addressed store, hash-verified

62}
63
64func (cmd *UnbindService) Execute(c flags.FlagContext) error {
65 app := cmd.appReq.GetApplication()
66 instance := cmd.serviceInstanceReq.GetServiceInstance()
67
68 cmd.ui.Say(T("Unbinding app {{.AppName}} from service {{.ServiceName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.CurrentUser}}...",
69 map[string]interface{}{
70 "AppName": terminal.EntityNameColor(app.Name),
71 "ServiceName": terminal.EntityNameColor(instance.Name),
72 "OrgName": terminal.EntityNameColor(cmd.config.OrganizationFields().Name),
73 "SpaceName": terminal.EntityNameColor(cmd.config.SpaceFields().Name),
74 "CurrentUser": terminal.EntityNameColor(cmd.config.Username()),
75 }))
76
77 found, err := cmd.serviceBindingRepo.Delete(instance, app.GUID)
78 if err != nil {
79 return err
80 }
81
82 cmd.ui.Ok()
83
84 if !found {
85 cmd.ui.Warn(T("Binding between {{.InstanceName}} and {{.AppName}} did not exist",
86 map[string]interface{}{"InstanceName": instance.Name, "AppName": app.Name}))
87 }
88 return nil
89}

Callers

nothing calls this directly

Calls 10

EntityNameColorFunction · 0.92
GetApplicationMethod · 0.65
GetServiceInstanceMethod · 0.65
SayMethod · 0.65
OrganizationFieldsMethod · 0.65
SpaceFieldsMethod · 0.65
UsernameMethod · 0.65
DeleteMethod · 0.65
OkMethod · 0.65
WarnMethod · 0.65

Tested by

no test coverage detected