Documentation
¶
Overview ¶
Package protectedenvs implements MCP tools for GitLab protected environment operations.
The package wraps the GitLab Protected environments API:
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func FormatListMarkdown(out ListOutput) string
- func FormatOutputMarkdown(pe Output) string
- func Unprotect(ctx context.Context, client *gitlabclient.Client, input UnprotectInput) error
- type AccessLevelOutput
- type ApprovalRuleInput
- type ApprovalRuleOutput
- type DeployAccessLevelInput
- type GetInput
- type ListInput
- type ListOutput
- type Output
- type ProtectInput
- type UnprotectInput
- type UpdateApprovalRuleInput
- type UpdateDeployAccessLevelInput
- type UpdateInput
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 protected environment actions.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) string
FormatListMarkdown renders a page of a project's protected environments as a Markdown table.
func FormatOutputMarkdown ¶
FormatOutputMarkdown renders one protected environment as the card of a single object: the approvals it needs, then the deploy access levels and the approval rules as nested collections, as protectedenvdata.WriteRules writes them for a group protected environment too.
func Unprotect ¶
func Unprotect(ctx context.Context, client *gitlabclient.Client, input UnprotectInput) error
Unprotect removes protection from an environment.
Types ¶
type AccessLevelOutput ¶
type AccessLevelOutput = protectedenvdata.AccessLevel
AccessLevelOutput represents an access level on a protected environment, the shape a group protected environment answers with too.
type ApprovalRuleInput ¶
type ApprovalRuleInput = protectedenvdata.ApprovalRuleInput
ApprovalRuleInput represents an approval rule for an environment, the shape a group protected environment takes too.
type ApprovalRuleOutput ¶
type ApprovalRuleOutput = protectedenvdata.ApprovalRule
ApprovalRuleOutput represents an approval rule on a protected environment, the shape a group protected environment answers with too.
type DeployAccessLevelInput ¶
type DeployAccessLevelInput = protectedenvdata.DeployAccessLevelInput
DeployAccessLevelInput represents an access level for deployment, the shape a group protected environment takes too.
type GetInput ¶
type GetInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Environment string `json:"environment" jsonschema:"Environment name,required"`
}
GetInput holds parameters for retrieving a single protected environment.
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 keyset-paginated results by"`
Sort string `json:"sort,omitempty" jsonschema:"Sort direction (asc, desc)"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
ListInput holds parameters for listing protected environments. It mirrors gl.ListProtectedEnvironmentsOptions, 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 represents a paginated list of protected environments.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List retrieves a paginated list of protected environments for a project.
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 protected environment.
func Protect ¶
func Protect(ctx context.Context, client *gitlabclient.Client, input ProtectInput) (Output, error)
Protect creates a new protected environment.
func Update ¶
func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)
Update modifies an existing protected environment.
type ProtectInput ¶
type ProtectInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Name string `json:"name" jsonschema:"Environment name to protect,required"`
DeployAccessLevels []DeployAccessLevelInput `` /* 159-byte string literal not displayed */
RequiredApprovalCount *int64 `` /* 166-byte string literal not displayed */
ApprovalRules []ApprovalRuleInput `` /* 150-byte string literal not displayed */
}
ProtectInput holds parameters for protecting a repository environment.
type UnprotectInput ¶
type UnprotectInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Environment string `json:"environment" jsonschema:"Environment name to unprotect,required"`
}
UnprotectInput holds parameters for unprotecting an environment.
type UpdateApprovalRuleInput ¶
type UpdateApprovalRuleInput = protectedenvdata.UpdateApprovalRuleInput
UpdateApprovalRuleInput represents an updated approval rule for an environment, the shape a group protected environment takes too.
type UpdateDeployAccessLevelInput ¶
type UpdateDeployAccessLevelInput = protectedenvdata.UpdateDeployAccessLevelInput
UpdateDeployAccessLevelInput represents an updated access level for deployment, the shape a group protected environment takes too.
type UpdateInput ¶
type UpdateInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Environment string `json:"environment" jsonschema:"Environment name,required"`
Name string `json:"name,omitempty" jsonschema:"New environment name"`
DeployAccessLevels []UpdateDeployAccessLevelInput `` /* 322-byte string literal not displayed */
RequiredApprovalCount *int64 `` /* 166-byte string literal not displayed */
ApprovalRules []UpdateApprovalRuleInput `` /* 324-byte string literal not displayed */
}
UpdateInput holds parameters for updating a protected environment.