storages3

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: MIT Imports: 11 Imported by: 0

README

Module Storage

Storage APIs
GET /api/v1/storage/presigned-url
PUT /api/v1/storage/legitimize-files	
Usage

Install

go get -u github.com/gflydev/modules/storages3@v1.0.0

File main.go

import (
    _ "github.com/gflydev/storage/s3"
)

File api_routes.go

import "github.com/gflydev/modules/storages3/api"

// `API` Router
g.Group(prefixAPI, func(apiRouter *core.Group) {
    /* ============================ Storage Group ==========================================*/
    apiRouter.Group("/storage", func(uploadGroup *core.Group) {
        uploadGroup.GET("/presigned-url", api.NewPresignedURLApi())      // Get presigned URL
        uploadGroup.PUT("/legitimize-files", api.NewLegitimizeFileApi()) // Legitimize uploaded file
    })
})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LegitimizeFiles

func LegitimizeFiles(files []dto.LegitimizeItem) []dto.LegitimizeItem

LegitimizeFiles make file list available

func PresignedURL

func PresignedURL(objectKey string) (string, string, error)

PresignedURL generate pre-signed upload URL from Local storage

Types

type PreSigner

type PreSigner struct {
	PreSignClient *s3.PresignClient
}

PreSigner encapsulates the Amazon Simple Storage Service (Amazon S3) preSigned actions used in the examples. It contains PreSignClient, a client that is used to preSigned requests to Amazon S3. PreSigned requests contain temporary credentials and can be made from any HTTP client.

func (PreSigner) DeleteObject

func (preSigner PreSigner) DeleteObject(bucketName, objectKey string) (*v4.PresignedHTTPRequest, error)

DeleteObject makes a preSigned request that can be used to delete an object from a bucket.

func (PreSigner) GetObject

func (preSigner PreSigner) GetObject(
	bucketName, objectKey string, lifetimeSecs int64) (*v4.PresignedHTTPRequest, error)

GetObject makes a preSigned request that can be used to get an object from a bucket. The preSigned request is valid for the specified number of seconds.

func (PreSigner) PutObject

func (preSigner PreSigner) PutObject(
	bucketName, objectKey string, lifetimeSecs int64) (*v4.PresignedHTTPRequest, error)

PutObject makes a preSigned request that can be used to put an object in a bucket. The preSigned request is valid for the specified number of seconds.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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