gitlab

package module
Version: v0.92.3 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0 Imports: 24 Imported by: 1,183

README

go-gitlab

A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way

Build Status Sourcegraph GoDoc Go Report Card

NOTE

Release v0.6.0 (released on 25-08-2017) no longer supports the older V3 GitLab API. If you need V3 support, please use the f-api-v3 branch. This release contains some backwards incompatible changes that were needed to fully support the V4 GitLab API.

Coverage

This API client package covers most of the existing GitLab API calls and is updated regularly to add new and/or missing endpoints. Currently, the following services are supported:

  • Applications
  • Award Emojis
  • Branches
  • Broadcast Messages
  • Commits
  • Container Registry
  • Custom Attributes
  • Deploy Keys
  • Deployments
  • Discussions (threaded comments)
  • Environments
  • Epic Issues
  • Epics
  • Error Tracking
  • Events
  • Feature Flags
  • Geo Nodes
  • Generic Packages
  • GitLab CI Config Templates
  • Gitignores Templates
  • Group Access Requests
  • Group Issue Boards
  • Group Members
  • Group Milestones
  • Group Wikis
  • Group-Level Variables
  • Groups
  • Instance Clusters
  • Invites
  • Issue Boards
  • Issues
  • Jobs
  • Keys
  • Labels
  • License
  • Markdown
  • Merge Request Approvals
  • Merge Requests
  • Namespaces
  • Notes (comments)
  • Notification Settings
  • Open Source License Templates
  • Packages
  • Pages
  • Pages Domains
  • Personal Access Tokens
  • Pipeline Schedules
  • Pipeline Triggers
  • Pipelines
  • Plan limits
  • Project Access Requests
  • Project Badges
  • Project Clusters
  • Project Import/export
  • Project Members
  • Project Milestones
  • Project Repository Storage Moves
  • Project Snippets
  • Project Vulnerabilities
  • Project-Level Variables
  • Projects (including setting Webhooks)
  • Protected Branches
  • Protected Environments
  • Protected Tags
  • Repositories
  • Repository Files
  • Repository Submodules
  • Runners
  • Search
  • Services
  • Settings
  • Sidekiq Metrics
  • System Hooks
  • Tags
  • Todos
  • Topics
  • Users
  • Validate CI Configuration
  • Version
  • Wikis

Usage

import "github.com/xanzy/go-gitlab"

Construct a new GitLab client, then use the various services on the client to access different parts of the GitLab API. For example, to list all users:

git, err := gitlab.NewClient("yourtokengoeshere")
if err != nil {
  log.Fatalf("Failed to create client: %v", err)
}
users, _, err := git.Users.ListUsers(&gitlab.ListUsersOptions{})

There are a few With... option functions that can be used to customize the API client. For example, to set a custom base URL:

git, err := gitlab.NewClient("yourtokengoeshere", gitlab.WithBaseURL("https://git.mydomain.com/api/v4"))
if err != nil {
  log.Fatalf("Failed to create client: %v", err)
}
users, _, err := git.Users.ListUsers(&gitlab.ListUsersOptions{})

Some API methods have optional parameters that can be passed. For example, to list all projects for user "svanharmelen":

git := gitlab.NewClient("yourtokengoeshere")
opt := &gitlab.ListProjectsOptions{Search: gitlab.String("svanharmelen")}
projects, _, err := git.Projects.ListProjects(opt)
Examples

The examples directory contains a couple for clear examples, of which one is partially listed here as well:

package main

import (
	"log"

	"github.com/xanzy/go-gitlab"
)

func main() {
	git, err := gitlab.NewClient("yourtokengoeshere")
	if err != nil {
		log.Fatalf("Failed to create client: %v", err)
	}

	// Create new project
	p := &gitlab.CreateProjectOptions{
		Name:                 gitlab.String("My Project"),
		Description:          gitlab.String("Just a test project to play with"),
		MergeRequestsEnabled: gitlab.Bool(true),
		SnippetsEnabled:      gitlab.Bool(true),
		Visibility:           gitlab.Visibility(gitlab.PublicVisibility),
	}
	project, _, err := git.Projects.CreateProject(p)
	if err != nil {
		log.Fatal(err)
	}

	// Add a new snippet
	s := &gitlab.CreateProjectSnippetOptions{
		Title:           gitlab.String("Dummy Snippet"),
		FileName:        gitlab.String("snippet.go"),
		Content:         gitlab.String("package main...."),
		Visibility:      gitlab.Visibility(gitlab.PublicVisibility),
	}
	_, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s)
	if err != nil {
		log.Fatal(err)
	}
}

For complete usage of go-gitlab, see the full package docs.

ToDo

  • The biggest thing this package still needs is tests 😞

Issues

Author

Sander van Harmelen (sander@vanharmelen.nl)

