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

Method Detach

app/controlplane/pkg/biz/integration.go:375–397  ·  view source on GitHub ↗

Detach integration from workflow

(ctx context.Context, orgID, attachmentID string)

Source from the content-addressed store, hash-verified

373
374// Detach integration from workflow
375func (uc *IntegrationUseCase) Detach(ctx context.Context, orgID, attachmentID string) error {
376 ctx, span := otelx.Start(ctx, integrationTracer, "IntegrationUseCase.Detach")
377 defer span.End()
378
379 orgUUID, err := uuid.Parse(orgID)
380 if err != nil {
381 return NewErrInvalidUUID(err)
382 }
383
384 attachmentUUID, err := uuid.Parse(attachmentID)
385 if err != nil {
386 return NewErrInvalidUUID(err)
387 }
388
389 // Make sure that the attachment is part of the provided organization
390 if attachment, err := uc.integrationARepo.FindByIDInOrg(ctx, orgUUID, attachmentUUID); err != nil {
391 return err
392 } else if attachment == nil {
393 return NewErrNotFound("attachment")
394 }
395
396 return uc.integrationARepo.SoftDelete(ctx, attachmentUUID)
397}
398
399func (uc *IntegrationUseCase) GetAttachment(ctx context.Context, orgID, attID uuid.UUID) (*IntegrationAttachment, error) {
400 ctx, span := otelx.Start(ctx, integrationTracer, "IntegrationUseCase.GetAttachment")

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected