Documentation
¶
Overview ¶
Package management provides a REST client for Hilt's tenant and access-key management API (the handlers in pkg/api). It authenticates with the partner key as an HTTP bearer token and speaks plain JSON — it is not a UCAN client (cf. the UCAN clients in the parent pkg/client package).
Index ¶
- type APIError
- type Client
- func (c *Client) CreateAccessKey(ctx context.Context, tenantID string, req api.CreateAccessKeyRequest) (api.CreatedAccessKey, error)
- func (c *Client) DeleteAccessKey(ctx context.Context, tenantID, accessKeyID string) error
- func (c *Client) DeleteTenant(ctx context.Context, tenantID string) error
- func (c *Client) GetAccessKey(ctx context.Context, tenantID, accessKeyID string) (api.AccessKey, error)
- func (c *Client) GetTenant(ctx context.Context, tenantID string) (api.Tenant, error)
- func (c *Client) ListAccessKeys(ctx context.Context, tenantID string) ([]api.AccessKey, error)
- func (c *Client) ProvisionTenant(ctx context.Context, tenantID string, req api.ProvisionTenantRequest) (api.Tenant, error)
- func (c *Client) UpdateTenantStatus(ctx context.Context, tenantID string, status api.TenantStatus) error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
APIError is returned when the server responds with an unexpected status code. It carries the HTTP status and the server's error message so callers can branch on the status (e.g. 404 Not Found, 409 Conflict).
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a REST client for the Hilt management API.
func NewClient ¶
NewClient creates a management API client that targets baseURL and authenticates with partnerKey (sent as "Authorization: Bearer <partnerKey>").
func (*Client) CreateAccessKey ¶
func (c *Client) CreateAccessKey(ctx context.Context, tenantID string, req api.CreateAccessKeyRequest) (api.CreatedAccessKey, error)
CreateAccessKey creates an S3 access key for the tenant. The returned api.CreatedAccessKey is the only time the secret access key is exposed.
func (*Client) DeleteAccessKey ¶
DeleteAccessKey revokes an access key. It is idempotent server-side.
func (*Client) DeleteTenant ¶
DeleteTenant permanently deletes the tenant. It is idempotent server-side.
func (*Client) GetAccessKey ¶
func (c *Client) GetAccessKey(ctx context.Context, tenantID, accessKeyID string) (api.AccessKey, error)
GetAccessKey retrieves metadata for a single access key.
func (*Client) ListAccessKeys ¶
ListAccessKeys lists the tenant's access keys (secrets are never included).
func (*Client) ProvisionTenant ¶
func (c *Client) ProvisionTenant(ctx context.Context, tenantID string, req api.ProvisionTenantRequest) (api.Tenant, error)
ProvisionTenant provisions (or, idempotently, returns) the tenant with the given external id.
func (*Client) UpdateTenantStatus ¶
func (c *Client) UpdateTenantStatus(ctx context.Context, tenantID string, status api.TenantStatus) error
UpdateTenantStatus updates the access mode of the tenant.
type Option ¶
type Option func(*config)
Option configures a Client.
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client used for requests. A nil client is ignored (the default http.DefaultClient is kept).
func WithLogger ¶
WithLogger sets the logger. A nil logger is ignored (a no-op logger is kept).