Documentation
¶
Overview ¶
getEnvOrFile returns the value of the environment variable if set, otherwise if a corresponding _FILE variable is set, reads the value from the file at that path. If both are set, the environment variable takes precedence.
Index ¶
- Constants
- func AddBasicAuthToURL(originalURL, username, password string) (string, error)
- func ToPtr[T any](v T) *T
- func TrimInPlace(s *string)
- type AzureDevOpsHost
- type AzureDevOpsRepo
- type BasicAuth
- type BitbucketHost
- type BundleManifest
- type CodebergHost
- type GitHubHost
- type GitLabHost
- type GiteaHost
- type LFSManifest
- type NewAzureDevOpsHostInput
- type NewBitBucketHostInput
- type NewCodebergHostInput
- type NewGitHubHostInput
- type NewGitLabHostInput
- type NewGiteaHostInput
- type NewSourcehutHostInput
- type Project
- type ProviderBackupResult
- type RepoBackupResults
- type SourcehutHost
- type WorkerConfig
Constants ¶
const ( BitbucketProviderName = "BitBucket" // Auth Type AuthTypeBitbucketOAuth2 = AuthTypeBearerToken AuthTypeBitbucketAPIToken = AuthTypeBasicAuthHeader AuthTypeBasicAuthHeader = "basic-auth-header" AuthTypeBearerToken = "bearer-token" )
const ( // HTTP Headers HeaderContentType = "Content-Type" HeaderAuthorization = "Authorization" HeaderAccept = "Accept" // Authentication prefixes AuthPrefixBearer = "Bearer " AuthPrefixToken = "token " AuthPrefixBasic = "Basic " // Content types ContentTypeJSON = "application/json" ContentTypeFormEncoded = "application/x-www-form-urlencoded" ContentTypeAny = "*/*" )
const (
AzureDevOpsProviderName = "AzureDevOps"
)
const (
// GitLabDefaultMinimumProjectAccessLevel https://docs.gitlab.com/ee/user/permissions.html#roles
GitLabDefaultMinimumProjectAccessLevel = 20
)
Variables ¶
This section is empty.
Functions ¶
func AddBasicAuthToURL ¶
func TrimInPlace ¶
func TrimInPlace(s *string)
Types ¶
type AzureDevOpsHost ¶
type AzureDevOpsHost struct {
Caller string
HttpClient *retryablehttp.Client
Provider string
PAT string
Orgs []string
UserName string
DiffRemoteMethod string
BackupDir string
BackupsToRetain int
LogLevel int
BackupLFS bool
EncryptionPassphrase string
}
func NewAzureDevOpsHost ¶
func NewAzureDevOpsHost(input NewAzureDevOpsHostInput) (*AzureDevOpsHost, error)
func (*AzureDevOpsHost) Backup ¶
func (ad *AzureDevOpsHost) Backup() ProviderBackupResult
type AzureDevOpsRepo ¶
type AzureDevOpsRepo struct {
Id string `json:"id"`
Url string `json:"url"`
Name string `json:"name"`
Size int64 `json:"size"`
SshUrl string `json:"sshUrl"`
WebUrl string `json:"webUrl"`
Project Project `json:"project"`
RemoteUrl string `json:"remoteUrl"`
DefaultBranch string `json:"defaultBranch"`
}
func ListAllRepositories ¶
func ListAllRepositories(httpClient *retryablehttp.Client, basicAuth, projectName, orgName string) ([]AzureDevOpsRepo, error)
type BitbucketHost ¶
type BitbucketHost struct {
Caller string
HttpClient *retryablehttp.Client
Provider string
APIURL string
DiffRemoteMethod string
BackupDir string
BackupsToRetain int
AuthType string
// API OAuthToken
Email string
APIToken string
BasicAuth BasicAuth
// OAuth2
User string
OAuthToken string
Key string
Secret string
LogLevel int
BackupLFS bool
EncryptionPassphrase string
Workspaces []string
}
func NewBitBucketHost ¶
func NewBitBucketHost(input NewBitBucketHostInput) (*BitbucketHost, error)
func (BitbucketHost) Backup ¶
func (bb BitbucketHost) Backup() ProviderBackupResult
type BundleManifest ¶
type BundleManifest struct {
CreationTime string `json:"creation_time"`
BundleHash string `json:"bundle_hash"`
BundleFile string `json:"bundle_file"`
GitRefs map[string]string `json:"git_refs"`
}
BundleManifest represents the metadata for a bundle
type CodebergHost ¶ added in v2.1.7
type CodebergHost struct {
Caller string
Provider string
APIURL string
DiffRemoteMethod string
BackupDir string
Token string
Orgs []string
SkipUserRepos bool
LimitUserOwned bool
BackupsToRetain int
LogLevel int
BackupLFS bool
EncryptionPassphrase string
// contains filtered or unexported fields
}
func NewCodebergHost ¶ added in v2.1.7
func NewCodebergHost(input NewCodebergHostInput) (*CodebergHost, error)
func (*CodebergHost) Backup ¶ added in v2.1.7
func (cb *CodebergHost) Backup() ProviderBackupResult
type GitHubHost ¶
type GitHubHost struct {
Caller string
HttpClient *retryablehttp.Client
Provider string
APIURL string
DiffRemoteMethod string
BackupDir string
SkipUserRepos bool
LimitUserOwned bool
BackupsToRetain int
Token string
Orgs []string
LogLevel int
BackupLFS bool
EncryptionPassphrase string
// contains filtered or unexported fields
}
func NewGitHubHost ¶
func NewGitHubHost(input NewGitHubHostInput) (*GitHubHost, error)
func (*GitHubHost) Backup ¶
func (gh *GitHubHost) Backup() ProviderBackupResult
type GitLabHost ¶
type GitLabHost struct {
Caller string
APIURL string
DiffRemoteMethod string
BackupDir string
BackupsToRetain int
ProjectMinAccessLevel int
Token string
User gitlabUser
LogLevel int
BackupLFS bool
EncryptionPassphrase string
// contains filtered or unexported fields
}
func NewGitLabHost ¶
func NewGitLabHost(input NewGitLabHostInput) (*GitLabHost, error)
func (*GitLabHost) Backup ¶
func (gl *GitLabHost) Backup() ProviderBackupResult
type GiteaHost ¶
type GiteaHost struct {
Caller string
APIURL string
DiffRemoteMethod string
BackupDir string
BackupsToRetain int
Token string
Orgs []string
LogLevel int
BackupLFS bool
EncryptionPassphrase string
// contains filtered or unexported fields
}
func NewGiteaHost ¶
func NewGiteaHost(input NewGiteaHostInput) (*GiteaHost, error)
func (*GiteaHost) Backup ¶
func (g *GiteaHost) Backup() ProviderBackupResult
type LFSManifest ¶
type LFSManifest struct {
CreationTime string `json:"creation_time"`
ArchiveHash string `json:"archive_hash"`
ArchiveFile string `json:"archive_file"`
}
LFSManifest represents the metadata for an LFS archive
type NewAzureDevOpsHostInput ¶
type NewBitBucketHostInput ¶
type NewBitBucketHostInput struct {
Caller string
HTTPClient *retryablehttp.Client
APIURL string
DiffRemoteMethod string
BackupDir string
// API OAuthToken
Email string
BasicAuth BasicAuth
AuthType string
// API OAuthToken
APIToken string
// OAuth2
User string
Key string
Secret string
OAuthToken string
Username string
BackupsToRetain int
LogLevel int
BackupLFS bool
EncryptionPassphrase string
Workspaces []string
}
type NewCodebergHostInput ¶ added in v2.1.7
type NewCodebergHostInput struct {
Caller string
HTTPClient *retryablehttp.Client
APIURL string
DiffRemoteMethod string
BackupDir string
Token string
// Orgs limits organisation backups to the named organisations. An entry of
// "*" expands to every organisation the token belongs to, and can be
// combined with names of organisations it does not.
Orgs []string
// SkipUserRepos omits /user/repos, backing up only the repositories owned
// by the organisations named in Orgs.
SkipUserRepos bool
// LimitUserOwned restricts /user/repos results to repositories owned by the
// authenticated user, excluding those they merely have access to.
LimitUserOwned bool
BackupsToRetain int
LogLevel int
BackupLFS bool
EncryptionPassphrase string
}
NewCodebergHostInput configures a Codeberg host.
Codeberg runs Forgejo, which serves the same /api/v1 surface as Gitea, but as a shared public instance rather than one you administer. The Gitea host enumerates repositories via the instance-admin endpoints (/admin/users and /orgs), which a Codeberg personal access token cannot reach; this host uses the token-scoped endpoints (/user/repos and /user/orgs) instead.
type NewGitHubHostInput ¶
type NewGitLabHostInput ¶
type NewGiteaHostInput ¶
type NewSourcehutHostInput ¶
type ProviderBackupResult ¶
type ProviderBackupResult struct {
BackupResults []RepoBackupResults
Error errors.E
}
type RepoBackupResults ¶
type SourcehutHost ¶
type SourcehutHost struct {
Caller string
HttpClient *retryablehttp.Client
Provider string
APIURL string
DiffRemoteMethod string
BackupDir string
SkipUserRepos bool
LimitUserOwned bool
BackupsToRetain int
PersonalAccessToken string
Orgs []string
LogLevel int
BackupLFS bool
EncryptionPassphrase string
}
func NewSourcehutHost ¶
func NewSourcehutHost(input NewSourcehutHostInput) (*SourcehutHost, error)
func (*SourcehutHost) Backup ¶
func (sh *SourcehutHost) Backup() ProviderBackupResult