Documentation
¶
Index ¶
- Constants
- Variables
- type Configuration
- func (m *Configuration) GetBool(key string) bool
- func (m *Configuration) GetString(key string) string
- func (m *Configuration) ID() driver.TMSID
- func (m *Configuration) IsSet(key string) bool
- func (m *Configuration) Serialize(tmsID token.TMSID) ([]byte, error)
- func (m *Configuration) TranslatePath(path string) string
- func (m *Configuration) UnmarshalKey(key string, rawVal interface{}) error
- func (m *Configuration) Validate() error
- type Provider
- type Service
- func (m *Service) AddConfiguration(raw []byte) error
- func (m *Service) ConfigurationFor(network, channel, namespace string) (*Configuration, error)
- func (m *Service) Configurations() ([]*Configuration, error)
- func (m *Service) Enabled() bool
- func (m *Service) LookupNamespace(network, channel string) (string, error)
- func (m *Service) Version() string
- type TMSConfig
- type TokenConfig
- type ValidateConfiguration
- type Validator
Constants ¶
const ( Network = "network" Channel = "channel" Namespace = "namespace" )
const ( RootKey = "token" TMSKey = "tms" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
Configuration is the configuration of a given configuration
func NewConfiguration ¶
func NewConfiguration(cp Provider, keyID string, tmsID driver.TMSID) *Configuration
func (*Configuration) GetBool ¶ added in v0.7.0
func (m *Configuration) GetBool(key string) bool
func (*Configuration) GetString ¶ added in v0.7.0
func (m *Configuration) GetString(key string) string
func (*Configuration) ID ¶ added in v0.7.0
func (m *Configuration) ID() driver.TMSID
func (*Configuration) IsSet ¶ added in v0.7.0
func (m *Configuration) IsSet(key string) bool
func (*Configuration) Serialize ¶ added in v0.7.0
func (m *Configuration) Serialize(tmsID token.TMSID) ([]byte, error)
Serialize serializes this configuration with the respect to the passed tms ID
func (*Configuration) TranslatePath ¶ added in v0.7.0
func (m *Configuration) TranslatePath(path string) string
TranslatePath translates the passed path relative to the config path
func (*Configuration) UnmarshalKey ¶ added in v0.7.0
func (m *Configuration) UnmarshalKey(key string, rawVal interface{}) error
UnmarshalKey takes a single key and unmarshals it into a Struct
func (*Configuration) Validate ¶ added in v0.7.0
func (m *Configuration) Validate() error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service model the configuration service for the token sdk
func NewService ¶
NewService creates a new Service configuration.
func (*Service) AddConfiguration ¶ added in v0.7.0
AddConfiguration does the following: - parse raw as a yaml stream - extract the configuration - validate it making sure it contains a new TMS If all good, accept the new TMS Updates to an existing TMS should be rejected.
func (*Service) ConfigurationFor ¶
func (m *Service) ConfigurationFor(network, channel, namespace string) (*Configuration, error)
ConfigurationFor returns a configuration for the given network, channel, and namespace.
func (*Service) Configurations ¶
func (m *Service) Configurations() ([]*Configuration, error)
Configurations returns all configuration configurations.
func (*Service) LookupNamespace ¶
LookupNamespace searches for a configuration that matches the given network and channel, and return its namespace. If no matching configuration is found, an error is returned. If multiple matching configurations are found, an error is returned.
type TMSConfig ¶ added in v0.7.0
type TMSConfig struct {
Token TokenConfig `yaml:"token"`
}
TMSConfig is the TMS configuration
type TokenConfig ¶ added in v0.7.0
TokenConfig is used to serialize a TMS configuration
type ValidateConfiguration ¶ added in v0.7.0
type ValidateConfiguration interface {
// ID identities the TMS this configuration refers to.
ID() token.TMSID
// IsSet checks to see if the key has been set in any of the data locations
IsSet(key string) bool
// UnmarshalKey takes a single key and unmarshals it into a struct.
// The key must be relative to the TMS this configuration refers to.
UnmarshalKey(key string, rawVal interface{}) error
// GetString returns the value associated with the key as a string
GetString(key string) string
// GetBool returns the value associated with the key as a bool
GetBool(key string) bool
// TranslatePath translates the passed path relative to the config path
TranslatePath(path string) string
}
ValidateConfiguration provides functions to access the configuration of a given TMS
type Validator ¶ added in v0.7.0
type Validator interface {
// Validate returns nil if the passed configuration is valid, an error otherwise.
Validate(ValidateConfiguration) error
}
Validator is used to validate a TMS configuration