repo

package
v0.0.0-...-4c964c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActiveRepoStates = []enum.RepoState{enum.RepoStateActive}

WireSet provides a wire set for this package.

Functions

func GetRepo

func GetRepo(
	ctx context.Context,
	repoStore store.RepoStore,
	repoRef string,
	allowedStates []enum.RepoState,
) (*types.Repository, error)

GetRepo fetches an repository.

func GetRepoCheckAccess

func GetRepoCheckAccess(
	ctx context.Context,
	repoStore store.RepoStore,
	authorizer authz.Authorizer,
	session *auth.Session,
	repoRef string,
	reqPermission enum.Permission,
	allowedStates []enum.RepoState,
) (*types.Repository, error)

GetRepoCheckAccess fetches an active repo (not one that is currently being imported) and checks if the current user has permission to access it.

func ParseGitAgentValidator

func ParseGitAgentValidator(ctx context.Context) gitAgentValidator

func ValidateParentRef

func ValidateParentRef(parentRef string) error

Types

type Branch

type Branch struct {
	Name      string        `json:"name"`
	SHA       string        `json:"sha"`
	IsDefault bool          `json:"is_default"`
	Commit    *types.Commit `json:"commit,omitempty"`
}

type Check

type Check interface {
	// Create allows adding extra check during create repo operations
	Create(ctx context.Context, session *auth.Session, in *CreateInput) error
}

Check defines the interface for adding extra checks during repository operations.

func ProvideRepoCheck

func ProvideRepoCheck() Check

type CommitDivergenceRequest

type CommitDivergenceRequest struct {
	// From is the ref from which the counting of the diverging commits starts.
	From string `json:"from"`
	// To is the ref at which the counting of the diverging commits ends.
	// If the value is empty the divergence is calculated to the default branch of the repo.
	To string `json:"to"`
}

CommitDivergenceRequest contains the refs for which the converging commits should be counted.

type CommitFileAction

type CommitFileAction struct {
	Action   git.FileAction           `json:"action"`
	Path     string                   `json:"path"`
	Payload  string                   `json:"payload"`
	Encoding enum.ContentEncodingType `json:"encoding"`

	// SHA can be used for optimistic locking of an update action (Optional).
	// The provided value is compared against the latest sha of the file that's being updated.
	// If the SHA doesn't match, the update fails.
	// WARNING: If no SHA is provided, the update action will blindly overwrite the file's content.
	SHA sha.SHA `json:"sha"`
}

CommitFileAction holds file operation data.

type CommitFilesOptions

type CommitFilesOptions struct {
	Title     string             `json:"title"`
	Message   string             `json:"message"`
	Branch    string             `json:"branch"`
	NewBranch string             `json:"new_branch"`
	Actions   []CommitFileAction `json:"actions"`
	Author    *git.Identity      `json:"author"`

	DryRunRules bool `json:"dry_run_rules"`
	BypassRules bool `json:"bypass_rules"`
}

CommitFilesOptions holds the data for file operations.

func (*CommitFilesOptions) Sanitize

func (in *CommitFilesOptions) Sanitize() error

type CommitTag

type CommitTag struct {
	Name        string           `json:"name"`
	SHA         string           `json:"sha"`
	IsAnnotated bool             `json:"is_annotated"`
	Title       string           `json:"title,omitempty"`
	Message     string           `json:"message,omitempty"`
	Tagger      *types.Signature `json:"tagger,omitempty"`
	Commit      *types.Commit    `json:"commit,omitempty"`
}

type CompareInfo

type CompareInfo struct {
	BaseRef   string
	HeadRef   string
	MergeBase bool
}

type Content

type Content interface {
	// contains filtered or unexported methods
}

Content restricts the possible types of content returned by the api.

type ContentInfo

type ContentInfo struct {
	Type         ContentType   `json:"type"`
	SHA          string        `json:"sha"`
	Name         string        `json:"name"`
	Path         string        `json:"path"`
	LatestCommit *types.Commit `json:"latest_commit,omitempty"`
}

type ContentType

