(ctx context.Context, resources ...*gateway.ServiceRelease)
| 31 | } |
| 32 | |
| 33 | func (s *ServiceClient) Offline(ctx context.Context, resources ...*gateway.ServiceRelease) error { |
| 34 | s.client.Begin(ctx) |
| 35 | for _, r := range resources { |
| 36 | for _, api := range r.Apis { |
| 37 | err := s.client.HDel(ctx, fmt.Sprintf("%s:%s", KeyServiceOfApi, api), r.ID) |
| 38 | if err != nil { |
| 39 | s.client.Rollback(ctx) |
| 40 | return err |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | return s.client.Commit(ctx) |
| 45 | } |
| 46 | |
| 47 | func NewServiceClient(client admin_client.Client) *ServiceClient { |
| 48 | return &ServiceClient{client: client} |