Documentation ¶
Index ¶
- Constants
- Variables
- func GetAccessEndpoint() (string, error)
- func GetAccessKeyID() (string, error)
- func GetAccessKeySecret() (string, error)
- func GetCustomProxy() string
- func ReadBody(body io.ReadCloser) ([]byte, error)
- type Interface
- type Option
- type Proxy
- type ProxyRequestParams
- type Request
- func (r *Request) Body(obj interface{}) *Request
- func (r *Request) Bucket(bucketName string) *Request
- func (r *Request) Channel(channel string) *Request
- func (r *Request) Delete() error
- func (r *Request) Download() (io.ReadCloser, error)
- func (r *Request) ForceDelete(key string) error
- func (r *Request) FullRootPath() string
- func (r *Request) List(opts ...oss.Option) (oss.ListObjectsResult, error)
- func (r *Request) MaxRetries(maxRetries int) *Request
- func (r *Request) Name(resourceName string) *Request
- func (r *Request) Namespace(namespace string) *Request
- func (r *Request) Resource(resource string) *Request
- func (r *Request) SetModel(bo bool)
- func (r *Request) SetOption(opt *Option)
- func (r *Request) Timeout(d time.Duration) *Request
- func (r *Request) Upload() error
- func (r *Request) Verb(verb string) *Request
- type RestOssClient
- func (a *RestOssClient) Delete() *Request
- func (a *RestOssClient) DeleteObject(bucketName, objectKey string) error
- func (a *RestOssClient) Get() *Request
- func (a *RestOssClient) GetObject(bucketName, objectKey string) (io.ReadCloser, error)
- func (a *RestOssClient) ListBucket() error
- func (a *RestOssClient) ListObjects(bucketName string, opts ...oss.Option) (oss.ListObjectsResult, error)
- func (a *RestOssClient) Post() *Request
- func (a *RestOssClient) Put() *Request
- func (a *RestOssClient) PutObject(bucketName, objectKey string, reader io.Reader) error
- func (a *RestOssClient) Verb(verb string) *Request
Constants ¶
const ( AccessEndpoint = "ALIYUNOSS_ACCESS_ENDPOINT" AccessKeyID = "ALIYUNOSS_ACCESS_KEY_ID" AccessKeySecret = "ALIYUNOSS_ACCESS_SECRET" CustomProxy = "ALIYUNOSS_CUSTOM_PROXY" )
const ( ModelNative = false ModelProxy = true )
Variables ¶
var ( ErrNoAccessEndpoint = errors.New("unable to load configuration, ALIYUNOSS_ACCESS_ENDPOINT must be defined") ErrNoAccessKeyID = errors.New("unable to load configuration, ALIYUNOSS_ACCESS_KEY_ID must be defined") ErrNoAccessKeySecret = errors.New("unable to load configuration, ALIYUNOSS_ACCESS_SECRET must be defined") )
Functions ¶
func GetAccessEndpoint ¶
func GetAccessKeyID ¶
func GetAccessKeySecret ¶
func GetCustomProxy ¶ added in v1.0.3
func GetCustomProxy() string
Types ¶
type ProxyRequestParams ¶ added in v1.0.3
type ProxyRequestParams struct { AccessEndpoint string `form:"access_endpoint"` AccessKeyID string `form:"access_key_id"` AccessKeySecret string `form:"access_key_secret"` BucketName string `form:"bucket_name"` Namespace string `form:"namespace"` Channel string `form:"channel"` Filename string `form:"filename"` }
func (ProxyRequestParams) ToUrlParams ¶ added in v1.0.3
func (prp ProxyRequestParams) ToUrlParams() string
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func NewRequest(c *RestOssClient) *Request
func (*Request) Body ¶
Body makes the request use obj as the body. Optional. If obj is a string, try to read a file of that name. If obj is a []byte, send it directly. If obj is an io.Reader, use it directly. If obj is a runtime.Object, marshal it correctly, and set Content-Type header. If obj is a runtime.Object and nil, do nothing. Otherwise, set an error.
func (*Request) Channel ¶
Channel applies the channel scope to a request (<resource>/[ns/<namespace>/]/[ch/<channel>/]<name>)
func (*Request) ForceDelete ¶ added in v1.0.1
func (*Request) FullRootPath ¶
func (*Request) MaxRetries ¶
MaxRetries makes the request use the given integer as a ceiling of retrying upon receiving "Retry-After" headers and 429 status-code in the response. The default is 10 unless this function is specifically called with a different value. A zero maxRetries prevent it from doing retires and return an error immediately.
func (*Request) Name ¶
Name sets the name of a resource to access (<resource>/[ns/<namespace>/]/[ch/<channel>/]<name>)
func (*Request) Namespace ¶
Namespace applies the namespace scope to a request (<resource>/[ns/<namespace>/]/[ch/<channel>/]<name>)
func (*Request) Resource ¶
Resource sets the resource to access (<resource>/[ns/<namespace>/]/[ch/<channel>/]<name>)
type RestOssClient ¶
type RestOssClient struct {
// contains filtered or unexported fields
}
func NewRestClient ¶
func NewRestClient(opt *Option) (*RestOssClient, error)
func (*RestOssClient) Delete ¶
func (a *RestOssClient) Delete() *Request
Delete begins a DELETE request. Short for a.Verb("DELETE").
func (*RestOssClient) DeleteObject ¶
func (a *RestOssClient) DeleteObject(bucketName, objectKey string) error
func (*RestOssClient) Get ¶
func (a *RestOssClient) Get() *Request
Get begins a GET request. Short for a.Verb("GET").
func (*RestOssClient) GetObject ¶
func (a *RestOssClient) GetObject(bucketName, objectKey string) (io.ReadCloser, error)
func (*RestOssClient) ListBucket ¶
func (a *RestOssClient) ListBucket() error
func (*RestOssClient) ListObjects ¶
func (a *RestOssClient) ListObjects(bucketName string, opts ...oss.Option) (oss.ListObjectsResult, error)
func (*RestOssClient) Post ¶
func (a *RestOssClient) Post() *Request
Post begins a POST request. Short for a.Verb("POST").
func (*RestOssClient) Put ¶
func (a *RestOssClient) Put() *Request
Put begins a PUT request. Short for a.Verb("PUT").
func (*RestOssClient) PutObject ¶
func (a *RestOssClient) PutObject(bucketName, objectKey string, reader io.Reader) error
func (*RestOssClient) Verb ¶
func (a *RestOssClient) Verb(verb string) *Request