snippets

package
v0.51.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VersionPlaceholder = "$VERSION"

VersionPlaceholder is the string value $VERSION, intended to be replaced with the actual module version by a generator post-processing script.

Functions

This section is empty.

Types

type SnippetMetadata

type SnippetMetadata struct {
	// contains filtered or unexported fields
}

SnippetMetadata is a model for capturing snippet details and writing them to a snippet_metadata.*.json file.

func NewMetadata

func NewMetadata(protoPkg, libPkg, pkgName string) *SnippetMetadata

NewMetadata initializes the model that will collect snippet metadata, from: protoPkg - dot-separated, without final type name element (e.g. "google.cloud.bigquery.migration.v2") libPkg - the Go import path for the GAPIC client, per libraryPackage in gapic_metadata.json (e.g. "cloud.google.com/go/bigquery/migration/apiv2") pkgName - stored in g.opts.pkgName, used as an argument to pbinfo.ReduceServName

func (*SnippetMetadata) AddMethod

func (sm *SnippetMetadata) AddMethod(servName, methodName, parentProtoPkg, parentName string, regionTagEnd int)

AddMethod uses the service short name (e.g. "AutoscalingPolicyService") and method name to add an incomplete method entry that will be updated via UpdateMethodDoc and UpdateMethodResult. parentProtoPkg and parentName are the original proto namespace and service for the method. (In mixin methods, these are different from the protoPkg and service into which it has been mixed.)

func (*SnippetMetadata) AddParams

func (sm *SnippetMetadata) AddParams(servName, methodName, requestType string)

AddParams adds a slice of 3 params to the method: ctx context.Context, req <requestType>, opts ...gax.CallOption, ctx and opts params are hardcoded since these are currently the same in all client wrapper methods. The req param will be omitted if empty requestType is given.

func (*SnippetMetadata) AddService

func (sm *SnippetMetadata) AddService(servName, defaultHost string)

AddService creates a service entry from: servName - the service short name (e.g. "AutoscalingPolicyService") identifier defaultHost - the DNS hostname for the service, available from annotations.E_DefaultHost. (e.g. "bigquerymigration.googleapis.com")

func (*SnippetMetadata) RegionTag

func (sm *SnippetMetadata) RegionTag(servName, methodName string) string

RegionTag generates a snippet region tag from service.shortName(defaultHost), apiVersion, and the given full servName and method name.

func (*SnippetMetadata) ToMetadataIndex

func (sm *SnippetMetadata) ToMetadataIndex() *metadata.Index

ToMetadataIndex creates a metadata.Index from the SnippetMetadata.

func (*SnippetMetadata) ToMetadataJSON

func (sm *SnippetMetadata) ToMetadataJSON() ([]byte, error)

ToMetadataJSON marshals the completed SnippetMetadata to a []byte containing the protojson output.

func (*SnippetMetadata) UpdateMethodDoc

func (sm *SnippetMetadata) UpdateMethodDoc(servName, methodName, doc string)

UpdateMethodDoc uses service short name (e.g. "AutoscalingPolicyService") and and method name identifiers to add a doc method comment.

func (*SnippetMetadata) UpdateMethodResult

func (sm *SnippetMetadata) UpdateMethodResult(servName, methodName, result string)

UpdateMethodResult uses service short name (e.g. "AutoscalingPolicyService") and and method name identifiers to add a method result type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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