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

Method Create

app/controlplane/pkg/data/integration.go:46–68  ·  view source on GitHub ↗
(ctx context.Context, opts *biz.IntegrationCreateOpts)

Source from the content-addressed store, hash-verified

44}
45
46func (r *IntegrationRepo) Create(ctx context.Context, opts *biz.IntegrationCreateOpts) (*biz.Integration, error) {
47 ctx, span := otelx.Start(ctx, integrationRepoTracer, "IntegrationRepo.Create")
48 defer span.End()
49
50 integration, err := r.data.DB.Integration.Create().
51 SetName(opts.Name).
52 SetOrganizationID(opts.OrgID).
53 SetKind(opts.Kind).
54 SetDescription(opts.Description).
55 SetSecretName(opts.SecretName).
56 SetConfiguration(opts.Config).
57 Save(ctx)
58
59 if err != nil {
60 if ent.IsConstraintError(err) {
61 return nil, biz.NewErrAlreadyExists(err)
62 }
63
64 return nil, fmt.Errorf("failed to create registration: %w", err)
65 }
66
67 return entIntegrationToBiz(integration), nil
68}
69
70func (r *IntegrationRepo) List(ctx context.Context, orgID uuid.UUID) ([]*biz.Integration, error) {
71 ctx, span := otelx.Start(ctx, integrationRepoTracer, "IntegrationRepo.List")

Callers

nothing calls this directly

Implementers 6

CASBackendUseCaseapp/controlplane/pkg/biz/casbackend.go
CASBackendRepoapp/controlplane/pkg/biz/mocks/CASBack
CASBackendRepo_Expecterapp/controlplane/pkg/biz/mocks/CASBack
WorkflowContractRepoapp/controlplane/pkg/data/workflowcont
CASBackendRepoapp/controlplane/pkg/data/casbackend.g
IntegrationRepoapp/controlplane/pkg/data/integration.

Calls 12

StartFunction · 0.92
IsConstraintErrorFunction · 0.92
NewErrAlreadyExistsFunction · 0.92
entIntegrationToBizFunction · 0.85
SaveMethod · 0.65
CreateMethod · 0.65
SetConfigurationMethod · 0.45
SetSecretNameMethod · 0.45
SetDescriptionMethod · 0.45
SetKindMethod · 0.45
SetOrganizationIDMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected