You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
383 B
24 lines
383 B
package ossHandle
|
|
|
|
import "github.com/aliyun/aliyun-oss-go-sdk/oss"
|
|
|
|
func (o *OssClient) Init(endpoint string, key string, secret string, bucketName string) error {
|
|
client, err := oss.New(
|
|
endpoint, key, secret,
|
|
)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
bucket, err := client.Bucket(bucketName)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
o.Client = client
|
|
o.Bucket = bucket
|
|
|
|
return nil
|
|
}
|
|
|