Documentation
¶
Overview ¶
Package gcloud provides a code generator for gcloud commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CLIModel ¶ added in v0.12.0
type CLIModel struct {
// Imports holds the Go imports rendered into the generated main.go.
Imports []Import
// Groups holds the top-level gcloud command groups rendered into main.go.
Groups []Group
}
CLIModel represents the data structure for the template.
type ClientCall ¶ added in v0.12.1
type ClientCall struct {
// Method is the unqualified client method to call on the constructed
// client, for example "GetInstance". The template invokes it as
// `client.<Method>(ctx, &<RequestType>{...})`.
Method string
// NameField is the field on the request message that takes the
// composed resource path, for example "Name" for AIP-131 Get requests.
// The template assigns it from the local path variable.
NameField string
// Package is the import alias of the Go client package, for example
// "parallelstore". The template invokes the constructor as
// `client, err := <Package>.NewClient(ctx)`.
Package string
// RequestType is the qualified request message type, for example
// "parallelstorepb.GetInstanceRequest". The template composites a
// literal of this type and passes its address to the method.
RequestType string
}
ClientCall describes a Go client method invocation that should replace the default print-only action for a generated command.
type Command ¶
type Command struct {
Args []string
ClientCall *ClientCall
Flags []Flag
Name string
PathFormat string
PathLabel string
Usage string
}
Command represents a leaf command.
func (Command) HasPath ¶ added in v0.12.1
HasPath reports whether the command composes a resource path.
func (Command) PathFormatArgs ¶ added in v0.12.1
PathFormatArgs returns the comma-separated cmd.String("X") arguments passed to the generated fmt.Sprintf call.
type Flag ¶ added in v0.12.1
type Flag struct {
// Name is the long flag name without leading dashes (e.g. "project").
Name string
// Kind is the urfave/cli flag type (e.g. "String", "Bool").
Kind string
// Required reports whether the flag must be set on the command line.
Required bool
// Usage is the help text shown next to the flag.
//
// TODO(https://github.com/googleapis/librarian/issues/5769):
// Usage is currently a generic "The <name>." string. Source it from
// the proto field's documentation when we wire that through.
Usage string
}
Flag represents a single CLI flag.
type Import ¶ added in v0.12.1
type Import struct {
// Alias is the optional package alias; empty when the import has no
// alias. For example, "parallelstore" in:
//
// parallelstore "cloud.google.com/go/parallelstore/apiv1"
Alias string
// Path is the import path of the package, for example
// "cloud.google.com/go/parallelstore/apiv1".
Path string
}
Import represents a Go import line in the generated main.go.
Click to show internal directories.
Click to hide internal directories.