Contributing

Contributions are always welcome. For more information, check out the contributing guide

License

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

Documentation

Overview

Copyright 2022, Daniela Filipe Bento

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.

Package gitlab implements a GitLab API client.

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

View Source
var (
	ErrUserActivatePrevented         = errors.New("Cannot activate a user that is blocked by admin or by LDAP synchronization")
	ErrUserApprovePrevented          = errors.New("Cannot approve a user that is blocked by admin or by LDAP synchronization")
	ErrUserBlockPrevented            = errors.New("Cannot block a user that is already blocked by LDAP synchronization")
	ErrUserConflict                  = errors.New("User does not have a pending request")
	ErrUserDeactivatePrevented       = errors.New("Cannot deactivate a user that is blocked by admin or by LDAP synchronization")
	ErrUserDisableTwoFactorPrevented = errors.New("Cannot disable two factor authentication if not authenticated as administrator")
	ErrUserNotFound                  = errors.New("User does not exist")
	ErrUserRejectPrevented           = errors.New("Cannot reject a user if not authenticated as administrator")
	ErrUserTwoFactorNotEnabled       = errors.New("Cannot disable two factor authentication if not enabled")
	ErrUserUnblockPrevented          = errors.New("Cannot unblock a user that is blocked by LDAP synchronization")
)

List a couple of standard errors.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present.

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int value to store v and returns a pointer to it.

func ParseHook added in v0.24.0

func ParseHook(eventType EventType, payload []byte) (event interface{}, err error)

ParseHook tries to parse both web- and system hooks.

Example usage:

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    payload, err := ioutil.ReadAll(r.Body)
    if err != nil { ... }
    event, err := gitlab.ParseHook(gitlab.HookEventType(r), payload)
    if err != nil { ... }
    switch event := event.(type) {
    case *gitlab.PushEvent:
        processPushEvent(event)
    case *gitlab.MergeEvent:
        processMergeEvent(event)
    ...
    }
}

func ParseSystemhook added in v0.24.0

func ParseSystemhook(payload []byte) (event interface{}, err error)

ParseSystemhook parses the event payload. For recognized event types, a value of the corresponding struct type will be returned. An error will be returned for unrecognized event types.

Example usage:

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    payload, err := ioutil.ReadAll(r.Body)
    if err != nil { ... }
    event, err := gitlab.ParseSystemhook(payload)
    if err != nil { ... }
    switch event := event.(type) {
    case *gitlab.PushSystemEvent:
        processPushSystemEvent(event)
    case *gitlab.MergeSystemEvent:
        processMergeSystemEvent(event)
    ...
    }
}

func ParseWebhook added in v0.11.6

func ParseWebhook(eventType EventType, payload []byte) (event interface{}, err error)

ParseWebhook parses the event payload. For recognized event types, a value of the corresponding struct type will be returned. An error will be returned for unrecognized event types.

Example usage:

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    payload, err := ioutil.ReadAll(r.Body)
    if err != nil { ... }
    event, err := gitlab.ParseWebhook(gitlab.HookEventType(r), payload)
    if err != nil { ... }
    switch event := event.(type) {
    case *gitlab.PushEvent:
        processPushEvent(event)
    case *gitlab.MergeEvent:
        processMergeEvent(event)
    ...
    }
}

func PathEscape added in v0.53.0

func PathEscape(s string) string

Helper function to escape a project identifier.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Stringify

func Stringify(message interface{}) string

Stringify attempts to create a reasonable string representation of types in the Gitlab library. It does things like resolve pointers to their values and omits struct fields with nil values.

func Time added in v0.21.0

func Time(v time.Time) *time.Time

Time is a helper routine that allocates a new time.Time value to store v and returns a pointer to it.

Types

type AcceptMergeRequestOptions added in v0.4.0

type AcceptMergeRequestOptions struct {
	MergeCommitMessage        *string `url:"merge_commit_message,omitempty" json:"merge_commit_message,omitempty"`
	SquashCommitMessage       *string `url:"squash_commit_message,omitempty" json:"squash_commit_message,omitempty"`
	Squash                    *bool   `url:"squash,omitempty" json:"squash,omitempty"`
	ShouldRemoveSourceBranch  *bool   `url:"should_remove_source_branch,omitempty" json:"should_remove_source_branch,omitempty"`
	MergeWhenPipelineSucceeds *bool   `url:"merge_when_pipeline_succeeds,omitempty" json:"merge_when_pipeline_succeeds,omitempty"`
	SHA                       *string `url:"sha,omitempty" json:"sha,omitempty"`
}

AcceptMergeRequestOptions represents the available AcceptMergeRequest() options.

GitLab API docs: https://docs.gitlab.com/ee/api/merge_requests.html#merge-a-merge-request

