Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.0.54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2025 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheConfig

type CacheConfig struct {
	// cache type: "local" or "remote"
	Type string `yaml:"type,omitempty" json:"type,omitempty"`
	// Local cache attr
	StoreType string `yaml:"store-type,omitempty" json:"store-type,omitempty"`
	Dir       string `yaml:"dir,omitempty" json:"dir,omitempty"`
	// Remote cache attr
	Address string `yaml:"address,omitempty" json:"address,omitempty"`
}

type Config

type Config struct {
	GRPCServer                *GRPCServer                     `yaml:"grpc-server,omitempty" json:"grpc-server,omitempty"`
	SchemaStore               *schemaConfig.SchemaStoreConfig `yaml:"schema-store,omitempty" json:"schema-store,omitempty"`
	Datastores                []*DatastoreConfig              `yaml:"datastores,omitempty" json:"datastores,omitempty"`
	SchemaServer              *RemoteSchemaServer             `yaml:"schema-server,omitempty" json:"schema-server,omitempty"`
	Cache                     *CacheConfig                    `yaml:"cache,omitempty" json:"cache,omitempty"`
	Prometheus                *PromConfig                     `yaml:"prometheus,omitempty" json:"prometheus,omitempty"`
	DefaultTransactionTimeout time.Duration                   `yaml:"transaction-timeout,omitempty" json:"transaction-timeout,omitempty"`
}

func New

func New(file string) (*Config, error)

type Creds

type Creds struct {
	Username string `yaml:"username,omitempty" json:"username,omitempty"`
	Password string `yaml:"password,omitempty" json:"password,omitempty"`
	Token    string `yaml:"token,omitempty" json:"token,omitempty"`
}

type DataServer

type DataServer struct {
	// Enabled       bool `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	MaxCandidates int `yaml:"max-candidates,omitempty" json:"max-candidates,omitempty"`
}

type DatastoreConfig

type DatastoreConfig struct {
	Name   string        `yaml:"name,omitempty" json:"name,omitempty"`
	Schema *SchemaConfig `yaml:"schema,omitempty" json:"schema,omitempty"`
	SBI    *SBI          `yaml:"sbi,omitempty" json:"sbi,omitempty"`
	Sync   *Sync         `yaml:"sync,omitempty" json:"sync,omitempty"`
}

func (*DatastoreConfig) ValidateSetDefaults

func (ds *DatastoreConfig) ValidateSetDefaults() error

type GRPCServer

type GRPCServer struct {
	Address        string        `yaml:"address,omitempty" json:"address,omitempty"`
	TLS            *TLS          `yaml:"tls,omitempty" json:"tls,omitempty"`
	SchemaServer   *SchemaServer `yaml:"schema-server,omitempty" json:"schema-server,omitempty"`
	DataServer     *DataServer   `yaml:"data-server,omitempty" json:"data-server,omitempty"`
	MaxRecvMsgSize int           `yaml:"max-recv-msg-size,omitempty" json:"max-recv-msg-size,omitempty"`
	RPCTimeout     time.Duration `yaml:"rpc-timeout,omitempty" json:"rpc-timeout,omitempty"`
}

type PromConfig

type PromConfig struct {
	Address string `yaml:"address,omitempty" json:"address,omitempty"`
}

type RemoteSchemaCache

type RemoteSchemaCache struct {
	TTL             time.Duration `yaml:"ttl,omitempty" json:"ttl,omitempty"`
	Capacity        uint64        `yaml:"capacity,omitempty" json:"capacity,omitempty"`
	WithDescription bool          `yaml:"with-description,omitempty" json:"with-description,omitempty"`
	RefreshOnHit    bool          `yaml:"refresh-on-hit,omitempty" json:"refresh-on-hit,omitempty"`
}

type RemoteSchemaServer

type RemoteSchemaServer struct {
	Address string             `yaml:"address,omitempty" json:"address,omitempty"`
	TLS     *TLS               `yaml:"tls,omitempty" json:"tls,omitempty"`
	Cache   *RemoteSchemaCache `yaml:"cache,omitempty" json:"cache,omitempty"`
}

type SBI

