Documentation
¶
Overview ¶
Package config defines the structures to configure a robot and its connected parts.
Index ¶
- Constants
- Variables
- func AssociatedResourceConfigFromProto(proto *pb.ResourceLevelServiceConfig) (resource.AssociatedResourceConfig, error)
- func AssociatedResourceConfigToProto(conf resource.AssociatedResourceConfig) (*pb.ResourceLevelServiceConfig, error)
- func AuthConfigToProto(auth *AuthConfig) (*pb.AuthConfig, error)
- func CloudConfigToProto(cloud *Cloud) (*pb.CloudConfig, error)
- func ComponentConfigFromProto(protoConf *pb.ComponentConfig) (*resource.Config, error)
- func ComponentConfigToProto(conf *resource.Config) (*pb.ComponentConfig, error)
- func ContainsPlaceholder(s string) bool
- func CreateNewGRPCClient(ctx context.Context, cloudCfg *Cloud, logger logging.Logger) (rpc.ClientConn, error)
- func CreateNewGRPCClientWithAPIKey(ctx context.Context, cloudCfg *Cloud, apiKey, apiKeyID string, ...) (rpc.ClientConn, error)
- func FrameConfigFromProto(proto *pb.Frame) (*referenceframe.LinkConfig, error)
- func FrameConfigToProto(frame referenceframe.LinkConfig) (*pb.Frame, error)
- func InitLoggingSettings(logger logging.Logger, cmdLineDebugFlag bool)
- func LogConfigToProto(logConfig *LoggerPatternConfig) (*pb.LogPatternConfig, error)
- func ModuleConfigToProto(module *Module) (*pb.ModuleConfig, error)
- func NetworkConfigToProto(network *NetworkConfig) (*pb.NetworkConfig, error)
- func PackageConfigToProto(cfg *PackageConfig) (*pb.PackageConfig, error)
- func PackageTypeToProto(t PackageType) (*packagespb.PackageType, error)
- func ProcessConfigFromProto(proto *pb.ProcessConfig) (*pexec.ProcessConfig, error)
- func ProcessConfigToProto(process *pexec.ProcessConfig) (*pb.ProcessConfig, error)
- func RemoteConfigToProto(remote *Remote) (*pb.RemoteConfig, error)
- func ServiceConfigFromProto(protoConf *pb.ServiceConfig) (*resource.Config, error)
- func ServiceConfigToProto(conf *resource.Config) (*pb.ServiceConfig, error)
- func UpdateCloudConfigDebug(cloudDebug bool)
- func UpdateFileConfigDebug(fileDebug bool)
- func UpdateLoggerRegistry(logConfig []LoggerPatternConfig, loggerRegistry map[string]logging.Logger) (map[string]logging.Logger, error)
- type AppValidationStatus
- type AuthConfig
- type AuthHandlerConfig
- type Cloud
- type Config
- func FromProto(proto *pb.RobotConfig, logger logging.Logger) (*Config, error)
- func FromReader(ctx context.Context, originalPath string, r io.Reader, logger logging.Logger) (*Config, error)
- func ProcessConfig(in *Config, tlsCfg *TLSConfig) (*Config, error)
- func Read(ctx context.Context, filePath string, logger logging.Logger) (*Config, error)
- func ReadLocalConfig(ctx context.Context, filePath string, logger logging.Logger) (*Config, error)
- func (c *Config) CopyOnlyPublicFields() (*Config, error)
- func (c *Config) Ensure(fromCloud bool, logger logging.Logger) error
- func (c Config) FindComponent(name string) *resource.Config
- func (c Config) MarshalJSON() ([]byte, error)
- func (c *Config) ProcessLocal(logger logging.Logger) error
- func (c *Config) ReplacePlaceholders() error
- func (c *Config) UnmarshalJSON(data []byte) error
- type Diff
- type ExternalAuthConfig
- type JSONManifest
- type LocationSecret
- type LoggerPatternConfig
- type ModifiedConfigDiff
- type Module
- type ModuleType
- type NetworkConfig
- type NetworkConfigData
- type PackageConfig
- func (p PackageConfig) Equals(other PackageConfig) bool
- func (p *PackageConfig) LocalDataDirectory(packagesDir string) string
- func (p *PackageConfig) LocalDataParentDirectory(packagesDir string) string
- func (p *PackageConfig) LocalDownloadPath(packagesDir string) string
- func (p *PackageConfig) SanitizedName() string
- func (p *PackageConfig) Validate(path string) error
- type PackageType
- type Remote
- type RemoteAuth
- type SessionsConfig
- type TLSConfig
- type Watcher
Constants ¶
const ( // PackagesDirName is where packages go underneath viamDotDir. PackagesDirName = "packages" // LocalPackagesSuffix is used by the local package manager. LocalPackagesSuffix = "-local" )
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 = "" DateCompiled = "" )
RDK versioning variables which are replaced by LD flags.
var SupportedPackageTypes = []PackageType{PackageTypeMlModel, PackageTypeModule, PackageTypeSlamMap}
SupportedPackageTypes is a list of all of the valid package types.
var ( // ViamDotDir is the directory for Viam's cached files. ViamDotDir string )
Functions ¶
func AssociatedResourceConfigFromProto ¶ added in v0.2.36
func AssociatedResourceConfigFromProto(proto *pb.ResourceLevelServiceConfig) (resource.AssociatedResourceConfig, error)
AssociatedResourceConfigFromProto creates AssociatedResourceConfig from the proto equivalent.
func AssociatedResourceConfigToProto ¶ added in v0.2.36
func AssociatedResourceConfigToProto(conf resource.AssociatedResourceConfig) (*pb.ResourceLevelServiceConfig, error)
AssociatedResourceConfigToProto converts AssociatedResourceConfig to the proto equivalent.
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 ComponentConfigFromProto ¶ added in v0.0.6
func ComponentConfigFromProto(protoConf *pb.ComponentConfig) (*resource.Config, error)
ComponentConfigFromProto creates Component from the proto equivalent.
func ComponentConfigToProto ¶ added in v0.0.6
func ComponentConfigToProto(conf *resource.Config) (*pb.ComponentConfig, error)
ComponentConfigToProto converts Component to the proto equivalent. Assumes config is valid except for partial names which will be completed.
func ContainsPlaceholder ¶ added in v0.7.2
ContainsPlaceholder returns true if the passed string contains a placeholder.
func CreateNewGRPCClient ¶ added in v0.0.7
func CreateNewGRPCClient(ctx context.Context, cloudCfg *Cloud, logger logging.Logger) (rpc.ClientConn, error)
CreateNewGRPCClient creates a new grpc cloud configured to communicate with the robot service based on the cloud config given.
func CreateNewGRPCClientWithAPIKey ¶ added in v0.12.0
func CreateNewGRPCClientWithAPIKey(ctx context.Context, cloudCfg *Cloud, apiKey, apiKeyID string, logger logging.Logger, ) (rpc.ClientConn, error)
CreateNewGRPCClientWithAPIKey creates a new grpc cloud configured to communicate with the robot service based on the cloud config and API key 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 InitLoggingSettings ¶ added in v0.10.0
InitLoggingSettings initializes the global logging settings.
func LogConfigToProto ¶ added in v0.33.0
func LogConfigToProto(logConfig *LoggerPatternConfig) (*pb.LogPatternConfig, error)
LogConfigToProto converts a LoggerPatternConfig type to its 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 PackageTypeToProto ¶ added in v0.7.2
func PackageTypeToProto(t PackageType) (*packagespb.PackageType, error)
PackageTypeToProto converts a config PackageType to its proto equivalent This is required be because app/packages uses a PackageType enum but app/PackageConfig uses a string Type.
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 RemoteConfigToProto ¶ added in v0.0.6
func RemoteConfigToProto(remote *Remote) (*pb.RemoteConfig, error)
RemoteConfigToProto converts Remote to the proto equivalent.
func ServiceConfigFromProto ¶ added in v0.0.6
func ServiceConfigFromProto(protoConf *pb.ServiceConfig) (*resource.Config, error)
ServiceConfigFromProto creates Service from the proto equivalent shared with Components.
func ServiceConfigToProto ¶ added in v0.0.6
func ServiceConfigToProto(conf *resource.Config) (*pb.ServiceConfig, error)
ServiceConfigToProto converts Service to the proto equivalent. Assumes config is valid except for partial names which will be completed.
func UpdateCloudConfigDebug ¶ added in v0.10.0
func UpdateCloudConfigDebug(cloudDebug bool)
UpdateCloudConfigDebug is used to update the debug flag whenever a cloud-based viam config is refreshed.
func UpdateFileConfigDebug ¶ added in v0.10.0
func UpdateFileConfigDebug(fileDebug bool)
UpdateFileConfigDebug is used to update the debug flag whenever a file-based viam config is refreshed.
func UpdateLoggerRegistry ¶ added in v0.33.0
func UpdateLoggerRegistry(logConfig []LoggerPatternConfig, loggerRegistry map[string]logging.Logger) (map[string]logging.Logger, error)
UpdateLoggerRegistry updates the logger registry if necessary with the specified logConfig.
Types ¶
type AppValidationStatus ¶ added in v0.13.0
type AppValidationStatus struct {
Error string `json:"error"`
}
AppValidationStatus refers to the.
type AuthConfig ¶
type AuthConfig struct { Handlers []AuthHandlerConfig `json:"handlers,omitempty"` TLSAuthEntities []string `json:"tls_auth_entities,omitempty"` ExternalAuthConfig *ExternalAuthConfig `json:"external_auth_config,omitempty"` }
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. If it exists, updates ExternalAuthConfig's ValidatedKeySet once validated. A sample AuthConfig in JSON form is shown below, where "handlers" contains a list of auth handlers. The only accepted credential type for the RDK in the config is "api-key" currently. An auth handler for utils.CredentialsTypeRobotLocationSecret may be added later by the RDK during processing.
"auth": { "handlers": [ { "type": "api-key", "config": { "API_KEY_ID": "API_KEY", "API_KEY_ID_2": "API_KEY_2", "keys": ["API_KEY_ID", "API_KEY_ID_2"] } } ], "external_auth_config": {} }
type AuthHandlerConfig ¶
type AuthHandlerConfig struct { Type rpc.CredentialsType `json:"type"` Config rutils.AttributeMap `json:"config"` }
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 LocationID string PrimaryOrgID string MachineID string 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.
func (*Cloud) Validate ¶
Validate ensures all parts of the config are valid. Adds default for RefreshInterval if not set.
func (*Cloud) ValidateTLS ¶ added in v0.21.1
ValidateTLS ensures TLS fields are valid.
type Config ¶
type Config struct { Cloud *Cloud Modules []Module Remotes []Remote Components []resource.Config Processes []pexec.ProcessConfig Services []resource.Config Packages []PackageConfig Network NetworkConfig Auth AuthConfig Debug bool LogConfig []LoggerPatternConfig ConfigFilePath string // 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 // 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 // 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 // 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 // PackagePath sets the directory used to store packages locally. Defaults to ~/.viam/packages PackagePath string // EnableWebProfile turns pprof http server in localhost. Defaults to false. EnableWebProfile bool }
A Config describes the configuration of a robot.
func FromReader ¶
func FromReader( ctx context.Context, originalPath string, r io.Reader, logger logging.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
func ReadLocalConfig( ctx context.Context, filePath string, logger logging.Logger, ) (*Config, error)
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) Ensure ¶
Ensure ensures all parts of the config are valid, which may include updating it. Only returns an error if c.DisablePartialStart is true (default: false).
func (Config) FindComponent ¶
FindComponent finds a particular component by name.
func (Config) MarshalJSON ¶ added in v0.2.36
MarshalJSON marshals JSON from the config.
func (*Config) ProcessLocal ¶ added in v0.31.0
ProcessLocal validates the current config assuming it came from a local file and updates it with all derived fields. Returns an error if the unprocessedConfig is non-valid.
func (*Config) ReplacePlaceholders ¶ added in v0.7.2
ReplacePlaceholders traverses parts of the config to replace placeholders with their resolved values.
func (*Config) UnmarshalJSON ¶ added in v0.2.36
UnmarshalJSON unmarshals JSON into the config and adjusts some names if they are not fully filled in.
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 ExternalAuthConfig ¶ added in v0.2.27
type ExternalAuthConfig struct { // contains the raw jwks json. JSONKeySet rutils.AttributeMap `json:"jwks"` // on validation the JSONKeySet is validated and parsed into this field and can be used. ValidatedKeySet jwks.KeySet `json:"-"` }
ExternalAuthConfig contains information needed to verify externally authenticated tokens.
func (*ExternalAuthConfig) Validate ¶ added in v0.2.27
func (c *ExternalAuthConfig) Validate(path string) error
Validate returns true if the config is valid. Ensures each key is valid and meets the required constraints. Updates ValidatedKeySet once validated. A sample ExternalAuthConfig in JSON form is shown below, where "keys" contains a list of JSON Web Keys as defined in https://datatracker.ietf.org/doc/html/rfc7517.
"external_auth_config": { "jwks": { "keys": [ { "alg": "XXXX", "e": "XXXX", "kid": "XXXX", "kty": "XXXX", "n": "XXXX" } ] } }
type JSONManifest ¶ added in v0.28.0
type JSONManifest struct {
Entrypoint string `json:"entrypoint"`
}
JSONManifest contains meta.json fields that are used by both RDK and CLI.
type LocationSecret ¶ added in v0.1.7
type LocationSecret struct { ID string `json:"id"` // Payload of the secret Secret string `json:"secret"` }
LocationSecret describes a location secret that can be used to authenticate to the rdk.
type LoggerPatternConfig ¶ added in v0.33.0
LoggerPatternConfig is an instance of a level specification for a given logger.
func LogConfigFromProto ¶ added in v0.33.0
func LogConfigFromProto(proto *pb.LogPatternConfig) (*LoggerPatternConfig, error)
LogConfigFromProto converts a proto LoggerPatternConfig to the rdk version.
type ModifiedConfigDiff ¶
type ModifiedConfigDiff struct { Remotes []Remote Components []resource.Config Processes []pexec.ProcessConfig Services []resource.Config Packages []PackageConfig Modules []Module }
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"` // LogLevel represents the level at which the module should log its messages. It will be passed as a commandline // argument "log-level" (i.e. preceded by "--log-level=") to the module executable. If unset or set to an empty // string, "--log-level=debug" will be passed to the module executable if the server was started with "-debug". // // SDK logger-creation utilities, such as module.NewLoggerFromArgs, will create an "Info" level logger when any // value besides "" or "debug" is used for LogLevel ("log_level" in JSON). In other words, setting a LogLevel // of something like "info" will ignore the debug setting on the server. LogLevel string `json:"log_level"` // Type indicates whether this is a local or registry module. Type ModuleType `json:"type"` // ModuleID is the id of the module in the registry. It is empty on non-registry modules. ModuleID string `json:"module_id,omitempty"` // Environment contains additional variables that are passed to the module process when it is started. // They overwrite existing environment variables. Environment map[string]string `json:"env,omitempty"` // Status refers to the validations done in the APP to make sure a module is configured correctly Status *AppValidationStatus `json:"status"` // LocalVersion is an in-process fake version used for local module change management. LocalVersion string // contains filtered or unexported fields }
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.
func (Module) Equals ¶ added in v0.5.0
Equals checks if the two modules are deeply equal to each other.
func (Module) EvaluateExePath ¶ added in v0.28.0
EvaluateExePath returns absolute ExePath from one of three sources (in order of precedence): 1. if there is a meta.json in the exe dir, use that, except in local non-tarball case. 2. if this is a local tarball and there's a meta.json next to the tarball, use that. 3. otherwise use the exe path from config, or fail if this is a local tarball. Note: the working directory must be the unpacked tarball directory or local exec directory.
func (Module) NeedsSyntheticPackage ¶ added in v0.28.0
NeedsSyntheticPackage returns true if this is a local module pointing at a tarball.
func (Module) SyntheticPackage ¶ added in v0.28.0
func (m Module) SyntheticPackage() (PackageConfig, error)
SyntheticPackage creates a fake package for a module which can be used to access some package logic.
type ModuleType ¶ added in v0.11.0
type ModuleType string
ModuleType indicates where a module comes from.
const ( // ModuleTypeLocal is a module that resides on the host system. ModuleTypeLocal ModuleType = "local" // ModuleTypeRegistry is a module from our registry that is distributed in a package and is downloaded at runtime. ModuleTypeRegistry ModuleType = "registry" )
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. Adds default BindAddress and HeartbeatWindow if not set.
type NetworkConfigData ¶
type NetworkConfigData struct { // FQDN is the unique name of this server. FQDN string `json:"fqdn,omitempty"` // 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,omitempty"` 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,omitempty"` // 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,omitempty"` // 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"` // Types of the Package. Type PackageType `json:"type"` Status *AppValidationStatus `json:"status,omitempty"` // contains filtered or unexported fields }
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) Equals ¶ added in v0.5.0
func (p PackageConfig) Equals(other PackageConfig) bool
Equals checks if the two configs are deeply equal to each other.
func (*PackageConfig) LocalDataDirectory ¶ added in v0.7.2
func (p *PackageConfig) LocalDataDirectory(packagesDir string) string
LocalDataDirectory returns the folder where the package should be extracted. Ex: /home/user/.viam/packages/data/ml_model/orgid_ballClassifier_0.1.2.
func (*PackageConfig) LocalDataParentDirectory ¶ added in v0.7.2
func (p *PackageConfig) LocalDataParentDirectory(packagesDir string) string
LocalDataParentDirectory returns the folder that will contain the all packages of this type. Ex: /home/user/.viam/packages/data/ml_model.
func (*PackageConfig) LocalDownloadPath ¶ added in v0.7.2
func (p *PackageConfig) LocalDownloadPath(packagesDir string) string
LocalDownloadPath returns the file where the archive should be downloaded before extraction.
func (*PackageConfig) SanitizedName ¶ added in v0.7.2
func (p *PackageConfig) SanitizedName() string
SanitizedName returns the package name for the symlink/filepath of the package on the system.
func (*PackageConfig) Validate ¶ added in v0.2.14
func (p *PackageConfig) Validate(path string) error
Validate package config is valid.
type PackageType ¶ added in v0.6.0
type PackageType string
PackageType indicates the type of the package This is used to replace placeholder strings in the config.
const ( // PackageTypeMlModel represents an ML model. PackageTypeMlModel PackageType = "ml_model" // PackageTypeModule represents a module type. PackageTypeModule PackageType = "module" // PackageTypeSlamMap represents a slam internal state. PackageTypeSlamMap PackageType = "slam_map" )
type Remote ¶
type Remote struct { Name string Address string Frame *referenceframe.LinkConfig Auth RemoteAuth ManagedBy string Insecure bool ConnectionCheckInterval time.Duration ReconnectInterval time.Duration AssociatedResourceConfigs []resource.AssociatedResourceConfig // Secret is a helper for a robot location secret. Secret string // contains filtered or unexported fields }
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) Equals ¶ added in v0.2.36
Equals checks if the two configs are deeply equal to each other.
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 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. Sets default HeartbeatWindow if not set.
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.