Documentation ¶
Overview ¶
Copyright 2018 caicloud authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func NewGitlab(scmCfg *api.SCMConfig) (scm.SCMProvider, error)
- func NewGitlabV4(scmCfg *api.SCMConfig) (scm.SCMProvider, error)
- type GitlabV3
- func (g *GitlabV3) Authcallback(code string, state string) (string, error)
- func (g *GitlabV3) CheckToken() bool
- func (g *GitlabV3) CreateWebHook(repoURL string, webHook *scm.WebHook) error
- func (g *GitlabV3) DeleteWebHook(repoURL string, webHookUrl string) error
- func (g *GitlabV3) GetAuthCodeURL(state string, scmType api.SCMType) (string, error)
- func (g *GitlabV3) GetToken() (string, error)
- func (g *GitlabV3) ListBranches(repo string) ([]string, error)
- func (g *GitlabV3) ListRepos() ([]api.Repository, error)
- func (g *GitlabV3) ListTags(repo string) ([]string, error)
- func (g *GitlabV3) NewTagFromLatest(tagName, description, commitID, url string) error
- type GitlabV4
- func (g *GitlabV4) Authcallback(code string, state string) (string, error)
- func (g *GitlabV4) CheckToken() bool
- func (g *GitlabV4) CreateWebHook(repoURL string, webHook *scm.WebHook) error
- func (g *GitlabV4) DeleteWebHook(repoURL string, webHookUrl string) error
- func (g *GitlabV4) GetAuthCodeURL(state string, scmType api.SCMType) (string, error)
- func (g *GitlabV4) GetToken() (string, error)
- func (g *GitlabV4) ListBranches(repo string) ([]string, error)
- func (g *GitlabV4) ListRepos() ([]api.Repository, error)
- func (g *GitlabV4) ListTags(repo string) ([]string, error)
- func (g *GitlabV4) NewTagFromLatest(tagName, description, commitID, url string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGitlab ¶
func NewGitlab(scmCfg *api.SCMConfig) (scm.SCMProvider, error)
NewGitlab news Gitlab v3 or v4 client according to the API version detected from Gitlab server,
func NewGitlabV4 ¶
func NewGitlabV4(scmCfg *api.SCMConfig) (scm.SCMProvider, error)
Types ¶
type GitlabV3 ¶
type GitlabV3 struct {
// contains filtered or unexported fields
}
GitlabV3 represents the SCM provider of GitlabV3 with API V3.
func (*GitlabV3) Authcallback ¶
Authcallback get Token by oauth code and state return userInfo by oauth2
func (*GitlabV3) CheckToken ¶
CheckToken checks whether the token has the authority of repo by trying ListRepos with the token.
func (*GitlabV3) CreateWebHook ¶
CreateWebHook creates webhook for specified repo.
func (*GitlabV3) DeleteWebHook ¶
DeleteWebHook deletes webhook from specified repo.
func (*GitlabV3) GetAuthCodeURL ¶
GetAuthCodeURL gets the URL for token request.
func (*GitlabV3) ListBranches ¶
ListBranches lists the branches for specified repo.
func (*GitlabV3) ListRepos ¶
func (g *GitlabV3) ListRepos() ([]api.Repository, error)
ListRepos lists the repos by the SCM config.
func (*GitlabV3) NewTagFromLatest ¶
NewTagFromLatest generate a new tag
type GitlabV4 ¶
type GitlabV4 struct {
// contains filtered or unexported fields
}
GitlabV4 represents the SCM provider of Gitlab with API V4.
func (*GitlabV4) Authcallback ¶
func (*GitlabV4) CheckToken ¶
CheckToken checks whether the token has the authority of repo by trying ListRepos with the token.
func (*GitlabV4) CreateWebHook ¶
CreateWebHook creates webhook for specified repo.
func (*GitlabV4) DeleteWebHook ¶
DeleteWebHook deletes webhook from specified repo.
func (*GitlabV4) GetAuthCodeURL ¶
TODO: Get oauth token by GitlabV4
func (*GitlabV4) ListBranches ¶
ListBranches lists the branches for specified repo.
func (*GitlabV4) ListRepos ¶
func (g *GitlabV4) ListRepos() ([]api.Repository, error)
ListRepos lists the repos by the SCM config.
func (*GitlabV4) NewTagFromLatest ¶
NewTagFromLatest generate a new tag