type ContentType string
const (
	ContentTypeFile      ContentType = "file"
	ContentTypeDir       ContentType = "dir"
	ContentTypeSymlink   ContentType = "symlink"
	ContentTypeSubmodule ContentType = "submodule"
)

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(
	config *types.Config,
	tx dbtx.Transactor,
	urlProvider url.Provider,
	authorizer authz.Authorizer,
	repoStore store.RepoStore,
	spaceStore store.SpaceStore,
	memberShipStore store.MembershipStore,
	pipelineStore store.PipelineStore,
	executionStore store.ExecutionStore,
	principalStore store.PrincipalStore,
	ruleStore store.RuleStore,
	checkStore store.CheckStore,
	pullReqStore store.PullReqStore,
	settings *settings.Service,
	principalInfoCache store.PrincipalInfoCache,
	protectionManager *protection.Manager,
	git git.Interface,
	importer *importer.Repository,
	codeOwners *codeowners.Service,
	eventReporter *repoevents.Reporter,
	indexer keywordsearch.Indexer,
	limiter limiter.ResourceLimiter,
	locker *locker.Locker,
	auditService audit.Service,
	mtxManager lock.MutexManager,
	identifierCheck check.RepoIdentifier,
	repoCheck Check,
	publicAccess publicaccess.Service,
	labelSvc *label.Service,
	instrumentation instrument.Service,
	userGroupStore store.UserGroupStore,
	userGroupService usergroup.SearchService,
) *Controller

func ProvideController

func ProvideController(
	config *types.Config,
	tx dbtx.Transactor,
	urlProvider url.Provider,
	authorizer authz.Authorizer,
	repoStore store.RepoStore,
	spaceStore store.SpaceStore,
	memberShipStore store.MembershipStore,
	pipelineStore store.PipelineStore,
	principalStore store.PrincipalStore,
	executionStore store.ExecutionStore,
	ruleStore store.RuleStore,
	checkStore store.CheckStore,
	pullReqStore store.PullReqStore,
	settings *settings.Service,
	principalInfoCache store.PrincipalInfoCache,
	protectionManager *protection.Manager,
	rpcClient git.Interface,
	importer *importer.Repository,
	codeOwners *codeowners.Service,
	reporeporter *repoevents.Reporter,
	indexer keywordsearch.Indexer,
	limiter limiter.ResourceLimiter,
	locker *locker.Locker,
	auditService audit.Service,
	mtxManager lock.MutexManager,
	identifierCheck check.RepoIdentifier,
	repoChecks Check,
	publicAccess publicaccess.Service,
	labelSvc *label.Service,
	instrumentation instrument.Service,
	userGroupStore store.UserGroupStore,
	userGroupService usergroup.SearchService,
) *Controller

func (*Controller) AIConfig

func (c *Controller) AIConfig(ctx context.Context, session *auth.Session, repoRef string) (*types.RepositoryMirror, error)

AIConfig get ai repository config

func (*Controller) Archive

func (c *Controller) Archive(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	params api.ArchiveParams,
	w io.Writer,
) error

func (*Controller) Blame

func (c *Controller) Blame(ctx context.Context,
	session *auth.Session,
	repoRef, gitRef, path string,
	lineFrom, lineTo int,
) (types.Stream[*git.BlamePart], error)

func (*Controller) CodeOwnersValidate

func (c *Controller) CodeOwnersValidate(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	ref string,
) (*types.CodeOwnersValidation, error)

func (*Controller) CommitDiff

func (c *Controller) CommitDiff(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	rev string,
	w io.Writer,
) error

func (*Controller) CommitFiles

func (c *Controller) CommitFiles(ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *CommitFilesOptions,
) (types.CommitFilesResponse, []types.RuleViolations, error)

func (*Controller) Create

func (c *Controller) Create(ctx context.Context, session *auth.Session, in *CreateInput) (*RepositoryOutput, error)

Create creates a new repository.

func (*Controller) CreateBranch

func (c *Controller) CreateBranch(ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *CreateBranchInput,
) (types.CreateBranchOutput, []types.RuleViolations, error)

