client

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminClient

type AdminClient struct {
	Issuer   ucan.Issuer
	Executor execution.Executor
	Logger   *zap.Logger
}

AdminClient invokes Hilt's /admin/* UCAN RPC commands. These are self-issued: the issuer must be Hilt's own service identity and the subject is the service itself, so no delegation proofs are attached. Construct it with NewAdminClient, passing the service identity as the issuer.

func NewAdminClient

func NewAdminClient(issuer ucan.Issuer, serviceURL url.URL, logger *zap.Logger) (*AdminClient, error)

NewAdminClient creates an admin client for Hilt's UCAN RPC API at serviceURL. issuer is the service identity: admin commands are self-issued, so its DID is the invocation issuer, subject and audience.

func (*AdminClient) AddProvider

func (c *AdminClient) AddProvider(ctx context.Context, providerID did.DID, region string) error

AddProvider invokes /admin/provider/add to register a regional provider. No proofs are attached: the subject is the service itself, so authority is implicit in the issuer being the service identity.

type Client

type Client struct {
	ServiceID did.DID            // Hilt's DID (invocation subject + audience)
	Issuer    ucan.Issuer        // default invocation issuer (e.g. Ingot)
	Proofs    ucanlib.ProofStore // supplies the Hilt→issuer proof chains
	Executor  execution.Executor
	Logger    *zap.Logger
}

Client invokes Hilt's S3 UCAN RPC commands (the caller is typically Ingot). Construct it with New; each method invokes one /s3/* command. Commands whose result carries re-delegated proof chains (AuthorizeRequest, CreateBucket, BucketInfo) also return the response container so the caller can extract the delegation blocks via ucan.Container.Delegations.

func New

func New(serviceID did.DID, serviceURL url.URL, issuer ucan.Issuer, proofs ucanlib.ProofStore, opts ...Option) (*Client, error)

New creates a Client for Hilt's UCAN RPC API at serviceURL, identified by serviceID (Hilt's DID). issuer signs invocations and proofs supplies the delegation chains from Hilt to the issuer; both are defaults, overridable per call with WithIssuer / WithProofs.

func (*Client) AuthorizeRequest

func (c *Client) AuthorizeRequest(ctx context.Context, req s3.Request, opts ...MethodOption) (*s3req.AuthorizeOK, ucan.Container, error)

AuthorizeRequest invokes /s3/request/authorize. The returned container carries the delegations Hilt re-delegated to the invocation issuer.

func (*Client) BucketInfo

func (c *Client) BucketInfo(ctx context.Context, name string, accessKey did.DID, opts ...MethodOption) (*s3bkt.InfoOK, ucan.Container, error)

BucketInfo invokes /s3/bucket/info for the named bucket and access key. The returned container carries the bucket→access-key delegation chains.

func (*Client) CreateBucket

func (c *Client) CreateBucket(ctx context.Context, req s3.Request, opts ...MethodOption) (*s3req.AuthorizeOK, ucan.Container, error)

CreateBucket invokes /s3/bucket/create. The returned container carries the delegation chains that now grant the access key access to the new bucket.

func (*Client) DeleteBucket

func (c *Client) DeleteBucket(ctx context.Context, req s3.Request, opts ...MethodOption) error

DeleteBucket invokes /s3/bucket/delete. It returns no delegations.

func (*Client) ListBuckets

func (c *Client) ListBuckets(ctx context.Context, req s3.Request, opts ...MethodOption) (*s3bkt.ListOK, error)

ListBuckets invokes /s3/bucket/list. It returns no delegations.

type MethodOption

type MethodOption func(*methodConfig)

func WithIssuer

func WithIssuer(iss ucan.Issuer) MethodOption

func WithProofs

func WithProofs(proofs ucanlib.ProofStore) MethodOption

type Option

type Option func(*clientConfig)

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

func WithLogger

func WithLogger(logger *zap.Logger) Option

func WithProduct

func WithProduct(product did.DID) Option

WithProduct sets the default product/plan DID used when registering customers (see UploadClient.RegisterCustomer).

type UploadClient

type UploadClient struct {
	ServiceID did.DID
	Issuer    ucan.Issuer
	Proofs    ucanlib.ProofStore
	Product   did.DID
	Executor  execution.Executor
	Logger    *zap.Logger
}

func NewUploadClient

func NewUploadClient(serviceID did.DID, serviceURL url.URL, issuer ucan.Issuer, proofs ucanlib.ProofStore, opts ...Option) (*UploadClient, error)

NewUploadClient creates a new UploadClient for interacting with the upload service. The issuer and proofs parameters are used as the default issuer and proof set if none are provided as individual method options.

func (*UploadClient) ProvisionSpace

func (c *UploadClient) ProvisionSpace(ctx context.Context, account ucan.Issuer, space did.DID) (string, error)

ProvisionSpace provisions a new space with the upload service. It returns the ID of the subscription that was set up.

func (*UploadClient) RegisterCustomer

func (c *UploadClient) RegisterCustomer(ctx context.Context, customer did.DID, product did.DID, details map[string]string, opts ...MethodOption) error

RegisterCustomer registers a new customer with the upload service.

func (*UploadClient) SpaceEmpty

func (c *UploadClient) SpaceEmpty(ctx context.Context, space did.DID, opts ...MethodOption) (bool, error)

SpaceEmpty checks whether the given space is empty (contains no blobs).

Directories

Path Synopsis
Package management provides a REST client for Hilt's tenant and access-key management API (the handlers in pkg/api).
Package management provides a REST client for Hilt's tenant and access-key management API (the handlers in pkg/api).

Jump to

Keyboard shortcuts

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