protectedpackages

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 protectedpackages implements GitLab package protection rule operations including list, create, update, and delete. Package protection rules restrict who can push or delete specific package patterns.

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 package protection rule from a project.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

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

func FormatOutputMarkdown

func FormatOutputMarkdown(r Output) string

FormatOutputMarkdown renders a single package protection rule as Markdown.

func RegisterTools

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

RegisterTools registers MCP tools for GitLab package protection rule operations.

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               `json:"package_type"                            jsonschema:"Package type (npm, pypi, maven, generic, etc.),required"`
	MinimumAccessLevelForPush   string               `json:"minimum_access_level_for_push,omitempty" jsonschema:"Minimum access level for push (maintainer, owner, admin)"`
	MinimumAccessLevelForDelete string               `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"`
	toolutil.PaginationInput
}

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               `json:"package_type,omitempty"                  jsonschema:"Package type (npm, pypi, maven, generic, etc.)"`
	MinimumAccessLevelForPush   string               `json:"minimum_access_level_for_push,omitempty" jsonschema:"Minimum access level for push (maintainer, owner, admin)"`
	MinimumAccessLevelForDelete string               `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