MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / Delete

Method Delete

app/controlplane/pkg/biz/integration.go:303–336  ·  view source on GitHub ↗
(ctx context.Context, orgID, integrationID string)

Source from the content-addressed store, hash-verified

301}
302
303func (uc *IntegrationUseCase) Delete(ctx context.Context, orgID, integrationID string) error {
304 ctx, span := otelx.Start(ctx, integrationTracer, "IntegrationUseCase.Delete")
305 defer span.End()
306
307 orgUUID, err := uuid.Parse(orgID)
308 if err != nil {
309 return NewErrInvalidUUID(err)
310 }
311
312 integrationUUID, err := uuid.Parse(integrationID)
313 if err != nil {
314 return NewErrInvalidUUID(err)
315 }
316
317 uc.logger.Infow("msg", "deleting integration", "ID", integrationID)
318 // Make sure that the integration is from this org and it has not associated workflows
319 integration, err := uc.integrationRepo.FindByIDInOrg(ctx, orgUUID, integrationUUID)
320 if err != nil {
321 return err
322 } else if integration == nil {
323 return NewErrNotFound("integration")
324 }
325
326 if integration.SecretName != "" {
327 uc.logger.Infow("msg", "deleting integration external secrets", "ID", integrationID, "secretName", integration.SecretName)
328 if err := uc.credsRW.DeleteCredentials(ctx, integration.SecretName); err != nil {
329 uc.logger.Warnw("msg", "can't delete credentials", "name", integration.SecretName, "err", err)
330 }
331 }
332
333 uc.logger.Infow("msg", "integration deleted", "ID", integrationID)
334 // Check that the workflow to delete belongs to the provided organization
335 return uc.integrationRepo.SoftDelete(ctx, integrationUUID)
336}
337
338type ListAttachmentsOpts struct {
339 // limit search for a particular workflow

Callers

nothing calls this directly

Calls 9

StartFunction · 0.92
NewErrInvalidUUIDFunction · 0.85
ParseMethod · 0.80
NewErrNotFoundFunction · 0.70
InfowMethod · 0.65
FindByIDInOrgMethod · 0.65
DeleteCredentialsMethod · 0.65
WarnwMethod · 0.65
SoftDeleteMethod · 0.65

Tested by

no test coverage detected