api

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: Apache-2.0, MIT Imports: 10 Imported by: 0

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

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

type CreatedAccessKey struct {
	AccessKey
	SecretAccessKey string `json:"secretAccessKey"`
}

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

func NewDeleteTenantHandler(logger *zap.Logger, tenants *tenantsvc.Service) Route

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

func NewGetTenantHandler(logger *zap.Logger, tenants *tenantsvc.Service) Route

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

func NewProvisionTenantHandler(logger *zap.Logger, tenants *tenantsvc.Service) Route

NewProvisionTenantHandler handles PUT /tenants/{tenantId} — provision a tenant (idempotent on the external {tenantId}).

func NewRoute

func NewRoute(method, path string, handler echo.HandlerFunc) Route

NewRoute builds a Route from a method, path, and handler.

func NewUpdateTenantStatusHandler

func NewUpdateTenantStatusHandler(logger *zap.Logger, tenants *tenantsvc.Service) Route

NewUpdateTenantStatusHandler handles POST /tenants/{tenantId}/status — update tenant access mode.

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL