groupprotectedenvs

package
v2.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package groupprotectedenvs implements MCP tools for GitLab group protected environment operations.

The package wraps the GitLab Group protected environments 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 group protected environment actions.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown renders a paginated list of group protected environments as Markdown.

func FormatOutputMarkdown

func FormatOutputMarkdown(out Output) string

FormatOutputMarkdown renders a single group protected environment as Markdown.

func Unprotect

func Unprotect(ctx context.Context, client *gitlabclient.Client, input UnprotectInput) error

Unprotect removes a group-level protected environment.

Types

type AccessLevelOutput

type AccessLevelOutput struct {
	ID                     int64  `json:"id"`
	AccessLevel            int    `json:"access_level"`
	AccessLevelDescription string `json:"access_level_description"`
	UserID                 int64  `json:"user_id,omitempty"`
	GroupID                int64  `json:"group_id,omitempty"`
	GroupInheritanceType   int64  `json:"group_inheritance_type,omitempty"`
}

AccessLevelOutput represents a deploy access level on a group protected environment.

type ApprovalRuleInput

type ApprovalRuleInput struct {
	UserID                 *int64  `json:"user_id,omitempty"                  jsonschema:"User ID"`
	GroupID                *int64  `json:"group_id,omitempty"                 jsonschema:"Group ID"`
	AccessLevel            *int    `json:"access_level,omitempty"             jsonschema:"Access level"`
	AccessLevelDescription *string `json:"access_level_description,omitempty"  jsonschema:"Human-readable description of the access level"`
	RequiredApprovalCount  *int64  `json:"required_approvals,omitempty"       jsonschema:"Required number of approvals"`
	GroupInheritanceType   *int64  `json:"group_inheritance_type,omitempty"   jsonschema:"Group inheritance type (0=direct, 1=inherited)"`
}

ApprovalRuleInput represents an approval rule input. It mirrors gl.GroupEnvironmentApprovalRuleOptions field-for-field.

type ApprovalRuleOutput

type ApprovalRuleOutput struct {
	ID                     int64  `json:"id"`
	UserID                 int64  `json:"user_id,omitempty"`
	GroupID                int64  `json:"group_id,omitempty"`
	AccessLevel            int    `json:"access_level"`
	AccessLevelDescription string `json:"access_level_description"`
	RequiredApprovalCount  int64  `json:"required_approvals"`
	GroupInheritanceType   int64  `json:"group_inheritance_type,omitempty"`
}

ApprovalRuleOutput represents an approval rule on a group protected environment.

type DeployAccessLevelInput

type DeployAccessLevelInput struct {
	AccessLevel          *int   `json:"access_level,omitempty"           jsonschema:"Access level (0=No access, 30=Developer, 40=Maintainer, 60=Admin)"`
	UserID               *int64 `json:"user_id,omitempty"                jsonschema:"User ID"`
	GroupID              *int64 `json:"group_id,omitempty"               jsonschema:"Group ID"`
	GroupInheritanceType *int64 `json:"group_inheritance_type,omitempty" jsonschema:"Group inheritance type (0=direct, 1=inherited)"`
}

DeployAccessLevelInput represents an access level for deployment.

type GetInput

type GetInput struct {
	GroupID     toolutil.StringOrInt `json:"group_id"    jsonschema:"Group ID or URL-encoded path,required"`
	Environment string               `json:"environment" jsonschema:"Environment tier (production, staging, testing, development, other),required"`
}

GetInput defines parameters for the Get action which retrieves a single group-level protected environment.

type ListInput

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

ListInput defines parameters for the List action which retrieves group-level protected environments. It mirrors gl.ListGroupProtectedEnvironmentsOptions, which embeds gl.ListOptions, exposing keyset pagination (order_by, sort, pagination, page_token) in addition to offset pagination.

type ListOutput

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

ListOutput holds a paginated list of group protected environments.

func List

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

List retrieves all group-level protected environments.

type Output

type Output struct {
	toolutil.HintableOutput
	Name                  string               `json:"name"`
	DeployAccessLevels    []AccessLevelOutput  `json:"deploy_access_levels"`
	RequiredApprovalCount int64                `json:"required_approval_count"`
	ApprovalRules         []ApprovalRuleOutput `json:"approval_rules"`
}

