codecommit

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 26 Imported by: 0

README

CodeCommit

Parity grade: A · SDK aws-sdk-go-v2/service/codecommit@v1.33.10 · last audited 2026-07-12 (2ca17ef1)

Coverage

Metric Value
Operations audited 79 (75 ok, 4 partial)
Feature families 3 (3 ok)
Known gaps 3
Deferred items 2
Resource leaks clean
Known gaps
  • MergeBranchesBySquash/MergeBranchesByThreeWay handlers call the FastForward backend method verbatim (handler_ops.go handleMergeBranchesBySquash/handleMergeBranchesByThreeWay) — the merge result (a new commit + branch tip update) is real, but there's no content-level distinction between the three strategies. Root cause: the backend has no tree/blob diff-merge engine. Implementing real 3-way/squash merge semantics is a substantial feature, not a bug fix; out of scope for this pass. (bd: file follow-up)
  • GetMergeConflicts/BatchDescribeMergeConflicts/DescribeMergeConflicts never report a real conflict: mergeable is always true and conflicts/mergeHunks are always empty, because the backend has no file-content diffing. This was true before this pass (backend.go's BatchDescribeMergeConflicts doc even says so) and DescribeMergeConflicts now correctly delegates to that same (still content-blind) logic instead of being a separate, less-validated stub. (bd: file follow-up)
  • DeleteFile ignores parentCommitId entirely (never validates it against the branch tip), unlike CreateCommit which enforces ParentCommitIdOutdatedException. Real AWS requires parentCommitId to be the current HEAD. Low-risk since DeleteFile is typically called right after GetBranch in real clients, but a race with a concurrent commit would go undetected here. (bd: file follow-up)
Deferred
  • GetDifferences pagination (nextToken/maxResults accepted but not enforced — returns full result set every call)
  • ListFileCommitHistory pagination

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a requested resource does not exist.
	ErrNotFound = awserr.New(errRepoDoesNotExist, awserr.ErrNotFound)
	// ErrAlreadyExists is returned when a resource already exists.
	ErrAlreadyExists = awserr.New("RepositoryNameExistsException", awserr.ErrConflict)
	// ErrValidation is returned when input validation fails.
	ErrValidation = awserr.New("InvalidParameterException", awserr.ErrInvalidParameter)
	// ErrApprovalRuleTemplateNotFound is returned when an approval rule template is not found.
	ErrApprovalRuleTemplateNotFound = awserr.New(errApprovalRuleTemplateNotExist, awserr.ErrNotFound)
	// ErrApprovalRuleTemplateAlreadyExists is returned when an approval rule template already exists.
	ErrApprovalRuleTemplateAlreadyExists = awserr.New(
		"ApprovalRuleTemplateNameAlreadyExistsException",
		awserr.ErrConflict,
	)
	// ErrBranchNotFound is returned when a branch is not found.
	ErrBranchNotFound = awserr.New("BranchDoesNotExistException", awserr.ErrNotFound)
	// ErrBranchAlreadyExists is returned when a branch already exists.
	ErrBranchAlreadyExists = awserr.New("BranchNameExistsException", awserr.ErrConflict)
	// ErrCommitNotFound is returned when a commit is not found.
	ErrCommitNotFound = awserr.New("CommitDoesNotExistException", awserr.ErrNotFound)
	// ErrPullRequestNotFound is returned when a pull request is not found.
	ErrPullRequestNotFound = awserr.New("PullRequestDoesNotExistException", awserr.ErrNotFound)
	// ErrPullRequestAlreadyMerged is returned when a PR is already merged.
	ErrPullRequestAlreadyMerged = awserr.New("PullRequestAlreadyClosedException", awserr.ErrConflict)
	// ErrInvalidRepositoryName is returned when a repository name is invalid.
	ErrInvalidRepositoryName = awserr.New("InvalidRepositoryNameException", awserr.ErrInvalidParameter)
	// ErrMaxRepositoriesExceeded is returned when too many repositories are requested.
	ErrMaxRepositoriesExceeded = awserr.New("MaximumRepositoryNamesExceededException", awserr.ErrInvalidParameter)
	// ErrBranchNameRequired is returned when a branch name is missing.
	ErrBranchNameRequired = awserr.New("BranchNameRequiredException", awserr.ErrInvalidParameter)
	// ErrInvalidBranchName is returned when a branch name contains invalid characters.
	ErrInvalidBranchName = awserr.New("InvalidBranchNameException", awserr.ErrInvalidParameter)
	// ErrParentCommitIDRequired is returned when parentCommitId is missing for a branch with commits.
	ErrParentCommitIDRequired = awserr.New("ParentCommitIdRequiredException", awserr.ErrInvalidParameter)
	// ErrParentCommitIDOutdated is returned when parentCommitId doesn't match branch tip.
	ErrParentCommitIDOutdated = awserr.New("ParentCommitIdOutdatedException", awserr.ErrConflict)
	// ErrSameFileContent is returned when putFiles has no actual changes.
	ErrSameFileContent = awserr.New("SameFileContentException", awserr.ErrConflict)
	// ErrFilePathConflicts is returned when a file path conflicts with an existing path.
	ErrFilePathConflicts = awserr.New("FilePathConflictsWithSubmodulePathException", awserr.ErrConflict)
	// ErrFileNotFound is returned when a file path does not exist in the repository.
	ErrFileNotFound = awserr.New("FileDoesNotExistException", awserr.ErrNotFound)
	// ErrBlobNotFound is returned when a blob ID does not exist in the repository.
	ErrBlobNotFound = awserr.New("BlobIdDoesNotExistException", awserr.ErrNotFound)
	// ErrCommentNotFound is returned when a comment ID does not exist.
	ErrCommentNotFound = awserr.New("CommentDoesNotExistException", awserr.ErrNotFound)
	// ErrApprovalRuleNotFound is returned when a pull request approval rule does not exist.
	ErrApprovalRuleNotFound = awserr.New("ApprovalRuleDoesNotExistException", awserr.ErrNotFound)
)
View Source
var ErrNilAppContext = errors.New("AppContext is required")

