machineconfiguration

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultFullSyncInterval        = 600
	DefaultSyncTypeNormal   string = SyncTypeNormal
	SyncTypeNormal          string = "normal"
	SyncTypeClean           string = "clean"
	SyncTypeCleanAll        string = "clean_all"
)
View Source
const (
	CacheKeyGlobal = "global"
)

Variables

This section is empty.

Functions

func SetGlobalConfig

func SetGlobalConfig(client dynamodb.PutItemAPI, clientMode types.ClientMode, blockedPathRegex string, allowedPathRegex string, batchSize int, isEnableBundles bool, isEnabledTransitiveRules bool, fullSyncInterval int, uploadLogsURL string) (err error)

SetGlobalConfig writes a global configuration to the DynamoDB table via a PutItem API call

func SetMachineConfig

func SetMachineConfig(client dynamodb.PutItemAPI, machineID string, clientMode types.ClientMode, blockedPathRegex string, allowedPathRegex string, batchSize int, isEnableBundles bool, isEnabledTransitiveRules bool, isCleanSync bool, fullSyncInterval int, uploadLogsURL string) (err error)

SetMachineConfig writes a machineID specific configuration to the DynamoDB table via a PutItem API call

func UpdateGlobalConfigClientMode

func UpdateGlobalConfigClientMode(client dynamodb.UpdateItemAPI, newClientMode types.ClientMode) error

UpdateGlobalConfigClientMode updates a machineID specific ClientMode configuration to the DynamoDB table via an UpdateItem API call

func UpdateMachineConfigClientMode

func UpdateMachineConfigClientMode(client dynamodb.UpdateItemAPI, machineID string, newClientMode types.ClientMode) error

UpdateMachineConfigClientMode updates a machineID specific ClientMode configuration to the DynamoDB table via an UpdateItem API call

Types

type Cache

type Cache interface {
	Has(key string) bool
	Get(key string) *MachineConfiguration
	Set(key string, config *MachineConfiguration) bool
}

Cache

func GetCache

func GetCache(timeProvider clock.TimeProvider) Cache

type CachedConcreteGlobalConfigurationFetcher

type CachedConcreteGlobalConfigurationFetcher struct {
	// contains filtered or unexported fields
}

func (CachedConcreteGlobalConfigurationFetcher) GetGlobalConfig

func (c CachedConcreteGlobalConfigurationFetcher) GetGlobalConfig() (config *MachineConfiguration, err error)

type ConcreteCache

type ConcreteCache struct {
	// contains filtered or unexported fields
}

func (*ConcreteCache) Get

func (*ConcreteCache) Has

func (c *ConcreteCache) Has(key string) bool

func (*ConcreteCache) Set

func (c *ConcreteCache) Set(key string, config *MachineConfiguration) bool

type ConcreteConfigurationDeleter

type ConcreteConfigurationDeleter struct {
	// contains filtered or unexported fields
}

type ConcreteConfigurationFetcher

type ConcreteConfigurationFetcher struct {
	// contains filtered or unexported fields
}

func GetConfigurationFetcher

func GetConfigurationFetcher(client dynamodb.GetItemAPI, timeProvider clock.TimeProvider) ConcreteConfigurationFetcher

func GetUncachedConfigurationFetcher

func GetUncachedConfigurationFetcher(client dynamodb.GetItemAPI, timeProvider clock.TimeProvider) ConcreteConfigurationFetcher

type ConcreteConfigurationSetter

type ConcreteConfigurationSetter struct {
	// contains filtered or unexported fields
}

func GetConfigurationSetter

func GetConfigurationSetter(client dynamodb.PutItemAPI, timeProvider clock.TimeProvider) ConcreteConfigurationSetter

type ConcreteConfigurationUpdater

type ConcreteConfigurationUpdater struct {
	// contains filtered or unexported fields
}

func (ConcreteConfigurationUpdater) UpdateGlobalConfig

func (ConcreteConfigurationUpdater) UpdateMachineConfig

func (f ConcreteConfigurationUpdater) UpdateMachineConfig(machineID string, configRequest MachineConfigurationUpdateRequest) (*MachineConfiguration, error)

type ConcreteGlobalConfigurationDeleter

type ConcreteGlobalConfigurationDeleter struct {
	// contains filtered or unexported fields
}

type ConcreteGlobalConfigurationSetter

type ConcreteGlobalConfigurationSetter struct {
	// contains filtered or unexported fields
}

type ConcreteGlobalConfigurationUpdater

type ConcreteGlobalConfigurationUpdater struct {
	// contains filtered or unexported fields
}

type ConcreteMachineConfigurationDeleter

