MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / DeleteSubscriber

Method DeleteSubscriber

module/subscribe/iml.go:286–319  ·  view source on GitHub ↗
(ctx context.Context, service string, serviceId string, applicationId string)

Source from the content-addressed store, hash-verified

284}
285
286func (i *imlSubscribeModule) DeleteSubscriber(ctx context.Context, service string, serviceId string, applicationId string) error {
287 _, err := i.serviceService.Get(ctx, service)
288 if err != nil {
289 return err
290 }
291 clusters, err := i.clusterService.List(ctx)
292 if err != nil {
293 return err
294 }
295
296 return i.transaction.Transaction(ctx, func(ctx context.Context) error {
297 list, err := i.subscribeService.ListByApplication(ctx, serviceId, applicationId)
298 if err != nil {
299 return err
300 }
301 releaseInfo := &gateway.SubscribeRelease{
302 Service: serviceId,
303 Application: applicationId,
304 }
305 for _, s := range list {
306 err = i.subscribeService.Delete(ctx, s.Id)
307 if err != nil {
308 return err
309 }
310 }
311 for _, c := range clusters {
312 err = i.offlineForCluster(ctx, c.Uuid, releaseInfo)
313 if err != nil {
314 return fmt.Errorf("offline subscribe for cluster[%s] %s", c.Uuid, err)
315 }
316 }
317 return nil
318 })
319}
320func (i *imlSubscribeModule) offlineForCluster(ctx context.Context, clusterId string, config *gateway.SubscribeRelease) error {
321
322 client, err := i.clusterService.GatewayClient(ctx, clusterId)

Callers

nothing calls this directly

Calls 5

offlineForClusterMethod · 0.95
GetMethod · 0.65
ListMethod · 0.65
ListByApplicationMethod · 0.65
DeleteMethod · 0.65

Tested by

no test coverage detected