Documentation ¶
Index ¶
- Variables
- func BotResourceName(botName string) string
- func UpsertBot(ctx context.Context, backend Backend, bot *pb.Bot, now time.Time, ...) (*pb.Bot, error)
- type Backend
- type BotService
- func (bs *BotService) CreateBot(ctx context.Context, req *pb.CreateBotRequest) (*pb.Bot, error)
- func (bs *BotService) CreateBotLegacy(ctx context.Context, req *proto.CreateBotRequest) (*proto.CreateBotResponse, error)
- func (bs *BotService) DeleteBot(ctx context.Context, req *pb.DeleteBotRequest) (*emptypb.Empty, error)
- func (bs *BotService) GetBot(ctx context.Context, req *pb.GetBotRequest) (*pb.Bot, error)
- func (bs *BotService) GetBotUsersLegacy(ctx context.Context) ([]types.User, error)
- func (bs *BotService) ListBots(ctx context.Context, req *pb.ListBotsRequest) (*pb.ListBotsResponse, error)
- func (bs *BotService) UpdateBot(ctx context.Context, req *pb.UpdateBotRequest) (*pb.Bot, error)
- func (bs *BotService) UpsertBot(ctx context.Context, req *pb.UpsertBotRequest) (*pb.Bot, error)
- type BotServiceConfig
- type Cache
Constants ¶
This section is empty.
Variables ¶
var SupportedJoinMethods = []types.JoinMethod{ types.JoinMethodAzure, types.JoinMethodCircleCI, types.JoinMethodGCP, types.JoinMethodGitHub, types.JoinMethodGitLab, types.JoinMethodIAM, types.JoinMethodKubernetes, types.JoinMethodSpacelift, types.JoinMethodToken, }
SupportedJoinMethods should match SupportedJoinMethods declared in lib/tbot/config
Functions ¶
func BotResourceName ¶
BotResourceName returns the default name for resources associated with the given named bot.
func UpsertBot ¶
func UpsertBot( ctx context.Context, backend Backend, bot *pb.Bot, now time.Time, createdBy string, ) (*pb.Bot, error)
UpsertBot creates a new bot or forcefully updates an existing bot. This is a function rather than a method so that it can be used by both the gRPC service and the auth server init code when dealing with resources to be applied at startup.
Types ¶
type Backend ¶
type Backend interface { // CreateUser creates user, only if the user entry does not exist CreateUser(ctx context.Context, user types.User) (types.User, error) // CreateRole creates role, only if the role entry does not exist CreateRole(ctx context.Context, role types.Role) (types.Role, error) // UpdateUser updates an existing user if revisions match. UpdateUser(ctx context.Context, user types.User) (types.User, error) // UpdateRole updates an existing role if revisions match. UpdateRole(ctx context.Context, role types.Role) (types.Role, error) // UpsertUser creates a new user or forcefully updates an existing user. UpsertUser(ctx context.Context, user types.User) (types.User, error) // UpsertRole creates a new role or forcefully updates an existing role. UpsertRole(ctx context.Context, role types.Role) (types.Role, error) // UpsertToken creates a new token or forcefully updates an existing token. UpsertToken(ctx context.Context, token types.ProvisionToken) error // DeleteRole deletes a role by name. DeleteRole(ctx context.Context, name string) error // DeleteUser deletes a user and all associated objects. DeleteUser(ctx context.Context, user string) error // GetUser returns a user by name. GetUser(ctx context.Context, name string, withSecrets bool) (types.User, error) // GetRole returns a role by name. GetRole(ctx context.Context, name string) (types.Role, error) // GetToken returns a token by name. GetToken(ctx context.Context, name string) (types.ProvisionToken, error) }
Backend is the subset of the backend resources that the Service modifies.
type BotService ¶
type BotService struct { pb.UnimplementedBotServiceServer // contains filtered or unexported fields }
BotService implements the teleport.machineid.v1.BotService RPC service.
func NewBotService ¶
func NewBotService(cfg BotServiceConfig) (*BotService, error)
NewBotService returns a new instance of the BotService.
func (*BotService) CreateBot ¶
func (bs *BotService) CreateBot( ctx context.Context, req *pb.CreateBotRequest, ) (*pb.Bot, error)
CreateBot creates a new bot. It will throw an error if the bot already exists.
func (*BotService) CreateBotLegacy ¶
func (bs *BotService) CreateBotLegacy(ctx context.Context, req *proto.CreateBotRequest) (*proto.CreateBotResponse, error)
CreateBotLegacy creates a bot and a join token. TODO(noah): DELETE IN 16.0.0 Deprecated: Switch to calling BotService.CreateBot and CreateToken separately.
func (*BotService) DeleteBot ¶
func (bs *BotService) DeleteBot( ctx context.Context, req *pb.DeleteBotRequest, ) (*emptypb.Empty, error)
DeleteBot deletes an existing bot. It will throw an error if the bot does not exist.
func (*BotService) GetBot ¶
func (bs *BotService) GetBot(ctx context.Context, req *pb.GetBotRequest) (*pb.Bot, error)
GetBot gets a bot by name. It will throw an error if the bot does not exist.
func (*BotService) GetBotUsersLegacy ¶
GetBotUsersLegacy fetches all Users with the BotLabel field set. Users are fetched without secrets. TODO(noah): DELETE IN 16.0.0 Deprecated: Switch to BotService.ListBots.
func (*BotService) ListBots ¶
func (bs *BotService) ListBots( ctx context.Context, req *pb.ListBotsRequest, ) (*pb.ListBotsResponse, error)
ListBots lists all bots.
func (*BotService) UpdateBot ¶
func (bs *BotService) UpdateBot( ctx context.Context, req *pb.UpdateBotRequest, ) (*pb.Bot, error)
UpdateBot updates an existing bot. It will throw an error if the bot does not exist.
func (*BotService) UpsertBot ¶
func (bs *BotService) UpsertBot(ctx context.Context, req *pb.UpsertBotRequest) (*pb.Bot, error)
UpsertBot creates a new bot or forcefully updates an existing bot.
type BotServiceConfig ¶
type BotServiceConfig struct { Authorizer authz.Authorizer Cache Cache Backend Backend Logger logrus.FieldLogger Emitter apievents.Emitter Reporter usagereporter.UsageReporter Clock clockwork.Clock }
BotServiceConfig holds configuration options for the bots gRPC service.
type Cache ¶
type Cache interface { // GetUser returns a user by name. GetUser(ctx context.Context, user string, withSecrets bool) (types.User, error) // ListUsers lists users ListUsers(ctx context.Context, pageSize int, pageToken string, withSecrets bool) ([]types.User, string, error) // GetRole returns a role by name. GetRole(ctx context.Context, name string) (types.Role, error) }
Cache is the subset of the cached resources that the Service queries.