Documentation ¶
Overview ¶
Package config defines the structures to configure a robot and its connected parts.
Index ¶
- Constants
- Variables
- func AuthConfigToProto(auth *AuthConfig) (*pb.AuthConfig, error)
- func CloudConfigToProto(cloud *Cloud) (*pb.CloudConfig, error)
- func ComponentConfigToProto(component *Component) (*pb.ComponentConfig, error)
- func CreateCloudRequest(ctx context.Context, cloudCfg *Cloud) (*http.Request, error)
- func CreateNewGRPCClient(ctx context.Context, cloudCfg *Cloud, logger golog.Logger) (rpc.ClientConn, error)
- func FrameConfigFromProto(proto *pb.Frame) (*referenceframe.LinkConfig, error)
- func FrameConfigToProto(frame referenceframe.LinkConfig) (*pb.Frame, error)
- func ModuleConfigToProto(module *Module) (*pb.ModuleConfig, error)
- func NetworkConfigToProto(network *NetworkConfig) (*pb.NetworkConfig, error)
- func PackageConfigToProto(cfg *PackageConfig) (*pb.PackageConfig, error)
- func ProcessConfigFromProto(proto *pb.ProcessConfig) (*pexec.ProcessConfig, error)
- func ProcessConfigToProto(process *pexec.ProcessConfig) (*pb.ProcessConfig, error)
- func RegisterComponentAttributeConverter(subtype resource.Subtype, model resource.Model, attr string, ...)
- func RegisterComponentAttributeMapConverter(subtype resource.Subtype, model resource.Model, conv AttributeMapConverter, ...)
- func RegisterServiceAttributeMapConverter(svcType resource.Subtype, model resource.Model, conv AttributeMapConverter, ...)
- func RemoteConfigToProto(remote *Remote) (*pb.RemoteConfig, error)
- func ResourceLevelServiceConfigToProto(service ResourceLevelServiceConfig) (*pb.ResourceLevelServiceConfig, error)
- func ServiceConfigToProto(service *Service) (*pb.ServiceConfig, error)
- func ServiceConfigToSharedProto(service *Service) (*pb.ComponentConfig, error)
- func TransformAttributeMapToStruct(to interface{}, attributes AttributeMap) (interface{}, error)
- type AttributeConverter
- type AttributeMap
- func (am AttributeMap) Bool(name string, def bool) bool
- func (am AttributeMap) BoolSlice(name string, def bool) []bool
- func (am AttributeMap) Float64(name string, def float64) float64
- func (am AttributeMap) Float64Slice(name string) []float64
- func (am AttributeMap) Has(name string) bool
- func (am AttributeMap) Int(name string, def int) int
- func (am AttributeMap) IntSlice(name string) []int
- func (am AttributeMap) String(name string) string
- func (am AttributeMap) StringSlice(name string) []string
- type AttributeMapConverter
- type AuthConfig
- type AuthHandlerConfig
- type Cloud
- type Component
- type ComponentAttributeConverterRegistration
- type ComponentAttributeMapConverterRegistration
- type ComponentUpdate
- type Config
- func FromProto(proto *pb.RobotConfig) (*Config, error)
- func FromReader(ctx context.Context, originalPath string, r io.Reader, logger golog.Logger) (*Config, error)
- func ProcessConfig(in *Config, tlsCfg *TLSConfig) (*Config, error)
- func Read(ctx context.Context, filePath string, logger golog.Logger) (*Config, error)
- func ReadLocalConfig(ctx context.Context, filePath string, logger golog.Logger) (*Config, error)
- type Diff
- type LocationSecret
- type ModifiedConfigDiff
- type Module
- type NetworkConfig
- type NetworkConfigData
- type PackageConfig
- type Remote
- type RemoteAuth
- type ResourceConfig
- type ResourceLevelServiceConfig
- type Service
- type ServiceAttributeMapConverterRegistration
- type SessionsConfig
- type TLSConfig
- type UpdateActionType
- type Updateable
- type Watcher
- type WebOAuthConfig
Constants ¶
const DefaultBindAddress = "localhost:8080"
DefaultBindAddress is the default address that will be listened on. This default may not be used in managed cases when no bind address is explicitly set. In those cases the server will bind to all interfaces.
const DefaultPackageVersionValue = "latest"
DefaultPackageVersionValue default value of the package version used when empty.
const DefaultSessionHeartbeatWindow = 2 * time.Second
DefaultSessionHeartbeatWindow is the default session heartbeat window to use when not specified. It can be set with network.sessions.heartbeat_window.
Variables ¶
var ( Version = "" GitRevision = "" )
RDK versioning variables which are replaced by LD flags.
Functions ¶
func AuthConfigToProto ¶ added in v0.0.6
func AuthConfigToProto(auth *AuthConfig) (*pb.AuthConfig, error)
AuthConfigToProto converts AuthConfig to the proto equivalent.
func CloudConfigToProto ¶ added in v0.0.6
func CloudConfigToProto(cloud *Cloud) (*pb.CloudConfig, error)
CloudConfigToProto converts Cloud to the proto equivalent.
func ComponentConfigToProto ¶ added in v0.0.6
func ComponentConfigToProto(component *Component) (*pb.ComponentConfig, error)
ComponentConfigToProto converts Component to the proto equivalent.
func CreateCloudRequest ¶
CreateCloudRequest makes a request to fetch the robot config from a cloud endpoint.
func CreateNewGRPCClient ¶ added in v0.0.7
func CreateNewGRPCClient(ctx context.Context, cloudCfg *Cloud, logger golog.Logger) (rpc.ClientConn, error)
CreateNewGRPCClient creates a new grpc cloud configured to communicate with the robot service based on the cloud config given.
func FrameConfigFromProto ¶ added in v0.0.6
func FrameConfigFromProto(proto *pb.Frame) (*referenceframe.LinkConfig, error)
FrameConfigFromProto creates Frame from the proto equivalent.
func FrameConfigToProto ¶ added in v0.0.6
func FrameConfigToProto(frame referenceframe.LinkConfig) (*pb.Frame, error)
FrameConfigToProto converts Frame to the proto equivalent.
func ModuleConfigToProto ¶ added in v0.2.8
func ModuleConfigToProto(module *Module) (*pb.ModuleConfig, error)
ModuleConfigToProto converts Module to the proto equivalent.
func NetworkConfigToProto ¶ added in v0.0.6
func NetworkConfigToProto(network *NetworkConfig) (*pb.NetworkConfig, error)
NetworkConfigToProto converts NetworkConfig from the proto equivalent.
func PackageConfigToProto ¶ added in v0.2.14
func PackageConfigToProto(cfg *PackageConfig) (*pb.PackageConfig, error)
PackageConfigToProto converts a rdk package config to the proto version.
func ProcessConfigFromProto ¶ added in v0.0.6
func ProcessConfigFromProto(proto *pb.ProcessConfig) (*pexec.ProcessConfig, error)
ProcessConfigFromProto creates ProcessConfig from the proto equivalent.
func ProcessConfigToProto ¶ added in v0.0.6
func ProcessConfigToProto(process *pexec.ProcessConfig) (*pb.ProcessConfig, error)
ProcessConfigToProto converts ProcessConfig to proto equivalent.
func RegisterComponentAttributeConverter ¶
func RegisterComponentAttributeConverter(subtype resource.Subtype, model resource.Model, attr string, conv AttributeConverter)
RegisterComponentAttributeConverter associates a component type and model with a way to convert a particular attribute name.
func RegisterComponentAttributeMapConverter ¶
func RegisterComponentAttributeMapConverter( subtype resource.Subtype, model resource.Model, conv AttributeMapConverter, retType interface{}, )
RegisterComponentAttributeMapConverter associates a component type and model with a way to convert all attributes.
func RegisterServiceAttributeMapConverter ¶
func RegisterServiceAttributeMapConverter( svcType resource.Subtype, model resource.Model, conv AttributeMapConverter, retType interface{}, )
RegisterServiceAttributeMapConverter associates a service type with a way to convert all attributes.
func RemoteConfigToProto ¶ added in v0.0.6
func RemoteConfigToProto(remote *Remote) (*pb.RemoteConfig, error)
RemoteConfigToProto converts Remote to the proto equivalent.
func ResourceLevelServiceConfigToProto ¶ added in v0.0.6
func ResourceLevelServiceConfigToProto(service ResourceLevelServiceConfig) (*pb.ResourceLevelServiceConfig, error)
ResourceLevelServiceConfigToProto converts ResourceLevelServiceConfig to the proto equivalent.
func ServiceConfigToProto ¶ added in v0.0.6
func ServiceConfigToProto(service *Service) (*pb.ServiceConfig, error)
ServiceConfigToProto converts Service to the proto equivalent.
func ServiceConfigToSharedProto ¶ added in v0.2.8
func ServiceConfigToSharedProto(service *Service) (*pb.ComponentConfig, error)
ServiceConfigToSharedProto converts Service to the proto equivalent shared with Components.
func TransformAttributeMapToStruct ¶
func TransformAttributeMapToStruct(to interface{}, attributes AttributeMap) (interface{}, error)
TransformAttributeMapToStruct uses an attribute map to transform attributes to the perscribed format.
Types ¶
type AttributeConverter ¶
type AttributeConverter func(val interface{}) (interface{}, error)
An AttributeConverter converts a single attribute into a possibly different representation.
type AttributeMap ¶
type AttributeMap map[string]interface{}
An AttributeMap is a convenience wrapper for pulling out typed information from a map.
func (AttributeMap) Bool ¶
func (am AttributeMap) Bool(name string, def bool) bool
Bool attempts to return a boolean present in the map with the given name; returns the given default otherwise.
func (AttributeMap) BoolSlice ¶
func (am AttributeMap) BoolSlice(name string, def bool) []bool
BoolSlice attempts to return a slice of bools present in the map with the given name; returns an empty slice otherwise.
func (AttributeMap) Float64 ¶
func (am AttributeMap) Float64(name string, def float64) float64
Float64 attempts to return a float64 present in the map with the given name; returns the given default otherwise.
func (AttributeMap) Float64Slice ¶
func (am AttributeMap) Float64Slice(name string) []float64
Float64Slice attempts to return a slice of ints present in the map with the given name; returns an empty slice otherwise.
func (AttributeMap) Has ¶
func (am AttributeMap) Has(name string) bool
Has returns whether or not the given name is in the map.
func (AttributeMap) Int ¶
func (am AttributeMap) Int(name string, def int) int
Int attempts to return an integer present in the map with the given name; returns the given default otherwise.
func (AttributeMap) IntSlice ¶
func (am AttributeMap) IntSlice(name string) []int
IntSlice attempts to return a slice of ints present in the map with the given name; returns an empty slice otherwise.
func (AttributeMap) String ¶
func (am AttributeMap) String(name string) string
String attempts to return a string present in the map with the given name; returns an empty string otherwise.
func (AttributeMap) StringSlice ¶
func (am AttributeMap) StringSlice(name string) []string
StringSlice attempts to return a slice of strings present in the map with the given name; returns an empty slice otherwise.
type AttributeMapConverter ¶
type AttributeMapConverter func(attributes AttributeMap) (interface{}, error)
An AttributeMapConverter converts an attribute map into a possibly different representation.
type AuthConfig ¶
type AuthConfig struct { Handlers []AuthHandlerConfig `json:"handlers"` TLSAuthEntities []string `json:"tls_auth_entities"` }
AuthConfig describes authentication and authorization settings for the web server.
func AuthConfigFromProto ¶ added in v0.0.6
func AuthConfigFromProto(proto *pb.AuthConfig) (*AuthConfig, error)
AuthConfigFromProto creates AuthConfig from the proto equivalent.
func (*AuthConfig) Validate ¶
func (config *AuthConfig) Validate(path string) error
Validate ensures all parts of the config are valid.
type AuthHandlerConfig ¶
type AuthHandlerConfig struct { Type rpc.CredentialsType `json:"type"` Config AttributeMap `json:"config"` // Structured config for credential type CredentialsTypeOAuthWeb. When this is set the Config field should be empty. WebOAuthConfig *WebOAuthConfig `json:"web_oauth_config,omitempty"` }
AuthHandlerConfig describes the configuration for a particular auth handler.
func (*AuthHandlerConfig) Validate ¶
func (config *AuthHandlerConfig) Validate(path string) error
Validate ensures all parts of the config are valid.
type Cloud ¶
type Cloud struct { ID string Secret string LocationSecret string // Deprecated: Use LocationSecrets LocationSecrets []LocationSecret ManagedBy string FQDN string LocalFQDN string SignalingAddress string SignalingInsecure bool Path string LogPath string AppAddress string RefreshInterval time.Duration // cached by us and fetched from a non-config endpoint. TLSCertificate string TLSPrivateKey string }
A Cloud describes how to configure a robot controlled by the cloud. The cloud source could be anything that supports http. URL is constructed as $Path?id=ID and secret is put in a http header.
func CloudConfigFromProto ¶ added in v0.0.6
func CloudConfigFromProto(proto *pb.CloudConfig) (*Cloud, error)
CloudConfigFromProto creates Cloud from the proto equivalent.
func (Cloud) MarshalJSON ¶ added in v0.2.5
MarshalJSON marshals out this config.
func (*Cloud) UnmarshalJSON ¶ added in v0.2.5
UnmarshalJSON unmarshals JSON data into this config.
type Component ¶
type Component struct { Name string `json:"name"` Namespace resource.Namespace `json:"namespace"` Type resource.SubtypeName `json:"type"` // TODO(PRODUCT-266): API replaces Type and Namespace when Service/Component merge, so json needs to be enabled. API resource.Subtype `json:"-"` Model resource.Model `json:"model"` Frame *referenceframe.LinkConfig `json:"frame,omitempty"` DependsOn []string `json:"depends_on"` ServiceConfig []ResourceLevelServiceConfig `json:"service_config"` Attributes AttributeMap `json:"attributes"` ConvertedAttributes interface{} `json:"-"` ImplicitDependsOn []string `json:"-"` }
A Component describes the configuration of a component.
func ComponentConfigFromProto ¶ added in v0.0.6
func ComponentConfigFromProto(proto *pb.ComponentConfig) (*Component, error)
ComponentConfigFromProto creates Component from the proto equivalent.
func ParseComponentFlag ¶
ParseComponentFlag parses a component flag from command line arguments.
func ServiceConfigToShared ¶ added in v0.2.8
ServiceConfigToShared converts a Service to the common resource config (Component for now.)
func (*Component) Dependencies ¶
Dependencies returns the deduplicated union of user-defined and implicit dependencies.
func (*Component) ResourceName ¶
ResourceName returns the ResourceName for the component.
type ComponentAttributeConverterRegistration ¶
type ComponentAttributeConverterRegistration struct { Subtype resource.Subtype Model resource.Model Attr string Conv AttributeConverter }
A ComponentAttributeConverterRegistration describes how to convert a specific attribute for a model of a type of component.
func RegisteredComponentAttributeConverters ¶
func RegisteredComponentAttributeConverters() []ComponentAttributeConverterRegistration
RegisteredComponentAttributeConverters returns a copy of the registered component attribute converters.
type ComponentAttributeMapConverterRegistration ¶
type ComponentAttributeMapConverterRegistration struct { Subtype resource.Subtype Model resource.Model Conv AttributeMapConverter RetType interface{} // the shape of what is converted to }
A ComponentAttributeMapConverterRegistration describes how to convert all attributes for a model of a type of component.
func RegisteredComponentAttributeMapConverters ¶
func RegisteredComponentAttributeMapConverters() []ComponentAttributeMapConverterRegistration
RegisteredComponentAttributeMapConverters returns a copy of the registered component attribute converters.
type ComponentUpdate ¶ added in v0.0.9
type ComponentUpdate interface {
UpdateAction(config *Component) UpdateActionType
}
ComponentUpdate interface that a component can optionally implement. This interface helps the reconfiguration process.
type Config ¶
type Config struct { Cloud *Cloud `json:"cloud,omitempty"` Modules []Module `json:"modules,omitempty"` Remotes []Remote `json:"remotes,omitempty"` Components []Component `json:"components,omitempty"` Processes []pexec.ProcessConfig `json:"processes,omitempty"` Services []Service `json:"services,omitempty"` Packages []PackageConfig `json:"packages,omitempty"` Network NetworkConfig `json:"network"` Auth AuthConfig `json:"auth"` Debug bool `json:"debug,omitempty"` ConfigFilePath string `json:"-"` // AllowInsecureCreds is used to have all connections allow insecure // downgrades and send credentials over plaintext. This is an option // a user must pass via command line arguments. AllowInsecureCreds bool `json:"-"` // UntrustedEnv is used to disable Processes and shell for untrusted environments // where a process cannot be trusted. This is an option a user must pass via // command line arguments. UntrustedEnv bool `json:"-"` // FromCommand indicates if this config was parsed via the web server command. // If false, it's for creating a robot via the RDK library. This is helpful for // error messages that can indicate flags/config fields to use. FromCommand bool `json:"-"` // DisablePartialStart ensures that a robot will only start when all the components, // services, and remotes pass config validation. This value is false by default DisablePartialStart bool `json:"disable_partial_start"` }
A Config describes the configuration of a robot.
func FromProto ¶ added in v0.1.0
func FromProto(proto *pb.RobotConfig) (*Config, error)
FromProto converts the RobotConfig to the internal rdk equivalent.
func FromReader ¶
func FromReader( ctx context.Context, originalPath string, r io.Reader, logger golog.Logger, ) (*Config, error)
FromReader reads a config from the given reader and specifies where, if applicable, the file the reader originated from.
func ProcessConfig ¶
ProcessConfig processes robot configs.
func ReadLocalConfig ¶ added in v0.1.0
ReadLocalConfig reads a config from the given file but does not fetch any config from the remote servers.
func (*Config) CopyOnlyPublicFields ¶ added in v0.0.6
CopyOnlyPublicFields returns a deep-copy of the current config only preserving JSON exported fields.
func (Config) FindComponent ¶
FindComponent finds a particular component by name.
type Diff ¶
type Diff struct {
Left, Right *Config
Added *Config
Modified *ModifiedConfigDiff
Removed *Config
ResourcesEqual bool
NetworkEqual bool
PrettyDiff string
}
A Diff is the difference between two configs, left and right where left is usually old and right is new. So the diff is the changes from left to right.
func DiffConfigs ¶
DiffConfigs returns the difference between the two given configs from left to right.
type LocationSecret ¶ added in v0.1.7
LocationSecret describes a location secret that can be used to authenticate to the rdk.
type ModifiedConfigDiff ¶
type ModifiedConfigDiff struct { Remotes []Remote Components []Component Processes []pexec.ProcessConfig Services []Service }
ModifiedConfigDiff is the modificative different between two configs.
type Module ¶ added in v0.2.8
type Module struct { // Name is an arbitrary name used to identify the module, and is used to name it's socket as well. Name string `json:"name"` // ExePath is the path (either absolute, or relative to the working directory) to the executable module file. ExePath string `json:"executable_path"` }
Module represents an external resource module, with a path to the binary module file.
func ModuleConfigFromProto ¶ added in v0.2.8
func ModuleConfigFromProto(proto *pb.ModuleConfig) (*Module, error)
ModuleConfigFromProto creates Module from the proto equivalent.
type NetworkConfig ¶
type NetworkConfig struct {
NetworkConfigData
}
NetworkConfig describes networking settings for the web server.
func NetworkConfigFromProto ¶ added in v0.0.6
func NetworkConfigFromProto(proto *pb.NetworkConfig) (*NetworkConfig, error)
NetworkConfigFromProto creates NetworkConfig from the proto equivalent.
func (*NetworkConfig) MarshalJSON ¶
func (nc *NetworkConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshals out this config.
func (*NetworkConfig) Validate ¶
func (nc *NetworkConfig) Validate(path string) error
Validate ensures all parts of the config are valid.
type NetworkConfigData ¶
type NetworkConfigData struct { // FQDN is the unique name of this server. FQDN string `json:"fqdn"` // Listener is the listener that the web server will use. This is mutually // exclusive with BindAddress. Listener net.Listener `json:"-"` // BindAddress is the address that the web server will bind to. // The default behavior is to bind to localhost:8080. This is mutually // exclusive with Listener. BindAddress string `json:"bind_address"` BindAddressDefaultSet bool `json:"-"` // TLSCertFile is used to enable secure communications on the hosted HTTP server. // This is mutually exclusive with TLSCertPEM and TLSKeyPEM. TLSCertFile string `json:"tls_cert_file"` // TLSKeyFile is used to enable secure communications on the hosted HTTP server. // This is mutually exclusive with TLSCertPEM and TLSKeyPEM. TLSKeyFile string `json:"tls_key_file"` // TLSConfig is used to enable secure communications on the hosted HTTP server. // This is mutually exclusive with TLSCertFile and TLSKeyFile. TLSConfig *tls.Config `json:"-"` // Sessions configures session management. Sessions SessionsConfig `json:"sessions"` }
NetworkConfigData is the network config data that gets marshaled/unmarshaled.
type PackageConfig ¶ added in v0.2.14
type PackageConfig struct { // Name is the local name of the package on the RDK. Must be unique across Packages. Must not be empty. Name string `json:"name"` // Package is the unqiue package name hosted by a remote PackageService. Must not be empty. Package string `json:"package"` // Version of the package ID hosted by a remote PackageService. If not specified "latest" is assumed. Version string `json:"version,omitempty"` }
A PackageConfig describes the configuration of a Package.
func PackageConfigFromProto ¶ added in v0.2.14
func PackageConfigFromProto(proto *pb.PackageConfig) (*PackageConfig, error)
PackageConfigFromProto converts a proto package config to the rdk version.
func (*PackageConfig) Validate ¶ added in v0.2.14
func (p *PackageConfig) Validate(path string) error
Validate package config is valid.
type Remote ¶
type Remote struct { Name string Address string Frame *referenceframe.LinkConfig Auth RemoteAuth ManagedBy string Insecure bool ConnectionCheckInterval time.Duration ReconnectInterval time.Duration ServiceConfig []ResourceLevelServiceConfig // Secret is a helper for a robot location secret. Secret string }
A Remote describes a remote robot that should be integrated. The Frame field defines how the "world" node of the remote robot should be reconciled with the "world" node of the current robot. All components of the remote robot who have Parent as "world" will be attached to the parent defined in Frame, and with the given offset as well.
func RemoteConfigFromProto ¶ added in v0.0.6
func RemoteConfigFromProto(proto *pb.RemoteConfig) (*Remote, error)
RemoteConfigFromProto creates Remote from the proto equivalent.
func (Remote) MarshalJSON ¶ added in v0.2.5
MarshalJSON marshals out this config.
func (*Remote) UnmarshalJSON ¶ added in v0.2.5
UnmarshalJSON unmarshals JSON data into this config.
type RemoteAuth ¶
type RemoteAuth struct { Credentials *rpc.Credentials `json:"credentials"` Entity string `json:"entity"` // only used internally right now ExternalAuthAddress string `json:"-"` ExternalAuthInsecure bool `json:"-"` ExternalAuthToEntity string `json:"-"` Managed bool `json:""` SignalingServerAddress string `json:""` SignalingAuthEntity string `json:""` SignalingCreds *rpc.Credentials `json:""` }
RemoteAuth specifies how to authenticate against a remote. If no credentials are specified, authentication does not happen. If an entity is specified, the authentication request will specify it.
type ResourceConfig ¶
type ResourceConfig interface { String() string ResourceName() resource.Name Get() interface{} Set(val string) error // contains filtered or unexported methods }
A ResourceConfig represents an implmentation of a config for any type of resource.
type ResourceLevelServiceConfig ¶
type ResourceLevelServiceConfig struct { Type resource.SubtypeName `json:"type"` Attributes AttributeMap `json:"attributes"` ConvertedAttributes interface{} `json:"-"` }
A ResourceLevelServiceConfig describes component or remote configuration for a service.
func ResourceLevelServiceConfigFromProto ¶ added in v0.0.6
func ResourceLevelServiceConfigFromProto(proto *pb.ResourceLevelServiceConfig) (ResourceLevelServiceConfig, error)
ResourceLevelServiceConfigFromProto creates ResourceLevelServiceConfig from the proto equivalent.
func (*ResourceLevelServiceConfig) ResourceName ¶
func (config *ResourceLevelServiceConfig) ResourceName() resource.Name
ResourceName returns the ResourceName for the component within a service_config.
type Service ¶
type Service struct { Name string `json:"name"` Namespace resource.Namespace `json:"namespace"` Type resource.SubtypeName `json:"type"` Model resource.Model `json:"model"` DependsOn []string `json:"depends_on"` Attributes AttributeMap `json:"attributes"` ConvertedAttributes interface{} `json:"-"` ImplicitDependsOn []string `json:"-"` }
A Service describes the configuration of a service.
func ParseServiceFlag ¶
ParseServiceFlag parses a service flag from command line arguments.
func ServiceConfigFromProto ¶ added in v0.0.6
func ServiceConfigFromProto(proto *pb.ServiceConfig) (*Service, error)
ServiceConfigFromProto creates Service from the proto equivalent shared with Components.
func ServiceConfigFromShared ¶ added in v0.2.8
ServiceConfigFromShared converts a common resource config (Component for now) to a Service.
func ServiceConfigFromSharedProto ¶ added in v0.2.8
func ServiceConfigFromSharedProto(proto *pb.ComponentConfig) (*Service, error)
ServiceConfigFromSharedProto creates a Service from the proto equivalent.
func (*Service) Dependencies ¶ added in v0.2.0
Dependencies returns the deduplicated union of user-defined and implicit dependencies.
func (*Service) ResourceName ¶
ResourceName returns the ResourceName for the component.
type ServiceAttributeMapConverterRegistration ¶
type ServiceAttributeMapConverterRegistration struct { SvcType resource.Subtype Model resource.Model Conv AttributeMapConverter RetType interface{} // the shape of what is converted to }
A ServiceAttributeMapConverterRegistration describes how to convert all attributes for a model of a type of service.
func RegisteredServiceAttributeMapConverters ¶
func RegisteredServiceAttributeMapConverters() []ServiceAttributeMapConverterRegistration
RegisteredServiceAttributeMapConverters returns a copy of the registered component attribute converters.
type SessionsConfig ¶ added in v0.2.5
type SessionsConfig struct { // HeartbeatWindow is the window within which clients must send at least one // heartbeat in order to keep a session alive. HeartbeatWindow time.Duration }
SessionsConfig configures various parameters used in session management.
func (SessionsConfig) MarshalJSON ¶ added in v0.2.5
func (sc SessionsConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshals out this config.
func (*SessionsConfig) UnmarshalJSON ¶ added in v0.2.5
func (sc *SessionsConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON data into this config.
func (*SessionsConfig) Validate ¶ added in v0.2.5
func (sc *SessionsConfig) Validate(path string) error
Validate ensures all parts of the config are valid.
type TLSConfig ¶
TLSConfig stores the TLS config for the robot.
func NewTLSConfig ¶
NewTLSConfig creates a new tls config.
func (*TLSConfig) UpdateCert ¶
UpdateCert updates the TLS certificate to be returned.
type UpdateActionType ¶
type UpdateActionType int
UpdateActionType help hint the reconfigure process on whether one should reconfigure a resource or rebuild it.
const ( // None is returned when the new configuration doesn't change the resource. None UpdateActionType = iota // Reconfigure is returned when the resource should be updated without recreating its proxies. // Note that two instances (old&new) will coexist, all dependencies will be destroyed and recreated. Reconfigure // Rebuild is returned when the resource and it's proxies should be destroyed and recreated, // all dependencies will be destroyed and recreated. Rebuild )
type Updateable ¶
Updateable is implemented when component/service of a robot should be updated with the config.
type Watcher ¶
type Watcher interface {
Config() <-chan *Config
}
A Watcher is responsible for watching for changes to a config from some source and delivering those changes to some destination.
type WebOAuthConfig ¶ added in v0.2.6
type WebOAuthConfig struct { // The allowed jwt audiences the OAuthWeb auth handler will accept. AllowedAudiences []string `json:"allowed_audiences"` // contains the raw jwks json. JSONKeySet AttributeMap `json:"jwks"` // on validation the JSONKeySet is validated and parsed into this field and can be used. ValidatedKeySet jwks.KeySet `json:"-"` }
WebOAuthConfig contains the structued AuthHandlerConfig for the CredentialsTypeOAuthWeb type.
func (*WebOAuthConfig) Validate ¶ added in v0.2.6
func (c *WebOAuthConfig) Validate(path string) error
Validate returns true if the WebOAuth is valid. Ensures each key is valid and meets the required constraints.