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 GitHubHost
- type GitLabHost
- type GiteaHost
- type LFSManifest
- type NewAzureDevOpsHostInput
- type NewBitBucketHostInput
- type NewGitHubHostInput
- type NewGitLabHostInput
- type NewGiteaHostInput
- type NewSourcehutHostInput
- type Project
- type ProviderBackupResult
- type RepoBackupResults
- type SourcehutHost
- type WorkerConfig
Constants ¶
View Source
const ( BitbucketProviderName = "BitBucket" // Auth Type AuthTypeBitbucketOAuth2 = AuthTypeBearerToken AuthTypeBitbucketAPIToken = AuthTypeBasicAuthHeader AuthTypeBasicAuthHeader = "basic-auth-header" AuthTypeBearerToken = "bearer-token" )
View Source
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 = "*/*" )
View Source
const (
AzureDevOpsProviderName = "AzureDevOps"
)
View Source
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
}
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 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
}
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
}
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
Click to show internal directories.
Click to hide internal directories.