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

pages

package
v3.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package pages implements MCP tools for GitLab Pages operations.

The package wraps the GitLab Pages 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 project Pages actions exposed as MCP tools. The settings, custom domain, and admin routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).

func DeleteDomain

func DeleteDomain(ctx context.Context, client *gitlabclient.Client, input DeleteDomainInput) error

DeleteDomain removes a custom Pages domain from a project via the GitLab Pages domains API (DELETE /projects/:id/pages/domains/:domain). Requires Maintainer or Owner role.

func FormatAllDomainsMarkdown

func FormatAllDomainsMarkdown(out ListAllDomainsOutput) string

FormatAllDomainsMarkdown renders one page of the Pages domains on the instance as a table, with the pagination GitLab sent so a reader can tell the page from the whole.

func FormatDomainListMarkdown

func FormatDomainListMarkdown(out ListDomainsOutput) string

FormatDomainListMarkdown renders a project's Pages domains as a table.

func FormatDomainMarkdown

func FormatDomainMarkdown(out DomainOutput) string

FormatDomainMarkdown renders one Pages custom domain as a card.

The verification code is shown only while the domain is unverified, which is the one moment a reader needs it: it is the TXT record GitLab checks for.

func FormatPagesMarkdown

func FormatPagesMarkdown(out Output) string

FormatPagesMarkdown renders a project's Pages settings as a card, with the deployments as a nested collection under a heading of their own.

func UnpublishPages

func UnpublishPages(ctx context.Context, client *gitlabclient.Client, input UnpublishPagesInput) error

UnpublishPages removes the published Pages site for a project via the GitLab Pages API (DELETE /projects/:id/pages). Requires Maintainer or Owner role.

Types

type CertificateOutput

type CertificateOutput struct {
	Subject         string `json:"subject"`
	Expired         bool   `json:"expired"`
	Expiration      string `json:"expiration,omitempty"`
	Certificate     string `json:"certificate,omitempty"`
	CertificateText string `json:"certificate_text,omitempty"`
}

CertificateOutput represents a Pages domain certificate.

type CreateDomainInput

type CreateDomainInput struct {
	ProjectID      toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Domain         string               `json:"domain" jsonschema:"Custom domain name (e.g. example.com),required"`
	AutoSslEnabled *bool                `json:"auto_ssl_enabled,omitempty" jsonschema:"Enable automatic SSL certificate provisioning"`
	Certificate    string               `json:"certificate,omitempty" jsonschema:"PEM-encoded SSL certificate"`
	Key            string               `json:"key,omitempty" jsonschema:"PEM-encoded private key for the certificate"`
}

CreateDomainInput defines parameters for creating a Pages domain.

type DeleteDomainInput

type DeleteDomainInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Domain    string               `json:"domain" jsonschema:"The Pages domain name to delete,required"`
}

DeleteDomainInput defines parameters for deleting a Pages domain.

type DeploymentOutput

type DeploymentOutput struct {
	CreatedAt     string `json:"created_at"`
	URL           string `json:"url"`
	PathPrefix    string `json:"path_prefix"`
	RootDirectory string `json:"root_directory"`
}

DeploymentOutput represents a Pages deployment.

type DomainOutput

type DomainOutput struct {
	toolutil.HintableOutput
	Domain           string            `json:"domain"`
	AutoSslEnabled   bool              `json:"auto_ssl_enabled"`
	URL              string            `json:"url"`
	ProjectID        int64             `json:"project_id"`
	Verified         bool              `json:"verified"`
	VerificationCode string            `json:"verification_code"`
	EnabledUntil     string            `json:"enabled_until,omitempty"`
	Certificate      CertificateOutput `json:"certificate"`
	// CertificateExpiration is the top-level object GitLab sends on a domain
	// that has a certificate, beside the certificate itself.
	CertificateExpiration *toolutil.PagesCertificateExpirationOutput `json:"certificate_expiration,omitempty"`
}

DomainOutput represents a Pages domain.

func CreateDomain

func CreateDomain(ctx context.Context, client *gitlabclient.Client, input CreateDomainInput) (DomainOutput, error)

CreateDomain adds a new custom domain to a project's Pages configuration via the GitLab Pages domains API (POST /projects/:id/pages/domains). Optional AutoSslEnabled, Certificate, and Key fields are forwarded to the API.

func GetDomain

func GetDomain(ctx context.Context, client *gitlabclient.Client, input GetDomainInput) (DomainOutput, error)

GetDomain retrieves a single Pages domain by name via the GitLab Pages domains API (GET /projects/:id/pages/domains/:domain).

func UpdateDomain

func UpdateDomain(ctx context.Context, client *gitlabclient.Client, input UpdateDomainInput) (DomainOutput, error)

