Documentation
¶
Index ¶
- Constants
- func BuildDefaultUploadPRBody(baseBranch string, subdirectory string) string
- func BuildDefaultUploadPRTitle(project string, fileCount int) string
- func BuildGitUploadBranchName(project string) string
- func BuildGitUploadTargetPath(subdirectory string, fileName string) string
- func BuildLFSPointerContent(checksum string, size int64) string
- func DeleteAuthzResource(ctx context.Context, authorizationHeader, resourcePath string) error
- func GitPathExistsInRef(repo *gogit.Repository, hash plumbing.Hash, path string) (bool, error)
- func NormalizeGitUploadFileName(value string) (string, error)
- func NormalizeGitUploadSubdirectory(value string) string
- func OpenRepository(path string) (*gogit.Repository, error)
- func OrganizationConfigurationState(appInstalled bool, configuredProjects int, totalProjects int) string
- func ProgramProjectResourcePath(organization, project string) string
- func RepositoryIsEmpty(repo *gogit.Repository) bool
- func ResolveGitReference(repo *gogit.Repository, requestedRef string, defaultBranch string) (string, plumbing.Hash, error)
- func SyncRepositoryMirror(ctx context.Context, remoteURL string, mirrorPath string, ...) error
- type CalyprProjectInitializeResponse
- type CalyprProjectReadiness
- type CalyprProjectSetupRequest
- type CalyprProjectSetupResponse
- type CalyprProjectStorageIntent
- type CalyprProjectStorageRequest
- type CalyprProjectStorageResponse
- type CalyprReadinessCheck
- type Error
- type ErrorKind
- type GitHubInstallationRepository
- type GitHubRepositoryMetadata
- type GitLFSPointerInfo
- type GitOrganizationConnectResponse
- type GitOrganizationProjectStatus
- type GitOrganizationStatusResponse
- type GitOrganizationsStatusResponse
- type GitProjectFileResponse
- type GitProjectRefreshResponse
- type GitProjectRefsResponse
- type GitProjectStatusResponse
- type GitProjectTreeResponse
- type GitRef
- type GitRepositoryIdentity
- type GitRepositoryInstallationStatus
- type GitService
- func (service *GitService) CreateGitHubUploadPullRequest(ctx context.Context, authorizationHeader string, organization string, ...) (string, string, error)
- func (service *GitService) EnsureDataDir() error
- func (service *GitService) FetchRepositoryMetadata(ctx context.Context, accessToken string, identity GitRepositoryIdentity) (*GitHubRepositoryMetadata, error)
- func (service *GitService) GetGitHubFileMetadata(ctx context.Context, authorizationHeader string, organization string, ...) (*github.RepositoryContent, []byte, error)
- func (service *GitService) Init(db *sqlx.DB) error
- func (service *GitService) ListInstallationRepositories(ctx context.Context, authorizationHeader string, installationID int64) ([]GitHubInstallationRepository, error)
- func (service *GitService) MirrorPathForIdentity(identity GitRepositoryIdentity) string
- func (service *GitService) RefreshProject(ctx context.Context, projectID string, identity GitRepositoryIdentity, ...) (*GitProjectRefreshResponse, *geckodb.GitProjectState, error)
- func (service *GitService) RequestInstallationStatus(ctx context.Context, authorizationHeader string, organization string, ...) (GitRepositoryInstallationStatus, error)
- func (service *GitService) RequestInstallationToken(ctx context.Context, authorizationHeader string, organization string, ...) (string, error)
- func (service *GitService) RequestInstallationURL(ctx context.Context, authorizationHeader string, owner string, ...) (string, error)
- func (service *GitService) RequestOrganizationInstallationStatus(ctx context.Context, authorizationHeader string, organization string, ...) (GitRepositoryInstallationStatus, error)
- func (service *GitService) ResolveTargetAndRepositoryIDs(ctx context.Context, identity GitRepositoryIdentity) (int64, int64, error)
- func (service *GitService) StatusFromState(projectID string, organization string, project string, ...) GitProjectStatusResponse
- type GitServiceConfig
- type GitTreeEntry
- type GitUploadSessionAttachFilesRequest
- type GitUploadSessionCreateRequest
- type GitUploadSessionFileAttachment
- type GitUploadSessionFileManifest
- type GitUploadSessionFileStatus
- type GitUploadSessionFinalizeRequest
- type GitUploadSessionResponse
- type HTTPStatusError
- type ProjectIntegrationCheck
- type ProjectIntegrationStatus
- type ReconcileService
- func (service *ReconcileService) BuildOrganizationStatus(ctx context.Context, organization string, projectIDs []string, ...) (GitOrganizationStatusResponse, error)
- func (service *ReconcileService) BuildOrganizationsStatus(ctx context.Context, authorizationHeader string, projectIDs []string, ...) (GitOrganizationsStatusResponse, error)
- func (service *ReconcileService) BuildSingleOrganizationStatus(ctx context.Context, authorizationHeader string, organization string, ...) (GitOrganizationStatusResponse, error)
- func (service *ReconcileService) ReconcileOrganization(ctx context.Context, organization string, authorizationHeader string, ...) error
- func (service *ReconcileService) ReconcileOrganizations(ctx context.Context, authorizationHeader string, projectIDs []string) error
- type SetupService
- func (service *SetupService) CleanupProjectStorage(ctx context.Context, authorizationHeader, organization, project string) error
- func (service *SetupService) InitializeProject(ctx context.Context, authorizationHeader, organization, project string, ...) (*CalyprProjectInitializeResponse, error)
- func (service *SetupService) PopulateStorage(ctx context.Context, authorizationHeader, organization, project string, ...) (*CalyprProjectStorageResponse, error)
- func (service *SetupService) PopulateStorageIntent(ctx context.Context, authorizationHeader string, ...) error
- func (service *SetupService) StorageCheck(ctx context.Context, authorizationHeader, organization, project string) (ProjectIntegrationCheck, error)
- type StorageBucket
- type StorageConfig
Constants ¶
View Source
const ( GitSyncNeverSynced = "never_synced" GitSyncReady = "ready" GitSyncUpdating = "updating" GitSyncError = "error" GitInstallationNotConnected = "not_connected" GitInstallationConnected = "connected" )
View Source
const ( GitUploadSessionPending = "pending_upload" GitUploadSessionReady = "ready_for_pr" GitUploadSessionFinalized = "finalized" GitUploadFilePending = "pending_upload" GitUploadFileUploaded = "uploaded" GitUploadFileCollision = "collision" )
Variables ¶
This section is empty.
Functions ¶
func BuildLFSPointerContent ¶
func DeleteAuthzResource ¶
func GitPathExistsInRef ¶
func OpenRepository ¶
func OpenRepository(path string) (*gogit.Repository, error)
func RepositoryIsEmpty ¶
func RepositoryIsEmpty(repo *gogit.Repository) bool
func ResolveGitReference ¶
Types ¶
type CalyprProjectReadiness ¶
type CalyprProjectReadiness struct {
Git CalyprReadinessCheck `json:"git"`
Syfon CalyprReadinessCheck `json:"syfon"`
Config CalyprReadinessCheck `json:"config"`
}
type CalyprProjectSetupRequest ¶
type CalyprProjectSetupRequest struct {
Config appconfig.ProjectConfig `json:"config"`
Storage *CalyprProjectStorageIntent `json:"storage,omitempty"`
}
type CalyprProjectSetupResponse ¶
type CalyprProjectSetupResponse struct {
ProjectID string `json:"project_id"`
ResourcePath string `json:"resource_path"`
Configured bool `json:"configured"`
Readiness CalyprProjectReadiness `json:"readiness"`
}
type CalyprProjectStorageIntent ¶
type CalyprProjectStorageIntent struct {
Bucket string `json:"bucket"`
Provider string `json:"provider"`
Endpoint string `json:"endpoint"`
Region string `json:"region"`
AccessKey string `json:"access_key"`
SecretKey string `json:"secret_key"`
Organization string `json:"organization"`
ProjectID string `json:"project_id"`
Path string `json:"path,omitempty"`
PathPrefix string `json:"path_prefix,omitempty"`
OrganizationSubPath string `json:"organization_sub_path,omitempty"`
ProjectSubPath string `json:"project_sub_path,omitempty"`
}
type CalyprProjectStorageRequest ¶
type CalyprProjectStorageRequest struct {
Storage *CalyprProjectStorageIntent `json:"storage"`
}
type CalyprProjectStorageResponse ¶
type CalyprProjectStorageResponse struct {
Success bool `json:"success"`
ProjectID string `json:"project_id"`
ResourcePath string `json:"resource_path"`
Storage ProjectIntegrationCheck `json:"storage"`
}
type CalyprReadinessCheck ¶
type GitHubInstallationRepository ¶
type GitHubInstallationRepository = domain.GitHubInstallationRepository
GitHubInstallationRepository is an alias for domain.GitHubInstallationRepository.
type GitHubRepositoryMetadata ¶
type GitHubRepositoryMetadata = domain.GitHubRepositoryMetadata
GitHubRepositoryMetadata is an alias for domain.GitHubRepositoryMetadata.
type GitLFSPointerInfo ¶
type GitLFSPointerInfo struct {
Version string `json:"version"`
OID string `json:"oid"`
Size int64 `json:"size"`
}
func ParseGitLFSPointer ¶
func ParseGitLFSPointer(content []byte) *GitLFSPointerInfo
type GitOrganizationConnectResponse ¶
type GitOrganizationConnectResponse struct {
Mode string `json:"mode"`
RedirectURL string `json:"redirect_url,omitempty"`
InstallationID *int64 `json:"installation_id,omitempty"`
Repositories []GitHubInstallationRepository `json:"repositories,omitempty"`
}
type GitOrganizationProjectStatus ¶
type GitOrganizationProjectStatus struct {
ProjectID string `json:"project_id"`
Project string `json:"project"`
ResourcePath string `json:"resource_path"`
Repository GitRepositoryIdentity `json:"repository"`
Configured bool `json:"configured"`
Readiness *CalyprProjectReadiness `json:"readiness,omitempty"`
Integrations ProjectIntegrationStatus `json:"integrations"`
Accessible bool `json:"accessible"`
CanManageSettings bool `json:"can_manage_settings"`
RequestAccess bool `json:"request_access"`
RequestAccessResourcePath string `json:"request_access_resource_path,omitempty"`
Installation GitRepositoryInstallationStatus `json:"installation"`
}
type GitOrganizationStatusResponse ¶
type GitOrganizationStatusResponse struct {
Organization string `json:"organization"`
Connected bool `json:"connected"`
AppInstalled bool `json:"app_installed"`
CanAccessSettings bool `json:"can_access_settings"`
CanCreateProjects bool `json:"can_create_projects"`
CanManagePeople bool `json:"can_manage_people"`
CanDeleteOrg bool `json:"can_delete_org"`
InstallationID *int64 `json:"installation_id,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
RepositorySelection string `json:"repository_selection,omitempty"`
ConfigurationState string `json:"configuration_state"`
ConnectedProjects int `json:"connected_projects"`
ConfiguredProjects int `json:"configured_projects"`
TotalProjects int `json:"total_projects"`
Projects []GitOrganizationProjectStatus `json:"projects"`
}
type GitOrganizationsStatusResponse ¶
type GitOrganizationsStatusResponse struct {
Connected bool `json:"connected"`
AppInstalled bool `json:"app_installed"`
ConnectedOrganizations int `json:"connected_organizations"`
InstalledOrganizations int `json:"installed_organizations"`
TotalOrganizations int `json:"total_organizations"`
ConnectedProjects int `json:"connected_projects"`
ConfiguredProjects int `json:"configured_projects"`
TotalProjects int `json:"total_projects"`
ConfigurationState string `json:"configuration_state"`
Organizations []GitOrganizationStatusResponse `json:"organizations"`
}
type GitProjectFileResponse ¶
type GitProjectFileResponse struct {
ProjectID string `json:"project_id"`
Ref string `json:"ref"`
Path string `json:"path"`
Name string `json:"name"`
Hash string `json:"hash"`
Size int64 `json:"size"`
HTMLURL string `json:"html_url,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
LFSPointer *GitLFSPointerInfo `json:"lfs_pointer,omitempty"`
}
func BuildGitFileResponse ¶
func BuildGitFileResponse(projectID string, ref string, path string, repo *gogit.Repository, hash plumbing.Hash) (*GitProjectFileResponse, error)
func BuildGitHubFileResponse ¶
func BuildGitHubFileResponse(projectID string, ref string, path string, metadata *github.RepositoryContent, contentBytes []byte) *GitProjectFileResponse
type GitProjectRefsResponse ¶
type GitProjectRefsResponse struct {
ProjectID string `json:"project_id"`
DefaultBranch string `json:"default_branch,omitempty"`
Refs []GitRef `json:"refs"`
}
func BuildGitRefsResponse ¶
func BuildGitRefsResponse(projectID string, defaultBranch string, repo *gogit.Repository) (*GitProjectRefsResponse, error)
type GitProjectStatusResponse ¶
type GitProjectStatusResponse struct {
ProjectID string `json:"project_id"`
Organization string `json:"organization"`
Project string `json:"project"`
ResourcePath string `json:"resource_path"`
Accessible bool `json:"accessible"`
RequestAccess bool `json:"request_access"`
RequestAccessResourcePath string `json:"request_access_resource_path,omitempty"`
Config appconfig.ProjectConfig `json:"config"`
Repository GitRepositoryIdentity `json:"repository"`
InstallationState string `json:"installation_state"`
InstallationID *int64 `json:"installation_id,omitempty"`
InstallationTarget string `json:"installation_target,omitempty"`
InstallationTargetType string `json:"installation_target_type,omitempty"`
OrganizationAppInstalled bool `json:"organization_app_installed"`
OrganizationHTMLURL string `json:"organization_html_url,omitempty"`
OrganizationRepositorySelection string `json:"organization_repository_selection,omitempty"`
SyncState string `json:"sync_state"`
DefaultBranch string `json:"default_branch,omitempty"`
LastRefreshedAt *time.Time `json:"last_refreshed_at,omitempty"`
LastError string `json:"last_error,omitempty"`
MirrorReady bool `json:"mirror_ready"`
}
type GitProjectTreeResponse ¶
type GitProjectTreeResponse struct {
ProjectID string `json:"project_id"`
Ref string `json:"ref"`
Path string `json:"path"`
Entries []GitTreeEntry `json:"entries"`
}
func BuildGitTreeResponse ¶
func BuildGitTreeResponse(projectID string, ref string, path string, repo *gogit.Repository, hash plumbing.Hash) (*GitProjectTreeResponse, error)
type GitRepositoryIdentity ¶
type GitRepositoryIdentity = domain.GitRepositoryIdentity
GitRepositoryIdentity is an alias for domain.GitRepositoryIdentity.
func ParseRepositoryIdentity ¶
func ParseRepositoryIdentity(raw string) (GitRepositoryIdentity, error)
type GitRepositoryInstallationStatus ¶
type GitRepositoryInstallationStatus = domain.GitRepositoryInstallationStatus
GitRepositoryInstallationStatus is an alias for domain.GitRepositoryInstallationStatus.
type GitService ¶
type GitService struct {
// contains filtered or unexported fields
}
func NewGitService ¶
func NewGitService(config GitServiceConfig) *GitService
func (*GitService) CreateGitHubUploadPullRequest ¶
func (service *GitService) CreateGitHubUploadPullRequest( ctx context.Context, authorizationHeader string, organization string, project string, identity GitRepositoryIdentity, baseBranch string, branchName string, title string, body string, files []geckodb.GitUploadSessionFile, ) (string, string, error)
func (*GitService) EnsureDataDir ¶
func (service *GitService) EnsureDataDir() error
func (*GitService) FetchRepositoryMetadata ¶
func (service *GitService) FetchRepositoryMetadata(ctx context.Context, accessToken string, identity GitRepositoryIdentity) (*GitHubRepositoryMetadata, error)
func (*GitService) GetGitHubFileMetadata ¶
func (service *GitService) GetGitHubFileMetadata(ctx context.Context, authorizationHeader string, organization string, project string, identity GitRepositoryIdentity, ref string, path string) (*github.RepositoryContent, []byte, error)
func (*GitService) ListInstallationRepositories ¶
func (service *GitService) ListInstallationRepositories(ctx context.Context, authorizationHeader string, installationID int64) ([]GitHubInstallationRepository, error)
func (*GitService) MirrorPathForIdentity ¶
func (service *GitService) MirrorPathForIdentity(identity GitRepositoryIdentity) string
func (*GitService) RefreshProject ¶
func (service *GitService) RefreshProject(ctx context.Context, projectID string, identity GitRepositoryIdentity, state *geckodb.GitProjectState, accessToken string) (*GitProjectRefreshResponse, *geckodb.GitProjectState, error)
func (*GitService) RequestInstallationStatus ¶
func (service *GitService) RequestInstallationStatus(ctx context.Context, authorizationHeader string, organization string, identity GitRepositoryIdentity) (GitRepositoryInstallationStatus, error)
func (*GitService) RequestInstallationToken ¶
func (service *GitService) RequestInstallationToken(ctx context.Context, authorizationHeader string, organization string, project string, identity GitRepositoryIdentity, access string) (string, error)
func (*GitService) RequestInstallationURL ¶
func (*GitService) RequestOrganizationInstallationStatus ¶
func (service *GitService) RequestOrganizationInstallationStatus(ctx context.Context, authorizationHeader string, organization string, owner string) (GitRepositoryInstallationStatus, error)
func (*GitService) ResolveTargetAndRepositoryIDs ¶
func (service *GitService) ResolveTargetAndRepositoryIDs(ctx context.Context, identity GitRepositoryIdentity) (int64, int64, error)
func (*GitService) StatusFromState ¶
func (service *GitService) StatusFromState(projectID string, organization string, project string, cfg appconfig.ProjectConfig, identity GitRepositoryIdentity, state *geckodb.GitProjectState, orgState *geckodb.GitOrganizationState) GitProjectStatusResponse
type GitServiceConfig ¶
type GitTreeEntry ¶
type GitUploadSessionAttachFilesRequest ¶
type GitUploadSessionAttachFilesRequest struct {
Files []GitUploadSessionFileAttachment `json:"files"`
}
type GitUploadSessionCreateRequest ¶
type GitUploadSessionCreateRequest struct {
BaseBranch string `json:"base_branch"`
TargetSubdir string `json:"target_subdirectory"`
Files []GitUploadSessionFileManifest `json:"files"`
}
type GitUploadSessionFileStatus ¶
type GitUploadSessionFileStatus struct {
FileName string `json:"file_name"`
TargetPath string `json:"target_path"`
Size int64 `json:"size"`
Checksum string `json:"checksum,omitempty"`
DRSObjectID string `json:"drs_object_id,omitempty"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
Collision bool `json:"collision"`
}
type GitUploadSessionResponse ¶
type GitUploadSessionResponse struct {
SessionID string `json:"session_id"`
ProjectID string `json:"project_id"`
BaseBranch string `json:"base_branch"`
TargetSubdir string `json:"target_subdirectory,omitempty"`
BranchName string `json:"branch_name"`
PRTitle string `json:"pr_title"`
PRBody string `json:"pr_body"`
Status string `json:"status"`
PullRequestURL string `json:"pull_request_url,omitempty"`
CommitSHA string `json:"commit_sha,omitempty"`
Files []GitUploadSessionFileStatus `json:"files"`
HasConflicts bool `json:"has_conflicts"`
}
func BuildGitUploadSessionResponse ¶
func BuildGitUploadSessionResponse(session geckodb.GitUploadSession, files []geckodb.GitUploadSessionFile) GitUploadSessionResponse
type HTTPStatusError ¶
type HTTPStatusError = domain.HTTPStatusError
HTTPStatusError is an alias for domain.HTTPStatusError.
type ProjectIntegrationCheck ¶
type ProjectIntegrationStatus ¶
type ProjectIntegrationStatus struct {
GitHub ProjectIntegrationCheck `json:"github"`
Storage ProjectIntegrationCheck `json:"storage"`
}
type ReconcileService ¶
type ReconcileService struct {
// contains filtered or unexported fields
}
func NewReconcileService ¶
func NewReconcileService(db *sqlx.DB, storage *syfon.Manager, gitService *GitService) *ReconcileService
func (*ReconcileService) BuildOrganizationStatus ¶
func (service *ReconcileService) BuildOrganizationStatus(ctx context.Context, organization string, projectIDs []string, projectStates map[string]geckodb.GitProjectState, organizationStates map[string]geckodb.GitOrganizationState, allowedResources []string, buckets map[string]StorageBucket, bucketsErr error) (GitOrganizationStatusResponse, error)
func (*ReconcileService) BuildOrganizationsStatus ¶
func (service *ReconcileService) BuildOrganizationsStatus(ctx context.Context, authorizationHeader string, projectIDs []string, allowedResources []string) (GitOrganizationsStatusResponse, error)
func (*ReconcileService) BuildSingleOrganizationStatus ¶
func (service *ReconcileService) BuildSingleOrganizationStatus(ctx context.Context, authorizationHeader string, organization string, projectIDs []string, allowedResources []string) (GitOrganizationStatusResponse, error)
func (*ReconcileService) ReconcileOrganization ¶
func (*ReconcileService) ReconcileOrganizations ¶
type SetupService ¶
type SetupService struct {
// contains filtered or unexported fields
}
func NewSetupService ¶
func NewSetupService(db *sqlx.DB, gitService *GitService, storage *syfon.Manager, accessChecks *servermw.FenceUserAccessHandler) *SetupService
func (*SetupService) CleanupProjectStorage ¶
func (service *SetupService) CleanupProjectStorage(ctx context.Context, authorizationHeader, organization, project string) error
func (*SetupService) InitializeProject ¶
func (service *SetupService) InitializeProject(ctx context.Context, authorizationHeader, organization, project string, request CalyprProjectSetupRequest) (*CalyprProjectInitializeResponse, error)
func (*SetupService) PopulateStorage ¶
func (service *SetupService) PopulateStorage(ctx context.Context, authorizationHeader, organization, project string, request CalyprProjectStorageRequest) (*CalyprProjectStorageResponse, error)
func (*SetupService) PopulateStorageIntent ¶
func (service *SetupService) PopulateStorageIntent(ctx context.Context, authorizationHeader string, intent *CalyprProjectStorageIntent) error
func (*SetupService) StorageCheck ¶
func (service *SetupService) StorageCheck(ctx context.Context, authorizationHeader, organization, project string) (ProjectIntegrationCheck, error)
type StorageBucket ¶
type StorageBucket = domain.StorageBucket
StorageBucket is an alias for domain.StorageBucket.
type StorageConfig ¶
type StorageConfig = domain.StorageConfig
StorageConfig is an alias for domain.StorageConfig.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.