type AccessControlValue added in v0.32.0

type AccessControlValue string

AccessControlValue represents an access control value within GitLab, used for managing access to certain project features.

GitLab API docs: https://docs.gitlab.com/ee/api/projects.html

const (
	DisabledAccessControl AccessControlValue = "disabled"
	EnabledAccessControl  AccessControlValue = "enabled"
	PrivateAccessControl  AccessControlValue = "private"
	PublicAccessControl   AccessControlValue = "public"
)

List of available access control values.

GitLab API docs: https://docs.gitlab.com/ee/api/projects.html

func AccessControl added in v0.32.0

func AccessControl(v AccessControlValue) *AccessControlValue

AccessControl is a helper routine that allocates a new AccessControlValue to store v and returns a pointer to it.

type AccessLevelValue added in v0.2.0

type AccessLevelValue int

AccessLevelValue represents a permission level within GitLab.

GitLab API docs: https://docs.gitlab.com/ee/user/permissions.html

const (
	NoPermissions            AccessLevelValue = 0
	MinimalAccessPermissions AccessLevelValue = 5
	GuestPermissions         AccessLevelValue = 10
	ReporterPermissions      AccessLevelValue = 20
	DeveloperPermissions     AccessLevelValue = 30
	MaintainerPermissions    AccessLevelValue = 40
	OwnerPermissions         AccessLevelValue = 50
	AdminPermissions         AccessLevelValue = 60

	// Deprecated: Renamed to MaintainerPermissions in GitLab 11.0.
	MasterPermissions AccessLevelValue = 40
	// Deprecated: Renamed to OwnerPermissions.
	OwnerPermission AccessLevelValue = 50
)

List of available access levels

GitLab API docs: https://docs.gitlab.com/ee/user/permissions.html

func AccessLevel

func AccessLevel(v AccessLevelValue) *AccessLevelValue

AccessLevel is a helper routine that allocates a new AccessLevelValue to store v and returns a pointer to it.

type AccessRequest added in v0.11.1

type AccessRequest struct {
	ID          int              `json:"id"`
	Username    string           `json:"username"`
	Name        string           `json:"name"`
	State       string           `json:"state"`
	CreatedAt   *time.Time       `json:"created_at"`
	RequestedAt *time.Time       `json:"requested_at"`
	AccessLevel AccessLevelValue `json:"access_level"`
}

AccessRequest represents a access request for a group or project.

GitLab API docs: https://docs.gitlab.com/ee/api/access_requests.html

type AccessRequestsService added in v0.11.1

type AccessRequestsService struct {
	// contains filtered or unexported fields
}

AccessRequestsService handles communication with the project/group access requests related methods of the GitLab API.

GitLab API docs: https://docs.gitlab.com/ee/api/access_requests.html

func (*AccessRequestsService) ApproveGroupAccessRequest added in v0.11.1

func (s *AccessRequestsService) ApproveGroupAccessRequest(gid interface{}, user int, opt *ApproveAccessRequestOptions, options ...RequestOptionFunc) (*AccessRequest, *Response, error)

ApproveGroupAccessRequest approves an access request for the given user.

GitLab API docs: https://docs.gitlab.com/ee/api/access_requests.html#approve-an-access-request

func (*AccessRequestsService) ApproveProjectAccessRequest added in v0.11.1

func (s *AccessRequestsService) ApproveProjectAccessRequest(pid interface{}, user int, opt *ApproveAccessRequestOptions, options ...RequestOptionFunc) (*AccessRequest, *Response, error)

ApproveProjectAccessRequest approves an access request for the given user.

GitLab API docs: https://docs.gitlab.com/ee/api/access_requests.html#approve-an-access-request

func (*AccessRequestsService) DenyGroupAccessRequest added in v0.11.1

func (s *AccessRequestsService) DenyGroupAccessRequest(gid interface{}, user int, options ...RequestOptionFunc) (*Response, error)

DenyGroupAccessRequest denies an access request for the given user.

GitLab API docs: https://docs.gitlab.com/ee/api/access_requests.html#deny-an-access-request

func (*AccessRequestsService) DenyProjectAccessRequest added in v0.11.1

func (s *AccessRequestsService) DenyProjectAccessRequest(pid interface{}, user int, options ...RequestOptionFunc) (*Response, error)

DenyProjectAccessRequest denies an access request for the given user.

GitLab API docs: https://docs.gitlab.com/ee/api/access_requests.html#deny-an-access-request

func (*AccessRequestsService) ListGroupAccessRequests added in v0.11.1

func (s *AccessRequestsService) ListGroupAccessRequests(gid interface{}, opt *ListAccessRequestsOptions, options ...RequestOptionFunc) ([]*AccessRequest, *Response, error)

ListGroupAccessRequests gets a list of access requests viewable by the authenticated user.