ErrNilAppContext is returned when Provider.Init is called with a nil AppContext.

Functions

func ValidateRepositoryName

func ValidateRepositoryName(name string) error

ValidateRepositoryName returns an error if name is not a valid CodeCommit repository name.

Types

type ApprovalRuleTemplate

type ApprovalRuleTemplate struct {
	CreationDate                    time.Time `json:"creationDate"`
	LastModifiedDate                time.Time `json:"lastModifiedDate"`
	ApprovalRuleTemplateID          string    `json:"approvalRuleTemplateId"`
	ApprovalRuleTemplateName        string    `json:"approvalRuleTemplateName"`
	ApprovalRuleTemplateARN         string    `json:"approvalRuleTemplateArn"`
	ApprovalRuleTemplateContent     string    `json:"approvalRuleTemplateContent"`
	ApprovalRuleTemplateDescription string    `json:"approvalRuleTemplateDescription,omitempty"`
	LastModifiedUser                string    `json:"lastModifiedUser,omitempty"`
	RuleContentSha256               string    `json:"ruleContentSha256"`
}

ApprovalRuleTemplate represents an AWS CodeCommit approval rule template.

type BatchAssociationError

type BatchAssociationError struct {
	RepositoryName string `json:"repositoryName"`
	ErrorCode      string `json:"errorCode"`
	ErrorMessage   string `json:"errorMessage"`
}

BatchAssociationError holds the error info for a single failed batch association.

type BatchCommitError

type BatchCommitError struct {
	CommitID     string `json:"commitId"`
	ErrorCode    string `json:"errorCode"`
	ErrorMessage string `json:"errorMessage"`
}

BatchCommitError holds error information for a failed batch commit retrieval.

type BatchDescribeMergeConflictsResult

type BatchDescribeMergeConflictsResult struct {
	DestinationCommitID string          `json:"destinationCommitId"`
	SourceCommitID      string          `json:"sourceCommitId"`
	BaseCommitID        string          `json:"baseCommitId,omitempty"`
	Conflicts           []MergeConflict `json:"conflicts"`
	Errors              []ConflictError `json:"errors,omitempty"`
}

BatchDescribeMergeConflictsResult holds the result of a merge conflict description.

type BlobInfo

type BlobInfo struct {
	BlobID string `json:"blobId"`
	Path   string `json:"path"`
	Mode   string `json:"mode"`
}

BlobInfo holds per-blob metadata in a file difference, matching real AWS shape.

type Branch

type Branch struct {
	BranchName     string `json:"branchName"`
	CommitID       string `json:"commitId"`
	RepositoryName string `json:"repositoryName"`
}

Branch represents a CodeCommit branch.

type Comment

type Comment struct {
	CommentID        string `json:"commentId"`
	Content          string `json:"content"`
	AuthorARN        string `json:"authorArn"`
	CreationDate     string `json:"creationDate"`
	LastModifiedDate string `json:"lastModifiedDate"`
	// InReplyTo links to parent comment for replies
	InReplyTo string `json:"inReplyTo,omitempty"`
	// PRid links comment to a pull request
	PRid string `json:"-"`
	// RepoName + AfterCommitID for commit comments
	RepoName      string `json:"-"`
	AfterCommitID string `json:"-"`
	Deleted       bool   `json:"deleted"`
}

Comment represents a CodeCommit comment.

type Commit

