35 lines
697 B
Go
35 lines
697 B
Go
package gitlabremote
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/xanzy/go-gitlab"
|
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/remote"
|
|
)
|
|
|
|
type GitlabRemote struct {
|
|
info *remote.RemoteInfo
|
|
api *gitlab.Client
|
|
}
|
|
|
|
func (r *GitlabRemote) GetInfo() *remote.RemoteInfo {
|
|
return r.info
|
|
}
|
|
|
|
func (r *GitlabRemote) String() string {
|
|
return fmt.Sprintf("GitLab %s (%s), clone proto %s",
|
|
r.GetInfo().Name, r.GetInfo().Host, r.GetInfo().CloneProto)
|
|
}
|
|
|
|
func NewGitlabRemote(remoteInfo *remote.RemoteInfo) (*GitlabRemote, error) {
|
|
api, err := NewGitlabApi(remoteInfo)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
gl := &GitlabRemote{
|
|
info: remoteInfo,
|
|
api: api,
|
|
}
|
|
return gl, nil
|
|
}
|