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

Method Create

module/system-apikey/iml.go:205–225  ·  view source on GitHub ↗
(ctx context.Context, input *system_apikey_dto.Create)

Source from the content-addressed store, hash-verified

203}
204
205func (i *imlAPIKeyModule) Create(ctx context.Context, input *system_apikey_dto.Create) error {
206 if input.Id == "" {
207 input.Id = uuid.NewString()
208 }
209 return i.transaction.Transaction(ctx, func(ctx context.Context) error {
210 err := i.apikeyService.Create(ctx, &system_apikey.Create{
211 Id: input.Id,
212 Name: input.Name,
213 Value: input.Value,
214 Expired: input.Expired,
215 })
216 if err != nil {
217 return err
218 }
219 client, err := i.clusterServer.GatewayClient(ctx, cluster.DefaultClusterID)
220 if err != nil {
221 return err
222 }
223 return i.online(ctx, client)
224 })
225}
226
227func (i *imlAPIKeyModule) Update(ctx context.Context, id string, input *system_apikey_dto.Update) error {
228 return i.transaction.Transaction(ctx, func(ctx context.Context) error {

Callers

nothing calls this directly

Calls 3

onlineMethod · 0.95
CreateMethod · 0.65
GatewayClientMethod · 0.65

Tested by

no test coverage detected