Help us shape the future of Go! Take the 2026 Go Developer Survey

deploykeys

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package deploykeys implements MCP tools for GitLab deploy key operations.

The package wraps the GitLab Deploy keys API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionSpecs

func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec

ActionSpecs returns canonical specs for deploy key actions.

func Delete

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

Delete removes a deploy key from a project.

func FormatInstanceListMarkdown

func FormatInstanceListMarkdown(o InstanceListOutput) string

FormatInstanceListMarkdown renders a list of instance deploy keys as a table.

func FormatInstanceOutputMarkdown

func FormatInstanceOutputMarkdown(o InstanceOutput) string

FormatInstanceOutputMarkdown renders one instance deploy key as a card.

func FormatListMarkdown

func FormatListMarkdown(o ListOutput) string

FormatListMarkdown renders a list of project deploy keys as a table.

func FormatOutputMarkdown

func FormatOutputMarkdown(o Output) string

FormatOutputMarkdown renders one project deploy key as a card.

Types

type AddInput

type AddInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Title     string               `json:"title" jsonschema:"Deploy key title,required"`
	Key       string               `json:"key" jsonschema:"Public SSH key content,required"`
	CanPush   *bool                `json:"can_push,omitempty" jsonschema:"Whether the key can push to the project"`
	ExpiresAt string               `json:"expires_at,omitempty" jsonschema:"Expiry date (YYYY-MM-DD)"`
}

AddInput represents parameters for adding a deploy key to a project.

type AddInstanceInput

type AddInstanceInput struct {
	Title     string `json:"title" jsonschema:"Deploy key title,required"`
	Key       string `json:"key" jsonschema:"Public SSH key content,required"`
	ExpiresAt string `json:"expires_at,omitempty" jsonschema:"Expiry date (YYYY-MM-DD)"`
}

AddInstanceInput represents parameters for creating an instance-level deploy key.

type DeleteInput

type DeleteInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	DeployKeyID int64                `json:"deploy_key_id" jsonschema:"Deploy key ID returned by deploy key operations. Do not use deploy_token_id,required"`
}

DeleteInput represents parameters for deleting a deploy key.

type EnableInput

type EnableInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	DeployKeyID int64                `json:"deploy_key_id" jsonschema:"Deploy key ID to enable. Do not use deploy_token_id,required"`
}

EnableInput represents parameters for enabling a deploy key for a project.

type GetInput

type GetInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	DeployKeyID int64                `json:"deploy_key_id" jsonschema:"Deploy key ID returned by deploy key operations. Do not use deploy_token_id,required"`
}

GetInput represents parameters for getting a single deploy key.

type InstanceListOutput

