provider

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeStorageProvider = "codestorage"
	SuperGitProvider    = "supergit"
)

* Two available git storage providers: * - codestorage - https://code.storage * - supergit - https://github.com/superplanehq/supergit

View Source
const ReservedSuperPlanePath = ".superplane"

* Users should not be able to create files in this directory. * I am not really sure we need this protection, but it's better * to start being restrictive and open up later on, than the other way around.

Variables

View Source
var (
	ErrInvalidPath          = errors.New("invalid file path")
	ErrInvalidRepositoryID  = errors.New("invalid repository path")
	ErrReservedPath         = errors.New("path is reserved for SuperPlane")
	ErrInvalidCommit        = errors.New("invalid commit")
	ErrExpectedHeadMismatch = errors.New("expected head sha does not match current branch head")
)

Functions

func DefaultBranch

func DefaultBranch(branch string) string

func NormalizePath

func NormalizePath(value string) (string, error)

func RefOrDefault

func RefOrDefault(ref, branch string) string

func ValidateCommitMetadata

func ValidateCommitMetadata(message string, author CommitAuthor) error

func ValidateUserPath

func ValidateUserPath(value string) (string, error)

Types

type CommitAuthor

type CommitAuthor struct {
	Name  string
	Email string
}

type CommitOptions

type CommitOptions struct {
	Branch          string
	BaseBranch      string
	ExpectedHeadSHA string
	Message         string
	Author          CommitAuthor
	Operations      []FileOperation
}

func InitialRepositoryCommitOptions

func InitialRepositoryCommitOptions(branch string) CommitOptions

type FileOperation

type FileOperation struct {
	Path      string
	Content   io.Reader
	SizeBytes int64
	Delete    bool
}

func ValidateCommitOperations

func ValidateCommitOperations(operations []FileOperation) ([]FileOperation, error)

type Provider

type Provider interface {

	//
	// The unique identifier of the provider.
	//
	Name() string

	//
	// Get the provider specific repository identifier,
	// Allows providers to define how they map metadata about a repository,
	// to its identifier.
	//
	GetRepositoryID(options RepositoryOptions) string

	//
	// Repository management methods.
	//
	CreateRepository(ctx context.Context, repoID string) (*Repository, error)
	DeleteRepository(ctx context.Context, repoID string) error

	//
	// File management methods
	//
	ListFiles(ctx context.Context, repoID string) ([]string, error)
	GetFile(ctx context.Context, repoID string, path string) (io.ReadCloser, error)
	Commit(ctx context.Context, repoID string, options CommitOptions) (string, error)
	Head(ctx context.Context, repoID string) (string, error)
}

type Repository

type Repository struct {
	ID string
}

type RepositoryOptions

type RepositoryOptions struct {
	OrganizationID uuid.UUID
	CanvasID       uuid.UUID
}

Jump to

Keyboard shortcuts

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