storage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package storage provides the direct-transfer Platform93 object storage flow. It never receives or stores S3 credentials; Platform93 authorizes short-lived transfer URLs for the authenticated application actor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL       string
	ApplicationID string
	AccessToken   func(context.Context) (string, error)
	HTTPClient    *http.Client
}

func (*Client) CompleteUpload

func (c *Client) CompleteUpload(ctx context.Context, objectID, workspaceID string) (Object, error)

func (*Client) CreateUpload

func (c *Client) CreateUpload(ctx context.Context, input CreateUpload, idempotencyKey, workspaceID string) (UploadAuthorization, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, objectID, workspaceID string) error

func (*Client) Download

func (c *Client) Download(ctx context.Context, objectID, workspaceID string) (Download, error)

func (*Client) List

func (c *Client) List(ctx context.Context, workspaceID string) (Page, error)

func (*Client) Put

func (c *Client) Put(ctx context.Context, authorization UploadAuthorization, body io.Reader) error

Put transfers bytes directly to the provider URL using only the headers that were signed into the authorization. It does not send the Platform93 token.

type CreateUpload

type CreateUpload struct {
	Filename    string         `json:"filename"`
	ContentType string         `json:"content_type"`
	SizeBytes   int64          `json:"size_bytes"`
	Visibility  string         `json:"visibility"`
	Purpose     string         `json:"purpose,omitempty"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

type Download

type Download struct {
	URL        string     `json:"url"`
	ExpiresAt  *time.Time `json:"expires_at"`
	Visibility string     `json:"visibility"`
}

type Object

type Object struct {
	ID              string         `json:"id"`
	ApplicationID   *string        `json:"application_id"`
	ProviderID      string         `json:"provider_id"`
	OwnerType       string         `json:"owner_type"`
	OwnerID         *string        `json:"owner_id"`
	Visibility      string         `json:"visibility"`
	Filename        string         `json:"filename"`
	ContentType     string         `json:"content_type"`
	SizeBytes       int64          `json:"size_bytes"`
	ETag            *string        `json:"etag"`
	Metadata        map[string]any `json:"metadata"`
	Status          string         `json:"status"`
	PublicURL       *string        `json:"public_url"`
	UploadExpiresAt *time.Time     `json:"upload_expires_at"`
	ReadyAt         *time.Time     `json:"ready_at"`
	LastError       *string        `json:"last_error"`
	Version         int64          `json:"version"`
	CreatedAt       time.Time      `json:"created_at"`
	UpdatedAt       time.Time      `json:"updated_at"`
}

type Page

type Page struct {
	Items      []Object `json:"items"`
	NextCursor *string  `json:"next_cursor"`
}

type UploadAuthorization

type UploadAuthorization struct {
	Object          Object            `json:"object"`
	UploadURL       string            `json:"upload_url"`
	UploadExpiresAt time.Time         `json:"upload_expires_at"`
	RequiredHeaders map[string]string `json:"required_headers"`
}

Jump to

Keyboard shortcuts

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