GitLab API docs: https://docs.gitlab.com/ee/api/access_requests.html#list-access-requests-for-a-group-or-project

func (*AccessRequestsService) ListProjectAccessRequests added in v0.11.1

func (s *AccessRequestsService) ListProjectAccessRequests(pid interface{}, opt *ListAccessRequestsOptions, options ...RequestOptionFunc) ([]*AccessRequest, *Response, error)

ListProjectAccessRequests gets a list of access requests viewable by the authenticated user.

GitLab API docs: https://docs.gitlab.com/ee/api/access_requests.html#list-access-requests-for-a-group-or-project

func (*AccessRequestsService) RequestGroupAccess added in v0.11.1

func (s *AccessRequestsService) RequestGroupAccess(gid interface{}, options ...RequestOptionFunc) (*AccessRequest, *Response, error)

RequestGroupAccess requests access for the authenticated user to a group or project.

GitLab API docs: https://docs.gitlab.com/ee/api/access_requests.html#request-access-to-a-group-or-project

func (*AccessRequestsService) RequestProjectAccess added in v0.11.1

func (s *AccessRequestsService) RequestProjectAccess(pid interface{}, options ...RequestOptionFunc) (*AccessRequest, *Response, error)

RequestProjectAccess requests access for the authenticated user to a group or project.

GitLab API docs: https://docs.gitlab.com/ee/api/access_requests.html#request-access-to-a-group-or-project

type AddChangelogOptions added in v0.80.1

type AddChangelogOptions struct {
	Version    *string  `url:"version,omitempty" json:"version,omitempty"`
	Branch     *string  `url:"branch,omitempty" json:"branch,omitempty"`
	ConfigFile *string  `url:"config_file,omitempty" json:"config_file,omitempty"`
	Date       *ISOTime `url:"date,omitempty" json:"date,omitempty"`
	File       *string  `url:"file,omitempty" json:"file,omitempty"`
	From       *string  `url:"from,omitempty" json:"from,omitempty"`
	Message    *string  `url:"message,omitempty" json:"message,omitempty"`
	To         *string  `url:"to,omitempty" json:"to,omitempty"`
	Trailer    *string  `url:"trailer,omitempty" json:"trailer,omitempty"`
}

AddChangelogOptions represents the available AddChangelog() options.

GitLab API docs: https://docs.gitlab.com/ee/api/repositories.html#add-changelog-data-to-a-changelog-file

type AddClusterOptions added in v0.14.1

type AddClusterOptions struct {
	Name                *string                       `url:"name,omitempty" json:"name,omitempty"`
	Domain              *string                       `url:"domain,omitempty" json:"domain,omitempty"`
	Enabled             *bool                         `url:"enabled,omitempty" json:"enabled,omitempty"`
	Managed             *bool                         `url:"managed,omitempty" json:"managed,omitempty"`
	EnvironmentScope    *string                       `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
	PlatformKubernetes  *AddPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"`
	ManagementProjectID *string                       `url:"management_project_id,omitempty" json:"management_project_id,omitempty"`
}

AddClusterOptions represents the available AddCluster() options.

GitLab API docs: https://docs.gitlab.com/ee/api/project_clusters.html#add-existing-cluster-to-project

type AddCommitDiscussionNoteOptions added in v0.11.2

type AddCommitDiscussionNoteOptions struct {
	Body      *string    `url:"body,omitempty" json:"body,omitempty"`
	CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
}

AddCommitDiscussionNoteOptions represents the available AddCommitDiscussionNote() options.

GitLab API docs: https://docs.gitlab.com/ee/api/discussions.html#add-note-to-existing-commit-thread

type AddDeployKeyOptions

type AddDeployKeyOptions struct {
	Title   *string `url:"title,omitempty" json:"title,omitempty"`
	Key     *string `url:"key,omitempty" json:"key,omitempty"`
	CanPush *bool   `url:"can_push,omitempty" json:"can_push,omitempty"`
}

AddDeployKeyOptions represents the available ADDDeployKey() options.

GitLab API docs: https://docs.gitlab.com/ee/api/deploy_keys.html#add-deploy-key

type AddEmailOptions added in v0.4.0

type AddEmailOptions struct {
	Email            *string `url:"email,omitempty" json:"email,omitempty"`
	SkipConfirmation *bool   `url:"skip_confirmation,omitempty" json:"skip_confirmation,omitempty"`
}

AddEmailOptions represents the available AddEmail() options.

GitLab API docs: https://docs.gitlab.com/ee/api/users.html#add-email

type AddEpicDiscussionNoteOptions added in v0.11.2

type AddEpicDiscussionNoteOptions struct {
	Body      *string    `url:"body,omitempty" json:"body,omitempty"`
	CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
}

AddEpicDiscussionNoteOptions represents the available AddEpicDiscussionNote() options.

GitLab API docs: https://docs.gitlab.com/ee/api/discussions.html#add-note-to-existing-epic-thread

type AddGPGKeyOptions added in v0.53.0

type AddGPGKeyOptions struct {
	Key *string `url:"key,omitempty" json:"key,omitempty"`
}

AddGPGKeyOptions represents the available AddGPGKey() options.

GitLab API docs: https://docs.gitlab.com/ee/api/users.html#add-a-gpg-key

type AddGroupBadgeOptions added in v0.16.0

type AddGroupBadgeOptions struct {
	LinkURL  *string `url:"link_url,omitempty" json:"link_url,omitempty"`
	ImageURL *string `url:"image_url,omitempty" json:"image_url,omitempty"`
	Name     *string `url:"name,omitempty" json:"name,omitempty"`
}

AddGroupBadgeOptions represents the available AddGroupBadge() options.

GitLab API docs: https://docs.gitlab.com/ee/api/group_badges.html#add-a-badge-to-a-group

type AddGroupClusterOptions added in v0.21.0

type AddGroupClusterOptions struct {
	Name                *string                            `url:"name,omitempty" json:"name,omitempty"`
	Domain              *string                            `url:"domain,omitempty" json:"domain,omitempty"`
	ManagementProjectID *string                            `url:"management_project_id,omitempty" json:"management_project_id,omitempty"`
	Enabled             *bool                              `url:"enabled,omitempty" json:"enabled,omitempty"`
	Managed             *bool                              `url:"managed,omitempty" json:"managed,omitempty"`
	EnvironmentScope    *string                            `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
	PlatformKubernetes  *AddGroupPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"`
}

AddGroupClusterOptions represents the available AddCluster() options.

GitLab API docs: https://docs.gitlab.com/ee/api/group_clusters.html#add-existing-cluster-to-group

type AddGroupHookOptions added in v0.30.0

type AddGroupHookOptions struct {
	URL                      *string `url:"url,omitempty" json:"url,omitempty"`
	PushEvents               *bool   `url:"push_events,omitempty"  json:"push_events,omitempty"`
	PushEventsBranchFilter   *string `url:"push_events_branch_filter,omitempty"  json:"push_events_branch_filter,omitempty"`
	IssuesEvents             *bool   `url:"issues_events,omitempty"  json:"issues_events,omitempty"`
	ConfidentialIssuesEvents *bool   `url:"confidential_issues_events,omitempty"  json:"confidential_issues_events,omitempty"`
	ConfidentialNoteEvents   *bool   `url:"confidential_note_events,omitempty"  json:"confidential_note_events,omitempty"`
	MergeRequestsEvents      *bool   `url:"merge_requests_events,omitempty"  json:"merge_requests_events,omitempty"`
	TagPushEvents            *bool   `url:"tag_push_events,omitempty"  json:"tag_push_events,omitempty"`
	NoteEvents               *bool   `url:"note_events,omitempty"  json:"note_events,omitempty"`
	JobEvents                *bool   `url:"job_events,omitempty"  json:"job_events,omitempty"`
	PipelineEvents           *bool   `url:"pipeline_events,omitempty"  json:"pipeline_events,omitempty"`
	WikiPageEvents           *bool   `url:"wiki_page_events,omitempty"  json:"wiki_page_events,omitempty"`
	DeploymentEvents         *bool   `url:"deployment_events,omitempty" json:"deployment_events,omitempty"`
	ReleasesEvents           *bool   `url:"releases_events,omitempty" json:"releases_events,omitempty"`
	SubGroupEvents           *bool   `url:"subgroup_events,omitempty" json:"subgroup_events,omitempty"`
	EnableSSLVerification    *bool   `url:"enable_ssl_verification,omitempty"  json:"enable_ssl_verification,omitempty"`
	Token                    *string `url:"token,omitempty" json:"token,omitempty"`
}

AddGroupHookOptions represents the available AddGroupHook() options.

GitLab API docs: https://docs.gitlab.com/ee/api/groups.html#add-group-hook

type AddGroupLDAPLinkOptions added in v0.30.0

type AddGroupLDAPLinkOptions struct {
	CN          *string           `url:"cn,omitempty" json:"cn,omitempty"`
	Filter      *string           `url:"filter,omitempty" json:"filter,omitempty"`
	GroupAccess *AccessLevelValue `url:"group_access,omitempty" json:"group_access,omitempty"`
	Provider    *string           `url:"provider,omitempty" json:"provider,omitempty"`
}

AddGroupLDAPLinkOptions represents the available AddGroupLDAPLink() options.

GitLab API docs: https://docs.gitlab.com/ee/api/groups.html#add-ldap-group-link-with-cn-or-filter

