MCPcopy Index your code
hub / github.com/chainloop-dev/chainloop / GetOrgScoped

Method GetOrgScoped

app/controlplane/pkg/data/workflow.go:411–429  ·  view source on GitHub ↗

GetOrgScoped Gets a workflow making sure it belongs to a given org

(ctx context.Context, orgID, workflowID uuid.UUID)

Source from the content-addressed store, hash-verified

409
410// GetOrgScoped Gets a workflow making sure it belongs to a given org
411func (r *WorkflowRepo) GetOrgScoped(ctx context.Context, orgID, workflowID uuid.UUID) (*biz.Workflow, error) {
412 ctx, span := otelx.Start(ctx, workflowRepoTracer, "WorkflowRepo.GetOrgScoped")
413 defer span.End()
414
415 workflow, err := orgScopedQuery(r.data.DB, orgID).
416 QueryWorkflows().
417 Where(workflow.ID(workflowID), workflow.DeletedAtIsNil()).
418 WithContract().WithOrganization().WithLatestWorkflowRun().WithProject().
419 Only(ctx)
420
421 if err != nil {
422 if ent.IsNotFound(err) {
423 return nil, biz.NewErrNotFound("workflow")
424 }
425 return nil, err
426 }
427
428 return entWFToBizWF(ctx, workflow)
429}
430
431// GetOrgScopedByProjectAndName Gets a workflow by name making sure it belongs to a given org
432func (r *WorkflowRepo) GetOrgScopedByProjectAndName(ctx context.Context, orgID uuid.UUID, projectName, workflowName string) (*biz.Workflow, error) {

Callers

nothing calls this directly

Implementers 1

WorkflowRepoapp/controlplane/pkg/data/workflow.go

Calls 14

StartFunction · 0.92
IDFunction · 0.92
DeletedAtIsNilFunction · 0.92
IsNotFoundFunction · 0.92
NewErrNotFoundFunction · 0.92
orgScopedQueryFunction · 0.85
entWFToBizWFFunction · 0.85
WithLatestWorkflowRunMethod · 0.80
OnlyMethod · 0.45
WithProjectMethod · 0.45
WithOrganizationMethod · 0.45
WithContractMethod · 0.45

Tested by

no test coverage detected