aliyun

package module
v0.0.0-...-da6892f Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 14 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"
	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 {
	// contains filtered or unexported fields
}

func NewOssClient

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

func (*OssClient) BucketUrl

func (client *OssClient) BucketUrl() string

func (*OssClient) Copy

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

func (*OssClient) Delete

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

func (*OssClient) Get

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

func (*OssClient) GetSite

func (client *OssClient) GetSite() string

func (*OssClient) GetSts

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

STS

func (*OssClient) PutObject

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

func (*OssClient) StsUploadLocal

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

test Sts client

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) (link string, err error)

func (*OssClient) UploadFromUrl

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

func (*OssClient) UploadLocal

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

OSS, oss.ForbidOverWrite(forbidWrite bool) oss.Option

type OssConfig

type OssConfig struct {
	AccessKeyId     string `mapstructure:"access_key_id" json:"accessKeyId,omitempty"`
	AccessKeySecret string `mapstructure:"access_key_secret" json:"accessKeySecret,omitempty"`
	Region          string `mapstructure:"region" json:"region,omitempty"`
	Bucket          string `mapstructure:"bucket" json:"bucket,omitempty"`

	// use custom domain instead of https://BUCKET.oss-{REGION_ID}.aliyunc.com
	Site            string `mapstructure:"site" json:"site,omitempty"`
	RoleArn         string `mapstructure:"role_arn" json:"roleArn,omitempty"`                 // sts
	DurationSeconds int    `mapstructure:"duration_seconds" json:"durationSeconds,omitempty"` // sts
	// contains filtered or unexported fields
}

func NewOssConfig

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

func (*OssConfig) Url

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

func (*OssConfig) Valid

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

type StsResult

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

Jump to

Keyboard shortcuts

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