CreateBranch creates a new branch for a repo.

func (*Controller) CreateCommitTag

func (c *Controller) CreateCommitTag(ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *CreateCommitTagInput,
) (*CommitTag, []types.RuleViolations, error)

CreateCommitTag creates a new tag for a repo.

func (*Controller) DefineLabel

func (c *Controller) DefineLabel(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *types.DefineLabelInput,
) (*types.Label, error)

DefineLabel defines a new label for the specified repository.

func (*Controller) DefineLabelValue

func (c *Controller) DefineLabelValue(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	key string,
	in *types.DefineValueInput,
) (*types.LabelValue, error)

DefineLabelValue defines a new label value for the specified repository.

func (*Controller) DeleteBranch

func (c *Controller) DeleteBranch(ctx context.Context,
	session *auth.Session,
	repoRef string,
	branchName string,
	bypassRules,
	dryRunRules bool,
) (types.DeleteBranchOutput, []types.RuleViolations, error)

DeleteBranch deletes a repo branch.

func (*Controller) DeleteGitRepository

func (c *Controller) DeleteGitRepository(
	ctx context.Context,
	session *auth.Session,
	gitUID string,
) error

func (*Controller) DeleteLabel

func (c *Controller) DeleteLabel(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	key string,
) error

DeleteLabel deletes a label for the specified repository.

func (*Controller) DeleteLabelValue

func (c *Controller) DeleteLabelValue(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	key string,
	value string,
) error

DeleteLabelValue deletes a label value for the specified repository.

func (*Controller) DeleteTag

func (c *Controller) DeleteTag(ctx context.Context,
	session *auth.Session,
	repoRef,
	tagName string,
	bypassRules bool,
) ([]types.RuleViolations, error)

DeleteTag deletes a tag from the repo.

func (*Controller) Diff

func (c *Controller) Diff(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	path string,
	includePatch bool,
	files ...gittypes.FileDiffRequest,
) (types.Stream[*git.FileDiff], error)

func (*Controller) DiffStats

func (c *Controller) DiffStats(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	path string,
) (types.DiffStats, error)

func (*Controller) Find

func (c *Controller) Find(ctx context.Context, session *auth.Session, repoRef string) (*RepositoryOutput, error)

Find finds a repo.

func (*Controller) GetBranch

func (c *Controller) GetBranch(ctx context.Context,
	session *auth.Session,
	repoRef string,
	branchName string,
	options types.BranchMetadataOptions,
) (*types.BranchExtended, error)

GetBranch gets a repo branch.

func (*Controller) GetCommit

func (c *Controller) GetCommit(ctx context.Context,
	session *auth.Session,
	repoRef string,
	sha string,
) (*types.Commit, error)

GetCommit gets a repo commit.

func (*Controller) GetCommitDivergences

func (c *Controller) GetCommitDivergences(ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *GetCommitDivergencesInput,
) ([]types.CommitDivergence, error)

GetCommitDivergences returns the commit divergences between reference pairs.

func (*Controller) GetContent

func (c *Controller) GetContent(ctx context.Context,
	session *auth.Session,
	repoRef string,
	gitRef string,
	repoPath string,
	includeLatestCommit bool,
	flattenDirectories bool,
) (*GetContentOutput, error)

GetContent finds the content of the repo at the given path. If no gitRef is provided, the content is retrieved from the default branch.

func (*Controller) GitInfoRefs

func (c *Controller) GitInfoRefs(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	service enum.GitServiceType,
	gitProtocol string,
	w io.Writer,
) error

GitInfoRefs executes the info refs part of git's smart http protocol.

func (*Controller) GitServicePack

func (c *Controller) GitServicePack(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	options api.ServicePackOptions,
) error

GitServicePack executes the service pack part of git's smart http protocol (receive-/upload-pack).

func (*Controller) HardDelete

func (c *Controller) HardDelete(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
) (*HardDeleteResponse, error)

HardDelete exactly deletes a repo

func (*Controller) Import

