management

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: 11 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
}

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

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a REST client for the Hilt management API.

func NewClient

func NewClient(baseURL url.URL, partnerKey string, opts ...Option) *Client

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

func (c *Client) DeleteAccessKey(ctx context.Context, tenantID, accessKeyID string) error

DeleteAccessKey revokes an access key. It is idempotent server-side.

func (*Client) DeleteTenant

func (c *Client) DeleteTenant(ctx context.Context, tenantID string) error

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

func (c *Client) GetTenant(ctx context.Context, tenantID string) (api.Tenant, error)

GetTenant retrieves the tenant with the given external id.

func (*Client) ListAccessKeys

func (c *Client) ListAccessKeys(ctx context.Context, tenantID string) ([]api.AccessKey, error)

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

func WithHTTPClient(httpClient *http.Client) Option

WithHTTPClient sets the HTTP client used for requests. A nil client is ignored (the default http.DefaultClient is kept).

func WithLogger

func WithLogger(logger *zap.Logger) Option

WithLogger sets the logger. A nil logger is ignored (a no-op logger is kept).

Jump to

Keyboard shortcuts

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