2024-01-15 20:39:35 +00:00
|
|
|
package remote
|
|
|
|
|
2024-01-16 16:15:52 +00:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/load"
|
|
|
|
)
|
|
|
|
|
|
|
|
type RemoteInfo struct {
|
|
|
|
Ctx context.Context
|
|
|
|
Host string
|
|
|
|
Name string
|
|
|
|
Token string
|
|
|
|
}
|
2024-01-15 20:39:35 +00:00
|
|
|
|
2024-01-16 16:24:06 +00:00
|
|
|
type RemoteProto string
|
|
|
|
|
|
|
|
const (
|
|
|
|
RemoteProtoSSH RemoteProto = "ssh"
|
|
|
|
RemoteProtoHTTP RemoteProto = "http"
|
|
|
|
RemoteProtoHTTPS RemoteProto = "https"
|
|
|
|
)
|
|
|
|
|
2024-01-15 20:39:35 +00:00
|
|
|
// Any remote needs to be able to return
|
|
|
|
// the number of projects the user has access to and also
|
|
|
|
// stream all projects along with updates to channels
|
|
|
|
// provided by *load.ProgressInfo
|
|
|
|
type Remote interface {
|
2024-01-16 16:24:06 +00:00
|
|
|
GetInfo() *RemoteInfo // Returns basic RemoteInfo struct
|
|
|
|
IsAlive(RemoteProto) bool // Indicates if the remote is reachable by either SSH or HTTP
|
|
|
|
GetNumProjects(*RemoteQueryOpts) int // Returns total number of accessible projects
|
|
|
|
StreamProjects(*load.ProgressInfo, *RemoteQueryOpts) // Streams projects to chans provided in load.ProgressInfo
|
2024-01-15 20:39:35 +00:00
|
|
|
}
|