Documentation
¶
Overview ¶
Package apptool is the manage_application MCP tool (#2411, #2412): an application's record, parts, releases, rollbacks, and its export and import between deployments, over the one service the portal routes use.
Index ¶
Constants ¶
const ( CmdCreate = "create" CmdGet = "get" CmdList = "list" CmdUpdate = "update" CmdDelete = "delete" CmdAddPart = "add_part" CmdRemovePart = "remove_part" CmdSetPart = "set_part" CmdRelease = "release" CmdRollback = "rollback" CmdReleases = "releases" CmdExport = "export" CmdImport = "import" // Environments and variables (#2696). CmdPromote = "promote" CmdAddEnvironment = "add_environment" CmdRemoveEnvironment = "remove_environment" CmdSetEnvironment = "set_environment" CmdVariables = "variables" CmdSetVariable = "set_variable" CmdDeleteVariable = "delete_variable" // CmdPrepare shows, and with save saves, what an application needs // before it runs in environments of their own (#2709). CmdPrepare = "prepare" )
The commands.
const ( CmdIdentityProviders = "identity_providers" CmdSetIdentityProvider = "set_identity_provider" CmdRemoveIdentityProvider = "remove_identity_provider" CmdSessions = "sessions" CmdEndSessions = "end_sessions" )
An application environment's own identity provider and its sessions (#2878).
const ToolName = "manage_application"
ToolName is the tool's name.
Variables ¶
var Commands = []string{ CmdCreate, CmdGet, CmdList, CmdUpdate, CmdDelete, CmdAddPart, CmdRemovePart, CmdSetPart, CmdRelease, CmdRollback, CmdReleases, CmdExport, CmdImport, CmdPromote, CmdAddEnvironment, CmdRemoveEnvironment, CmdSetEnvironment, CmdVariables, CmdSetVariable, CmdDeleteVariable, CmdPrepare, CmdIdentityProviders, CmdSetIdentityProvider, CmdRemoveIdentityProvider, CmdSessions, CmdEndSessions, }
Commands is every command, in the order the schema lists them.
var Reads = []string{CmdGet, CmdList, CmdReleases, CmdIdentityProviders, CmdSessions}
Reads is the commands that change nothing.
Functions ¶
This section is empty.
Types ¶
type Bundles ¶
type Bundles interface {
Export(ctx context.Context, actor application.Actor, ref string, release int) (any, error)
Import(ctx context.Context, actor application.Actor, bundle string, mapping map[string]string) (any, error)
}
Bundles exports and imports applications; nil on a deployment that cannot.
type IdentityInput ¶ added in v1.170.1
type IdentityInput struct {
Issuer string `json:"issuer,omitempty"`
ClientID string `json:"client_id,omitempty"`
ClientSecret string `json:"client_secret,omitempty"`
Scopes []string `json:"scopes,omitempty"`
ClaimSubject string `json:"claim_subject,omitempty"`
ClaimEmail string `json:"claim_email,omitempty"`
ClaimName string `json:"claim_name,omitempty"`
ClaimRoles string `json:"claim_roles,omitempty"`
RequireVerifiedEmail *bool `json:"require_verified_email,omitempty"`
SessionSeconds int `json:"session_seconds,omitempty"`
IdleSeconds int `json:"idle_seconds,omitempty"`
SignedOutRedirect string `json:"signed_out_redirect,omitempty"`
Reason string `json:"reason,omitempty"`
SessionID string `json:"session_id,omitempty"`
}
IdentityInput is the identity commands' arguments.
type Input ¶
type Input struct {
Command string `json:"command"`
Application string `json:"application,omitempty"`
Name string `json:"name,omitempty"`
// Description is create's and update's; update leaves it as it is when
// omitted.
Description *string `json:"description,omitempty"`
Connection string `json:"connection,omitempty"`
Schema string `json:"schema,omitempty"`
OwnerEmail string `json:"owner_email,omitempty"`
Kind string `json:"kind,omitempty"`
PartID string `json:"part_id,omitempty"`
Note string `json:"note,omitempty"`
ToRelease int `json:"to_release,omitempty"`
Release int `json:"release,omitempty"`
// Bundle is the managed resource an import reads, by id or URI.
Bundle string `json:"bundle,omitempty"`
// Map names, for each connection and secret the bundle names, the one on
// this deployment it becomes.
Map map[string]string `json:"map,omitempty"`
// ReleaseMode is a site part's: linked or coupled (#2679).
ReleaseMode string `json:"release_mode,omitempty"`
// ContractVersion is what update sets the application's contract to.
ContractVersion *int `json:"contract_version,omitempty"`
// Contract is the contract version a release declares.
Contract *int `json:"contract,omitempty"`
// MoveSites are the site parts a release moves besides the coupled ones.
MoveSites []string `json:"move_sites,omitempty"`
// Force releases over a site part that does not accept the contract.
Force bool `json:"force,omitempty"`
// Environment is the environment promote moves from, rollback moves
// back, and a variable belongs to ("" its default); After is where
// add_environment puts one; RequiresApproval is whether an agent's
// promote or rollback into it is refused for a person to carry out
// (#2696).
Environment string `json:"environment,omitempty"`
After string `json:"after,omitempty"`
RequiresApproval *bool `json:"requires_approval,omitempty"`
// Variable and Value are set_variable's NAME=value.
Variable string `json:"variable,omitempty"`
Value string `json:"value,omitempty"`
// Save saves what prepare shows (#2709).
Save bool `json:"save,omitempty"`
// RenameTo is the name update renames the application to (#2875).
RenameTo string `json:"rename_to,omitempty"`
IdentityInput
}
Input is the tool's arguments.
type Tool ¶
type Tool struct {
Service *appsvc.Service
Bundles Bundles
// Renamer renames applications (#2875); nil refuses a rename.
Renamer *apprename.Renamer
}
Tool is the registered tool.
func (*Tool) Handle ¶
Handle runs one command with no request to ask the person through: a rename that waits on them is filed in Approvals.
func (*Tool) HandleRequest ¶ added in v1.171.0
func (t *Tool) HandleRequest(ctx context.Context, req *mcp.CallToolRequest, in Input) (*mcp.CallToolResult, any, error)
HandleRequest runs one command. A rename that waits on the person asks them through their client, or files a request (#2875).