aliyun

package module
v0.0.0-...-37b9b94 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Aliyun OSS API:

https://help.aliyun.com/document_detail/32145.html
https://help.aliyun.com/document_detail/59670.htm
https://help.aliyun.com/document_detail/100624.htm
https://help.aliyun.com/document_detail/66222.html
https://www.alibabacloud.com/help/doc-detail/28759.htm
https://help.aliyun.com/document_detail/28756.html
https://developer.aliyun.com/ask/2549
https://error-center.aliyun.com/status/product/Oss

Index

Constants

View Source
const (
	ALIYUN_Domain         = "aliyuncs.com"
	ALIYUN_Code_NoSuchKey = "NoSuchKey"
)

Variables

This section is empty.

Functions

func ConfigDemo

func ConfigDemo() string

func ValidUrlFilepath

func ValidUrlFilepath(p string) (out string, err error)

Types

type OssClient

type OssClient struct {
	*oss.Client
	// contains filtered or unexported fields
}

func NewOssClient

func NewOssClient(fp, field string) (client *OssClient, err error)

func (*OssClient) Copy

func (client *OssClient) Copy(source, target string, options ...oss.Option) (
	code string, err error)

func (*OssClient) Delete

func (client *OssClient) Delete(source string, options ...oss.Option) (err error)

func (*OssClient) IntoStsClient

func (client *OssClient) IntoStsClient() (cli *StsClient, err error)

func (*OssClient) PutObject

func (client *OssClient) PutObject(reader io.Reader, target string, options ...oss.Option) (
	link string, err error)

func (*OssClient) ToSiteUrl

func (client *OssClient) ToSiteUrl(p string) string

func (*OssClient) Upload

func (client *OssClient) Upload(source string, target string) (link string, err error)

func (*OssClient) UploadDir

func (client *OssClient) UploadDir(source string, target string, conc uint) (
	link string, err error)

func (*OssClient) UploadFromUrl

func (client *OssClient) UploadFromUrl(source string, target string, options ...oss.Option) (
	link string, err error)

func (*OssClient) UploadLocal

func (client *OssClient) UploadLocal(source, target string, options ...oss.Option) (
	link string, err error)

oss.ForbidOverWrite(forbidWrite bool) oss.Option

type OssConfig

type OssConfig struct {
	AccessKeyId     string `mapstructure:"access_key_id"`
	AccessKeySecret string `mapstructure:"access_key_secret"`
	RegionId        string `mapstructure:"region_id"`
	Bucket          string `mapstructure:"bucket"`

	// use custom domain instead of https://BUCKET.oss-{REGION_ID}.aliyunc.com
	Site           string `mapstructure:"site"`
	RoleArn        string `mapstructure:"role_arn"`        // sts
	ExpiredSeconds int    `mapstructure:"expired_seconds"` // sts
	// contains filtered or unexported fields
}

func NewOssConfig

func NewOssConfig(fp, field string) (config OssConfig, err error)

func (*OssConfig) ToSiteUrl

func (config *OssConfig) ToSiteUrl(p string) string

func (*OssConfig) Url

func (config *OssConfig) Url(ps ...string) string

func (*OssConfig) Valid

func (config *OssConfig) Valid() (err error)

type StsClient

type StsClient struct {
	*sts.Client
	// contains filtered or unexported fields
}

func NewStsClient

func NewStsClient(fp, field string) (client *StsClient, err error)

func (*StsClient) GetSts

func (client *StsClient) GetSts(sessionName string) (result *StsResult, err error)

func (*StsClient) IntoOssClient

func (client *StsClient) IntoOssClient() (cli *OssClient, err error)

func (*StsClient) ToSiteUrl

func (client *StsClient) ToSiteUrl(p string) string

func (*StsClient) UploadLocal

func (client *StsClient) UploadLocal(sessionName string, source, target string, options ...oss.Option) (
	link string, err error)

type StsResult

type StsResult struct {
	AccessKeyId     string `json:"accessKeyId"`
	AccessKeySecret string `json:"accessKeySecret"`
	SecurityToken   string `json:"securityToken"`
	Expiration      string `json:"expiration"`
	RegionId        string `json:"regionId"`
	Bucket          string `json:"bucket"`
}

func (*StsResult) UploadLocal

func (result *StsResult) UploadLocal(source, target string, options ...oss.Option) (
	link string, err error)

Jump to

Keyboard shortcuts

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