type Commit struct {
	CreatedAt      time.Time `json:"createdAt"`
	CommitID       string    `json:"commitId"`
	TreeID         string    `json:"treeId"`
	Message        string    `json:"message,omitempty"`
	AdditionalData string    `json:"additionalData,omitempty"`
	AuthorName     string    `json:"authorName,omitempty"`
	AuthorEmail    string    `json:"authorEmail,omitempty"`
	CommitterName  string    `json:"committerName,omitempty"`
	CommitterEmail string    `json:"committerEmail,omitempty"`
	RepositoryName string    `json:"repositoryName"`
	Parents        []string  `json:"parents,omitempty"`
}

Commit represents a CodeCommit commit.

type ConflictError

type ConflictError struct {
	FilePath     string `json:"filePath"`
	ErrorCode    string `json:"errorCode"`
	ErrorMessage string `json:"errorMessage"`
}

ConflictError represents an error encountered while describing a conflict.

type ConflictMetadata

type ConflictMetadata struct {
	FilePath          string           `json:"filePath"`
	NumberOfConflicts int              `json:"numberOfConflicts"`
	IsBinaryFile      FileBinaryStatus `json:"isBinaryFile"`
	ContentConflict   bool             `json:"contentConflict"`
}

ConflictMetadata holds metadata about a merge conflict.

type File

type File struct {
	FilePath        string `json:"filePath"`
	CommitSpecifier string `json:"commitSpecifier"`
	BlobID          string `json:"blobId"`
	FileMode        string `json:"fileMode"`
	RepoName        string `json:"-"`
	FileContent     []byte `json:"fileContent"`
}

File represents a file stored in CodeCommit.

RepoName identifies the owning repository. It exists purely so the flattened store.Table[File] (see store_setup.go; this collection was previously nested repoName -> filePath -> *File) can derive its composite "repoName|filePath" key from the value alone; it is not part of the CodeCommit wire API, hence json:"-".

type FileBinaryStatus

type FileBinaryStatus struct {
	Source      bool `json:"source"`
	Destination bool `json:"destination"`
	Base        bool `json:"base"`
}

FileBinaryStatus holds whether each version of a file is binary.

type FileDifference

type FileDifference struct {
	AfterBlob  *BlobInfo `json:"afterBlob"`
	BeforeBlob *BlobInfo `json:"beforeBlob"`
	ChangeType string    `json:"changeType"`
}

FileDifference represents a file difference between two commits.

type Handler

type Handler struct {
	Backend *InMemoryBackend
	// contains filtered or unexported fields
}

Handler is the Echo HTTP handler for AWS CodeCommit operations.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a new CodeCommit handler.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns all regions this CodeCommit instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation extracts the CodeCommit operation from the X-Amz-Target header.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts the repository name from the request body.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of supported CodeCommit operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all handler and backend state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function that matches AWS CodeCommit requests.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

type InMemoryBackend

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

InMemoryBackend is the in-memory store for CodeCommit resources.