func (c *Controller) Import(ctx context.Context, session *auth.Session, in *ImportInput) (*RepositoryOutput, error)

Import creates a new empty repository and starts git import to it from a remote repository.

func (*Controller) ImportProgress

func (c *Controller) ImportProgress(ctx context.Context,
	session *auth.Session,
	repoRef string,
) (job.Progress, error)

ImportProgress returns progress of the import job.

func (*Controller) ListBranches

func (c *Controller) ListBranches(ctx context.Context,
	session *auth.Session,
	repoRef string,
	filter *types.BranchFilter,
) ([]types.BranchExtended, error)

ListBranches lists the branches of a repo.

func (*Controller) ListCommitTags

func (c *Controller) ListCommitTags(ctx context.Context,
	session *auth.Session,
	repoRef string,
	includeCommit bool,
	filter *types.TagFilter,
) ([]CommitTag, error)

ListCommitTags lists the commit tags of a repo.

func (*Controller) ListCommits

func (c *Controller) ListCommits(ctx context.Context,
	session *auth.Session,
	repoRef string,
	gitRef string,
	filter *types.CommitFilter,
) (types.ListCommitResponse, error)

ListCommits lists the commits of a repo.

func (*Controller) ListLabelValues

func (c *Controller) ListLabelValues(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	key string,
	filter *types.ListQueryFilter,
) ([]*types.LabelValue, error)

ListLabelValues lists all label values defined for the specified repository.

func (*Controller) ListLabels

func (c *Controller) ListLabels(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	filter *types.LabelFilter,
) ([]*types.Label, int64, error)

ListLabels lists all labels defined for the specified repository.

func (*Controller) ListPaths

func (c *Controller) ListPaths(ctx context.Context,
	session *auth.Session,
	repoRef string,
	gitRef string,
	includeDirectories bool,
) (ListPathsOutput, error)

ListPaths lists the paths in the repo for a specific revision.

func (*Controller) ListPipelines

func (c *Controller) ListPipelines(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	filter *types.ListPipelinesFilter,
) ([]*types.Pipeline, int64, error)

ListPipelines lists the pipelines under a repository.

func (*Controller) ListRepositories

func (c *Controller) ListRepositories(
	ctx context.Context,
	session *auth.Session,
	filter *types.RepoFilter,
) ([]*types.Repository, int64, error)

ListRepositories lists the repositories of a space.

func (*Controller) ListServiceAccounts

func (c *Controller) ListServiceAccounts(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
) ([]*types.ServiceAccount, error)

ListServiceAccounts lists the service accounts of a repo.

func (*Controller) MergeCheck

func (c *Controller) MergeCheck(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	diffPath string,
) (MergeCheck, error)

func (*Controller) Move

func (c *Controller) Move(ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *MoveInput,
) (*RepositoryOutput, error)

Move moves a repository to a new identifier. TODO: Add support for moving to other parents and aliases.

func (*Controller) PathsDetails

func (c *Controller) PathsDetails(ctx context.Context,
	session *auth.Session,
	repoRef string,
	gitRef string,
	input PathsDetailsInput,
) (PathsDetailsOutput, error)

PathsDetails finds the additional info about the provided paths of the repo. If no gitRef is provided, the content is retrieved from the default branch.

func (*Controller) PipelineGenerate

func (c *Controller) PipelineGenerate(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
) ([]byte, error)

PipelineGenerate returns automatically generate pipeline YAML for a repository.

func (*Controller) Purge

func (c *Controller) Purge(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	deletedAt int64,
) error

Purge removes a repo permanently.

func (*Controller) PurgeNoAuth

func (c *Controller) PurgeNoAuth(
	ctx context.Context,
	session *auth.Session,
	repo *types.Repository,
) error

func (*Controller) Raw

func (c *Controller) Raw(ctx context.Context,
	session *auth.Session,
	repoRef string,
	gitRef string,
	path string,
) (io.ReadCloser, int64, sha.SHA, error)

Raw finds the file of the repo at the given path and returns its raw content. If no gitRef is provided, the content is retrieved from the default branch.

