Documentation ¶
Overview ¶
Package firestoreFirestoreBackend implements Firestore storage backend for Teleport auth service, similar to DynamoDB backend.
firestore package implements the FirestoreBackend storage back-end for the auth server. Originally contributed by https://github.com/joshdurbin
Index ¶
- Constants
- func ConvertGRPCError(err error, args ...interface{}) error
- func CreateFirestoreClients(ctx context.Context, projectID string, endPoint string, credentialsFile string) (*apiv1.FirestoreAdminClient, *firestore.Client, error)
- func EnsureIndexes(ctx context.Context, adminSvc *apiv1.FirestoreAdminClient, tuples IndexList, ...) error
- func Field(name string, order adminpb.Index_IndexField_Order) *adminpb.Index_IndexField
- func GetName() string
- func RetryingAsyncFunctionRunner(ctx context.Context, retryConfig retryutils.LinearConfig, logger *log.Logger, ...)
- type Backend
- func (cfg *Backend) CheckAndSetDefaults() error
- func (b *Backend) Clock() clockwork.Clock
- func (b *Backend) Close() error
- func (b *Backend) CloseWatchers()
- func (b *Backend) CompareAndSwap(ctx context.Context, expected backend.Item, replaceWith backend.Item) (*backend.Lease, error)
- func (b *Backend) Create(ctx context.Context, item backend.Item) (*backend.Lease, error)
- func (b *Backend) Delete(ctx context.Context, key []byte) error
- func (b *Backend) DeleteRange(ctx context.Context, startKey, endKey []byte) error
- func (b *Backend) Get(ctx context.Context, key []byte) (*backend.Item, error)
- func (b *Backend) GetRange(ctx context.Context, startKey []byte, endKey []byte, limit int) (*backend.GetResult, error)
- func (b *Backend) KeepAlive(ctx context.Context, lease backend.Lease, expires time.Time) error
- func (b *Backend) NewWatcher(ctx context.Context, watch backend.Watch) (backend.Watcher, error)
- func (b *Backend) Put(ctx context.Context, item backend.Item) (*backend.Lease, error)
- func (b *Backend) Update(ctx context.Context, item backend.Item) (*backend.Lease, error)
- type Config
- type IndexList
- type Options
Constants ¶
const (
// BackendName is the name of this backend
BackendName = "firestore"
)
Variables ¶
This section is empty.
Functions ¶
func ConvertGRPCError ¶
ConvertGRPCError converts GRPC errors
func CreateFirestoreClients ¶
func CreateFirestoreClients(ctx context.Context, projectID string, endPoint string, credentialsFile string) (*apiv1.FirestoreAdminClient, *firestore.Client, error)
CreateFirestoreClients creates a firestore admin and normal client given the supplied parameters
func EnsureIndexes ¶
func EnsureIndexes(ctx context.Context, adminSvc *apiv1.FirestoreAdminClient, tuples IndexList, indexParent string) error
EnsureIndexes is a function used by Firestore events and backend to generate indexes and will block until indexes are reported as created
func Field ¶
func Field(name string, order adminpb.Index_IndexField_Order) *adminpb.Index_IndexField
func GetName ¶
func GetName() string
GetName is a part of backend API and it returns Firestore backend type as it appears in `storage/type` section of Teleport YAML
func RetryingAsyncFunctionRunner ¶
func RetryingAsyncFunctionRunner(ctx context.Context, retryConfig retryutils.LinearConfig, logger *log.Logger, task func() error, taskName string)
RetryingAsyncFunctionRunner wraps a task target in retry logic
Types ¶
type Backend ¶
Backend is a Firestore-backed key value backend implementation.
func New ¶
New returns new instance of Firestore backend. It's an implementation of backend API's NewFunc
func (*Backend) CheckAndSetDefaults ¶
func (cfg *Backend) CheckAndSetDefaults() error
CheckAndSetDefaults is a helper returns an error if the supplied configuration is not enough to connect to Firestore
func (*Backend) Close ¶
Close closes the Firestore client contexts and releases associated resources
func (*Backend) CloseWatchers ¶
func (b *Backend) CloseWatchers()
CloseWatchers closes all the watchers without closing the backend
func (*Backend) CompareAndSwap ¶
func (b *Backend) CompareAndSwap(ctx context.Context, expected backend.Item, replaceWith backend.Item) (*backend.Lease, error)
CompareAndSwap compares and swap values in atomic operation CompareAndSwap compares item with existing item and replaces is with replaceWith item
func (*Backend) DeleteRange ¶
DeleteRange deletes range of items with keys between startKey and endKey
func (*Backend) GetRange ¶
func (b *Backend) GetRange(ctx context.Context, startKey []byte, endKey []byte, limit int) (*backend.GetResult, error)
GetRange returns range of elements
func (*Backend) KeepAlive ¶
KeepAlive keeps object from expiring, updates lease on the existing object, expires contains the new expiry to set on the lease, some backends may ignore expires based on the implementation in case if the lease managed server side
func (*Backend) NewWatcher ¶
NewWatcher returns a new event watcher
type Config ¶
type Config struct { // Credentials path for the Firestore client CredentialsPath string `json:"credentials_path,omitempty"` // Google Project ID of Collection containing events ProjectID string `json:"project_id,omitempty"` // CollectName is the name of the collection containing events CollectionName string `json:"collection_name,omitempty"` // PurgeExpiredDocumentsPollInterval is the poll interval used to purge expired documents PurgeExpiredDocumentsPollInterval time.Duration `json:"purge_expired_documents_poll_interval,omitempty"` // RetryPeriod is a period between retry executions of long-lived document snapshot queries and purging expired records RetryPeriod time.Duration `json:"retry_period,omitempty"` // DisableExpiredDocumentPurge DisableExpiredDocumentPurge bool `json:"disable_expired_document_purge,omitempty"` // EndPoint is used to point the Firestore clients at emulated Firestore storage. EndPoint string `json:"endpoint,omitempty"` }
Config structure represents Firestore configuration as appears in `storage` section of Teleport YAML
type IndexList ¶
type IndexList [][]*adminpb.Index_IndexField
func (*IndexList) Index ¶
func (l *IndexList) Index(fields ...*adminpb.Index_IndexField)