type ConcreteMachineConfigurationDeleter struct {
	// contains filtered or unexported fields
}

type ConcreteMachineConfigurationFetcher

type ConcreteMachineConfigurationFetcher struct {
	// contains filtered or unexported fields
}

func (ConcreteMachineConfigurationFetcher) GetMachineSpecificConfig

func (f ConcreteMachineConfigurationFetcher) GetMachineSpecificConfig(machineID string) (config *MachineConfiguration, err error)

type ConcreteMachineConfigurationService

type ConcreteMachineConfigurationService struct {
	// contains filtered or unexported fields
}

func (ConcreteMachineConfigurationService) DeleteGlobalConfig

func (s ConcreteMachineConfigurationService) DeleteGlobalConfig() error

Global

func (ConcreteMachineConfigurationService) DeleteMachineConfig

func (s ConcreteMachineConfigurationService) DeleteMachineConfig(machineID string) error

Machine

func (ConcreteMachineConfigurationService) GetIntendedConfig

func (s ConcreteMachineConfigurationService) GetIntendedConfig(machineID string) (intendedConfig MachineConfiguration, err error)

Machine

func (ConcreteMachineConfigurationService) GetIntendedGlobalConfig

func (s ConcreteMachineConfigurationService) GetIntendedGlobalConfig() (intendedConfig MachineConfiguration, isDefaultConfig bool, err error)

Global

func (ConcreteMachineConfigurationService) SetGlobalConfig

Global

func (ConcreteMachineConfigurationService) SetMachineConfig

func (s ConcreteMachineConfigurationService) SetMachineConfig(machineID string, config MachineConfiguration) error

Machine

func (ConcreteMachineConfigurationService) UpdateGlobalConfig

Global

func (ConcreteMachineConfigurationService) UpdateMachineConfig

type ConcreteMachineConfigurationSetter

type ConcreteMachineConfigurationSetter struct {
	// contains filtered or unexported fields
}

type ConcreteMachineConfigurationUpdater

type ConcreteMachineConfigurationUpdater struct {
	// contains filtered or unexported fields
}

type ConcreteUniversalConfigurationProvider

type ConcreteUniversalConfigurationProvider struct{}

func (ConcreteUniversalConfigurationProvider) GetUniversalDefaultConfig

func (p ConcreteUniversalConfigurationProvider) GetUniversalDefaultConfig() MachineConfiguration

type ConfigurationUpdater

type ConfigurationUpdater interface {
	UpdateGlobalConfig(configRequest MachineConfigurationUpdateRequest) (MachineConfiguration, error)
	UpdateMachineConfig(machineID string, configRequest MachineConfigurationUpdateRequest) (MachineConfiguration, error)
}

ConfigurationUpdater is an interface to accept a new configuration and update either a global or machine configuration

type GlobalConfigurationDeleter

type GlobalConfigurationDeleter interface {
	// contains filtered or unexported methods
}

GlobalConfigurationDeleter

type GlobalConfigurationFetcher

type GlobalConfigurationFetcher interface {
	GetGlobalConfig() (*MachineConfiguration, error)
}

func GetGlobalConfigurationFetcher

func GetGlobalConfigurationFetcher(client dynamodb.GetItemAPI, timeProvider clock.TimeProvider) GlobalConfigurationFetcher

func GetUncachedGlobalConfigurationFetcher

func GetUncachedGlobalConfigurationFetcher(client dynamodb.GetItemAPI, timeProvider clock.TimeProvider) GlobalConfigurationFetcher

type GlobalConfigurationSetter

type GlobalConfigurationSetter interface {
	// contains filtered or unexported methods
}

GlobalConfigurationSetter

type GlobalConfigurationUpdater

type GlobalConfigurationUpdater interface {
	// contains filtered or unexported methods
}

GlobalConfigurationUpdater //

type MachineConfiguration

type MachineConfiguration struct {
	ClientMode             types.ClientMode `dynamodbav:"ClientMode"`
	BlockedPathRegex       string           `dynamodbav:"BlockedPathRegex"`
	AllowedPathRegex       string           `dynamodbav:"AllowedPathRegex"`
	BatchSize              int              `dynamodbav:"BatchSize"`
	EnableBundles          bool             `dynamodbav:"EnableBundles"`
	EnabledTransitiveRules bool             `dynamodbav:"EnableTransitiveRules"`
	CleanSync              bool             `dynamodbav:"CleanSync,omitempty"`
	FullSyncInterval       int              `dynamodbav:"FullSyncInterval,omitempty"`
	UploadLogsURL          string           `dynamodbav:"UploadLogsUrl,omitempty"`
	BlockUsbMount          bool             `dynamodbav:"BlockUsbMount,omitempty"`
	RemountUsbMode         string           `dynamodbav:"RemountUsbMode,omitempty"`
	// SyncType                 types.SyncType   `dynamodbav:"SyncType,omitempty"`
	OverrideFileAccessAction string         `dynamodbav:"OverrideFileAccessAction,omitempty"`
	DataType                 types.DataType `dynamodbav:"DataType,omitempty"`
}