type AddGroupMemberOptions

type AddGroupMemberOptions struct {
	UserID      *int              `url:"user_id,omitempty" json:"user_id,omitempty"`
	AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
	ExpiresAt   *string           `url:"expires_at,omitempty" json:"expires_at"`
}

AddGroupMemberOptions represents the available AddGroupMember() options.

GitLab API docs: https://docs.gitlab.com/ee/api/members.html#add-a-member-to-a-group-or-project

type AddGroupPlatformKubernetesOptions added in v0.21.0

type AddGroupPlatformKubernetesOptions struct {
	APIURL            *string `url:"api_url,omitempty" json:"api_url,omitempty"`
	Token             *string `url:"token,omitempty" json:"token,omitempty"`
	CaCert            *string `url:"ca_cert,omitempty" json:"ca_cert,omitempty"`
	Namespace         *string `url:"namespace,omitempty" json:"namespace,omitempty"`
	AuthorizationType *string `url:"authorization_type,omitempty" json:"authorization_type,omitempty"`
}

AddGroupPlatformKubernetesOptions represents the available PlatformKubernetes options for adding.

type AddGroupPushRuleOptions added in v0.38.0

type AddGroupPushRuleOptions struct {
	AuthorEmailRegex           *string `url:"author_email_regex,omitempty" json:"author_email_regex,omitempty"`
	BranchNameRegex            *string `url:"branch_name_regex,omitempty" json:"branch_name_regex,omitempty"`
	CommitCommitterCheck       *bool   `url:"commit_committer_check,omitempty" json:"commit_committer_check,omitempty"`
	CommitMessageNegativeRegex *string `url:"commit_message_negative_regex,omitempty" json:"commit_message_negative_regex,omitempty"`
	CommitMessageRegex         *string `url:"commit_message_regex,omitempty" json:"commit_message_regex,omitempty"`
	DenyDeleteTag              *bool   `url:"deny_delete_tag,omitempty" json:"deny_delete_tag,omitempty"`
	FileNameRegex              *string `url:"file_name_regex,omitempty" json:"file_name_regex,omitempty"`
	MaxFileSize                *int    `url:"max_file_size,omitempty" json:"max_file_size,omitempty"`
	MemberCheck                *bool   `url:"member_check,omitempty" json:"member_check,omitempty"`
	PreventSecrets             *bool   `url:"prevent_secrets,omitempty" json:"prevent_secrets,omitempty"`
	RejectUnsignedCommits      *bool   `url:"reject_unsigned_commits,omitempty" json:"reject_unsigned_commits,omitempty"`
}

AddGroupPushRuleOptions represents the available AddGroupPushRule() options.

GitLab API docs: https://docs.gitlab.com/ee/api/groups.html#add-group-push-rule

type AddGroupSAMLLinkOptions added in v0.73.0

type AddGroupSAMLLinkOptions struct {
	SAMLGroupName *string           `url:"saml_group_name,omitempty" json:"saml_group_name,omitempty"`
	AccessLevel   *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
}

AddGroupSAMLLinkOptions represents the available AddGroupSAMLLink() options.

GitLab API docs: https://docs.gitlab.com/ee/api/groups.html#add-saml-group-link

type AddHookOptions

