Documentation ¶
Index ¶
- Constants
- func CLICommandStrings() []string
- func CredentialsBackendTypeStrings() []string
- func GetAttributeValueAs[T types.AttributeValue](key string, values map[string]types.AttributeValue) (T, bool)
- func NotificationTypeStrings() []string
- func RunModeStrings() []string
- func StorageTypeStrings() []string
- func WithCLICommand(cmd string) func(*RunOptions) error
- func WithLocalAddress(addr string) func(*RunOptions) error
- func WithRunMode(mode string) func(*RunOptions) error
- type App
- func (app *App) ChangesList(ctx context.Context, channelID string) ([]*drive.Change, *ChannelItem, error)
- func (app *App) Close() error
- func (app *App) CreateChannel(ctx context.Context, driveID string) error
- func (app *App) DeleteChannel(ctx context.Context, item *ChannelItem) error
- func (app *App) DriveIDs(ctx context.Context) ([]string, error)
- func (app *App) RotateChannel(ctx context.Context, item *ChannelItem) error
- func (app *App) Run(optFns ...func(*RunOptions) error) error
- func (app *App) RunWithContext(ctx context.Context, optFns ...func(*RunOptions) error) error
- func (app *App) SendNotification(ctx context.Context, item *ChannelItem, changes []*drive.Change) error
- func (app *App) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type CLICommand
- type ChangeEventDetail
- type ChannelAlreadyExists
- type ChannelItem
- type ChannelNotFound
- type Config
- type CredentialsBackend
- type CredentialsBackendConfig
- type CredentialsBackendType
- type DriveConfig
- type DynamoDBStorage
- func (s *DynamoDBStorage) DeleteChannel(ctx context.Context, target *ChannelItem) error
- func (s *DynamoDBStorage) FindAllChannels(ctx context.Context) (<-chan []*ChannelItem, error)
- func (s *DynamoDBStorage) FindOneByChannelID(ctx context.Context, channelID string) (*ChannelItem, error)
- func (s *DynamoDBStorage) SaveChannel(ctx context.Context, item *ChannelItem) error
- func (s *DynamoDBStorage) UpdatePageToken(ctx context.Context, target *ChannelItem) error
- type EventBridgeClient
- type EventBridgeNotification
- type FileNotification
- type FileStorage
- func (s *FileStorage) DeleteChannel(ctx context.Context, target *ChannelItem) error
- func (s *FileStorage) FindAllChannels(ctx context.Context) (<-chan []*ChannelItem, error)
- func (s *FileStorage) FindOneByChannelID(ctx context.Context, channelID string) (*ChannelItem, error)
- func (s *FileStorage) SaveChannel(ctx context.Context, item *ChannelItem) error
- func (s *FileStorage) UpdatePageToken(ctx context.Context, target *ChannelItem) error
- type NoneCredentialsBackend
- type Notification
- type NotificationConfig
- type NotificationType
- type RunMode
- type RunOptions
- type SSMParameterStoreCredentialsBackend
- type Storage
- type StorageConfig
- type StorageType
- type TargetEntity
Constants ¶
const ( DetailTypeFileRemoved = "File Removed" DetailTypeFileTrashed = "File Move to trash" DetailTypeFileChanged = "File Changed" DetailTypeDriveRemoved = "Shared Drive Removed" DetailTypeDriveChanged = "Drive Status Changed" )
const (
DefaultDriveID = "__default__"
)
Variables ¶
This section is empty.
Functions ¶
func CLICommandStrings ¶
func CLICommandStrings() []string
CLICommandStrings returns a slice of all String values of the enum
func CredentialsBackendTypeStrings ¶ added in v0.1.0
func CredentialsBackendTypeStrings() []string
CredentialsBackendTypeStrings returns a slice of all String values of the enum
func GetAttributeValueAs ¶
func GetAttributeValueAs[T types.AttributeValue](key string, values map[string]types.AttributeValue) (T, bool)
func NotificationTypeStrings ¶
func NotificationTypeStrings() []string
NotificationTypeStrings returns a slice of all String values of the enum
func RunModeStrings ¶
func RunModeStrings() []string
RunModeStrings returns a slice of all String values of the enum
func StorageTypeStrings ¶
func StorageTypeStrings() []string
StorageTypeStrings returns a slice of all String values of the enum
func WithCLICommand ¶
func WithCLICommand(cmd string) func(*RunOptions) error
func WithLocalAddress ¶
func WithLocalAddress(addr string) func(*RunOptions) error
func WithRunMode ¶
func WithRunMode(mode string) func(*RunOptions) error
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) ChangesList ¶
func (*App) CreateChannel ¶
func (*App) DeleteChannel ¶
func (app *App) DeleteChannel(ctx context.Context, item *ChannelItem) error
func (*App) RotateChannel ¶
func (app *App) RotateChannel(ctx context.Context, item *ChannelItem) error
func (*App) RunWithContext ¶
func (*App) SendNotification ¶ added in v0.3.0
func (app *App) SendNotification(ctx context.Context, item *ChannelItem, changes []*drive.Change) error
type CLICommand ¶
type CLICommand int
const ( CLICommandList CLICommand = iota CLICommandServe CLICommandRegister CLICommandMaintenance CLICommandCleanup CLICommandSync )
func CLICommandString ¶
func CLICommandString(s string) (CLICommand, error)
CLICommandString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func CLICommandValues ¶
func CLICommandValues() []CLICommand
CLICommandValues returns all values of the enum
func (CLICommand) Description ¶
func (cmd CLICommand) Description() string
func (CLICommand) IsACLICommand ¶
func (i CLICommand) IsACLICommand() bool
IsACLICommand returns "true" if the value is listed in the enum definition. "false" otherwise
func (CLICommand) String ¶
func (i CLICommand) String() string
type ChangeEventDetail ¶ added in v0.2.0
type ChangeEventDetail struct { Subject string `json:"subject"` Entity *TargetEntity `json:"entity"` Actor *drive.User `json:"actor"` Change *drive.Change `json:"change"` }
func (*ChangeEventDetail) DetailType ¶ added in v0.2.0
func (e *ChangeEventDetail) DetailType() string
func (*ChangeEventDetail) MarshalJSON ¶ added in v0.2.0
func (e *ChangeEventDetail) MarshalJSON() ([]byte, error)
func (*ChangeEventDetail) Source ¶ added in v0.2.0
func (e *ChangeEventDetail) Source(sourcePrefix string) string
type ChannelAlreadyExists ¶
type ChannelAlreadyExists struct {
ChannelID string
}
func (*ChannelAlreadyExists) Error ¶
func (err *ChannelAlreadyExists) Error() string
type ChannelItem ¶
type ChannelItem struct { ChannelID string Expiration time.Time PageToken string ResourceID string DriveID string PageTokenFetchedAt time.Time CreatedAt time.Time UpdatedAt time.Time }
func NewChannelItemWithDynamoDBAttributeValues ¶
func NewChannelItemWithDynamoDBAttributeValues(values map[string]types.AttributeValue) *ChannelItem
func (*ChannelItem) IsAboutToExpired ¶
func (*ChannelItem) ToDynamoDBAttributeValues ¶
func (item *ChannelItem) ToDynamoDBAttributeValues() map[string]types.AttributeValue
type ChannelNotFound ¶
type ChannelNotFound struct {
ChannelID string
}
func (*ChannelNotFound) Error ¶
func (err *ChannelNotFound) Error() string
type Config ¶
type Config struct { RequiredVersion string `yaml:"required_version,omitempty"` Webhook string `yaml:"webhook,omitempty"` Credentials *CredentialsBackendConfig `yaml:"credentials,omitempty"` Expiration time.Duration `yaml:"expiration,omitempty"` Storage *StorageConfig `yaml:"storage,omitempty"` Notification *NotificationConfig `yaml:"notification,omitempty"` Drives []*DriveConfig `yaml:"drives,omitempty"` WithinModifiedTime *time.Duration `yaml:"within_modified_time,omitempty"` DrivesAutoDetect *bool `yaml:"drives_auto_detect,omitempty"` // contains filtered or unexported fields }
Config for App
func DefaultConfig ¶
func DefaultConfig() *Config
func (*Config) ValidateVersion ¶
ValidateVersion validates a version satisfies required_version.
type CredentialsBackend ¶ added in v0.1.0
type CredentialsBackend interface {
WithCredentialsClientOption(context.Context, []option.ClientOption) ([]option.ClientOption, error)
}
func NewCredentialsBackend ¶ added in v0.1.0
func NewCredentialsBackend(ctx context.Context, cfg *CredentialsBackendConfig, awsCfg aws.Config) (CredentialsBackend, error)
type CredentialsBackendConfig ¶ added in v0.1.0
type CredentialsBackendConfig struct { BackendType CredentialsBackendType `yaml:"backend_type,omitempty"` ParameterName *string `yaml:"parameter_name,omitempty"` Base64Encoding bool `yaml:"base64encoding,omitempty"` }
func (*CredentialsBackendConfig) Restrict ¶ added in v0.1.0
func (cfg *CredentialsBackendConfig) Restrict() error
Restrict restricts a configuration.
type CredentialsBackendType ¶ added in v0.1.0
type CredentialsBackendType int
const ( CredentialsBackendTypeNone CredentialsBackendType = iota CredentialsBackendTypeSSMParameterStore )
func CredentialsBackendTypeString ¶ added in v0.1.0
func CredentialsBackendTypeString(s string) (CredentialsBackendType, error)
CredentialsBackendTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func CredentialsBackendTypeValues ¶ added in v0.1.0
func CredentialsBackendTypeValues() []CredentialsBackendType
CredentialsBackendTypeValues returns all values of the enum
func (CredentialsBackendType) IsACredentialsBackendType ¶ added in v0.1.0
func (i CredentialsBackendType) IsACredentialsBackendType() bool
IsACredentialsBackendType returns "true" if the value is listed in the enum definition. "false" otherwise
func (CredentialsBackendType) MarshalYAML ¶ added in v0.1.0
func (i CredentialsBackendType) MarshalYAML() (interface{}, error)
MarshalYAML implements a YAML Marshaler for CredentialsBackendType
func (CredentialsBackendType) String ¶ added in v0.1.0
func (i CredentialsBackendType) String() string
func (*CredentialsBackendType) UnmarshalYAML ¶ added in v0.1.0
func (i *CredentialsBackendType) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements a YAML Unmarshaler for CredentialsBackendType
type DriveConfig ¶
type DriveConfig struct {
DriveID string `yaml:"drive_id,omitempty"`
}
func (*DriveConfig) Restrict ¶
func (cfg *DriveConfig) Restrict() error
Restrict restricts a configuration.
type DynamoDBStorage ¶
type DynamoDBStorage struct {
// contains filtered or unexported fields
}
func NewDynamoDBStorage ¶
func NewDynamoDBStorage(ctx context.Context, cfg *StorageConfig, awsCfg aws.Config) (*DynamoDBStorage, func() error, error)
func (*DynamoDBStorage) DeleteChannel ¶
func (s *DynamoDBStorage) DeleteChannel(ctx context.Context, target *ChannelItem) error
func (*DynamoDBStorage) FindAllChannels ¶
func (s *DynamoDBStorage) FindAllChannels(ctx context.Context) (<-chan []*ChannelItem, error)
func (*DynamoDBStorage) FindOneByChannelID ¶
func (s *DynamoDBStorage) FindOneByChannelID(ctx context.Context, channelID string) (*ChannelItem, error)
func (*DynamoDBStorage) SaveChannel ¶
func (s *DynamoDBStorage) SaveChannel(ctx context.Context, item *ChannelItem) error
func (*DynamoDBStorage) UpdatePageToken ¶
func (s *DynamoDBStorage) UpdatePageToken(ctx context.Context, target *ChannelItem) error
type EventBridgeClient ¶
type EventBridgeClient interface {
PutEvents(ctx context.Context, params *eventbridge.PutEventsInput, optFns ...func(*eventbridge.Options)) (*eventbridge.PutEventsOutput, error)
}
type EventBridgeNotification ¶
type EventBridgeNotification struct {
// contains filtered or unexported fields
}
func (*EventBridgeNotification) SendChanges ¶
func (n *EventBridgeNotification) SendChanges(ctx context.Context, item *ChannelItem, changes []*drive.Change) error
type FileNotification ¶
type FileNotification struct {
// contains filtered or unexported fields
}
func NewFileNotification ¶
func NewFileNotification(ctx context.Context, cfg *NotificationConfig) (*FileNotification, func() error, error)
func (*FileNotification) SendChanges ¶
func (n *FileNotification) SendChanges(ctx context.Context, _ *ChannelItem, changes []*drive.Change) error
type FileStorage ¶
type FileStorage struct { Items []*ChannelItem LockFile string FilePath string }
func NewFileStorage ¶
func NewFileStorage(ctx context.Context, cfg *StorageConfig) (*FileStorage, func() error, error)
func (*FileStorage) DeleteChannel ¶
func (s *FileStorage) DeleteChannel(ctx context.Context, target *ChannelItem) error
func (*FileStorage) FindAllChannels ¶
func (s *FileStorage) FindAllChannels(ctx context.Context) (<-chan []*ChannelItem, error)
func (*FileStorage) FindOneByChannelID ¶
func (s *FileStorage) FindOneByChannelID(ctx context.Context, channelID string) (*ChannelItem, error)
func (*FileStorage) SaveChannel ¶
func (s *FileStorage) SaveChannel(ctx context.Context, item *ChannelItem) error
func (*FileStorage) UpdatePageToken ¶
func (s *FileStorage) UpdatePageToken(ctx context.Context, target *ChannelItem) error
type NoneCredentialsBackend ¶ added in v0.1.0
type NoneCredentialsBackend struct{}
func (*NoneCredentialsBackend) WithCredentialsClientOption ¶ added in v0.1.0
func (b *NoneCredentialsBackend) WithCredentialsClientOption(_ context.Context, orig []option.ClientOption) ([]option.ClientOption, error)
type Notification ¶
type Notification interface {
SendChanges(context.Context, *ChannelItem, []*drive.Change) error
}
func NewEventBridgeNotification ¶
func NewEventBridgeNotification(ctx context.Context, cfg *NotificationConfig, awsCfg aws.Config) (Notification, func() error, error)
func NewNotification ¶
func NewNotification(ctx context.Context, cfg *NotificationConfig, awsCfg aws.Config) (Notification, func() error, error)
type NotificationConfig ¶
type NotificationConfig struct { Type NotificationType `yaml:"type,omitempty"` EventBus *string `yaml:"event_bus,omitempty"` EventFile *string `yaml:"event_file,omitempty"` }
func (*NotificationConfig) Restrict ¶
func (cfg *NotificationConfig) Restrict() error
Restrict restricts a configuration.
type NotificationType ¶
type NotificationType int
const ( NotificationTypeEventBridge NotificationType = iota NotificationTypeFile )
func NotificationTypeString ¶
func NotificationTypeString(s string) (NotificationType, error)
NotificationTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func NotificationTypeValues ¶
func NotificationTypeValues() []NotificationType
NotificationTypeValues returns all values of the enum
func (NotificationType) IsANotificationType ¶
func (i NotificationType) IsANotificationType() bool
IsANotificationType returns "true" if the value is listed in the enum definition. "false" otherwise
func (NotificationType) MarshalYAML ¶
func (i NotificationType) MarshalYAML() (interface{}, error)
MarshalYAML implements a YAML Marshaler for NotificationType
func (NotificationType) String ¶
func (i NotificationType) String() string
func (*NotificationType) UnmarshalYAML ¶
func (i *NotificationType) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements a YAML Unmarshaler for NotificationType
type RunMode ¶
type RunMode int
func DefaultRunMode ¶
func DefaultRunMode() RunMode
func RunModeString ¶
RunModeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (RunMode) IsARunMode ¶
IsARunMode returns "true" if the value is listed in the enum definition. "false" otherwise
type RunOptions ¶
type RunOptions struct { Mode RunMode LocalAddress string CLICommand CLICommand }
type SSMParameterStoreCredentialsBackend ¶ added in v0.1.0
type SSMParameterStoreCredentialsBackend struct {
// contains filtered or unexported fields
}
func NewSSMParameterStoreCredentialsBackend ¶ added in v0.1.0
func NewSSMParameterStoreCredentialsBackend(ctx context.Context, cfg *CredentialsBackendConfig, awsCfg aws.Config) (*SSMParameterStoreCredentialsBackend, error)
func (*SSMParameterStoreCredentialsBackend) WithCredentialsClientOption ¶ added in v0.1.0
func (cb *SSMParameterStoreCredentialsBackend) WithCredentialsClientOption(ctx context.Context, orig []option.ClientOption) ([]option.ClientOption, error)
type Storage ¶
type Storage interface { FindAllChannels(context.Context) (<-chan []*ChannelItem, error) FindOneByChannelID(context.Context, string) (*ChannelItem, error) UpdatePageToken(context.Context, *ChannelItem) error SaveChannel(context.Context, *ChannelItem) error DeleteChannel(context.Context, *ChannelItem) error }
func NewStorage ¶
type StorageConfig ¶
type StorageConfig struct { Type StorageType `yaml:"type,omitempty"` TableName *string `yaml:"table_name,omitempty"` DataFile *string `yaml:"data_file,omitempty"` LockFile *string `yaml:"lock_file,omitempty"` }
func (*StorageConfig) Restrict ¶
func (cfg *StorageConfig) Restrict() error
Restrict restricts a configuration.
type StorageType ¶
type StorageType int
const ( StorageTypeDynamoDB StorageType = iota StorageTypeFile )
func StorageTypeString ¶
func StorageTypeString(s string) (StorageType, error)
StorageTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func StorageTypeValues ¶
func StorageTypeValues() []StorageType
StorageTypeValues returns all values of the enum
func (StorageType) IsAStorageType ¶
func (i StorageType) IsAStorageType() bool
IsAStorageType returns "true" if the value is listed in the enum definition. "false" otherwise
func (StorageType) MarshalYAML ¶
func (i StorageType) MarshalYAML() (interface{}, error)
MarshalYAML implements a YAML Marshaler for StorageType
func (StorageType) String ¶
func (i StorageType) String() string
func (*StorageType) UnmarshalYAML ¶
func (i *StorageType) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements a YAML Unmarshaler for StorageType