(ctx context.Context, orgID, integrationID string)
| 301 | } |
| 302 | |
| 303 | func (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 | |
| 338 | type ListAttachmentsOpts struct { |
| 339 | // limit search for a particular workflow |
nothing calls this directly
no test coverage detected