type AddHookOptions struct {
	URL                    *string `url:"url,omitempty" json:"url,omitempty"`
	Token                  *string `url:"token,omitempty" json:"token,omitempty"`
	PushEvents             *bool   `url:"push_events,omitempty" json:"push_events,omitempty"`
	TagPushEvents          *bool   `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
	MergeRequestsEvents    *bool   `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
	RepositoryUpdateEvents *bool   `url:"repository_update_events,omitempty" json:"repository_update_events,omitempty"`
	EnableSSLVerification  *bool   `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
}

AddHookOptions represents the available AddHook() options.

GitLab API docs: https://docs.gitlab.com/ee/api/system_hooks.html#add-new-system-hook

type AddIssueDiscussionNoteOptions added in v0.11.2

type AddIssueDiscussionNoteOptions struct {
	Body      *string    `url:"body,omitempty" json:"body,omitempty"`
	CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
}

AddIssueDiscussionNoteOptions represents the available AddIssueDiscussionNote() options.

GitLab API docs: https://docs.gitlab.com/ee/api/discussions.html#add-note-to-existing-issue-thread

type AddLicenseOptions added in v0.11.4

type AddLicenseOptions struct {
	License *string `url:"license" json:"license"`
}

AddLicenseOptions represents the available AddLicense() options.

https://docs.gitlab.com/ee/api/license.html#add-a-new-license

type AddManagedLicenseOptions added in v0.50.0

type AddManagedLicenseOptions struct {
	Name           *string                     `url:"name,omitempty" json:"name,omitempty"`
	ApprovalStatus *LicenseApprovalStatusValue `url:"approval_status,omitempty" json:"approval_status,omitempty"`
}

AddManagedLicenseOptions represents the available AddManagedLicense() options.

GitLab API docs: https://docs.gitlab.com/ee/api/managed_licenses.html#create-a-new-managed-license

type AddMergeRequestDiscussionNoteOptions added in v0.11.2

type AddMergeRequestDiscussionNoteOptions struct {
	Body      *string    `url:"body,omitempty" json:"body,omitempty"`
	CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
}

AddMergeRequestDiscussionNoteOptions represents the available AddMergeRequestDiscussionNote() options.

GitLab API docs: https://docs.gitlab.com/ee/api/discussions.html#add-note-to-existing-merge-request-thread

type AddMergeRequestToMergeTrainOptions added in v0.91.0

type AddMergeRequestToMergeTrainOptions struct {
	WhenPipelineSucceeds *bool   `url:"when_pipeline_succeeds,omitempty" json:"when_pipeline_succeeds,omitempty"`
	SHA                  *string `url:"sha,omitempty" json:"sha,omitempty"`
	Squash               *bool   `url:"squash,omitempty" json:"squash,omitempty"`
}

AddMergeRequestToMergeTrainOptions represents the available AddMergeRequestToMergeTrain() options.

GitLab API docs: https://docs.gitlab.com/ee/api/merge_trains.html#add-a-merge-request-to-a-merge-train

type AddPipelineTriggerOptions added in v0.6.0

type AddPipelineTriggerOptions struct {
	Description *string `url:"description,omitempty" json:"description,omitempty"`
}

AddPipelineTriggerOptions represents the available AddPipelineTrigger() options.

GitLab API docs: https://docs.gitlab.com/ee/api/pipeline_triggers.html#create-a-trigger-token

type AddPlatformKubernetesOptions added in v0.14.1

type AddPlatformKubernetesOptions struct {
	APIURL            *string `url:"api_url,omitempty" json:"api_url,omitempty"`
	Token             *string `url:"token,omitempty" json:"token,omitempty"`
	CaCert            *string `url:"ca_cert,omitempty" json:"ca_cert,omitempty"`
	Namespace         *string `url:"namespace,omitempty" json:"namespace,omitempty"`
	AuthorizationType *string `url:"authorization_type,omitempty" json:"authorization_type,omitempty"`
}

AddPlatformKubernetesOptions represents the available PlatformKubernetes options for adding.

type AddProjectBadgeOptions added in v0.11.1

type AddProjectBadgeOptions struct {
	LinkURL  *string `url:"link_url,omitempty" json:"link_url,omitempty"`
	ImageURL *string `url:"image_url,omitempty" json:"image_url,omitempty"`
	Name     *string `url:"name,omitempty" json:"name,omitempty"`
}

AddProjectBadgeOptions represents the available AddProjectBadge() options.

GitLab API docs: https://docs.gitlab.com/ee/api/project_badges.html#add-a-badge-to-a-project

type AddProjectHookOptions

type AddProjectHookOptions struct {
	ConfidentialIssuesEvents *bool   `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
	ConfidentialNoteEvents   *bool   `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"`
	DeploymentEvents         *bool   `url:"deployment_events,omitempty" json:"deployment_events,omitempty"`
	EnableSSLVerification    *bool   `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
	IssuesEvents             *bool   `url:"issues_events,omitempty" json:"issues_events,omitempty"`
	JobEvents                *bool   `url:"job_events,omitempty" json:"job_events,omitempty"`
	MergeRequestsEvents      *bool   `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
	NoteEvents               *bool   `url:"note_events,omitempty" json:"note_events,omitempty"`
	PipelineEvents           *bool   `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
	PushEvents               *bool   `url:"push_events,omitempty" json:"push_events,omitempty"`
	PushEventsBranchFilter   *string `url:"push_events_branch_filter,omitempty" json:"push_events_branch_filter,omitempty"`
	ReleasesEvents           *bool   `url:"releases_events,omitempty" json:"releases_events,omitempty"`
	TagPushEvents            *bool   `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
	Token                    *string `url:"token,omitempty" json:"token,omitempty"`
	URL                      *string `url:"url,omitempty" json:"url,omitempty"`
	WikiPageEvents           *bool   `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
}

AddProjectHookOptions represents the available AddProjectHook() options.

GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#add-project-hook

type AddProjectMemberOptions

type AddProjectMemberOptions struct {
	UserID      interface{}       `url:"user_id,omitempty" json:"user_id,omitempty"`
	AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
	ExpiresAt   *string           `url:"expires_at,omitempty" json:"expires_at"`
}

AddProjectMemberOptions represents the available AddProjectMember() options.

GitLab API docs: https://docs.gitlab.com/ee/api/members.html#add-a-member-to-a-group-or-project

type AddProjectMirrorOptions added in v0.33.0

type AddProjectMirrorOptions struct {
	URL                   *string `url:"url,omitempty" json:"url,omitempty"`
	Enabled               *bool   `url:"enabled,omitempty" json:"enabled,omitempty"`
	OnlyProtectedBranches *bool   `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"`
	KeepDivergentRefs     *bool   `url:"keep_divergent_refs,omitempty" json:"keep_divergent_refs,omitempty"`
}

