Documentation ¶
Overview ¶
Package config supports configuring the Vervet Underground service.
Index ¶
- Constants
- func Save(w io.Writer, proj *Project) error
- type API
- type APIs
- type DiskConfig
- type GcsConfig
- type Generator
- type GeneratorScope
- type Generators
- type MergeConfig
- type Output
- type Overlay
- type Project
- type ResourceSet
- type S3Config
- type ServerConfig
- type ServiceConfig
- type StorageConfig
- type StorageType
Constants ¶
const ( // GeneratorScopeDefault indicates the default scope should be used in // configuration. GeneratorScopeDefault = "" // GeneratorScopeVersion indicates the generator operates on a single // resource version. GeneratorScopeVersion = "version" // GeneratorScopeResource indicates the generator operates on all versions // in a resource. This is useful for generating version routers, for // example. GeneratorScopeResource = "resource" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct { Name string `json:"-"` Resources []*ResourceSet `json:"resources"` Overlays []*Overlay `json:"overlays"` Output *Output `json:"output"` }
An API defines how and where to build versioned OpenAPI documents from a source collection of individual resource specifications and additional overlay content to merge.
type DiskConfig ¶
type DiskConfig struct {
Path string
}
DiskConfig defines configuration options for local disk storage.
type Generator ¶
type Generator struct { Name string `json:"-"` Scope GeneratorScope `json:"scope"` Filename string `json:"filename,omitempty"` Template string `json:"template"` Files string `json:"files,omitempty"` Functions string `json:"functions,omitempty"` }
Generator describes how files are generated for a resource.
type GeneratorScope ¶
type GeneratorScope string
GeneratorScope determines the template context when running the generator. Different scopes allow templates to operate over a single resource version, or all versions in a resource, for example.
type Generators ¶
Generators defines a named map of Generator instances.
func LoadGenerators ¶
func LoadGenerators(r io.Reader) (Generators, error)
LoadGenerators loads Generators from their YAML representation.
type MergeConfig ¶
type MergeConfig struct {
ExcludePatterns vervet.ExcludePatterns
}
MergeConfig contains configuration options defining how to merge OpenAPI documents when collating aggregate OpenAPI specifications across all services.
type Output ¶
Output defines where the aggregate versioned OpenAPI specs should be created during compilation.
func (*Output) ResolvePaths ¶
EffectivePaths returns a slice of effective configured output paths, whether a single or multiple output paths have been configured.
type Overlay ¶
An Overlay defines additional OpenAPI documents to merge into the aggregate OpenAPI spec when compiling an API. These might include special endpoints that should be included in the aggregate API but are not versioned, or top-level descriptions of the API itself.
type Project ¶
type Project struct { Version string `json:"version"` Generators Generators `json:"generators,omitempty"` APIs APIs `json:"apis"` }
Project defines collection of APIs and the standards they adhere to.
type ResourceSet ¶
type ResourceSet struct { Description string `json:"description"` Path string `json:"path"` Excludes []string `json:"excludes"` }
A ResourceSet defines a set of versioned resources that adhere to the same standards.
Versioned resources are expressed as individual OpenAPI documents in a directory structure:
+-resource
| +-2021-08-01 | | | +-spec.yaml | +-<implementation code, etc. can go here> | +-2021-08-15 | | | +-spec.yaml | +-<implementation code, etc. can go here> ...
Each YYYY-mm-dd directory under a resource is a version. The spec.yaml in each version is a complete OpenAPI document describing the resource at that version.
type S3Config ¶
type S3Config struct { Region string Endpoint string AccessKey string SecretKey string SessionKey string }
S3Config defines configuration options for AWS S3 storage.
type ServerConfig ¶
type ServerConfig struct { Host string Services []ServiceConfig Storage StorageConfig Merging MergeConfig }
ServerConfig defines the configuration options for the Vervet Underground service.
func LoadServerConfig ¶
func LoadServerConfig(configPaths ...string) (*ServerConfig, error)
LoadServerConfig returns a ServerConfig instance loaded from the given paths to a JSON config file.
func (*ServerConfig) ServiceFilter ¶
func (c *ServerConfig) ServiceFilter() map[string]bool
ServiceFilter provides a map of service names to quickly filter old services.
type ServiceConfig ¶
ServiceConfig defines configuration options on a service.
type StorageConfig ¶
type StorageConfig struct { Type StorageType BucketName string IamRoleEnabled bool S3 S3Config GCS GcsConfig Disk DiskConfig }
StorageConfig defines the configuration options for storage. The value of Type determines which of S3 or GCS will be used.
type StorageType ¶
type StorageType string
StorageType describes backend implementations supported by Vervet Underground.
const ( StorageTypeDisk StorageType = "disk" StorageTypeS3 StorageType = "s3" StorageTypeGCS StorageType = "gcs" )