service

package
v0.0.0-...-ee57881 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MaxContentLength = 10 * 1024 * 1024

MaxContentLength is 10MiB.

View Source
const PresignGetExpires time.Duration = 1 * duration.PerHour

PresignGetExpires is how long the presign GET request remains valid.

Variables

Functions

This section is empty.

Types

type HeaderField

type HeaderField struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type ImagesCloudStorageService

type ImagesCloudStorageService struct {
	HTTPClient ImagesCloudStorageServiceHTTPClient
	Storage    ImagesCloudStorageServiceStorage
}

func (*ImagesCloudStorageService) MakeDirector

func (p *ImagesCloudStorageService) MakeDirector(extractKey func(r *http.Request) string) func(r *http.Request)

func (*ImagesCloudStorageService) PresignPutRequest

type ImagesCloudStorageServiceHTTPClient

type ImagesCloudStorageServiceHTTPClient struct {
	*http.Client
}

func NewImagesCloudStorageServiceHTTPClient

func NewImagesCloudStorageServiceHTTPClient() ImagesCloudStorageServiceHTTPClient

type ImagesCloudStorageServiceStorage

type ImagesCloudStorageServiceStorage interface {
	PresignPutObject(ctx context.Context, name string, header http.Header) (*http.Request, error)
	PresignHeadObject(ctx context.Context, name string, expire time.Duration) (*url.URL, error)
	MakeDirector(extractKey func(r *http.Request) string, expire time.Duration) func(r *http.Request)
}

type PresignUploadRequest

type PresignUploadRequest struct {
	Key     string                 `json:"key"`
	Headers map[string]interface{} `json:"headers"`
}

func (*PresignUploadRequest) ContentLength

func (r *PresignUploadRequest) ContentLength() (contentLength int)

func (*PresignUploadRequest) HTTPHeader

func (r *PresignUploadRequest) HTTPHeader() http.Header

func (*PresignUploadRequest) Sanitize

func (r *PresignUploadRequest) Sanitize()

type PresignUploadResponse

type PresignUploadResponse struct {
	Key     string        `json:"key"`
	URL     string        `json:"url"`
	Method  string        `json:"method"`
	Headers []HeaderField `json:"headers"`
}

func NewPresignUploadResponse

func NewPresignUploadResponse(r *http.Request, key string) PresignUploadResponse

Jump to

Keyboard shortcuts

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