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

Method getCertificates

module/certificate/impl.go:37–64  ·  view source on GitHub ↗
(ctx context.Context, clusterId string)

Source from the content-addressed store, hash-verified

35}
36
37func (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
66func (m *imlCertificate) initGateway(ctx context.Context, clusterId string, clientDriver gateway.IClientDriver) error {
67 certificateClient, err := clientDriver.Dynamic("certificate")

Callers 1

initGatewayMethod · 0.95

Calls 2

ListMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected