Files
hatchet/pkg/repository/api_token.go
T
abelanger5 5d87f380ef feat: managed worker pools (#725)
* change api extension spec to register custom populators

* fix: support only bearer auth

* fix: correct authn logic

* fix: indexes on workflow runs, events

* feat: managed worker pools

* chore: lint fix

* hide workers view when not enabled

* support internal api tokens, minor improvements

* fix: actually write internal

* fix breaking changes

* don't allow revoking internal tokens

* fix: linting and remove metrics view

* fix: token

* address review and add feat flags
2024-07-16 13:33:46 +00:00

37 lines
917 B
Go

package repository
import (
"context"
"time"
"github.com/hatchet-dev/hatchet/pkg/repository/prisma/db"
"github.com/hatchet-dev/hatchet/pkg/repository/prisma/dbsqlc"
)
type CreateAPITokenOpts struct {
// The id of the token
ID string `validate:"required,uuid"`
// When the token expires
ExpiresAt time.Time
// (optional) A tenant ID for this API token
TenantId *string `validate:"omitempty,uuid"`
// (optional) A name for this API token
Name *string `validate:"omitempty,max=255"`
Internal bool
}
type APITokenRepository interface {
GetAPITokenById(id string) (*db.APITokenModel, error)
RevokeAPIToken(id string) error
ListAPITokensByTenant(tenantId string) ([]db.APITokenModel, error)
}
type EngineTokenRepository interface {
CreateAPIToken(ctx context.Context, opts *CreateAPITokenOpts) (*dbsqlc.APIToken, error)
GetAPITokenById(ctx context.Context, id string) (*dbsqlc.APIToken, error)
}