MachineConfiguration is the abstract notion, sans DynamoDB magic (e.g. PK/SK) Use Santa defined constants https://github.com/google/santa/blob/main/Source/santactl/Commands/sync/SNTCommandSyncConstants.m#L32-L35

func GetGlobalConfig

func GetGlobalConfig(client dynamodb.GetItemAPI) (config *MachineConfiguration, err error)

@deprecated

func GetIntendedConfig

func GetIntendedConfig(client dynamodb.GetItemAPI, machineID string) (intendedConfig MachineConfiguration, err error)

@deprecated

func GetMachineSpecificConfig

func GetMachineSpecificConfig(client dynamodb.GetItemAPI, machineID string) (config *MachineConfiguration, err error)

@deprecated

func GetUniversalDefaultConfig

func GetUniversalDefaultConfig() MachineConfiguration

Default Universal Config

type MachineConfigurationDeleter

type MachineConfigurationDeleter interface {
	// contains filtered or unexported methods
}

GlobalConfigurationDeleter

type MachineConfigurationFetcher

type MachineConfigurationFetcher interface {
	GetMachineSpecificConfig(machineID string) (*MachineConfiguration, error)
}

func GetMachineConfigurationFetcher

func GetMachineConfigurationFetcher(client dynamodb.GetItemAPI) MachineConfigurationFetcher

type MachineConfigurationRow

type MachineConfigurationRow struct {
	dynamodb.PrimaryKey
	MachineConfiguration
}

MachineConfigurationRow is an encapsulation of a DynamoDB row containing machine configuration data

type MachineConfigurationService

type MachineConfigurationService interface {
	GetIntendedConfig(machineID string) (intendedConfig MachineConfiguration, err error)
	GetIntendedGlobalConfig() (intendedConfig MachineConfiguration, isDefaultConfig bool, err error)
	SetGlobalConfig(config MachineConfiguration) error
	SetMachineConfig(machineID string, config MachineConfiguration) error
	UpdateGlobalConfig(configRequest MachineConfigurationUpdateRequest) (*MachineConfiguration, error)
	UpdateMachineConfig(machineID string, configRequest MachineConfigurationUpdateRequest) (*MachineConfiguration, error)
	DeleteGlobalConfig() error
	DeleteMachineConfig(machineID string) error
}

This service exposes all machineconfiguration access methods

func GetMachineConfigurationService

func GetMachineConfigurationService(dynamodb dynamodb.DynamoDBClient, timeProvider clock.TimeProvider) MachineConfigurationService

func GetUncachedMachineConfigurationService

func GetUncachedMachineConfigurationService(dynamodb dynamodb.DynamoDBClient, timeProvider clock.TimeProvider) MachineConfigurationService

type MachineConfigurationSetter

type MachineConfigurationSetter interface {
	// contains filtered or unexported methods
}

MachineConfigurationSetter

type MachineConfigurationUpdateRequest

type MachineConfigurationUpdateRequest struct {
	ClientMode            *types.ClientMode
	BlockedPathRegex      *string
	AllowedPathRegex      *string
	BatchSize             *int
	EnableBundles         *bool
	EnableTransitiveRules *bool
	CleanSync             *bool
	FullSyncInterval      *int
	BlockUsbMount         *bool
	RemountUsbMode        *string
	// SyncType                 *types.SyncType
	OverrideFileAccessAction *string
	UploadLogsURL            *string
}

type MachineConfigurationUpdater

type MachineConfigurationUpdater interface {
	// contains filtered or unexported methods
}

MachineConfig //

type UncachedConcreteGlobalConfigurationFetcher

type UncachedConcreteGlobalConfigurationFetcher struct {
	// contains filtered or unexported fields
}

func (UncachedConcreteGlobalConfigurationFetcher) GetGlobalConfig

func (c UncachedConcreteGlobalConfigurationFetcher) GetGlobalConfig() (config *MachineConfiguration, err error)

type UniversalConfigurationProvider

type UniversalConfigurationProvider interface {
	GetUniversalDefaultConfig() MachineConfiguration
}

func GetUniversalConfigurationProvider

func GetUniversalConfigurationProvider() UniversalConfigurationProvider

Jump to

Keyboard shortcuts

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