| 118 | } |
| 119 | |
| 120 | func (p *ProjectClient) Offline(ctx context.Context, projects ...*gateway.ProjectRelease) error { |
| 121 | err := p.client.Begin(ctx) |
| 122 | if err != nil { |
| 123 | return err |
| 124 | } |
| 125 | for _, project := range projects { |
| 126 | err = p.delete(ctx, project.Id) |
| 127 | if err != nil { |
| 128 | p.client.Rollback(ctx) |
| 129 | return err |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | return p.client.Commit(ctx) |
| 134 | } |
| 135 | |
| 136 | func (p *ProjectClient) delete(ctx context.Context, id string) error { |
| 137 | err := p.deleteByLabels(ctx, gateway.ProfessionRouter, map[string]string{"project": id}) |