Output represents a single group-level protected environment.

func Get

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

Get retrieves a single group-level protected environment.

func Protect

func Protect(ctx context.Context, client *gitlabclient.Client, input ProtectInput) (Output, error)

Protect creates a new group-level protected environment.

func Update

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

Update modifies a group-level protected environment.

type ProtectInput

type ProtectInput struct {
	GroupID               toolutil.StringOrInt     `json:"group_id"                          jsonschema:"Group ID or URL-encoded path,required"`
	Name                  string                   `` /* 141-byte string literal not displayed */
	DeployAccessLevels    []DeployAccessLevelInput `json:"deploy_access_levels,omitempty"    jsonschema:"Deploy access levels,required"`
	RequiredApprovalCount *int64                   `json:"required_approval_count,omitempty" jsonschema:"Required number of approvals"`
	ApprovalRules         []ApprovalRuleInput      `json:"approval_rules,omitempty"          jsonschema:"Approval rules"`
}

ProtectInput defines parameters for the Protect action which creates a group-level protected environment.

type UnprotectInput

type UnprotectInput struct {
	GroupID     toolutil.StringOrInt `json:"group_id"    jsonschema:"Group ID or URL-encoded path,required"`
	Environment string               `json:"environment" jsonschema:"Environment tier to unprotect (production, staging, testing, development, other),required"`
}

UnprotectInput defines parameters for the Unprotect action which removes a group-level protected environment.

type UpdateApprovalRuleInput

type UpdateApprovalRuleInput struct {
	ID                     *int64  `json:"id,omitempty"                       jsonschema:"Existing approval rule ID to update"`
	UserID                 *int64  `json:"user_id,omitempty"                  jsonschema:"User ID"`
	GroupID                *int64  `json:"group_id,omitempty"                 jsonschema:"Group ID"`
	AccessLevel            *int    `json:"access_level,omitempty"             jsonschema:"Access level"`
	AccessLevelDescription *string `json:"access_level_description,omitempty"  jsonschema:"Human-readable description of the access level"`
	RequiredApprovalCount  *int64  `json:"required_approvals,omitempty"       jsonschema:"Required number of approvals"`
	GroupInheritanceType   *int64  `json:"group_inheritance_type,omitempty"   jsonschema:"Group inheritance type"`
	Destroy                *bool   `json:"_destroy,omitempty"                 jsonschema:"Set true to remove this rule"`
}

UpdateApprovalRuleInput represents an updated approval rule. It mirrors gl.UpdateGroupEnvironmentApprovalRuleOptions field-for-field.

type UpdateDeployAccessLevelInput

type UpdateDeployAccessLevelInput struct {
	ID                   *int64 `json:"id,omitempty"                     jsonschema:"Existing access level ID to update"`
	AccessLevel          *int   `json:"access_level,omitempty"           jsonschema:"Access level"`
	UserID               *int64 `json:"user_id,omitempty"                jsonschema:"User ID"`
	GroupID              *int64 `json:"group_id,omitempty"               jsonschema:"Group ID"`
	GroupInheritanceType *int64 `json:"group_inheritance_type,omitempty" jsonschema:"Group inheritance type"`
	Destroy              *bool  `json:"_destroy,omitempty"               jsonschema:"Set true to remove this access level"`
}

UpdateDeployAccessLevelInput represents an updated deploy access level.

type UpdateInput

type UpdateInput struct {
	GroupID               toolutil.StringOrInt           `json:"group_id"                          jsonschema:"Group ID or URL-encoded path,required"`
	Environment           string                         `` /* 130-byte string literal not displayed */
	Name                  string                         `json:"name,omitempty"                    jsonschema:"New environment tier (production, staging, testing, development, other)"`
	DeployAccessLevels    []UpdateDeployAccessLevelInput `json:"deploy_access_levels,omitempty"    jsonschema:"Updated deploy access levels"`
	RequiredApprovalCount *int64                         `json:"required_approval_count,omitempty" jsonschema:"Required number of approvals"`
	ApprovalRules         []UpdateApprovalRuleInput      `json:"approval_rules,omitempty"          jsonschema:"Updated approval rules"`
}

UpdateInput defines parameters for the Update action which modifies a group-level protected environment.

Jump to

Keyboard shortcuts

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