(ctx context.Context, id string, edit *certificatedto.FileInput)
| 147 | } |
| 148 | |
| 149 | func (m *imlCertificate) Update(ctx context.Context, id string, edit *certificatedto.FileInput) error { |
| 150 | old, _, err := m.service.Get(ctx, id) |
| 151 | if err != nil { |
| 152 | return err |
| 153 | } |
| 154 | clusters, err := m.clusterService.ListByClusters(ctx, old.Cluster) |
| 155 | if err != nil { |
| 156 | return err |
| 157 | } |
| 158 | return m.transaction.Transaction(ctx, func(ctx context.Context) error { |
| 159 | version := time.Now().Format("20060102150405") |
| 160 | for _, c := range clusters { |
| 161 | err = m.syncGateway(ctx, c.Uuid, &gateway.DynamicRelease{ |
| 162 | BasicItem: &gateway.BasicItem{ |
| 163 | ID: id, |
| 164 | Description: "", |
| 165 | Version: version, |
| 166 | MatchLabels: map[string]string{ |
| 167 | "module": "certificate", |
| 168 | }, |
| 169 | }, |
| 170 | Attr: map[string]interface{}{ |
| 171 | "key": edit.Key, |
| 172 | "pem": edit.Cert, |
| 173 | }, |
| 174 | }, true) |
| 175 | if err != nil { |
| 176 | return err |
| 177 | } |
| 178 | } |
| 179 | _, err = m.save(ctx, id, old.Cluster, edit) |
| 180 | if err != nil { |
| 181 | return err |
| 182 | } |
| 183 | return nil |
| 184 | }) |
| 185 | } |
| 186 | func (m *imlCertificate) List(ctx context.Context) ([]*certificatedto.Certificate, error) { |
| 187 | certs, err := m.service.List(ctx, cluster.DefaultClusterID) |
| 188 | if err != nil { |
nothing calls this directly
no test coverage detected