Documentation
¶
Overview ¶
Package serviceconfig reads and parses API service config files.
Index ¶
Constants ¶
const ( // LangAll is the identifier for all languages. LangAll = "all" // LangCsharp is the language identifier for C#. LangCsharp = "csharp" // LangDart is the language identifier for Dart. LangDart = "dart" // LangGo is the language identifier for Go. LangGo = "go" // LangJava is the language identifier for Java. LangJava = "java" // LangNodejs is the language identifier for Node.js. LangNodejs = "nodejs" // LangPhp is the language identifier for PHP. LangPhp = "php" // LangPython is the language identifier for Python. LangPython = "python" // LangRuby is the language identifier for Ruby. LangRuby = "ruby" // LangRust is the language identifier for Rust. LangRust = "rust" )
Variables ¶
var APIs = []API{}/* 408 elements not displayed */
APIs defines API paths that require explicit configurations. APIs not in this list are implicitly allowed if they start with "google/cloud/".
Functions ¶
func FindGRPCServiceConfig ¶ added in v0.8.1
FindGRPCServiceConfig searches for gRPC service config files in the given API directory. It returns the path relative to googleapisDir for use with protoc's retry-config option. Returns empty string if no config is found. Returns an error if multiple matching files exist.
Types ¶
type API ¶
type API struct {
// Description provides the information for describing an API.
Description string
// Discovery is the file path to a discovery document in
// github.com/googleapis/discovery-artifact-manager.
// Used by sidekick languages (Rust, Dart) as an alternative to proto files.
Discovery string
// DocumentationURI overrides the product documentation URI from the service
// config's publishing section.
DocumentationURI string
// Languages restricts which languages can generate client libraries for this API.
// Empty means all languages can use this API.
//
// Restrictions exist for several reasons:
// - Newer languages (Rust, Dart) skip older beta versions when stable versions exist
// - Python has historical legacy APIs not available to other languages
// - Some APIs (like DIREGAPIC protos) are only used by specific languages
Languages []string
// NewIssueURI overrides the new issue URI from the service config's
// publishing section.
NewIssueURI string
// OpenAPI is the file path to an OpenAPI spec, currently in internal/testdata.
// This is not an official spec yet and exists only for Rust to validate OpenAPI support.
OpenAPI string
// Path is the proto directory path in github.com/googleapis/googleapis.
// If ServiceConfig is empty, the service config is assumed to live at this path.
Path string
// ShortName overrides the API short name from the service config's
// publishing section.
ShortName string
// ServiceConfig is the service config file path override.
// If empty, the service config is discovered in the directory specified by Path.
ServiceConfig string
// ServiceName is a DNS-like logical identifier for the service, such as `calendar.googleapis.com`.
ServiceName string
// Title overrides the API title from the service config.
Title string
// Transports defines the supported transports per language.
// Map key is the language name (e.g., "python", "rust").
// Optional. If omitted, all languages use GRPCRest by default.
Transports map[string]Transport
}
API describes an API path and its availability across languages.
func Find ¶
Find looks up the service config path and title override for a given API path, and validates that the API is allowed for the specified language.
It first checks the API list for overrides and language restrictions, then searches for YAML files containing "type: google.api.Service", skipping any files ending in _gapic.yaml.
The path should be relative to googleapisDir (e.g., "google/cloud/secretmanager/v1"). Returns an API struct with Path, ServiceConfig, and Title fields populated. ServiceConfig and Title may be empty strings if not found or not configured.
The Showcase API ("schema/google/showcase/v1beta1") is a special case: it does not live under https://github.com/googleapis/googleapis. For this API only, googleapisDir should point to showcase source dir instead.
type Authentication ¶
type Authentication = serviceconfig.Authentication
Type aliases for genproto service config types.
type AuthenticationRule ¶
type AuthenticationRule = serviceconfig.AuthenticationRule
Type aliases for genproto service config types.
type BackendRule ¶
type BackendRule = serviceconfig.BackendRule
Type aliases for genproto service config types.
type Documentation ¶
type Documentation = serviceconfig.Documentation
Type aliases for genproto service config types.
type DocumentationRule ¶
type DocumentationRule = serviceconfig.DocumentationRule
Type aliases for genproto service config types.
type OAuthRequirements ¶
type OAuthRequirements = serviceconfig.OAuthRequirements
Type aliases for genproto service config types.