UpdateDomain updates the auto-SSL flag and/or custom certificate of an existing Pages domain via the GitLab Pages domains API (PUT /projects/:id/pages/domains/:domain).

type GetDomainInput

type GetDomainInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Domain    string               `json:"domain" jsonschema:"The Pages domain name,required"`
}

GetDomainInput defines parameters for getting a single Pages domain.

type GetPagesInput

type GetPagesInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
}

GetPagesInput defines parameters for getting Pages settings.

type ListAllDomainsInput

type ListAllDomainsInput struct {
	toolutil.PaginationInput
}

ListAllDomainsInput defines the page of the instance's Pages domains to list. GitLab pages GET /pages/domains, and client-go's ListAllPagesDomains takes no options struct, so the page travels as a request option.

type ListAllDomainsOutput

type ListAllDomainsOutput struct {
	toolutil.HintableOutput
	Domains    []DomainOutput            `json:"domains"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListAllDomainsOutput wraps one page of the instance's Pages domains and the pagination GitLab sent with it.

func ListAllDomains

func ListAllDomains(ctx context.Context, client *gitlabclient.Client, input ListAllDomainsInput) (ListAllDomainsOutput, error)

ListAllDomains returns one page of the Pages domains across the entire instance via the GitLab Pages domains admin API (GET /pages/domains). Requires administrator access.

type ListDomainsInput

type ListDomainsInput 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
}

ListDomainsInput defines parameters for listing Pages domains for a project. It supports offset and keyset pagination (page_token/pagination) plus order_by/sort to mirror the keyset-capable gl.ListPagesDomainsOptions.

type ListDomainsOutput

type ListDomainsOutput struct {
	toolutil.HintableOutput
	Domains    []DomainOutput            `json:"domains"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListDomainsOutput wraps a list of Pages domains with pagination.

func ListDomains

func ListDomains(ctx context.Context, client *gitlabclient.Client, input ListDomainsInput) (ListDomainsOutput, error)

ListDomains returns the custom Pages domains configured for a project via the GitLab Pages domains API (GET /projects/:id/pages/domains). Supports pagination.

type Output

type Output struct {
	toolutil.HintableOutput
	URL                   string             `json:"url"`
	IsUniqueDomainEnabled bool               `json:"is_unique_domain_enabled"`
	ForceHTTPS            bool               `json:"force_https"`
	Deployments           []DeploymentOutput `json:"deployments,omitempty"`
	PrimaryDomain         string             `json:"primary_domain"`
}

Output represents Pages settings for a project.

func GetPages

func GetPages(ctx context.Context, client *gitlabclient.Client, input GetPagesInput) (Output, error)

GetPages retrieves the Pages settings (URL, unique domain, force HTTPS, deployments) for a project via the GitLab Pages API (GET /projects/:id/pages).

func UpdatePages

func UpdatePages(ctx context.Context, client *gitlabclient.Client, input UpdatePagesInput) (Output, error)

UpdatePages updates the Pages settings for a project via the GitLab Pages API (PATCH /projects/:id/pages). Only the fields the caller sent are applied; pages_primary_domain must reference a domain previously added via CreateDomain, and an empty one removes it.

GitLab removes the primary domain only on null: it refuses "" as a domain the project does not have. client-go's option cannot carry null, so an empty value is written into the body through a request option (issue 1306, upstream register row 122).

type UnpublishPagesInput

type UnpublishPagesInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
}

UnpublishPagesInput defines parameters for unpublishing Pages.

type UpdateDomainInput

type UpdateDomainInput struct {
	ProjectID      toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Domain         string               `json:"domain" jsonschema:"The Pages domain name to update,required"`
	AutoSslEnabled *bool                `json:"auto_ssl_enabled,omitempty" jsonschema:"Enable automatic SSL certificate provisioning"`
	Certificate    string               `json:"certificate,omitempty" jsonschema:"PEM-encoded SSL certificate"`
	Key            string               `json:"key,omitempty" jsonschema:"PEM-encoded private key for the certificate"`
}

UpdateDomainInput defines parameters for updating a Pages domain.

type UpdatePagesInput

type UpdatePagesInput struct {
	ProjectID                toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	PagesUniqueDomainEnabled *bool                `json:"pages_unique_domain_enabled,omitempty" jsonschema:"Enable unique domain for Pages"`
	PagesHTTPSOnly           *bool                `json:"pages_https_only,omitempty" jsonschema:"Enforce HTTPS for Pages"`
	PagesPrimaryDomain       *string              `` /* 148-byte string literal not displayed */
}

UpdatePagesInput defines parameters for updating Pages settings.

Jump to

Keyboard shortcuts

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