Phase 3.3 datalayer refactor: every map[string]*T resource field is registered exactly once (see store_setup.go's registerAllTables) as a *store.Table[T] on registry. Maps whose value is not a *T of its own (sets, plain scalars/strings, slices, or a pure reverse/derived index) are left as plain maps below -- see store_setup.go's file doc for the full audit of which field went which way and why.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new in-memory CodeCommit backend.

func (*InMemoryBackend) AddApprovalRuleTemplateInternal

func (b *InMemoryBackend) AddApprovalRuleTemplateInternal(t *ApprovalRuleTemplate)

AddApprovalRuleTemplateInternal seeds an ApprovalRuleTemplate directly.

func (*InMemoryBackend) AddBranchInternal

func (b *InMemoryBackend) AddBranchInternal(repositoryName string, br *Branch)

AddBranchInternal seeds a Branch directly into the backend.

func (*InMemoryBackend) AddCommitInternal

func (b *InMemoryBackend) AddCommitInternal(repositoryName string, c *Commit)

AddCommitInternal seeds a Commit directly into the backend.

func (*InMemoryBackend) AddPullRequestInternal

func (b *InMemoryBackend) AddPullRequestInternal(pr *PullRequest)

AddPullRequestInternal seeds a PullRequest directly into the backend.

func (*InMemoryBackend) AddRepositoryInternal

func (b *InMemoryBackend) AddRepositoryInternal(r *Repository)

AddRepositoryInternal seeds a Repository directly into the backend without going through normal validation.

func (*InMemoryBackend) AssociateApprovalRuleTemplateWithRepository

func (b *InMemoryBackend) AssociateApprovalRuleTemplateWithRepository(templateName, repositoryName string) error

AssociateApprovalRuleTemplateWithRepository associates an approval rule template with a repository.

func (*InMemoryBackend) BatchAssociateApprovalRuleTemplateWithRepositories

func (b *InMemoryBackend) BatchAssociateApprovalRuleTemplateWithRepositories(
	templateName string,
	repositoryNames []string,
) ([]string, []BatchAssociationError)

BatchAssociateApprovalRuleTemplateWithRepositories associates an approval rule template with multiple repositories. Returns lists of associated and failed repository names.

func (*InMemoryBackend) BatchDescribeMergeConflicts

func (b *InMemoryBackend) BatchDescribeMergeConflicts(
	repositoryName, destinationCommitSpecifier, sourceCommitSpecifier, _ string,
	filePaths []string,
) (*BatchDescribeMergeConflictsResult, error)

BatchDescribeMergeConflicts describes merge conflicts between two commits. This is a stub implementation — it returns empty conflicts since the backend does not track file-level content.

func (*InMemoryBackend) BatchDisassociateApprovalRuleTemplateFromRepositories

func (b *InMemoryBackend) BatchDisassociateApprovalRuleTemplateFromRepositories(
	templateName string,
	repositoryNames []string,
) ([]string, []BatchAssociationError)

BatchDisassociateApprovalRuleTemplateFromRepositories removes associations between a template and multiple repositories.

func (*InMemoryBackend) BatchGetCommits

func (b *InMemoryBackend) BatchGetCommits(
	repositoryName string,
	commitIDs []string,
) ([]*Commit, []BatchCommitError, error)

BatchGetCommits retrieves multiple commits by ID from a repository. Returns a 404 error if the repository does not exist.

func (*InMemoryBackend) BatchGetRepositories

func (b *InMemoryBackend) BatchGetRepositories(names []string) ([]*Repository, []string, error)

BatchGetRepositories returns repositories by name, splitting results into found/notFound. AWS enforces a maximum of 25 repository names per request.

func (*InMemoryBackend) CreateApprovalRuleTemplate

func (b *InMemoryBackend) CreateApprovalRuleTemplate(name, description, content string) (*ApprovalRuleTemplate, error)

CreateApprovalRuleTemplate creates a new approval rule template.

func (*InMemoryBackend) CreateBranch

func (b *InMemoryBackend) CreateBranch(repositoryName, branchName, commitID string) error

CreateBranch creates a new branch in a repository.

func (*InMemoryBackend) CreateCommit

func (b *InMemoryBackend) CreateCommit(
	repositoryName, branchName, authorName, authorEmail, message, parentCommitID string,
	putFiles []PutFileEntry, deleteFiles []string,
) (*Commit, map[string]string, error)

CreateCommit creates a new commit in a repository, tracking parent commits from the current branch head.

parentCommitID must match the current branch tip when the branch already has commits; AWS returns ParentCommitIdRequiredException if omitted and ParentCommitIdOutdatedException if it does not match the current tip.

func (*InMemoryBackend) CreatePullRequest

func (b *InMemoryBackend) CreatePullRequest(
	title, description, clientRequestToken string,
	targets []PullRequestTarget,
) (*PullRequest, error)

CreatePullRequest creates a new pull request.

func (*InMemoryBackend) CreatePullRequestApprovalRule

func (b *InMemoryBackend) CreatePullRequestApprovalRule(
	prID, ruleName, content string,
) (*PullRequestApprovalRule, error)

CreatePullRequestApprovalRule creates an approval rule on a pull request.

func (*InMemoryBackend) CreateRepository

func (b *InMemoryBackend) CreateRepository(name, description string, kv map[string]string) (*Repository, error)

CreateRepository creates a new CodeCommit repository.

func (*InMemoryBackend) CreateUnreferencedMergeCommit

func (b *InMemoryBackend) CreateUnreferencedMergeCommit(
	repoName, sourceCommitID, destinationCommitID string,
) (*Commit, error)

CreateUnreferencedMergeCommit creates a new unreferenced merge commit.

func (*InMemoryBackend) DeleteApprovalRuleTemplate

func (b *InMemoryBackend) DeleteApprovalRuleTemplate(name string) error

DeleteApprovalRuleTemplate deletes an approval rule template by name.

func (*InMemoryBackend) DeleteBranch

func (b *InMemoryBackend) DeleteBranch(repositoryName, branchName string) (*Branch, error)

DeleteBranch deletes a branch from a repository.

func (*InMemoryBackend) DeleteCommentContent

func (b *InMemoryBackend) DeleteCommentContent(commentID string) error

DeleteCommentContent marks a comment as deleted and clears its content.

func (*InMemoryBackend) DeleteFile

func (b *InMemoryBackend) DeleteFile(
	repoName, branchName, filePath, _ string,
) (*Commit, string, error)

DeleteFile removes a file and creates a delete commit. It returns the new commit and the blob ID of the removed file (AWS's DeleteFileOutput.BlobId is a required field reporting the blob that was taken out of the tree). AWS rejects deletion of a path that does not exist with FileDoesNotExistException, so callers must not be able to fabricate a delete commit for a file that was never there.

func (*InMemoryBackend) DeletePullRequestApprovalRule

func (b *InMemoryBackend) DeletePullRequestApprovalRule(prID, ruleName string) error

DeletePullRequestApprovalRule deletes an approval rule from a pull request.

func (*InMemoryBackend) DeleteRepository

func (b *InMemoryBackend) DeleteRepository(name string) (*Repository, error)

DeleteRepository deletes a repository by name and cascades to branches, commits, template associations, files, triggers, and pull requests targeting this repository.

func (*InMemoryBackend) DescribePullRequestEvents

func (b *InMemoryBackend) DescribePullRequestEvents(prID string) ([]PullRequestEvent, error)

DescribePullRequestEvents returns events for a pull request.

func (*InMemoryBackend) DisassociateApprovalRuleTemplateFromRepository

func (b *InMemoryBackend) DisassociateApprovalRuleTemplateFromRepository(templateName, repositoryName string) error

DisassociateApprovalRuleTemplateFromRepository removes an approval rule template association from a repository.

func (*InMemoryBackend) EvaluatePullRequestApprovalRules

func (b *InMemoryBackend) EvaluatePullRequestApprovalRules(prID string) ([]RuleEvaluation, error)

EvaluatePullRequestApprovalRules evaluates all approval rules for a pull request.

func (*InMemoryBackend) GetApprovalRuleTemplate

func (b *InMemoryBackend) GetApprovalRuleTemplate(name string) (*ApprovalRuleTemplate, error)

GetApprovalRuleTemplate retrieves an approval rule template by name.

func (*InMemoryBackend) GetBlob

func (b *InMemoryBackend) GetBlob(repoName, blobID string) ([]byte, error)

GetBlob returns the content of a blob by blobID.

func (*InMemoryBackend) GetBranch

func (b *InMemoryBackend) GetBranch(repositoryName, branchName string) (*Branch, error)

GetBranch returns a branch by repository and branch name.

func (*InMemoryBackend) GetComment

func (b *InMemoryBackend) GetComment(commentID string) (*Comment, error)

GetComment retrieves a comment by ID.

func (*InMemoryBackend) GetCommentReactions

func (b *InMemoryBackend) GetCommentReactions(commentID string) ([]Reaction, error)

GetCommentReactions returns reactions for a comment.

func (*InMemoryBackend) GetCommentsForComparedCommit

func (b *InMemoryBackend) GetCommentsForComparedCommit(repoName, afterCommitID string) ([]*Comment, error)

GetCommentsForComparedCommit returns comments for a compared commit.

func (*InMemoryBackend) GetCommentsForPullRequest

func (b *InMemoryBackend) GetCommentsForPullRequest(prID string) ([]*Comment, error)

GetCommentsForPullRequest returns comments for a pull request.

func (*InMemoryBackend) GetCommit

func (b *InMemoryBackend) GetCommit(repositoryName, commitID string) (*Commit, error)

GetCommit returns a commit by repository and commit ID.

func (*InMemoryBackend) GetDifferences

func (b *InMemoryBackend) GetDifferences(repoName, afterCommitSpecifier, _ string) ([]FileDifference, error)

GetDifferences returns file differences between beforeCommitSpecifier and afterCommitSpecifier. When beforeCommitSpecifier is empty, returns all files in afterCommitSpecifier as ADDed.

func (*InMemoryBackend) GetFile

func (b *InMemoryBackend) GetFile(repoName, _, filePath string) (*File, error)

GetFile retrieves a file by repository, commit specifier, and path.

func (*InMemoryBackend) GetFolder

func (b *InMemoryBackend) GetFolder(repoName, _, folderPath string) ([]string, error)

GetFolder lists file paths under a folder path.

func (*InMemoryBackend) GetFolderFiles

func (b *InMemoryBackend) GetFolderFiles(repoName, _, folderPath string) ([]*File, error)

GetFolderFiles returns file metadata (path, blobId, fileMode) for files under a folder path. This provides richer info than GetFolder for handler responses matching the AWS API shape.

func (*InMemoryBackend) GetMergeCommit

func (b *InMemoryBackend) GetMergeCommit(
	repoName, sourceCommitSpecifier, destinationCommitSpecifier string,
) (*Commit, error)

GetMergeCommit returns a commit that has both sourceCommitSpecifier and destinationCommitSpecifier as parents, or falls back to the most recent commit.

func (*InMemoryBackend) GetMergeConflicts

func (b *InMemoryBackend) GetMergeConflicts(
	repoName, _, _, _ string,
) (bool, error)

GetMergeConflicts returns whether there are merge conflicts (always false).

func (*InMemoryBackend) GetMergeOptions

func (b *InMemoryBackend) GetMergeOptions(
	repoName, _, _ string,
) ([]string, error)

GetMergeOptions returns the available merge options for two branches.

func (*InMemoryBackend) GetPullRequest

func (b *InMemoryBackend) GetPullRequest(prID string) (*PullRequest, error)

GetPullRequest returns a pull request by ID.

func (*InMemoryBackend) GetPullRequestApprovalStates

func (b *InMemoryBackend) GetPullRequestApprovalStates(prID string) ([]PullRequestApproval, error)

GetPullRequestApprovalStates returns the approval states for a pull request.

func (*InMemoryBackend) GetPullRequestOverrideState

func (b *InMemoryBackend) GetPullRequestOverrideState(prID string) (bool, string, error)

GetPullRequestOverrideState returns whether a PR has been overridden and by whom.

func (*InMemoryBackend) GetRepository

func (b *InMemoryBackend) GetRepository(name string) (*Repository, error)

GetRepository returns a repository by name.

func (*InMemoryBackend) GetRepositoryTriggers

func (b *InMemoryBackend) GetRepositoryTriggers(repoName string) ([]RepositoryTrigger, error)

GetRepositoryTriggers returns triggers for a repository.

func (*InMemoryBackend) ListApprovalRuleTemplates

func (b *InMemoryBackend) ListApprovalRuleTemplates() []*ApprovalRuleTemplate

ListApprovalRuleTemplates returns all approval rule templates.

func (*InMemoryBackend) ListAssociatedApprovalRuleTemplatesForRepository

func (b *InMemoryBackend) ListAssociatedApprovalRuleTemplatesForRepository(repoName string) ([]string, error)

ListAssociatedApprovalRuleTemplatesForRepository returns template names associated with a repository.

func (*InMemoryBackend) ListBranches

func (b *InMemoryBackend) ListBranches(repositoryName string) ([]string, error)

ListBranches returns all branch names for a repository in sorted order.

func (*InMemoryBackend) ListFileCommitHistory

func (b *InMemoryBackend) ListFileCommitHistory(repoName, filePath string) ([]*Commit, error)

ListFileCommitHistory returns commits that touched the given filePath. When filePath is empty, all commits for the repository are returned.

func (*InMemoryBackend) ListPullRequests

func (b *InMemoryBackend) ListPullRequests(repositoryName, pullRequestStatus, authorARN string) ([]string, error)

ListPullRequests returns pull request IDs for a repository, optionally filtered by status. IDs are returned in numeric descending order (newest first), matching AWS behaviour. pullRequestStatus accepts "OPEN", "CLOSED", or "MERGED" (empty means return all).

func (*InMemoryBackend) ListRepositories

func (b *InMemoryBackend) ListRepositories() []*Repository

ListRepositories returns all repositories sorted by name.

func (*InMemoryBackend) ListRepositoriesForApprovalRuleTemplate

func (b *InMemoryBackend) ListRepositoriesForApprovalRuleTemplate(templateName string) ([]string, error)

ListRepositoriesForApprovalRuleTemplate returns repository names that have a given template associated.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)

ListTagsForResource returns tags for a repository by ARN.

func (*InMemoryBackend) MergeBranchesByFastForward

func (b *InMemoryBackend) MergeBranchesByFastForward(repoName, sourceRef, destinationRef string) (*Commit, error)

MergeBranchesByFastForward merges branches by fast-forward and creates a merge commit.

func (*InMemoryBackend) MergePullRequestByFastForward

func (b *InMemoryBackend) MergePullRequestByFastForward(
	prID, _, _ string,
) (*PullRequest, error)

MergePullRequestByFastForward merges a pull request by fast-forward strategy.

func (*InMemoryBackend) MergePullRequestBySquash

func (b *InMemoryBackend) MergePullRequestBySquash(
	prID, _, _ string,
) (*PullRequest, error)

MergePullRequestBySquash merges a pull request by squash strategy.

func (*InMemoryBackend) MergePullRequestByThreeWay

func (b *InMemoryBackend) MergePullRequestByThreeWay(
	prID, _, _ string,
) (*PullRequest, error)

MergePullRequestByThreeWay merges a pull request by three-way strategy.

func (*InMemoryBackend) OverridePullRequestApprovalRules

func (b *InMemoryBackend) OverridePullRequestApprovalRules(prID, overrideStatus, overriderARN string) error

OverridePullRequestApprovalRules sets the override status for a pull request.

func (*InMemoryBackend) PostCommentForComparedCommit

func (b *InMemoryBackend) PostCommentForComparedCommit(repoName, _, afterCommitID, content string) (*Comment, error)

PostCommentForComparedCommit creates a comment on a compared commit.

func (*InMemoryBackend) PostCommentForPullRequest

func (b *InMemoryBackend) PostCommentForPullRequest(prID, repoName, content string) (*Comment, error)

PostCommentForPullRequest creates a comment on a pull request.

func (*InMemoryBackend) PostCommentReply

func (b *InMemoryBackend) PostCommentReply(inReplyTo, content string) (*Comment, error)

PostCommentReply creates a reply to an existing comment.

func (*InMemoryBackend) PutCommentReaction

func (b *InMemoryBackend) PutCommentReaction(commentID, emoji string) error

PutCommentReaction adds a reaction to a comment.

func (*InMemoryBackend) PutFile

func (b *InMemoryBackend) PutFile(repoName, branchName, filePath string, content []byte) (*Commit, string, error)

PutFile stores a file and creates a commit. It returns the new commit and the blob ID of the stored file content (AWS's PutFileOutput.BlobId is a required field, so callers must round-trip this into GetBlob).

func (*InMemoryBackend) PutRepositoryTriggers

func (b *InMemoryBackend) PutRepositoryTriggers(repoName string, triggers []RepositoryTrigger) error

PutRepositoryTriggers replaces triggers for a repository.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the AWS region this backend is configured for.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all backend state, returning it to a pristine empty state.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore deserializes state from JSON. It implements persistence.Persistable.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serializes current state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(resourceARN string, kv map[string]string) error

TagResource adds or replaces tags on a repository by ARN.

func (*InMemoryBackend) TestRepositoryTriggers

func (b *InMemoryBackend) TestRepositoryTriggers(repoName string) ([]string, error)

TestRepositoryTriggers returns the names of triggers that succeeded.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error

UntagResource removes tags from a repository by ARN.

func (*InMemoryBackend) UpdateApprovalRuleTemplateContent

func (b *InMemoryBackend) UpdateApprovalRuleTemplateContent(name, content string) error

UpdateApprovalRuleTemplateContent updates the content of an approval rule template.

func (*InMemoryBackend) UpdateApprovalRuleTemplateDescription

func (b *InMemoryBackend) UpdateApprovalRuleTemplateDescription(name, desc string) error

UpdateApprovalRuleTemplateDescription updates the description of an approval rule template.

func (*InMemoryBackend) UpdateApprovalRuleTemplateName

func (b *InMemoryBackend) UpdateApprovalRuleTemplateName(oldName, newName string) error

UpdateApprovalRuleTemplateName renames an approval rule template.

func (*InMemoryBackend) UpdateComment

func (b *InMemoryBackend) UpdateComment(commentID, content string) error

UpdateComment updates the content of a comment.

func (*InMemoryBackend) UpdateDefaultBranch

func (b *InMemoryBackend) UpdateDefaultBranch(repoName, branchName string) error

UpdateDefaultBranch sets the default branch for a repository. AWS requires the branch to exist in the repository.

func (*InMemoryBackend) UpdatePullRequestApprovalRuleContent

func (b *InMemoryBackend) UpdatePullRequestApprovalRuleContent(prID, ruleName, content string) error

UpdatePullRequestApprovalRuleContent updates the content of an approval rule on a pull request.

func (*InMemoryBackend) UpdatePullRequestApprovalState

func (b *InMemoryBackend) UpdatePullRequestApprovalState(prID, userARN, approvalState string) error

UpdatePullRequestApprovalState sets the approval state for a user on a pull request. AWS rejects this operation on closed or merged pull requests.

func (*InMemoryBackend) UpdatePullRequestDescription

func (b *InMemoryBackend) UpdatePullRequestDescription(prID, desc string) error

UpdatePullRequestDescription updates the description of a pull request. AWS rejects this operation on closed or merged pull requests.

func (*InMemoryBackend) UpdatePullRequestStatus

func (b *InMemoryBackend) UpdatePullRequestStatus(prID, status string) error

UpdatePullRequestStatus updates the status of a pull request.

func (*InMemoryBackend) UpdatePullRequestTitle

func (b *InMemoryBackend) UpdatePullRequestTitle(prID, title string) error

UpdatePullRequestTitle updates the title of a pull request. AWS rejects this operation on closed or merged pull requests.

func (*InMemoryBackend) UpdateRepositoryDescription

func (b *InMemoryBackend) UpdateRepositoryDescription(name, desc string) error

UpdateRepositoryDescription sets the description of a repository.

func (*InMemoryBackend) UpdateRepositoryEncryptionKey

func (b *InMemoryBackend) UpdateRepositoryEncryptionKey(name, kmsKeyID string) error

UpdateRepositoryEncryptionKey sets the KMS key ID for a repository.

func (*InMemoryBackend) UpdateRepositoryName

func (b *InMemoryBackend) UpdateRepositoryName(oldName, newName string) error

UpdateRepositoryName renames a repository from oldName to newName.

type MergeConflict

type MergeConflict struct {
	MergeHunks       []MergeHunk      `json:"mergeHunks,omitempty"`
	ConflictMetadata ConflictMetadata `json:"conflictMetadata"`
}

MergeConflict represents a single file conflict.

type MergeHunk

type MergeHunk struct {
	Source      *MergeHunkDetail `json:"source,omitempty"`
	Destination *MergeHunkDetail `json:"destination,omitempty"`
	Base        *MergeHunkDetail `json:"base,omitempty"`
	IsConflict  bool             `json:"isConflict"`
}

MergeHunk represents a merge hunk.

type MergeHunkDetail

type MergeHunkDetail struct {
	HunkContent string `json:"hunkContent"`
	StartLine   int    `json:"startLine"`
	EndLine     int    `json:"endLine"`
}

MergeHunkDetail represents details about a merge hunk.

type Provider

type Provider struct{}

Provider implements service.Provider for AWS CodeCommit.

func (*Provider) Init

Init initializes the CodeCommit service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type PullRequest

type PullRequest struct {
	CreationDate       time.Time           `json:"creationDate"`
	LastActivityDate   time.Time           `json:"lastActivityDate"`
	PullRequestID      string              `json:"pullRequestId"`
	Title              string              `json:"title"`
	Description        string              `json:"description,omitempty"`
	AuthorARN          string              `json:"authorArn,omitempty"`
	PullRequestStatus  string              `json:"pullRequestStatus"`
	ClientRequestToken string              `json:"clientRequestToken,omitempty"`
	RevisionID         string              `json:"revisionId"`
	PullRequestTargets []PullRequestTarget `json:"pullRequestTargets"`
}

PullRequest represents a CodeCommit pull request.

type PullRequestApproval

type PullRequestApproval struct {
	UserARN       string `json:"userArn"`
	ApprovalState string `json:"approvalState"`
}

PullRequestApproval represents a user's approval state for a pull request.

type PullRequestApprovalRule

type PullRequestApprovalRule struct {
	RuleID              string `json:"approvalRuleId"`
	RuleName            string `json:"approvalRuleName"`
	ApprovalRuleContent string `json:"approvalRuleContent"`
	PRID                string `json:"-"`
}

PullRequestApprovalRule represents an approval rule on a pull request.

PRID identifies the owning pull request. It exists purely so the flattened store.Table[PullRequestApprovalRule] (see store_setup.go; this collection was previously nested prID -> ruleName -> *rule) can derive its composite "prID|ruleName" key from the value alone; it is not part of the CodeCommit wire API, hence json:"-".

type PullRequestEvent

type PullRequestEvent struct {
	PullRequestEventType string `json:"pullRequestEventType"`
	EventDate            string `json:"eventDate"`
}

PullRequestEvent represents an event on a pull request.

type PullRequestTarget

type PullRequestTarget struct {
	RepositoryName       string `json:"repositoryName"`
	SourceReference      string `json:"sourceReference"`
	DestinationReference string `json:"destinationReference,omitempty"`
	SourceCommit         string `json:"sourceCommit,omitempty"`
	DestinationCommit    string `json:"destinationCommit,omitempty"`
	MergeBase            string `json:"mergeBase,omitempty"`
}

PullRequestTarget represents a target for a pull request.

type PutFileEntry

type PutFileEntry struct {
	FilePath    string `json:"filePath"`
	FileMode    string `json:"fileMode"`
	FileContent []byte `json:"fileContent"`
}

PutFileEntry describes a file to add or overwrite in a CreateCommit call.

type Reaction

type Reaction struct {
	Emoji   string `json:"emoji"`
	UserARN string `json:"userArn"`
}

Reaction represents a reaction emoji by a user on a comment.

type Repository

type Repository struct {
	CreationDate     time.Time  `json:"creationDate"`
	LastModifiedDate time.Time  `json:"lastModifiedDate"`
	Tags             *tags.Tags `json:"tags,omitempty"`
	RepositoryName   string     `json:"repositoryName"`
	RepositoryID     string     `json:"repositoryId"`
	ARN              string     `json:"arn"`
	Description      string     `json:"repositoryDescription,omitempty"`
	AccountID        string     `json:"accountId"`
	Region           string     `json:"-"`
	CloneURLHTTP     string     `json:"cloneUrlHttp"`
	CloneURLSSH      string     `json:"cloneUrlSsh"`
	KmsKeyID         string     `json:"kmsKeyId,omitempty"`
	DefaultBranch    string     `json:"defaultBranch,omitempty"`
}

Repository represents an AWS CodeCommit repository.

The Tags field is backend-owned. Callers must treat the returned pointer as read-only; mutate tags only via TagResource / CreateRepository.

type RepositoryTrigger

type RepositoryTrigger struct {
	Name           string   `json:"name"`
	DestinationARN string   `json:"destinationArn"`
	Events         []string `json:"events"`
}

RepositoryTrigger represents a trigger on a repository.

type RuleEvaluation

type RuleEvaluation struct {
	RuleName  string `json:"approvalRuleName"`
	Satisfied bool   `json:"satisfied"`
}

RuleEvaluation represents the evaluation of a pull request approval rule.

Jump to

Keyboard shortcuts

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