47 lines
867 B
Go
47 lines
867 B
Go
package oss
|
|
|
|
import (
|
|
"errors"
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
|
)
|
|
|
|
const (
|
|
VERSION = "2024-05-30"
|
|
)
|
|
|
|
var HOST = requests.Host{
|
|
Default: "oss.gaore.com",
|
|
}
|
|
|
|
type Client struct {
|
|
sdk.Client
|
|
}
|
|
|
|
func NewClient() (client *Client, err error) {
|
|
client = new(Client)
|
|
err = client.Init()
|
|
return
|
|
}
|
|
|
|
func (c *Client) PutOss(req *PutOssRequest) (resp *PutOssResponse, err error) {
|
|
if req.BucketName == "" {
|
|
err = errors.New("bucket name is empty")
|
|
return
|
|
}
|
|
if req.FileStream == nil {
|
|
err = errors.New("stream is empty")
|
|
return
|
|
}
|
|
req.SetContent(req.FileStream)
|
|
resp = CreatePutOssResponse()
|
|
err = c.DoAction(req, resp)
|
|
return
|
|
}
|
|
|
|
func (c *Client) DelOss(req *DelOssRequest) (resp *DelOssResponse, err error) {
|
|
resp = CreateDelOssResponse()
|
|
err = c.DoAction(req, resp)
|
|
return
|
|
}
|