func (*Controller) RawDiff

func (c *Controller) RawDiff(
	ctx context.Context,
	w io.Writer,
	session *auth.Session,
	repoRef string,
	path string,
	files ...gittypes.FileDiffRequest,
) error

func (*Controller) Rebase

func (c *Controller) Rebase(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *RebaseInput,
) (*types.RebaseResponse, *types.MergeViolations, error)

Rebase rebases a branch against (the latest commit from) a different branch.

func (*Controller) Restore

func (c *Controller) Restore(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	deletedAt int64,
	in *RestoreInput,
) (*RepositoryOutput, error)

func (*Controller) RestoreNoAuth

func (c *Controller) RestoreNoAuth(
	ctx context.Context,
	repo *types.Repository,
	newIdentifier *string,
	newParentID int64,
) (*RepositoryOutput, error)

func (*Controller) RuleCreate

func (c *Controller) RuleCreate(ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *RuleCreateInput,
) (*types.Rule, error)

RuleCreate creates a new protection rule for a repo.

func (*Controller) RuleDelete

func (c *Controller) RuleDelete(ctx context.Context,
	session *auth.Session,
	repoRef string,
	identifier string,
) error

RuleDelete deletes a protection rule by identifier.

func (*Controller) RuleFind

func (c *Controller) RuleFind(ctx context.Context,
	session *auth.Session,
	repoRef string,
	identifier string,
) (*types.Rule, error)

RuleFind returns the protection rule by identifier.

func (*Controller) RuleList

func (c *Controller) RuleList(ctx context.Context,
	session *auth.Session,
	repoRef string,
	filter *types.RuleFilter,
) ([]types.Rule, int64, error)

RuleList returns protection rules for a repository.

func (*Controller) RuleUpdate

func (c *Controller) RuleUpdate(ctx context.Context,
	session *auth.Session,
	repoRef string,
	identifier string,
	in *RuleUpdateInput,
) (*types.Rule, error)

RuleUpdate updates an existing protection rule for a repository.

func (*Controller) SaveLabel

func (c *Controller) SaveLabel(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *types.SaveInput,
) (*types.LabelWithValues, error)

SaveLabel creates or updates a label and possibly label values for the specified repository.

func (*Controller) SoftDelete

func (c *Controller) SoftDelete(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
) (*SoftDeleteResponse, error)

SoftDelete soft deletes a repo and returns the deletedAt timestamp in epoch format.

func (*Controller) SoftDeleteNoAuth

func (c *Controller) SoftDeleteNoAuth(
	ctx context.Context,
	session *auth.Session,
	repo *types.Repository,
	deletedAt int64,
) error

func (*Controller) Squash

func (c *Controller) Squash(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *SquashInput,
) (*types.SquashResponse, *types.MergeViolations, error)

Squash squashes all commits since merge-base to the latest commit of the base branch. This operation alters history of the base branch and therefore is considered a force push.

func (*Controller) Summary

func (c *Controller) Summary(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
) (*types.RepositorySummary, error)

Summary returns commit, branch, tag and pull req count for a repo.

func (*Controller) Update

func (c *Controller) Update(ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *UpdateInput,
) (*RepositoryOutput, error)

Update updates a repository.

func (*Controller) UpdateAIConfig

func (c *Controller) UpdateAIConfig(ctx context.Context, session *auth.Session, repoRef string, opts *types.RepositoryMirror) error

UpdateAIConfig update ai repository config

func (*Controller) UpdateDefaultBranch

func (c *Controller) UpdateDefaultBranch(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *UpdateDefaultBranchInput,
) (*RepositoryOutput, error)

TODO: handle the racing condition between update/delete default branch requests for a repo.

func (*Controller) UpdateLabel

func (c *Controller) UpdateLabel(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	key string,
	in *types.UpdateLabelInput,
) (*types.Label, error)

UpdateLabel updates a label for the specified repository.

func (*Controller) UpdateLabelValue