AddProjectMirrorOptions contains the properties requires to create a new project mirror.

GitLab API docs: https://docs.gitlab.com/ee/api/remote_mirrors.html#create-a-push-mirror

type AddProjectPushRuleOptions added in v0.11.5

type AddProjectPushRuleOptions struct {
	AuthorEmailRegex           *string `url:"author_email_regex,omitempty" json:"author_email_regex,omitempty"`
	BranchNameRegex            *string `url:"branch_name_regex,omitempty" json:"branch_name_regex,omitempty"`
	CommitCommitterCheck       *bool   `url:"commit_committer_check,omitempty" json:"commit_committer_check,omitempty"`
	CommitMessageNegativeRegex *string `url:"commit_message_negative_regex,omitempty" json:"commit_message_negative_regex,omitempty"`
	CommitMessageRegex         *string `url:"commit_message_regex,omitempty" json:"commit_message_regex,omitempty"`
	DenyDeleteTag              *bool   `url:"deny_delete_tag,omitempty" json:"deny_delete_tag,omitempty"`
	FileNameRegex              *string `url:"file_name_regex,omitempty" json:"file_name_regex,omitempty"`
	MaxFileSize                *int    `url:"max_file_size,omitempty" json:"max_file_size,omitempty"`
	MemberCheck                *bool   `url:"member_check,omitempty" json:"member_check,omitempty"`
	PreventSecrets             *bool   `url:"prevent_secrets,omitempty" json:"prevent_secrets,omitempty"`
	RejectUnsignedCommits      *bool   `url:"reject_unsigned_commits,omitempty" json:"reject_unsigned_commits,omitempty"`
}

AddProjectPushRuleOptions represents the available AddProjectPushRule() options.

GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#add-project-push-rule

type AddSSHKeyOptions

type AddSSHKeyOptions struct {
	Title     *string  `url:"title,omitempty" json:"title,omitempty"`
	Key       *string  `url:"key,omitempty" json:"key,omitempty"`
	ExpiresAt *ISOTime `url:"expires_at,omitempty" json:"expires_at,omitempty"`
}

AddSSHKeyOptions represents the available AddSSHKey() options.

GitLab API docs: https://docs.gitlab.com/ee/api/users.html#add-ssh-key

type AddSnippetDiscussionNoteOptions added in v0.11.2

type AddSnippetDiscussionNoteOptions struct {
	Body      *string    `url:"body,omitempty" json:"body,omitempty"`
	CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
}

AddSnippetDiscussionNoteOptions represents the available AddSnippetDiscussionNote() options.

GitLab API docs: https://docs.gitlab.com/ee/api/discussions.html#add-note-to-existing-snippet-thread

type AddSpentTimeOptions added in v0.4.0

type AddSpentTimeOptions struct {
	Duration *string `url:"duration,omitempty" json:"duration,omitempty"`
}

AddSpentTimeOptions represents the available AddSpentTime() options.

GitLab docs: https://docs.gitlab.com/ee/workflow/time_tracking.html

type Agent added in v0.66.0

type Agent struct {
	ID              int           `json:"id"`
	Name            string        `json:"name"`
	CreatedAt       *time.Time    `json:"created_at"`
	CreatedByUserID int           `json:"created_by_user_id"`
	ConfigProject   ConfigProject `json:"config_project"`
}

Agent represents a GitLab agent for Kubernetes.

GitLab API docs: https://docs.gitlab.com/ee/api/cluster_agents.html

func (Agent) String added in v0.66.0

func (a Agent) String() string

type AgentToken added in v0.66.0

type AgentToken struct {
	ID              int        `json:"id"`
	Name            string     `json:"name"`
	Description     string     `json:"description"`
	AgentID         int        `json:"agent_id"`
	Status          string     `json:"status"`
	CreatedAt       *time.Time `json:"created_at"`
	CreatedByUserID int        `json:"created_by_user_id"`
	LastUsedAt      *time.Time `json:"last_used_at"`
	Token           string     `json:"token"`
}

AgentToken represents a GitLab agent token.

GitLab API docs: https://docs.gitlab.com/ee/api/cluster_agents.html#list-tokens-for-an-agent

func (AgentToken) String added in v0.66.0

func (a AgentToken) String() string

type