type SBI struct {
	// Southbound interface type, one of: gnmi, netconf
	Type string `yaml:"type,omitempty" json:"type,omitempty"`
	// gNMI or netconf address
	Address string `yaml:"address,omitempty" json:"address,omitempty"`
	Port    uint32 `yaml:"port,omitempty" json:"port,omitempty"`
	// TLS config
	TLS *TLS `yaml:"tls,omitempty" json:"tls,omitempty"`
	// Target SBI credentials
	Credentials    *Creds             `yaml:"credentials,omitempty" json:"credentials,omitempty"`
	NetconfOptions *SBINetconfOptions `yaml:"netconf-options,omitempty" json:"netconf-options,omitempty"`
	GnmiOptions    *SBIGnmiOptions    `yaml:"gnmi-options,omitempty" json:"gnmi-options,omitempty"`
	// ConnectRetry
	ConnectRetry time.Duration `yaml:"connect-retry,omitempty" json:"connect-retry,omitempty"`
	// Timeout
	Timeout time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty"`
}

type SBIGnmiOptions added in v0.0.44

type SBIGnmiOptions struct {
	Encoding string `yaml:"encoding,omitempty" json:"encoding,omitempty"`
}

type SBINetconfOptions added in v0.0.44

type SBINetconfOptions struct {
	// if true, the namespace is included as an `xmlns` attribute in the netconf payloads
	IncludeNS bool `yaml:"include-ns,omitempty" json:"include-ns,omitempty"`
	// sets the preferred NC version: 1.0 or 1.1
	PreferredNCVersion string `yaml:"preferred-nc-version,omitempty" json:"preferred-nc-version,omitempty"`
	// add a namespace when specifying a netconf operation such as 'delete' or 'remove'
	OperationWithNamespace bool `yaml:"operation-with-namespace,omitempty" json:"operation-with-namespace,omitempty"`
	// use 'remove' operation instead of 'delete'
	UseOperationRemove bool `yaml:"use-operation-remove,omitempty" json:"use-operation-remove,omitempty"`
	// for netconf targets: defines whether to commit to running or use a candidate.
	CommitDatastore string `yaml:"commit-datastore,omitempty" json:"commit-datastore,omitempty"`
}

type SchemaConfig

type SchemaConfig struct {
	Name    string `json:"name,omitempty"`
	Vendor  string `json:"vendor,omitempty"`
	Version string `json:"version,omitempty"`
}

func (*SchemaConfig) GetSchema

func (sc *SchemaConfig) GetSchema() *sdcpb.Schema

type SchemaServer

type SchemaServer struct {
	Enabled          bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	SchemasDirectory string `yaml:"schemas-directory,omitempty" json:"schemas-directory,omitempty"`
}

type Sync

type Sync struct {
	Validate     bool            `yaml:"validate,omitempty" json:"validate,omitempty"`
	Buffer       int64           `yaml:"buffer,omitempty" json:"buffer,omitempty"`
	WriteWorkers int64           `yaml:"write-workers,omitempty" json:"write-workers,omitempty"`
	Config       []*SyncProtocol `yaml:"config,omitempty" json:"config,omitempty"`
}

type SyncProtocol

type SyncProtocol struct {
	Name     string        `yaml:"name,omitempty" json:"name,omitempty"`
	Protocol string        `yaml:"protocol,omitempty" json:"protocol,omitempty"`
	Paths    []string      `yaml:"paths,omitempty" json:"paths,omitempty"`
	Interval time.Duration `yaml:"interval,omitempty" json:"interval,omitempty"`
	Mode     string        `yaml:"mode,omitempty" json:"mode,omitempty"`
	Encoding string        `yaml:"encoding,omitempty" json:"encoding,omitempty"`
}

type TLS

type TLS struct {
	CA         string `yaml:"ca,omitempty" json:"ca,omitempty"`
	Cert       string `yaml:"cert,omitempty" json:"cert,omitempty"`
	Key        string `yaml:"key,omitempty" json:"key,omitempty"`
	SkipVerify bool   `yaml:"skip-verify,omitempty" json:"skip-verify,omitempty"`
}

func (*TLS) NewConfig

func (t *TLS) NewConfig(ctx context.Context) (*tls.Config, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL