projectmirrors

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package projectmirrors implements GitLab project remote mirror (push mirror) operations including list, get, get public key, add, edit, delete, and force push update.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, client *gitlabclient.Client, in DeleteInput) error

Delete removes a remote mirror from a project.

func ForcePushUpdate

func ForcePushUpdate(ctx context.Context, client *gitlabclient.Client, in ForcePushInput) error

ForcePushUpdate triggers an immediate push mirror update.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown renders a paginated list of project mirrors as Markdown.

func FormatOutputMarkdown

func FormatOutputMarkdown(m Output) string

FormatOutputMarkdown renders a single project mirror as Markdown.

func FormatPublicKeyMarkdown

func FormatPublicKeyMarkdown(pk PublicKeyOutput) string

FormatPublicKeyMarkdown renders a mirror's SSH public key as Markdown.

func RegisterTools

func RegisterTools(server *mcp.Server, client *gitlabclient.Client)

RegisterTools registers MCP tools for GitLab project mirror operations.

Types

type AddInput

type AddInput struct {
	ProjectID             toolutil.StringOrInt `json:"project_id"                        jsonschema:"Project ID or URL-encoded path,required"`
	URL                   string               `` /* 127-byte string literal not displayed */
	Enabled               *bool                `json:"enabled,omitempty"                 jsonschema:"Whether the mirror is enabled"`
	KeepDivergentRefs     *bool                `json:"keep_divergent_refs,omitempty"     jsonschema:"Keep divergent refs on the remote"`
	OnlyProtectedBranches *bool                `json:"only_protected_branches,omitempty" jsonschema:"Mirror only protected branches"`
	MirrorBranchRegex     string               `json:"mirror_branch_regex,omitempty"     jsonschema:"Regex pattern for branches to mirror"`
	AuthMethod            string               `json:"auth_method,omitempty"             jsonschema:"Authentication method (password or ssh_public_key)"`
	HostKeys              []string             `json:"host_keys,omitempty"               jsonschema:"SSH host keys for the remote mirror"`
}

AddInput holds parameters for creating a new project mirror.

type DeleteInput

type DeleteInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MirrorID  int64                `json:"mirror_id"  jsonschema:"Remote mirror ID,required"`
}

DeleteInput holds parameters for deleting a project mirror.

type EditInput

type EditInput struct {
	ProjectID             toolutil.StringOrInt `json:"project_id"                        jsonschema:"Project ID or URL-encoded path,required"`
	MirrorID              int64                `json:"mirror_id"                         jsonschema:"Remote mirror ID,required"`
	Enabled               *bool                `json:"enabled,omitempty"                 jsonschema:"Whether the mirror is enabled"`
	KeepDivergentRefs     *bool                `json:"keep_divergent_refs,omitempty"     jsonschema:"Keep divergent refs on the remote"`
	OnlyProtectedBranches *bool                `json:"only_protected_branches,omitempty" jsonschema:"Mirror only protected branches"`
	MirrorBranchRegex     string               `json:"mirror_branch_regex,omitempty"     jsonschema:"Regex pattern for branches to mirror"`
	AuthMethod            string               `json:"auth_method,omitempty"             jsonschema:"Authentication method (password or ssh_public_key)"`
	HostKeys              []string             `json:"host_keys,omitempty"               jsonschema:"SSH host keys for the remote mirror"`
}

EditInput holds parameters for updating an existing project mirror.

type ForcePushInput

type ForcePushInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MirrorID  int64                `json:"mirror_id"  jsonschema:"Remote mirror ID,required"`
}

ForcePushInput holds parameters for triggering a forced push mirror update.

type GetInput

type GetInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MirrorID  int64                `json:"mirror_id"  jsonschema:"Remote mirror ID,required"`
}

GetInput holds parameters for retrieving a single project mirror.

type GetPublicKeyInput

type GetPublicKeyInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MirrorID  int64                `json:"mirror_id"  jsonschema:"Remote mirror ID,required"`
}

GetPublicKeyInput holds parameters for retrieving a mirror's SSH public key.

type HostKeyOutput

type HostKeyOutput struct {
	FingerprintSHA256 string `json:"fingerprint_sha256"`
}

HostKeyOutput represents a host key fingerprint for an SSH-based mirror.

type ListInput

type ListInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	toolutil.PaginationInput
}

ListInput holds parameters for listing project mirrors.

type ListOutput

type ListOutput struct {
	toolutil.HintableOutput
	Mirrors    []Output                  `json:"mirrors"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListOutput contains a paginated list of project mirrors.

func List

func List(ctx context.Context, client *gitlabclient.Client, in ListInput) (ListOutput, error)

List returns all remote mirrors for a project.

type Output

type Output struct {
	toolutil.HintableOutput
	ID                     int64           `json:"id"`
	Enabled                bool            `json:"enabled"`
	URL                    string          `json:"url"`
	UpdateStatus           string          `json:"update_status"`
	LastError              string          `json:"last_error,omitempty"`
	LastSuccessfulUpdateAt string          `json:"last_successful_update_at,omitempty"`
	LastUpdateAt           string          `json:"last_update_at,omitempty"`
	LastUpdateStartedAt    string          `json:"last_update_started_at,omitempty"`
	OnlyProtectedBranches  bool            `json:"only_protected_branches"`
	KeepDivergentRefs      bool            `json:"keep_divergent_refs"`
	MirrorBranchRegex      string          `json:"mirror_branch_regex,omitempty"`
	AuthMethod             string          `json:"auth_method,omitempty"`
	HostKeys               []HostKeyOutput `json:"host_keys,omitempty"`
}

Output represents a project mirror.

func Add

func Add(ctx context.Context, client *gitlabclient.Client, in AddInput) (Output, error)

Add creates a new remote mirror for a project.

func Edit

func Edit(ctx context.Context, client *gitlabclient.Client, in EditInput) (Output, error)

Edit updates an existing remote mirror for a project.

func Get

func Get(ctx context.Context, client *gitlabclient.Client, in GetInput) (Output, error)

Get returns a single remote mirror for a project.

type PublicKeyOutput

type PublicKeyOutput struct {
	toolutil.HintableOutput
	PublicKey string `json:"public_key"`
}

PublicKeyOutput represents a mirror's SSH public key.

func GetPublicKey

func GetPublicKey(ctx context.Context, client *gitlabclient.Client, in GetPublicKeyInput) (PublicKeyOutput, error)

GetPublicKey returns the SSH public key for a remote mirror.

Jump to

Keyboard shortcuts

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