Documentation ¶
Index ¶
Constants ¶
View Source
const ( QuotaTargetSrv quota.TargetSrv = "api_key" QuotaTarget quota.Target = "api_key" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct { ID int64 `db:"id" xorm:"pk autoincr 'id'"` OrgID int64 `db:"org_id" xorm:"org_id"` Name string `db:"name"` Key string `db:"key"` Role org.RoleType `db:"role"` Created time.Time `db:"created"` Updated time.Time `db:"updated"` LastUsedAt *time.Time `xorm:"last_used_at" db:"last_used_at"` Expires *int64 `db:"expires"` ServiceAccountId *int64 `db:"service_account_id"` IsRevoked *bool `xorm:"is_revoked" db:"is_revoked"` }
type AddCommand ¶
type AddCommand struct { Name string `json:"name" binding:"Required"` Role org.RoleType `json:"role" binding:"Required"` OrgID int64 `json:"-" xorm:"org_id"` Key string `json:"-"` SecondsToLive int64 `json:"secondsToLive"` ServiceAccountID *int64 `json:"-"` }
swagger:model AddAPIKeyCommand
type DeleteCommand ¶
type GetApiKeysQuery ¶
type GetByIDQuery ¶
type GetByIDQuery struct {
ApiKeyID int64
}
type GetByNameQuery ¶
type Service ¶
type Service interface { GetAPIKeys(ctx context.Context, query *GetApiKeysQuery) (res []*APIKey, err error) GetAllAPIKeys(ctx context.Context, orgID int64) ([]*APIKey, error) DeleteApiKey(ctx context.Context, cmd *DeleteCommand) error AddAPIKey(ctx context.Context, cmd *AddCommand) (res *APIKey, err error) GetApiKeyById(ctx context.Context, query *GetByIDQuery) (res *APIKey, err error) GetApiKeyByName(ctx context.Context, query *GetByNameQuery) (res *APIKey, err error) GetAPIKeyByHash(ctx context.Context, hash string) (*APIKey, error) UpdateAPIKeyLastUsedDate(ctx context.Context, tokenID int64) error // IsDisabled returns true if the API key is not available for use. IsDisabled(ctx context.Context, orgID int64) (bool, error) }
Click to show internal directories.
Click to hide internal directories.