(ctx context.Context, clusterId string)
| 35 | } |
| 36 | |
| 37 | func (m *imlCertificate) getCertificates(ctx context.Context, clusterId string) ([]*gateway.DynamicRelease, error) { |
| 38 | certs, err := m.service.List(ctx, clusterId) |
| 39 | if err != nil { |
| 40 | return nil, err |
| 41 | } |
| 42 | publishCerts := make([]*gateway.DynamicRelease, 0, len(certs)) |
| 43 | for _, cert := range certs { |
| 44 | _, certFile, err := m.service.Get(ctx, cert.ID) |
| 45 | if err != nil { |
| 46 | return nil, err |
| 47 | } |
| 48 | publishCerts = append(publishCerts, &gateway.DynamicRelease{ |
| 49 | BasicItem: &gateway.BasicItem{ |
| 50 | ID: cert.ID, |
| 51 | Description: "", |
| 52 | Version: cert.UpdateTime.Format("20060102150405"), |
| 53 | MatchLabels: map[string]string{ |
| 54 | "module": "certificate", |
| 55 | }, |
| 56 | }, |
| 57 | Attr: map[string]interface{}{ |
| 58 | "key": certFile.Key, |
| 59 | "pem": certFile.Cert, |
| 60 | }, |
| 61 | }) |
| 62 | } |
| 63 | return publishCerts, nil |
| 64 | } |
| 65 | |
| 66 | func (m *imlCertificate) initGateway(ctx context.Context, clusterId string, clientDriver gateway.IClientDriver) error { |
| 67 | certificateClient, err := clientDriver.Dynamic("certificate") |
no test coverage detected