Documentation
¶
Overview ¶
DigitalRebar Provision CLI provides the core parts of the CLI. This CLI uses an access core based upon a set of generated files from the generated swagger.json file.
cli/exports.go
Copyright © 2020 RackN <support@rackn.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func AddDirToZip(zipWriter *zip.Writer, dirname string) error
- func AddFileToZip(zipWriter *zip.Writer, filename string) error
- func ComponentsFromGohai(buf []byte) ([]models.Component, error)
- func Format() string
- func IsGohaiPayload(buf []byte) bool
- func NewApp() *cobra.Command
- func NewBasicKeyRequest() *basicKeyReq
- func NoColor() bool
- func NoHeader() bool
- func ObjectErrorsAreFatal() bool
- func PatchWithFunction(key string, op *ops, fn func(models.Model) (models.Model, bool)) error
- func PatchWithString(key, js string, op *ops) error
- func ResetDefaults()
- func SessionForToken(token string) (*api.Client, error)
- func SetFormat(s string)
- func SetNoColor(b bool)
- func SetNoHeader(b bool)
- func SetObjectErrorsAreFatal(b bool)
- type DocData
- type Item
- type LabDocData
- func (dd *LabDocData) Encapsulate(str, first, pat string) string
- func (dd *LabDocData) GenerateLabMd() string
- func (dd *LabDocData) GenerateSectionMarkdown(section *models.LabSection, depth int, inTab bool) string
- func (dd *LabDocData) LengthString(str, pat string) string
- func (dd *LabDocData) MarkdownToRst(data string) string
- func (dd *LabDocData) RenderSection(tmplFile string, ls *models.LabSection, depth int, tab string) string
- func (dd *LabDocData) StringCleanup(str string) string
- func (dd *LabDocData) ToRef(names ...string) string
- type McpDocsConfig
- type McpLimitsConfig
- type McpTransportConfig
- type Output
- type PackID
- type RefKind
- type RefLoc
- type Service
- type Services
- type Warning
Constants ¶
const ( AgentConfigFileName = "agent-cfg.yml" AgentConfigFileMode = 0600 )
Variables ¶
var ( // ActuallyPowerThings is a boolean to use in testing to keep from power off the test machine ActuallyPowerThings = true // DefaultStateLoc is the default location to save agent state DefaultStateLoc string AgentName = "drp-agent" )
var AllKinds = []RefKind{ KindTemplate, KindParam, KindStage, KindTask, KindBootEnv, KindContext, KindProfile, KindWorkflow, KindBlueprint, KindTrigger, }
AllKinds is the canonical list of reference kinds. Add new kinds here and they’ll automatically be picked up everywhere.
var AllowedCallsFields = map[string]info{ "Param": {/* contains filtered or unexported fields */}, "ParamExists": {/* contains filtered or unexported fields */}, "ParamExpand": {/* contains filtered or unexported fields */}, "ParamAsJSON": {/* contains filtered or unexported fields */}, "ParamAsYAML": {/* contains filtered or unexported fields */}, "ParamCompose": {/* contains filtered or unexported fields */}, "ParamComposeExpand": {/* contains filtered or unexported fields */}, "ComposeParam": {/* contains filtered or unexported fields */}, "ExpandParam": {/* contains filtered or unexported fields */}, "CallTemplate": {/* contains filtered or unexported fields */}, "CurrentJob": {/* contains filtered or unexported fields */}, "GenerateInfiniteToken": {/* contains filtered or unexported fields */}, "GenerateCreateOrMachineToken": {/* contains filtered or unexported fields */}, "GenerateInfiniteMachineToken": {/* contains filtered or unexported fields */}, "GenerateJobToken": {/* contains filtered or unexported fields */}, "GenerateToken": {/* contains filtered or unexported fields */}, "GenerateCreateToken": {/* contains filtered or unexported fields */}, "GenerateMachineToken": {/* contains filtered or unexported fields */}, "GenerateUserToken": {/* contains filtered or unexported fields */}, "GenerateProfileToken": {/* contains filtered or unexported fields */}, "BootParams": {/* contains filtered or unexported fields */}, "ProvisionerAddress": {/* contains filtered or unexported fields */}, "ProvisionerPort": {/* contains filtered or unexported fields */}, "ProvisionerURL": {/* contains filtered or unexported fields */}, "ProvisionerHostURL": {/* contains filtered or unexported fields */}, "SecureProvisionerPort": {/* contains filtered or unexported fields */}, "SecureProvisionerURL": {/* contains filtered or unexported fields */}, "SecureProvisionerHostURL": {/* contains filtered or unexported fields */}, "BootParamsFor": {/* contains filtered or unexported fields */}, "ApiURL": {/* contains filtered or unexported fields */}, "ApiHostURL": {/* contains filtered or unexported fields */}, "MachineRepos": {/* contains filtered or unexported fields */}, "InstallRepos": {/* contains filtered or unexported fields */}, "Tasks": {/* contains filtered or unexported fields */}, "CurrentTask": {/* contains filtered or unexported fields */}, "NetmaskToCIDR": {/* contains filtered or unexported fields */}, "ParseUrl": {/* contains filtered or unexported fields */}, "Machine": { // contains filtered or unexported fields }, "Env": { // contains filtered or unexported fields }, "WorkOrder": { // contains filtered or unexported fields }, "ObjectExpand": {/* contains filtered or unexported fields */}, "StringExpand": {/* contains filtered or unexported fields */}, "ServerPathInfo": { // contains filtered or unexported fields }, "Info": { // contains filtered or unexported fields }, }
var McpListFunc func(out io.Writer, app *cobra.Command, readOnly bool, docs McpDocsConfig) error
McpListFunc is called by `drpcli mcp list`. Same indirection rationale as McpServeFunc — set from cmds/drpcli to avoid the import cycle.
var McpServeFunc func(app *cobra.Command, readOnly bool, outputFormat string, docs McpDocsConfig, transports McpTransportConfig, limits McpLimitsConfig) error
McpServeFunc is called by `drpcli mcp serve`. It must be set before cli.NewApp() is called. The canonical setter is in cmds/drpcli which imports gitlab.com/rackn/provision/v4/cli/mcp; cli/mcp.go avoids that direct import to break the cli ↔ cli/mcp import cycle.
If nil, `drpcli mcp serve` returns an error at runtime.
var ( // Session is the global client access session Session *api.Client )
Functions ¶
func AddDirToZip ¶
given a top level dir this will walk it adding files and folders. to the archive
func AddFileToZip ¶
adds an individual file to the archive
func ComponentsFromGohai ¶ added in v4.17.6
ComponentsFromGohai converts a gohai payload into normalized Components.
func Format ¶ added in v4.17.0
func Format() string
Format returns the current output format ("json", "yaml", "text", "table").
func IsGohaiPayload ¶ added in v4.17.6
IsGohaiPayload reports whether buf looks like the output of gohai rather than a ComponentSet or a bare Devices array.
func NewBasicKeyRequest ¶
func NewBasicKeyRequest() *basicKeyReq
NewBasicKeyRequest returns a default BasicKeyRequest.
func NoColor ¶ added in v4.17.0
func NoColor() bool
NoColor returns whether colorized output is disabled.
func NoHeader ¶ added in v4.17.0
func NoHeader() bool
NoHeader returns whether table headers are suppressed.
func ObjectErrorsAreFatal ¶ added in v4.17.0
func ObjectErrorsAreFatal() bool
ObjectErrorsAreFatal returns whether commands exit non-zero when a returned object has Errors set.
func PatchWithFunction ¶
The input function takes the object and returns the modified object and if the object changed.
func PatchWithString ¶
func ResetDefaults ¶
func ResetDefaults()
func SessionForToken ¶ added in v4.17.3
SessionForToken builds a DRP client authenticated with the supplied bearer token, against the endpoint and TLS settings this drpcli invocation was configured with.
cli/mcp needs this to give each MCP request its own credential, and the inputs -- endpoint, caCert, serverVerify, ignoreUnixProxy -- are unexported package state here. Exposing one constructor keeps that knowledge in cli rather than duplicating the flag semantics in another package.
Note this does NOT validate the token: api.TokenSessionProxyServer stores it and returns without a round trip, so an invalid token fails on first use.
func SetFormat ¶ added in v4.17.0
func SetFormat(s string)
SetFormat overrides the output format. Used by the MCP server to force JSON.
func SetNoColor ¶ added in v4.17.0
func SetNoColor(b bool)
SetNoColor overrides the no-color setting. Used by the MCP server.
func SetNoHeader ¶ added in v4.17.0
func SetNoHeader(b bool)
SetNoHeader overrides the no-header setting. Used by the MCP server.
func SetObjectErrorsAreFatal ¶ added in v4.17.0
func SetObjectErrorsAreFatal(b bool)
SetObjectErrorsAreFatal overrides the exit-early setting. Used by the MCP server.
Types ¶
type DocData ¶
type DocData struct {
Name string
Prefix string
RefName string
RefPrefix string
DisplayName string
Full string
Version string
Documentation string
Description string
Content string
RefString string
Objects [][]models.Model
}
func (*DocData) LengthString ¶
func (*DocData) PrefixToTag ¶ added in v4.12.0
type Item ¶ added in v4.15.0
type Item struct {
Name string
Version string
CatalogEntry *models.CatalogItem
}
type LabDocData ¶ added in v4.10.0
type LabDocData struct {
Lab *models.Lab
LabSection *models.LabSection
Depth int
InTab bool
VideoTag string
VideoTime string
}
func (*LabDocData) Encapsulate ¶ added in v4.10.0
func (dd *LabDocData) Encapsulate(str, first, pat string) string
func (*LabDocData) GenerateLabMd ¶ added in v4.13.0
func (dd *LabDocData) GenerateLabMd() string
func (*LabDocData) GenerateSectionMarkdown ¶ added in v4.13.0
func (dd *LabDocData) GenerateSectionMarkdown(section *models.LabSection, depth int, inTab bool) string
func (*LabDocData) LengthString ¶ added in v4.10.0
func (dd *LabDocData) LengthString(str, pat string) string
func (*LabDocData) MarkdownToRst ¶ added in v4.10.0
func (dd *LabDocData) MarkdownToRst(data string) string
func (*LabDocData) RenderSection ¶ added in v4.10.0
func (dd *LabDocData) RenderSection(tmplFile string, ls *models.LabSection, depth int, tab string) string
func (*LabDocData) StringCleanup ¶ added in v4.13.0
func (dd *LabDocData) StringCleanup(str string) string
StringCleanup removes new lines and replaces them with a single space. Also doesn't change it if it contains a table.
func (*LabDocData) ToRef ¶ added in v4.10.0
func (dd *LabDocData) ToRef(names ...string) string
type McpDocsConfig ¶ added in v4.17.0
type McpDocsConfig struct {
Disabled bool // --no-docs
Version string // --docs-version
LocalZip string // --local-docs
BaseURL string // --docs-url
}
McpDocsConfig carries the `drpcli mcp serve` documentation-source flags through to the mcp package (which cli/mcp.go must not import directly, to avoid the cli ↔ cli/mcp import cycle). cmds/drpcli maps it to mcp.DocsConfig.
type McpLimitsConfig ¶ added in v4.17.9
type McpLimitsConfig struct {
MaxToolBytes int // --max-tool-bytes
}
McpLimitsConfig carries the `drpcli mcp serve` result-size limits.
type McpTransportConfig ¶ added in v4.17.3
type McpTransportConfig struct {
Unix string // --unix
UnixMode string // --unix-mode, octal, empty means 0600
HTTPS string // --https
TLSCert string // --tls-cert
TLSKey string // --tls-key
}
McpTransportConfig carries the `drpcli mcp serve` listener flags through to the mcp package. Same import-cycle rationale as McpDocsConfig: cli must not import cli/mcp, so cmds/drpcli maps this onto mcp.Options.
The zero value means stdio, which must stay byte-identical to the behaviour that shipped before the listeners existed.
type Output ¶ added in v4.16.0
type Output struct {
Index map[RefKind]map[string][]RefLoc `json:"index"`
RevIndex map[RefKind]map[string][]RefLoc `json:"rev_index"`
Summary struct {
Packs int `json:"packs"`
Objects int `json:"objects"`
TemplateRefs int `json:"templateRefs"`
ParamRefs int `json:"paramRefs"`
StageRefs int `json:"stageRefs"`
TaskRefs int `json:"taskRefs"`
BootenvRefs int `json:"bootenvRefs"`
ContextRefs int `json:"contextRefs"`
ProfileRefs int `json:"profileRefs"`
UniqueTemplates int `json:"uniqueTemplates"`
UniqueParams int `json:"uniqueParams"`
UniqueProfiles int `json:"uniqueProfiles"`
} `json:"summary"`
}
Output aggregates a normalized reverse index and summary
type RefKind ¶ added in v4.16.0
type RefKind string
Normalized kinds for a unified index
const ( KindTemplate RefKind = "templates" KindParam RefKind = "params" KindStage RefKind = "stages" KindTask RefKind = "tasks" KindBootEnv RefKind = "bootenvs" KindContext RefKind = "contexts" KindProfile RefKind = "profiles" KindWorkflow RefKind = "workflows" KindBlueprint RefKind = "blueprints" KindTrigger RefKind = "triggers" )
Source Files
¶
- actionHelper.go
- activities.go
- agent.go
- airgap.go
- alerts.go
- analyze.go
- appleNBI.go
- archive.go
- assets.go
- batches.go
- blueprints.go
- bootenv.go
- bootenvHelper.go
- catalog.go
- catalog_items.go
- certs.go
- clusters.go
- commandHelper.go
- common.go
- component_sets.go
- components_gohai.go
- config.go
- connection.go
- content_archives.go
- contents.go
- contexts.go
- debug.go
- delegations.go
- doc.go
- endpoints.go
- events.go
- exports.go
- extended.go
- files.go
- filters.go
- generate.go
- git.go
- gohai_other.go
- identity_providers.go
- info.go
- inspect.go
- instances.go
- interfaces.go
- isos.go
- jobs.go
- labs.go
- lease.go
- license.go
- load.go
- logs.go
- machines.go
- mcp.go
- metaHelper.go
- netwrangle.go
- new_common.go
- objects.go
- paramHelper.go
- params.go
- pipelines.go
- plugin_providers.go
- plugins.go
- pools.go
- preflight.go
- prefs.go
- process_jobs.go
- profileHelper.go
- profiles.go
- reapchildren_unix.go
- reservation.go
- resource_brokers.go
- roles.go
- session_for_token.go
- stages.go
- startup.go
- static.go
- store-objects.go
- subnet.go
- support.go
- system.go
- taskHelper.go
- tasks.go
- template.go
- tenant.go
- trigger_providers.go
- triggers.go
- user.go
- utils.go
- ux_options.go
- ux_settings.go
- ux_views.go
- version_sets.go
- workOrderHelper.go
- work_orders.go
- workflows.go
- zones.go