oss

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgent  = "Kusion-Server"
	EnvTimeout = "OSS_TIMEOUT"
)

Variables

View Source
var ErrNoExist = errors.New("oss: key not exist")
View Source
var Timeout = 5

Timeout default timeout is 5 second

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint      string
	AccessKey     string
	SecretKey     string
	SecurityToken string
	BucketName    string
}

type Payload

type Payload struct {
	Data []byte
	MD5  []byte
}

type RemoteClient

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

func NewRemoteClient

func NewRemoteClient(endpoint, accessKey, secretKey, securityToken, bucket string) (*RemoteClient, error)

func (*RemoteClient) DeleteObject

func (c *RemoteClient) DeleteObject(key string) error

func (*RemoteClient) Get

func (c *RemoteClient) Get(objectName string) (*Payload, error)

Get obtains target object from oss bucket.

func (*RemoteClient) GetObjectMeta

func (c *RemoteClient) GetObjectMeta(key string) (http.Header, error)

func (*RemoteClient) GetObjectToFile

func (c *RemoteClient) GetObjectToFile(key, dstPath string) error

func (*RemoteClient) GetOssClient

func (c *RemoteClient) GetOssClient() *oss.Client

func (*RemoteClient) IsObjectExist

func (c *RemoteClient) IsObjectExist(key string) (bool, error)

func (*RemoteClient) ListObjects

func (c *RemoteClient) ListObjects(prefix string) (*oss.ListObjectsResultV2, error)

func (*RemoteClient) Ping

func (c *RemoteClient) Ping() error

func (*RemoteClient) PutObject

func (c *RemoteClient) PutObject(key string, val []byte) error

func (*RemoteClient) PutObjectFromFile

func (c *RemoteClient) PutObjectFromFile(key, path string) error

func (*RemoteClient) WithBucket

func (c *RemoteClient) WithBucket(bucket string) *RemoteClient

Jump to

Keyboard shortcuts

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