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

protectedpackages

package
v3.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package protectedpackages implements MCP tools for GitLab package protection rule operations.

The package wraps the GitLab Protected packages 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 package protection rule actions.

func Delete

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

Delete removes a package protection rule from a project.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown renders a paginated list of package protection rules as a Markdown table.

func FormatOutputMarkdown

func FormatOutputMarkdown(r Output) string

FormatOutputMarkdown renders a single package protection rule as the card of one object: the pattern it matches and the access levels it demands.

Types

type CreateInput

type CreateInput struct {
	ProjectID                   toolutil.StringOrInt         `json:"project_id"                              jsonschema:"Project ID or URL-encoded path,required"`
	PackageNamePattern          string                       `` /* 138-byte string literal not displayed */
	PackageType                 string                       `` /* 198-byte string literal not displayed */
	MinimumAccessLevelForPush   gl.ProtectionRuleAccessLevel `json:"minimum_access_level_for_push,omitempty" jsonschema:"Minimum access level for push (maintainer, owner, admin)"`
	MinimumAccessLevelForDelete gl.ProtectionRuleAccessLevel `json:"minimum_access_level_for_delete,omitempty" jsonschema:"Minimum access level for delete (maintainer, owner, admin)"`
}

CreateInput holds parameters for creating a package protection rule.

type DeleteInput

type DeleteInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	RuleID    int64                `json:"rule_id"    jsonschema:"Package protection rule ID,required"`
}

DeleteInput holds parameters for deleting a package protection rule.

type ListInput

type ListInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order results by (keyset pagination)"`
	Sort      string               `json:"sort,omitempty"     jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListInput holds parameters for listing package protection rules.

type ListOutput

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

ListOutput contains a paginated list of package protection rules.

func List

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

List returns all package protection rules for a project.

type Output

type Output struct {
	toolutil.HintableOutput
	ID                          int64  `json:"id"`
	ProjectID                   int64  `json:"project_id"`
	PackageNamePattern          string `json:"package_name_pattern"`
	PackageType                 string `json:"package_type"`
	MinimumAccessLevelForPush   string `json:"minimum_access_level_for_push,omitempty"`
	MinimumAccessLevelForDelete string `json:"minimum_access_level_for_delete,omitempty"`
}

Output represents a package protection rule.

func Create

func Create(ctx context.Context, client *gitlabclient.Client, in CreateInput) (Output, error)

Create adds a new package protection rule to a project.

func Update

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

Update modifies an existing package protection rule.

type UpdateInput

type UpdateInput struct {
	ProjectID                   toolutil.StringOrInt         `json:"project_id"                              jsonschema:"Project ID or URL-encoded path,required"`
	RuleID                      int64                        `json:"rule_id"                                 jsonschema:"Package protection rule ID,required"`
	PackageNamePattern          string                       `json:"package_name_pattern,omitempty"          jsonschema:"Package name pattern with optional wildcards"`
	PackageType                 string                       `` /* 189-byte string literal not displayed */
	MinimumAccessLevelForPush   gl.ProtectionRuleAccessLevel `json:"minimum_access_level_for_push,omitempty" jsonschema:"Minimum access level for push (maintainer, owner, admin)"`
	MinimumAccessLevelForDelete gl.ProtectionRuleAccessLevel `json:"minimum_access_level_for_delete,omitempty" jsonschema:"Minimum access level for delete (maintainer, owner, admin)"`
}

UpdateInput holds parameters for updating a package protection rule.

Jump to

Keyboard shortcuts

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