MCPcopy
hub / github.com/cloudfoundry/cli / CreateManagedServiceInstance

Method CreateManagedServiceInstance

actor/v7action/service_instance.go:68–108  ·  view source on GitHub ↗
(params CreateManagedServiceInstanceParams)

Source from the content-addressed store, hash-verified

66}
67
68func (actor Actor) CreateManagedServiceInstance(params CreateManagedServiceInstanceParams) (chan PollJobEvent, Warnings, error) {
69 var (
70 servicePlan resources.ServicePlan
71 jobURL ccv3.JobURL
72 )
73
74 warnings, err := railway.Sequentially(
75 func() (warnings ccv3.Warnings, err error) {
76 var v7Warnings Warnings
77 servicePlan, v7Warnings, err = actor.GetServicePlanByNameOfferingAndBroker(
78 params.ServicePlanName,
79 params.ServiceOfferingName,
80 params.ServiceBrokerName,
81 )
82 return ccv3.Warnings(v7Warnings), err
83 },
84 func() (warnings ccv3.Warnings, err error) {
85 serviceInstance := resources.ServiceInstance{
86 Type: resources.ManagedServiceInstance,
87 Name: params.ServiceInstanceName,
88 ServicePlanGUID: servicePlan.GUID,
89 SpaceGUID: params.SpaceGUID,
90 Tags: params.Tags,
91 Parameters: params.Parameters,
92 }
93
94 jobURL, warnings, err = actor.CloudControllerClient.CreateServiceInstance(serviceInstance)
95 return
96 },
97 )
98 switch e := err.(type) {
99 case nil:
100 return actor.PollJobToEventStream(jobURL), Warnings(warnings), nil
101 case actionerror.DuplicateServicePlanError:
102 return nil, Warnings(warnings), actionerror.ServiceBrokerNameRequiredError{
103 ServiceOfferingName: e.ServiceOfferingName,
104 }
105 default:
106 return nil, Warnings(warnings), err
107 }
108}
109
110func (actor Actor) UpdateManagedServiceInstance(params UpdateManagedServiceInstanceParams) (chan PollJobEvent, Warnings, error) {
111 var (

Callers

nothing calls this directly

Implementers 1

FakeActorcommand/v7/v7fakes/fake_actor.go

Calls 6

PollJobToEventStreamMethod · 0.95
SequentiallyFunction · 0.92
WarningsTypeAlias · 0.92
WarningsTypeAlias · 0.70
CreateServiceInstanceMethod · 0.65

Tested by

no test coverage detected