type InstanceListOutput struct {
	toolutil.HintableOutput
	DeployKeys []InstanceOutput          `json:"deploy_keys"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

InstanceListOutput holds a paginated list of instance deploy keys.

func ListAll

func ListAll(ctx context.Context, client *gitlabclient.Client, input ListAllInput) (InstanceListOutput, error)

ListAll lists all instance-level deploy keys.

type InstanceOutput

type InstanceOutput struct {
	toolutil.HintableOutput
	ID                         int64            `json:"id"`
	Title                      string           `json:"title"`
	Key                        string           `json:"key"`
	Fingerprint                string           `json:"fingerprint,omitempty"`
	FingerprintSHA256          string           `json:"fingerprint_sha256,omitempty"`
	CreatedAt                  string           `json:"created_at,omitempty"`
	ExpiresAt                  string           `json:"expires_at,omitempty"`
	LastUsedAt                 string           `json:"last_used_at,omitempty"`
	UsageType                  string           `json:"usage_type,omitempty"`
	ProjectsWithWriteAccess    []ProjectSummary `json:"projects_with_write_access,omitempty"`
	ProjectsWithReadonlyAccess []ProjectSummary `json:"projects_with_readonly_access,omitempty"`
}

InstanceOutput represents an instance-level deploy key.

func AddInstance

func AddInstance(ctx context.Context, client *gitlabclient.Client, input AddInstanceInput) (InstanceOutput, error)

AddInstance creates an instance-level deploy key.

type ListAllInput

type ListAllInput struct {
	Public  *bool  `json:"public,omitempty"   jsonschema:"Filter by public keys"`
	OrderBy string `json:"order_by,omitempty" jsonschema:"Column to order results by (e.g. id, title, created_at)"`
	Sort    string `json:"sort,omitempty"     jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListAllInput represents parameters for listing all instance-level deploy keys.

type ListOutput

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

ListOutput holds a paginated list of project deploy keys.

func ListProject

func ListProject(ctx context.Context, client *gitlabclient.Client, input ListProjectInput) (ListOutput, error)

ListProject lists all deploy keys for a project.

func ListUserProject

func ListUserProject(ctx context.Context, client *gitlabclient.Client, input ListUserProjectInput) (ListOutput, error)

ListUserProject lists deploy keys for a specific user's projects.

type ListProjectInput

type ListProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id"         jsonschema:"Project ID or path,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order results by (e.g. id, title, created_at)"`
	Sort      string               `json:"sort,omitempty"     jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListProjectInput represents parameters for listing project deploy keys.

type ListUserProjectInput

type ListUserProjectInput struct {
	UserID  toolutil.StringOrInt `json:"user_id"            jsonschema:"User ID or username,required"`
	OrderBy string               `json:"order_by,omitempty" jsonschema:"Column to order results by (e.g. id, title, created_at)"`
	Sort    string               `json:"sort,omitempty"     jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListUserProjectInput represents parameters for listing a user's project deploy keys.

type Output

type Output struct {
	toolutil.HintableOutput
	ID                         int64            `json:"id"`
	Title                      string           `json:"title"`
	Key                        string           `json:"key"`
	Fingerprint                string           `json:"fingerprint,omitempty"`
	FingerprintSHA256          string           `json:"fingerprint_sha256,omitempty"`
	CreatedAt                  string           `json:"created_at,omitempty"`
	CanPush                    bool             `json:"can_push"`
	ExpiresAt                  string           `json:"expires_at,omitempty"`
	LastUsedAt                 string           `json:"last_used_at,omitempty"`
	UsageType                  string           `json:"usage_type,omitempty"`
	ProjectsWithWriteAccess    []ProjectSummary `json:"projects_with_write_access,omitempty"`
	ProjectsWithReadonlyAccess []ProjectSummary `json:"projects_with_readonly_access,omitempty"`
}

Output represents a project-level deploy key.

func Add

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

Add adds a deploy key to a project.

func Enable

func Enable(ctx context.Context, client *gitlabclient.Client, input EnableInput) (Output, error)

Enable enables a deploy key for a project.

func Get

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

Get retrieves a single deploy key by ID.

func Update

func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)

Update updates an existing deploy key.

type ProjectSummary

type ProjectSummary struct {
	ID                int64  `json:"id"`
	Description       string `json:"description,omitempty"`
	Name              string `json:"name"`
	NameWithNamespace string `json:"name_with_namespace,omitempty"`
	Path              string `json:"path,omitempty"`
	PathWithNamespace string `json:"path_with_namespace"`
	CreatedAt         string `json:"created_at,omitempty"`
}

ProjectSummary mirrors gl.DeployKeyProject, the project an instance deploy key has read-only or write access to. It carries the full set of project fields the GitLab API returns for each entry.

type UpdateInput

type UpdateInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	DeployKeyID int64                `json:"deploy_key_id" jsonschema:"Deploy key ID returned by deploy key operations. Do not use deploy_token_id,required"`
	Title       string               `json:"title,omitempty" jsonschema:"New deploy key title"`
	CanPush     *bool                `json:"can_push,omitempty" jsonschema:"Whether the key can push to the project"`
}

UpdateInput represents parameters for updating a deploy key.

Jump to

Keyboard shortcuts

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