Documentation
¶
Overview ¶
Package api defines the HTTP handlers for the Hilt tenant management API (the fil-one service orchestrator "Tenant API"). Handlers are exposed as Route values, collected via fx and registered on the echo server.
Index ¶
- type AccessKey
- type AccessKeyList
- type CreateAccessKeyRequest
- type CreatedAccessKey
- type ProvisionTenantRequest
- type Route
- func NewCreateAccessKeyHandler(logger *zap.Logger, accessKeys *accesskeysvc.Service) Route
- func NewDeleteAccessKeyHandler(logger *zap.Logger, accessKeys *accesskeysvc.Service) Route
- func NewDeleteTenantHandler(logger *zap.Logger, tenants *tenantsvc.Service) Route
- func NewGetAccessKeyHandler(logger *zap.Logger, accessKeys *accesskeysvc.Service) Route
- func NewGetTenantHandler(logger *zap.Logger, tenants *tenantsvc.Service) Route
- func NewListAccessKeysHandler(logger *zap.Logger, accessKeys *accesskeysvc.Service) Route
- func NewProvisionTenantHandler(logger *zap.Logger, tenants *tenantsvc.Service) Route
- func NewRoute(method, path string, handler echo.HandlerFunc) Route
- func NewUpdateTenantStatusHandler(logger *zap.Logger, tenants *tenantsvc.Service) Route
- type Tenant
- type TenantStatus
- type UpdateTenantStatusRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessKey ¶
type AccessKey struct {
AccessKeyID string `json:"accessKeyId"`
Name string `json:"name"`
Permissions []string `json:"permissions"`
Buckets []string `json:"buckets,omitempty"`
ExpiresAt *time.Time `json:"expiresAt"`
CreatedAt time.Time `json:"createdAt"`
}
AccessKey is the metadata for an S3 access key (never includes the secret).
type AccessKeyList ¶
type AccessKeyList struct {
Items []AccessKey `json:"items"`
}
AccessKeyList is the body of GET /tenants/{tenantId}/access-keys.
type CreateAccessKeyRequest ¶
type CreateAccessKeyRequest struct {
Name string `json:"name"`
Permissions []string `json:"permissions"`
Buckets []string `json:"buckets,omitempty"`
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
}
CreateAccessKeyRequest is the body of POST /tenants/{tenantId}/access-keys.
type CreatedAccessKey ¶
CreatedAccessKey is returned only by POST /tenants/{tenantId}/access-keys and is the one time the secret access key is exposed.
type ProvisionTenantRequest ¶
type ProvisionTenantRequest struct {
Region string `json:"region"`
}
ProvisionTenantRequest is the body of PUT /tenants/{tenantId}.
type Route ¶
type Route struct {
Method string
Path string
Handler echo.HandlerFunc
}
Route maps an HTTP method and path to the echo handler that serves it. A Route can be carried as a value — e.g. collected via dependency injection — and registered on an echo server later.
func NewCreateAccessKeyHandler ¶
func NewCreateAccessKeyHandler(logger *zap.Logger, accessKeys *accesskeysvc.Service) Route
NewCreateAccessKeyHandler handles POST /tenants/{tenantId}/access-keys — create an S3 access-key pair (returns the secret once only) and issue the tenant→access-key UCAN delegations for the requested permissions.
func NewDeleteAccessKeyHandler ¶
func NewDeleteAccessKeyHandler(logger *zap.Logger, accessKeys *accesskeysvc.Service) Route
NewDeleteAccessKeyHandler handles DELETE /tenants/{tenantId}/access-keys/{accessKeyId} — revoke an S3 access key.
func NewDeleteTenantHandler ¶
NewDeleteTenantHandler handles DELETE /tenants/{tenantId} — permanently delete a tenant (must be disabled first). Idempotent.
func NewGetAccessKeyHandler ¶
func NewGetAccessKeyHandler(logger *zap.Logger, accessKeys *accesskeysvc.Service) Route
NewGetAccessKeyHandler handles GET /tenants/{tenantId}/access-keys/{accessKeyId} — retrieve access-key metadata (secret never returned).
func NewGetTenantHandler ¶
NewGetTenantHandler handles GET /tenants/{tenantId} — retrieve tenant operational state and quotas.
func NewListAccessKeysHandler ¶
func NewListAccessKeysHandler(logger *zap.Logger, accessKeys *accesskeysvc.Service) Route
NewListAccessKeysHandler handles GET /tenants/{tenantId}/access-keys — list all S3 access keys for a tenant (excludes secrets).
func NewProvisionTenantHandler ¶
NewProvisionTenantHandler handles PUT /tenants/{tenantId} — provision a tenant (idempotent on the external {tenantId}).
type Tenant ¶
type Tenant struct {
TenantID string `json:"tenantId"`
Status TenantStatus `json:"status"`
BucketCount int `json:"bucketCount"`
BucketLimit int `json:"bucketLimit"`
AccessKeyCount int `json:"accessKeyCount"`
AccessKeyLimit int `json:"accessKeyLimit"`
CreatedAt time.Time `json:"createdAt"`
}
Tenant is the operational state and quotas for a tenant.
type TenantStatus ¶
type TenantStatus string
TenantStatus is the access mode of a tenant.
const ( TenantStatusActive TenantStatus = "active" TenantStatusWriteLocked TenantStatus = "write-locked" TenantStatusDisabled TenantStatus = "disabled" )
type UpdateTenantStatusRequest ¶
type UpdateTenantStatusRequest struct {
Status TenantStatus `json:"status"`
}
UpdateTenantStatusRequest is the body of POST /tenants/{tenantId}/status.
Directories
¶
| Path | Synopsis |
|---|---|
|
service
|
|
|
accesskey
Package accesskey provides the S3 access-key business logic for the REST API: creation (key-pair generation + tenant→access-key delegation issuance), listing, retrieval, and revocation.
|
Package accesskey provides the S3 access-key business logic for the REST API: creation (key-pair generation + tenant→access-key delegation issuance), listing, retrieval, and revocation. |
|
tenant
Package tenant provides the tenant-management business logic for the REST API: provisioning (did:plc key generation + PLC publication + upload-service registration), status updates, and deletion (with cascade + DID deactivation).
|
Package tenant provides the tenant-management business logic for the REST API: provisioning (did:plc key generation + PLC publication + upload-service registration), status updates, and deletion (with cascade + DID deactivation). |