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

Method Create

module/certificate/impl.go:118–147  ·  view source on GitHub ↗
(ctx context.Context, create *certificatedto.FileInput)

Source from the content-addressed store, hash-verified

116}
117
118func (m *imlCertificate) Create(ctx context.Context, create *certificatedto.FileInput) error {
119
120 return m.transaction.Transaction(ctx, func(ctx context.Context) error {
121 id := uuid.New().String()
122 version := time.Now().Format("20060102150405")
123 err := m.syncGateway(ctx, cluster.DefaultClusterID, &gateway.DynamicRelease{
124 BasicItem: &gateway.BasicItem{
125 ID: id,
126 Description: "",
127 Version: version,
128 MatchLabels: map[string]string{
129 "module": "certificate",
130 },
131 },
132 Attr: map[string]interface{}{
133 "key": create.Key,
134 "pem": create.Cert,
135 },
136 }, true)
137 if err != nil {
138 return err
139 }
140 _, err = m.save(ctx, id, cluster.DefaultClusterID, create)
141 if err != nil {
142 return err
143 }
144 return nil
145 })
146
147}
148
149func (m *imlCertificate) Update(ctx context.Context, id string, edit *certificatedto.FileInput) error {
150 old, _, err := m.service.Get(ctx, id)

Callers

nothing calls this directly

Calls 3

syncGatewayMethod · 0.95
saveMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected