Files
teleport/lib/services/databaseobject.go
T
Krzysztof Skrzętnickiandrosstimothy a094350a9b Cache support for database objects (#41692)
* Cache support for database objects

* Update tests

* lint fix

* Restore public API functions

* Implement `databaseObjectExecutor.deleteAll()` through now-exported `local.DatabaseObjectService`

* Drop removed field

* Update lib/services/local/databaseobject.go

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* Fix lint

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2024-05-27 11:36:58 +00:00

52 lines
2.1 KiB
Go

/*
* Teleport
* Copyright (C) 2024 Gravitational, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package services
import (
"context"
dbobjectv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/dbobject/v1"
)
// DatabaseObjects manages DatabaseObject resources.
type DatabaseObjects interface {
DatabaseObjectsGetter
// CreateDatabaseObject will create a new DatabaseObject resource.
CreateDatabaseObject(ctx context.Context, object *dbobjectv1.DatabaseObject) (*dbobjectv1.DatabaseObject, error)
// UpsertDatabaseObject creates a new DatabaseObject or forcefully updates an existing DatabaseObject.
UpsertDatabaseObject(ctx context.Context, object *dbobjectv1.DatabaseObject) (*dbobjectv1.DatabaseObject, error)
// DeleteDatabaseObject will delete a DatabaseObject resource.
DeleteDatabaseObject(ctx context.Context, name string) error
// UpdateDatabaseObject updates an existing DatabaseObject.
UpdateDatabaseObject(ctx context.Context, object *dbobjectv1.DatabaseObject) (*dbobjectv1.DatabaseObject, error)
}
// DatabaseObjectsGetter defines methods for fetching database objects.
type DatabaseObjectsGetter interface {
// GetDatabaseObject will get a DatabaseObject resource by name.
GetDatabaseObject(ctx context.Context, name string) (*dbobjectv1.DatabaseObject, error)
// ListDatabaseObjects will list DatabaseObject resources.
ListDatabaseObjects(ctx context.Context, size int, pageToken string) ([]*dbobjectv1.DatabaseObject, string, error)
}