func (c *Controller) UpdateLabelValue(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	key string,
	value string,
	in *types.UpdateValueInput,
) (*types.LabelValue, error)

UpdateLabelValue updates a label value for the specified label and repository.

func (*Controller) UpdatePublicAccess

func (c *Controller) UpdatePublicAccess(ctx context.Context,
	session *auth.Session,
	repoRef string,
	in *UpdatePublicAccessInput,
) (*RepositoryOutput, error)

type CreateBranchInput

type CreateBranchInput struct {
	Name string `json:"name"`

	// Target is the commit (or points to the commit) the new branch will be pointing to.
	// If no target is provided, the branch points to the same commit as the default branch of the repo.
	Target string `json:"target"`

	DryRunRules bool `json:"dry_run_rules"`
	BypassRules bool `json:"bypass_rules"`
}

CreateBranchInput used for branch creation apis.

type CreateCommitTagInput

type CreateCommitTagInput struct {
	Name string `json:"name"`
	// Target is the commit (or points to the commit) the new tag will be pointing to.
	// If no target is provided, the tag points to the same commit as the default branch of the repo.
	Target string `json:"target"`

	// Message is the optional message the tag will be created with - if the message is empty
	// the tag will be lightweight, otherwise it'll be annotated.
	Message string `json:"message"`

	BypassRules bool `json:"bypass_rules"`
}

CreateCommitTagInput used for tag creation apis.

type CreateInput

type CreateInput struct {
	ParentRef string `json:"parent_ref"`
	// TODO [CODE-1363]: remove after identifier migration.
	UID           string `json:"uid" deprecated:"true"`
	Identifier    string `json:"identifier"`
	DefaultBranch string `json:"default_branch"`
	Description   string `json:"description"`
	IsPublic      bool   `json:"is_public"`
	ForkID        int64  `json:"fork_id"`
	Readme        bool   `json:"readme"`
	License       string `json:"license"`
	GitIgnore     string `json:"git_ignore"`
}

type DirContent

type DirContent struct {
	Entries []ContentInfo `json:"entries"`
}

type FileContent

type FileContent struct {
	Encoding enum.ContentEncodingType `json:"encoding"`
	Data     string                   `json:"data"`
	Size     int64                    `json:"size"`
	DataSize int64                    `json:"data_size"`
}

type GetCommitDivergencesInput

type GetCommitDivergencesInput struct {
	// MaxCount restricts the maximum number of diverging commits that are counted.
	// IMPORTANT: This restricts the total commit count, so a (5, 18) restricted to 10 will return (0, 10)
	MaxCount int32                     `json:"max_count"`
	Requests []CommitDivergenceRequest `json:"requests"`
}

type GetContentOutput

type GetContentOutput struct {
	ContentInfo
	Content Content `json:"content"`
}

type HardDeleteResponse

type HardDeleteResponse struct {
	DeletedAt int64 `json:"deleted_at"`
}

type ImportInput

type ImportInput struct {
	ParentRef string `json:"parent_ref"`
	// TODO [CODE-1363]: remove after identifier migration.
	UID         string `json:"uid" deprecated:"true"`
	Identifier  string `json:"identifier"`
	Description string `json:"description"`

	Provider     importer.Provider `json:"provider"`
	ProviderRepo string            `json:"provider_repo"`

	Pipelines importer.PipelineOption `json:"pipelines"`

	// Mirror indicates whether the repository should be imported as a mirror.
	Mirror bool `json:"mirror,omitempty"`
}

type ListPathsOutput

type ListPathsOutput struct {
	Files       []string `json:"files,omitempty"`
	Directories []string `json:"directories,omitempty"`
}

type MergeCheck

type MergeCheck struct {
	Mergeable     bool     `json:"mergeable"`
	ConflictFiles []string `json:"conflict_files,omitempty"`
}

type MoveInput

type MoveInput struct {
	// TODO [CODE-1363]: remove after identifier migration.
	UID        *string `json:"uid" deprecated:"true"`
	Identifier *string `json:"identifier"`
}

MoveInput is used for moving a repo.

type NoOpRepoChecks

