gitlab

package
v0.6.3-hr Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

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

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

func (g *GitlabV3) Authcallback(code string, state string) (string, error)

Authcallback get Token by oauth code and state return userInfo by oauth2

func (*GitlabV3) CheckToken

func (g *GitlabV3) CheckToken() bool

CheckToken checks whether the token has the authority of repo by trying ListRepos with the token.

func (*GitlabV3) CreateWebHook

func (g *GitlabV3) CreateWebHook(repoURL string, webHook *scm.WebHook) error

CreateWebHook creates webhook for specified repo.

func (*GitlabV3) DeleteWebHook

func (g *GitlabV3) DeleteWebHook(repoURL string, webHookUrl string) error

DeleteWebHook deletes webhook from specified repo.

func (*GitlabV3) GetAuthCodeURL

func (g *GitlabV3) GetAuthCodeURL(state string, scmType api.SCMType) (string, error)

GetAuthCodeURL gets the URL for token request.

func (*GitlabV3) GetToken

func (g *GitlabV3) GetToken() (string, error)

GetToken gets the token by the username and password of SCM config.

func (*GitlabV3) ListBranches

func (g *GitlabV3) ListBranches(repo string) ([]string, error)

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) ListTags

func (g *GitlabV3) ListTags(repo string) ([]string, error)

ListTags lists the tags for specified repo.

func (*GitlabV3) NewTagFromLatest

func (g *GitlabV3) NewTagFromLatest(tagName, description, commitID, url string) error

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 (g *GitlabV4) Authcallback(code string, state string) (string, error)

func (*GitlabV4) CheckToken

func (g *GitlabV4) CheckToken() bool

CheckToken checks whether the token has the authority of repo by trying ListRepos with the token.

func (*GitlabV4) CreateWebHook

func (g *GitlabV4) CreateWebHook(repoURL string, webHook *scm.WebHook) error

CreateWebHook creates webhook for specified repo.

func (*GitlabV4) DeleteWebHook

func (g *GitlabV4) DeleteWebHook(repoURL string, webHookUrl string) error

DeleteWebHook deletes webhook from specified repo.

func (*GitlabV4) GetAuthCodeURL

func (g *GitlabV4) GetAuthCodeURL(state string, scmType api.SCMType) (string, error)

TODO: Get oauth token by GitlabV4

func (*GitlabV4) GetToken

func (g *GitlabV4) GetToken() (string, error)

GetToken gets the token by the username and password of SCM config.

func (*GitlabV4) ListBranches

func (g *GitlabV4) ListBranches(repo string) ([]string, error)

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) ListTags

func (g *GitlabV4) ListTags(repo string) ([]string, error)

ListTags lists the tags for specified repo.

func (*GitlabV4) NewTagFromLatest

func (g *GitlabV4) NewTagFromLatest(tagName, description, commitID, url string) error

NewTagFromLatest generate a new tag

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL