github.com/kubeshop/testkube@v1.17.23/pkg/api/v1/testkube/model_repository_extended.go (about) 1 package testkube 2 3 // GitAuthType defines git auth type 4 type GitAuthType string 5 6 const ( 7 // GitAuthTypeBasic for git basic auth requests 8 GitAuthTypeBasic GitAuthType = "basic" 9 // GitAuthTypeHeader for git header auth requests 10 GitAuthTypeHeader GitAuthType = "header" 11 // GitAuthTypeEmpty for git empty auth requests 12 GitAuthTypeEmpty GitAuthType = "" 13 ) 14 15 // NewGitRepository is a constructor for new repository 16 func NewGitRepository(uri, branch string) *Repository { 17 return &Repository{ 18 Type_: "git", 19 Branch: branch, 20 Uri: uri, 21 } 22 } 23 24 // WithPath supplies path for repository 25 func (r *Repository) WithPath(path string) *Repository { 26 r.Path = path 27 return r 28 } 29 30 // WithCommit supplies commit for repository 31 func (r *Repository) WithCommit(commit string) *Repository { 32 r.Commit = commit 33 return r 34 } 35 36 // WithAuthType supplies auth type for repository 37 func (r *Repository) WithAuthType(authType GitAuthType) *Repository { 38 r.AuthType = string(authType) 39 return r 40 } 41 42 // IsEmpty returns true if repository is empty 43 func (r *Repository) IsEmpty() bool { 44 return r == nil || 45 (r.Type_ == "" && 46 r.Uri == "" && 47 r.Branch == "" && 48 r.Path == "" && 49 r.Commit == "" && 50 r.WorkingDir == "") 51 }