Documentation ¶
Index ¶
- Variables
- func Deregister(s *Service) error
- func Register(s *Service, opts ...RegisterOption) error
- func String() string
- type APIKeysSecurity
- type ApplicationContent
- type BasicSecurity
- type BearerSecurity
- type DeregisterOption
- type DeregisterOptions
- type Endpoint
- type Event
- type EventType
- type GetOption
- type GetOptions
- type ListOption
- type ListOptions
- type Model
- type Node
- type OpenAPI
- type OpenAPIComponents
- type OpenAPIContact
- type OpenAPIExternalDocs
- type OpenAPIInfo
- type OpenAPILicense
- type OpenAPIOption
- type OpenAPIOptions
- type OpenAPIPath
- type OpenAPIPathDocs
- type OpenAPIServer
- type OpenAPITag
- type Option
- type Options
- type PathParameters
- type PathRequestBody
- type PathRequestBodyContent
- type PathResponse
- type PathSecurity
- type RegisterOption
- type RegisterOptions
- type Registry
- type Result
- type Schema
- type SecuritySchemes
- type Service
- type Value
- type WatchOption
- type WatchOptions
- type Watcher
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Register ¶
func Register(s *Service, opts ...RegisterOption) error
Register a service node. Additionally supply options such as TTL.
Types ¶
type APIKeysSecurity ¶ added in v0.23.0
type APIKeysSecurity struct { Type string `json:"type,omitempty"` // header In string `json:"in,omitempty"` Name string `json:"name,omitempty"` }
APIKeysSecurity is swagger API keys Authorization security (https://swagger.io/docs/specification/authentication/api-keys/)
type ApplicationContent ¶ added in v0.23.0
type ApplicationContent struct {
Schema *Schema `json:"schema,omitempty"`
}
type BasicSecurity ¶ added in v0.23.0
type BasicSecurity struct { // http, apiKey, oauth, openIdConnect Type string `json:"type,omitempty"` Scheme string `json:"scheme,omitempty"` }
BasicSecurity is swagger Basic Authorization security (https://swagger.io/docs/specification/authentication/basic-authentication/)
type BearerSecurity ¶ added in v0.23.0
type BearerSecurity struct { // http Type string `json:"type,omitempty"` Scheme string `json:"scheme,omitempty"` // JWT BearerFormat string `json:"bearerFormat,omitempty"` }
BearerSecurity is swagger Bearer Authorization security (https://swagger.io/docs/specification/authentication/bearer-authentication/)
type DeregisterOption ¶
type DeregisterOption func(*DeregisterOptions)
func DeregisterContext ¶
func DeregisterContext(ctx context.Context) DeregisterOption
type DeregisterOptions ¶
type Endpoint ¶ added in v0.23.0
type Endpoint struct { Name string `json:"name,omitempty"` Request *Value `json:"request,omitempty"` Response *Value `json:"response,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` }
Endpoint is a endpoint provided by a service
type Event ¶ added in v0.23.0
type Event struct { // Event Id Id string `json:"id,omitempty"` // type of event Type EventType `json:"type,omitempty"` // unix timestamp of event Timestamp int64 `json:"timestamp,omitempty"` // service entry Service *Service `json:"service,omitempty"` }
Event is registry event
type GetOptions ¶
type ListOption ¶
type ListOption func(*ListOptions)
func ListContext ¶
func ListContext(ctx context.Context) ListOption
type ListOptions ¶
type Model ¶ added in v0.23.0
type Model struct { // string, number, integer, boolean, array, object Type string `json:"type,omitempty"` Properties map[string]*Schema `json:"properties,omitempty"` Required []string `json:"required,omitempty"` }
Model is swagger data models (https://swagger.io/docs/specification/data-models/)
type Node ¶ added in v0.23.0
type Node struct { Id string `json:"id,omitempty"` Address string `json:"address,omitempty"` Port int64 `json:"port,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` }
Node represents the node the service is on
type OpenAPI ¶ added in v0.23.0
type OpenAPI struct { Openapi string `json:"openapi,omitempty"` Info *OpenAPIInfo `json:"info,omitempty"` ExternalDocs *OpenAPIExternalDocs `json:"externalDocs,omitempty"` Servers []*OpenAPIServer `json:"servers,omitempty"` Tags []*OpenAPITag `json:"tags,omitempty"` Paths map[string]*OpenAPIPath `json:"paths,omitempty"` Components *OpenAPIComponents `json:"components,omitempty"` }
type OpenAPIComponents ¶ added in v0.23.0
type OpenAPIComponents struct { SecuritySchemes *SecuritySchemes `json:"securitySchemes,omitempty"` Schemas map[string]*Model `json:"schemas,omitempty"` }
type OpenAPIContact ¶ added in v0.23.0
type OpenAPIExternalDocs ¶ added in v0.23.0
type OpenAPIInfo ¶ added in v0.23.0
type OpenAPIInfo struct { Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` TermsOfService string `json:"termsOfService,omitempty"` Contact *OpenAPIContact `json:"contact,omitempty"` License *OpenAPILicense `json:"license,omitempty"` Version string `json:"version,omitempty"` }
type OpenAPILicense ¶ added in v0.23.0
type OpenAPIOption ¶
type OpenAPIOption func(*OpenAPIOptions)
type OpenAPIOptions ¶
type OpenAPIPath ¶ added in v0.23.0
type OpenAPIPath struct { Get *OpenAPIPathDocs `json:"get,omitempty"` Post *OpenAPIPathDocs `json:"post,omitempty"` Put *OpenAPIPathDocs `json:"put,omitempty"` Patch *OpenAPIPathDocs `json:"patch,omitempty"` Delete *OpenAPIPathDocs `json:"delete,omitempty"` }
type OpenAPIPathDocs ¶ added in v0.23.0
type OpenAPIPathDocs struct { Tags []string `json:"tags,omitempty"` Summary string `json:"summary,omitempty"` Description string `json:"description,omitempty"` OperationId string `json:"operationId,omitempty"` Deprecated bool `json:"deprecated,omitempty"` RequestBody *PathRequestBody `json:"requestBody,omitempty"` Parameters []*PathParameters `json:"parameters,omitempty"` Responses map[string]*PathResponse `json:"responses,omitempty"` Security []*PathSecurity `json:"security,omitempty"` }
type OpenAPIServer ¶ added in v0.23.0
type OpenAPITag ¶ added in v0.23.0
type OpenAPITag struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` ExternalDocs *OpenAPIExternalDocs `json:"externalDocs,omitempty"` }
type PathParameters ¶ added in v0.23.0
type PathParameters struct { // query, cookie, path In string `json:"in,omitempty"` Name string `json:"name,omitempty"` Required bool `json:"required,omitempty"` Description string `json:"description,omitempty"` AllowReserved bool `json:"allowReserved,omitempty"` Style string `json:"style,omitempty"` Explode bool `json:"explode,omitempty"` AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` Schema *Schema `json:"schema,omitempty"` Example string `json:"example,omitempty"` }
type PathRequestBody ¶ added in v0.23.0
type PathRequestBody struct { Description string `json:"description,omitempty"` Required bool `json:"required,omitempty"` Content *PathRequestBodyContent `json:"content,omitempty"` }
type PathRequestBodyContent ¶ added in v0.23.0
type PathRequestBodyContent struct { ApplicationJson *ApplicationContent `json:"application/json,omitempty"` ApplicationXml *ApplicationContent `json:"application/xml,omitempty"` }
type PathResponse ¶ added in v0.23.0
type PathResponse struct { Description string `json:"description,omitempty"` Content *PathRequestBodyContent `json:"content,omitempty"` }
PathResponse is swagger path response
type PathSecurity ¶ added in v0.23.0
type RegisterOption ¶
type RegisterOption func(*RegisterOptions)
func RegisterContext ¶
func RegisterContext(ctx context.Context) RegisterOption
func RegisterTTL ¶
func RegisterTTL(t time.Duration) RegisterOption
type RegisterOptions ¶
type Registry ¶
type Registry interface { Init(...Option) error Options() Options Register(*Service, ...RegisterOption) error Deregister(*Service, ...DeregisterOption) error GetService(string, ...GetOption) ([]*Service, error) ListServices(...ListOption) ([]*Service, error) Watch(...WatchOption) (Watcher, error) String() string }
Registry the registry provides an interface for service discovery and an abstraction over varying implementations {consul, etcd, zookeeper, ...}
type Result ¶ added in v0.23.0
type Result struct { Action string `json:"action,omitempty"` Service *Service `json:"service,omitempty"` Timestamp int64 `json:"timestamp,omitempty"` }
Result is returns by the watcher
type Schema ¶ added in v0.23.0
type Schema struct { Type string `json:"type,omitempty"` Format string `json:"format,omitempty"` Description string `json:"description,omitempty"` Example string `json:"example,omitempty"` Pattern string `json:"pattern,omitempty"` Nullable bool `json:"nullable,omitempty"` ReadOnly bool `json:"readOnly,omitempty"` WriteOnly bool `json:"writeOnly,omitempty"` Required bool `json:"required,omitempty"` Ref string `json:"$ref,omitempty"` Default string `json:"default,omitempty"` MinLength int32 `json:"minLength,omitempty"` MaxLength int32 `json:"maxLength,omitempty"` MultipleOf int32 `json:"multipleOf,omitempty"` Minimum int32 `json:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` Maximum int32 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` Enum []string `json:"enum,omitempty"` Items *Schema `json:"items,omitempty"` Parameters []*PathParameters `json:"parameters,omitempty"` AdditionalProperties *Schema `json:"additionalProperties,omitempty"` }
type SecuritySchemes ¶ added in v0.23.0
type SecuritySchemes struct { Basic *BasicSecurity `json:"basic,omitempty"` ApiKeys *APIKeysSecurity `json:"apiKeys,omitempty"` Bearer *BearerSecurity `json:"bearer,omitempty"` }
type Service ¶ added in v0.23.0
type Service struct { Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` Endpoints []*Endpoint `json:"endpoints,omitempty"` Nodes []*Node `json:"nodes,omitempty"` TTL int64 `json:"ttl,omitempty"` Apis []*OpenAPI `json:"apis,omitempty"` }
Service represents a vine service
func GetService ¶
GetService retrieve a service. A slice is returned since we separate Name/Version.
func ListServices ¶
ListServices list the services. Only returns service names
type Value ¶ added in v0.23.0
type Value struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Values []*Value `json:"values,omitempty"` }
Value is an opaque value for a request or response
type WatchOption ¶
type WatchOption func(*WatchOptions)
func WatchContext ¶
func WatchContext(ctx context.Context) WatchOption