Documentation ¶
Index ¶
- type Config
- type CreateApiRequest
- type CreateApiResponse
- type CreateKeyRequest
- type CreateKeyResponse
- type CreateRootKeyRequest
- type CreateRootKeyResponse
- type CreateWorkspaceRequestV1
- type CreateWorkspaceResponseV1
- type DeleteRootKeyRequest
- type DeleteRootKeyResponse
- type GetApiRequest
- type GetApiResponse
- type GetKeyRequest
- type GetKeyRequestV1
- type GetKeyResponse
- type GetKeyResponseV1
- type GetKeyStatsRequest
- type GetKeyStatsResponse
- type ListKeysRequest
- type ListKeysResponse
- type RemoveApiRequest
- type RemoveApiResponse
- type RemoveKeyRequestV1
- type RemoveKeyResponseV1
- type Server
- type UpdateKeyRequest
- type UpdateKeyResponse
- type VerifyKeyRequestV1
- type VerifyKeyResponseV1
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Logger logging.Logger KeyCache cache.Cache[entities.Key] // The ApiCache uses the KeyAuthId as cache key, not an apiId ApiCache cache.Cache[entities.Api] Database database.Database Ratelimit ratelimit.Ratelimiter GlobalRatelimit ratelimit.Ratelimiter Tracer trace.Tracer Analytics analytics.Analytics UnkeyAppAuthToken string UnkeyWorkspaceId string UnkeyApiId string UnkeyKeyAuthId string Region string EventBus events.EventBus Version string WorkspaceService workspaces.WorkspaceService ApiService apis.ApiService Metrics metrics.Metrics }
type CreateApiRequest ¶
type CreateApiRequest struct {
Name string `json:"name" validate:"required"`
}
type CreateApiResponse ¶
type CreateApiResponse struct {
ApiId string `json:"apiId"`
}
type CreateKeyRequest ¶
type CreateKeyRequest struct { ApiId string `json:"apiId" validate:"required"` Prefix string `json:"prefix"` Name string `json:"name"` ByteLength int `json:"byteLength"` OwnerId string `json:"ownerId"` Meta map[string]any `json:"meta"` Expires int64 `json:"expires"` Ratelimit *struct { Type string `json:"type" validate:"required,oneof=fast consistent"` Limit int32 `json:"limit" validate:"required"` RefillRate int32 `json:"refillRate" validate:"required"` RefillInterval int32 `json:"refillInterval" validate:"required"` } `json:"ratelimit"` // ForWorkspaceId is used internally when the frontend wants to create a new root key. // Therefore we might not want to add this field to our docs. ForWorkspaceId string `json:"forWorkspaceId"` // How often this key may be used // `undefined`, `0` or negative to disable Remaining int32 `json:"remaining,omitempty"` }
type CreateKeyResponse ¶
type CreateRootKeyRequest ¶
type CreateRootKeyRequest struct { Name string `json:"name"` Expires int64 `json:"expires"` // ForWorkspaceId is used internally when the frontend wants to create a new root key. // Therefore we might not want to add this field to our docs. ForWorkspaceId string `json:"forWorkspaceId" validate:"required"` OwnerId string `json:"ownerId"` }
type CreateRootKeyResponse ¶
type CreateWorkspaceResponseV1 ¶
type CreateWorkspaceResponseV1 struct {
Id string `json:"id"`
}
type DeleteRootKeyRequest ¶
type DeleteRootKeyRequest struct {
KeyId string `json:"keyId" validate:"required"`
}
type DeleteRootKeyResponse ¶
type DeleteRootKeyResponse struct { }
type GetApiRequest ¶
type GetApiRequest struct {
ApiId string `json:"apiId" validate:"required"`
}
type GetApiResponse ¶
type GetKeyRequest ¶
type GetKeyRequest struct {
KeyId string `validate:"required"`
}
type GetKeyRequestV1 ¶
type GetKeyRequestV1 struct {
KeyId string `validate:"required"`
}
type GetKeyResponse ¶
type GetKeyResponse = keyResponse
type GetKeyResponseV1 ¶
type GetKeyResponseV1 = keyResponse
type GetKeyStatsRequest ¶
type GetKeyStatsRequest struct {
KeyId string `validate:"required"`
}
type GetKeyStatsResponse ¶
type GetKeyStatsResponse struct {
Usage []usageRecord `json:"usage"`
}
type ListKeysRequest ¶
type ListKeysResponse ¶
type ListKeysResponse struct { Keys []keyResponse `json:"keys"` Total int64 `json:"total"` }
type RemoveApiRequest ¶
type RemoveApiRequest struct {
ApiId string `json:"apiId" validate:"required"`
}
type RemoveApiResponse ¶
type RemoveApiResponse struct { }
type RemoveKeyRequestV1 ¶
type RemoveKeyRequestV1 struct {
KeyId string `json:"keyId" validate:"required"`
}
type RemoveKeyResponseV1 ¶
type RemoveKeyResponseV1 struct { }
type UpdateKeyRequest ¶
type UpdateKeyRequest struct { KeyId string `json:"keyId" validate:"required"` Name nullish[string] `json:"name"` OwnerId nullish[string] `json:"ownerId"` Meta nullish[map[string]any] `json:"meta"` Expires nullish[int64] `json:"expires"` Ratelimit nullish[struct { Type string `json:"type" validate:"required"` Limit int32 `json:"limit" validate:"required"` RefillRate int32 `json:"refillRate" validate:"required"` RefillInterval int32 `json:"refillInterval" validate:"required"` }] `json:"ratelimit"` Remaining nullish[int32] `json:"remaining"` }
type UpdateKeyResponse ¶
type UpdateKeyResponse struct{}
type VerifyKeyRequestV1 ¶
type VerifyKeyResponseV1 ¶
type VerifyKeyResponseV1 struct { Valid bool `json:"valid"` OwnerId string `json:"ownerId,omitempty"` Meta map[string]any `json:"meta,omitempty"` Expires int64 `json:"expires,omitempty"` Remaining *int32 `json:"remaining,omitempty"` Ratelimit *ratelimitResponse `json:"ratelimit,omitempty"` Code string `json:"code,omitempty"` Error string `json:"error,omitempty"` }
Source Files ¶
- api_get.go
- authorize_root_key.go
- authorize_static_key.go
- key_delete.go
- key_get.go
- key_stats.go
- key_update.go
- keys_list.go
- liveness.go
- root_key_create.go
- root_key_delete.go
- server.go
- util.go
- v1_apis_create.go
- v1_apis_remove.go
- v1_key_create.go
- v1_key_find.go
- v1_key_remove.go
- v1_key_verify.go
- v1_workspace_create.go
Click to show internal directories.
Click to hide internal directories.