type NoOpRepoChecks struct {
}

func NewNoOpRepoChecks

func NewNoOpRepoChecks() *NoOpRepoChecks

func (*NoOpRepoChecks) Create

type PathsDetailsInput

type PathsDetailsInput struct {
	Paths []string `json:"paths"`
}

type PathsDetailsOutput

type PathsDetailsOutput struct {
	Details []git.PathDetails `json:"details"`
}

type RebaseInput

type RebaseInput struct {
	BaseBranch    string  `json:"base_branch"`
	BaseCommitSHA sha.SHA `json:"base_commit_sha"`

	HeadBranch    string  `json:"head_branch"`
	HeadCommitSHA sha.SHA `json:"head_commit_sha"`

	DryRun      bool `json:"dry_run"`
	DryRunRules bool `json:"dry_run_rules"`
	BypassRules bool `json:"bypass_rules"`
}

type RepositoryOutput

type RepositoryOutput struct {
	types.Repository
	IsPublic  bool `json:"is_public" yaml:"is_public"`
	Importing bool `json:"importing" yaml:"-"`
}

func GetRepoOutput

func GetRepoOutput(
	ctx context.Context,
	publicAccess publicaccess.Service,
	repo *types.Repository,
) (*RepositoryOutput, error)

func GetRepoOutputWithAccess

func GetRepoOutputWithAccess(
	_ context.Context,
	isPublic bool,
	repo *types.Repository,
) *RepositoryOutput

func (RepositoryOutput) MarshalJSON

func (r RepositoryOutput) MarshalJSON() ([]byte, error)

TODO [CODE-1363]: remove after identifier migration.

type RestoreInput

type RestoreInput struct {
	NewIdentifier *string `json:"new_identifier,omitempty"`
	NewParentRef  *string `json:"new_parent_ref,omitempty"`
}

type RuleCreateInput

type RuleCreateInput struct {
	Type  types.RuleType `json:"type"`
	State enum.RuleState `json:"state"`
	// TODO [CODE-1363]: remove after identifier migration.
	UID         string             `json:"uid" deprecated:"true"`
	Identifier  string             `json:"identifier"`
	Description string             `json:"description"`
	Pattern     protection.Pattern `json:"pattern"`
	Definition  json.RawMessage    `json:"definition"`
}

type RuleUpdateInput

type RuleUpdateInput struct {
	// TODO [CODE-1363]: remove after identifier migration.
	UID         *string             `json:"uid" deprecated:"true"`
	Identifier  *string             `json:"identifier"`
	State       *enum.RuleState     `json:"state"`
	Description *string             `json:"description"`
	Pattern     *protection.Pattern `json:"pattern"`
	Definition  *json.RawMessage    `json:"definition"`
}

type SoftDeleteResponse

type SoftDeleteResponse struct {
	DeletedAt int64 `json:"deleted_at"`
}

type SquashInput

type SquashInput struct {
	BaseBranch    string  `json:"base_branch"`
	BaseCommitSHA sha.SHA `json:"base_commit_sha"`

	HeadBranch    string  `json:"head_branch"`
	HeadCommitSHA sha.SHA `json:"head_commit_sha"`

	Title   string `json:"title"`
	Message string `json:"message"`

	DryRun      bool `json:"dry_run"`
	DryRunRules bool `json:"dry_run_rules"`
	BypassRules bool `json:"bypass_rules"`
}

type SubmoduleContent

type SubmoduleContent struct {
	URL       string `json:"url"`
	CommitSHA string `json:"commit_sha"`
}

type SymlinkContent

type SymlinkContent struct {
	Target string `json:"target"`
	Size   int64  `json:"size"`
}

type UpdateDefaultBranchInput

type UpdateDefaultBranchInput struct {
	Name string `json:"name"`
}

type UpdateInput

type UpdateInput struct {
	Description *string `json:"description"`
}

UpdateInput is used for updating a repo.

type UpdatePublicAccessInput

type UpdatePublicAccessInput struct {
	IsPublic bool `json:"is_public"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL