id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
144,400 | yunify/qingstor-sdk-go | utils/conn.go | NewDialer | func NewDialer(connTimeout, readTimeout, writeTimeout time.Duration) *Dialer {
d := &net.Dialer{
DualStack: false,
Timeout: connTimeout,
}
return &Dialer{d, readTimeout, writeTimeout}
} | go | func NewDialer(connTimeout, readTimeout, writeTimeout time.Duration) *Dialer {
d := &net.Dialer{
DualStack: false,
Timeout: connTimeout,
}
return &Dialer{d, readTimeout, writeTimeout}
} | [
"func",
"NewDialer",
"(",
"connTimeout",
",",
"readTimeout",
",",
"writeTimeout",
"time",
".",
"Duration",
")",
"*",
"Dialer",
"{",
"d",
":=",
"&",
"net",
".",
"Dialer",
"{",
"DualStack",
":",
"false",
",",
"Timeout",
":",
"connTimeout",
",",
"}",
"\n",
... | // NewDialer will create a new dialer. | [
"NewDialer",
"will",
"create",
"a",
"new",
"dialer",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/utils/conn.go#L27-L33 |
144,401 | yunify/qingstor-sdk-go | utils/conn.go | Dial | func (d *Dialer) Dial(network, addr string) (net.Conn, error) {
c, err := d.Dialer.Dial(network, addr)
if err != nil {
return nil, err
}
conn := NewConn(c)
conn.readTimeout = d.ReadTimeout
conn.writeTimeout = d.WriteTimeout
return conn, nil
} | go | func (d *Dialer) Dial(network, addr string) (net.Conn, error) {
c, err := d.Dialer.Dial(network, addr)
if err != nil {
return nil, err
}
conn := NewConn(c)
conn.readTimeout = d.ReadTimeout
conn.writeTimeout = d.WriteTimeout
return conn, nil
} | [
"func",
"(",
"d",
"*",
"Dialer",
")",
"Dial",
"(",
"network",
",",
"addr",
"string",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"d",
".",
"Dialer",
".",
"Dial",
"(",
"network",
",",
"addr",
")",
"\n",
"if",
"... | // Dial connects to the address on the named network. | [
"Dial",
"connects",
"to",
"the",
"address",
"on",
"the",
"named",
"network",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/utils/conn.go#L36-L45 |
144,402 | yunify/qingstor-sdk-go | utils/conn.go | DialContext | func (d *Dialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
c, err := d.Dialer.DialContext(ctx, network, addr)
if err != nil {
return nil, err
}
conn := NewConn(c)
conn.readTimeout = d.ReadTimeout
conn.writeTimeout = d.WriteTimeout
return conn, nil
} | go | func (d *Dialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
c, err := d.Dialer.DialContext(ctx, network, addr)
if err != nil {
return nil, err
}
conn := NewConn(c)
conn.readTimeout = d.ReadTimeout
conn.writeTimeout = d.WriteTimeout
return conn, nil
} | [
"func",
"(",
"d",
"*",
"Dialer",
")",
"DialContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"network",
",",
"addr",
"string",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"d",
".",
"Dialer",
".",
"DialContext",
... | // DialContext connects to the address on the named network using
// the provided context. | [
"DialContext",
"connects",
"to",
"the",
"address",
"on",
"the",
"named",
"network",
"using",
"the",
"provided",
"context",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/utils/conn.go#L49-L58 |
144,403 | yunify/qingstor-sdk-go | utils/conn.go | NewConn | func NewConn(c netConn) *Conn {
conn, ok := c.(*Conn)
if ok {
return conn
}
conn, ok = connPool.Get().(*Conn)
if !ok {
conn = new(Conn)
}
conn.netConn = c
return conn
} | go | func NewConn(c netConn) *Conn {
conn, ok := c.(*Conn)
if ok {
return conn
}
conn, ok = connPool.Get().(*Conn)
if !ok {
conn = new(Conn)
}
conn.netConn = c
return conn
} | [
"func",
"NewConn",
"(",
"c",
"netConn",
")",
"*",
"Conn",
"{",
"conn",
",",
"ok",
":=",
"c",
".",
"(",
"*",
"Conn",
")",
"\n",
"if",
"ok",
"{",
"return",
"conn",
"\n",
"}",
"\n",
"conn",
",",
"ok",
"=",
"connPool",
".",
"Get",
"(",
")",
".",
... | // NewConn will create a new conn. | [
"NewConn",
"will",
"create",
"a",
"new",
"conn",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/utils/conn.go#L69-L80 |
144,404 | yunify/qingstor-sdk-go | utils/conn.go | Read | func (c Conn) Read(buf []byte) (n int, err error) {
if c.readTimeout > 0 {
c.SetDeadline(time.Now().Add(c.readTimeout))
}
n, err = c.netConn.Read(buf)
if c.readTimeout > 0 {
c.SetDeadline(time.Time{}) // clear timeout
}
return
} | go | func (c Conn) Read(buf []byte) (n int, err error) {
if c.readTimeout > 0 {
c.SetDeadline(time.Now().Add(c.readTimeout))
}
n, err = c.netConn.Read(buf)
if c.readTimeout > 0 {
c.SetDeadline(time.Time{}) // clear timeout
}
return
} | [
"func",
"(",
"c",
"Conn",
")",
"Read",
"(",
"buf",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"if",
"c",
".",
"readTimeout",
">",
"0",
"{",
"c",
".",
"SetDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
... | // Read will read from the conn. | [
"Read",
"will",
"read",
"from",
"the",
"conn",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/utils/conn.go#L93-L102 |
144,405 | yunify/qingstor-sdk-go | utils/conn.go | Write | func (c Conn) Write(buf []byte) (n int, err error) {
if c.writeTimeout > 0 {
c.SetDeadline(time.Now().Add(c.writeTimeout))
}
n, err = c.netConn.Write(buf)
if c.writeTimeout > 0 {
c.SetDeadline(time.Time{})
}
return
} | go | func (c Conn) Write(buf []byte) (n int, err error) {
if c.writeTimeout > 0 {
c.SetDeadline(time.Now().Add(c.writeTimeout))
}
n, err = c.netConn.Write(buf)
if c.writeTimeout > 0 {
c.SetDeadline(time.Time{})
}
return
} | [
"func",
"(",
"c",
"Conn",
")",
"Write",
"(",
"buf",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"if",
"c",
".",
"writeTimeout",
">",
"0",
"{",
"c",
".",
"SetDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
... | // Write will write into the conn. | [
"Write",
"will",
"write",
"into",
"the",
"conn",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/utils/conn.go#L105-L114 |
144,406 | yunify/qingstor-sdk-go | utils/conn.go | Close | func (c Conn) Close() (err error) {
if c.netConn == nil {
return nil
}
err = c.netConn.Close()
connPool.Put(c)
c.netConn = nil
c.readTimeout = 0
c.writeTimeout = 0
return
} | go | func (c Conn) Close() (err error) {
if c.netConn == nil {
return nil
}
err = c.netConn.Close()
connPool.Put(c)
c.netConn = nil
c.readTimeout = 0
c.writeTimeout = 0
return
} | [
"func",
"(",
"c",
"Conn",
")",
"Close",
"(",
")",
"(",
"err",
"error",
")",
"{",
"if",
"c",
".",
"netConn",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"err",
"=",
"c",
".",
"netConn",
".",
"Close",
"(",
")",
"\n",
"connPool",
".",
"P... | // Close will close the conn. | [
"Close",
"will",
"close",
"the",
"conn",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/utils/conn.go#L117-L127 |
144,407 | yunify/qingstor-sdk-go | utils/conn.go | IsTimeoutError | func IsTimeoutError(err error) bool {
e, ok := err.(net.Error)
if ok {
return e.Timeout()
}
return false
} | go | func IsTimeoutError(err error) bool {
e, ok := err.(net.Error)
if ok {
return e.Timeout()
}
return false
} | [
"func",
"IsTimeoutError",
"(",
"err",
"error",
")",
"bool",
"{",
"e",
",",
"ok",
":=",
"err",
".",
"(",
"net",
".",
"Error",
")",
"\n",
"if",
"ok",
"{",
"return",
"e",
".",
"Timeout",
"(",
")",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // IsTimeoutError will check whether the err is a timeout error. | [
"IsTimeoutError",
"will",
"check",
"whether",
"the",
"err",
"is",
"a",
"timeout",
"error",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/utils/conn.go#L130-L136 |
144,408 | yunify/qingstor-sdk-go | client/image/image.go | Init | func Init(bucket *service.Bucket, objectKey string) *Image {
return &Image{
key: &objectKey,
bucket: bucket,
input: &service.ImageProcessInput{},
}
} | go | func Init(bucket *service.Bucket, objectKey string) *Image {
return &Image{
key: &objectKey,
bucket: bucket,
input: &service.ImageProcessInput{},
}
} | [
"func",
"Init",
"(",
"bucket",
"*",
"service",
".",
"Bucket",
",",
"objectKey",
"string",
")",
"*",
"Image",
"{",
"return",
"&",
"Image",
"{",
"key",
":",
"&",
"objectKey",
",",
"bucket",
":",
"bucket",
",",
"input",
":",
"&",
"service",
".",
"ImageP... | // Init initializes an image to process. | [
"Init",
"initializes",
"an",
"image",
"to",
"process",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/image/image.go#L106-L112 |
144,409 | yunify/qingstor-sdk-go | client/image/image.go | Rotate | func (image *Image) Rotate(param *RotateParam) *Image {
return image.setActionParam(RotateOperation, param)
} | go | func (image *Image) Rotate(param *RotateParam) *Image {
return image.setActionParam(RotateOperation, param)
} | [
"func",
"(",
"image",
"*",
"Image",
")",
"Rotate",
"(",
"param",
"*",
"RotateParam",
")",
"*",
"Image",
"{",
"return",
"image",
".",
"setActionParam",
"(",
"RotateOperation",
",",
"param",
")",
"\n",
"}"
] | // Rotate image. | [
"Rotate",
"image",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/image/image.go#L125-L127 |
144,410 | yunify/qingstor-sdk-go | client/image/image.go | Resize | func (image *Image) Resize(param *ResizeParam) *Image {
return image.setActionParam(ResizeOperation, param)
} | go | func (image *Image) Resize(param *ResizeParam) *Image {
return image.setActionParam(ResizeOperation, param)
} | [
"func",
"(",
"image",
"*",
"Image",
")",
"Resize",
"(",
"param",
"*",
"ResizeParam",
")",
"*",
"Image",
"{",
"return",
"image",
".",
"setActionParam",
"(",
"ResizeOperation",
",",
"param",
")",
"\n",
"}"
] | // Resize image. | [
"Resize",
"image",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/image/image.go#L137-L139 |
144,411 | yunify/qingstor-sdk-go | client/image/image.go | Crop | func (image *Image) Crop(param *CropParam) *Image {
return image.setActionParam(CropOperation, param)
} | go | func (image *Image) Crop(param *CropParam) *Image {
return image.setActionParam(CropOperation, param)
} | [
"func",
"(",
"image",
"*",
"Image",
")",
"Crop",
"(",
"param",
"*",
"CropParam",
")",
"*",
"Image",
"{",
"return",
"image",
".",
"setActionParam",
"(",
"CropOperation",
",",
"param",
")",
"\n",
"}"
] | // Crop image. | [
"Crop",
"image",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/image/image.go#L149-L151 |
144,412 | yunify/qingstor-sdk-go | client/image/image.go | Format | func (image *Image) Format(param *FormatParam) *Image {
return image.setActionParam(FormatOperation, param)
} | go | func (image *Image) Format(param *FormatParam) *Image {
return image.setActionParam(FormatOperation, param)
} | [
"func",
"(",
"image",
"*",
"Image",
")",
"Format",
"(",
"param",
"*",
"FormatParam",
")",
"*",
"Image",
"{",
"return",
"image",
".",
"setActionParam",
"(",
"FormatOperation",
",",
"param",
")",
"\n",
"}"
] | // Format image. | [
"Format",
"image",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/image/image.go#L159-L161 |
144,413 | yunify/qingstor-sdk-go | client/image/image.go | WaterMark | func (image *Image) WaterMark(param *WaterMarkParam) *Image {
return image.setActionParam(WaterMarkOperation, param)
} | go | func (image *Image) WaterMark(param *WaterMarkParam) *Image {
return image.setActionParam(WaterMarkOperation, param)
} | [
"func",
"(",
"image",
"*",
"Image",
")",
"WaterMark",
"(",
"param",
"*",
"WaterMarkParam",
")",
"*",
"Image",
"{",
"return",
"image",
".",
"setActionParam",
"(",
"WaterMarkOperation",
",",
"param",
")",
"\n",
"}"
] | // WaterMark is operation of watermark text content. | [
"WaterMark",
"is",
"operation",
"of",
"watermark",
"text",
"content",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/image/image.go#L172-L174 |
144,414 | yunify/qingstor-sdk-go | client/image/image.go | WaterMarkImage | func (image *Image) WaterMarkImage(param *WaterMarkImageParam) *Image {
return image.setActionParam(WaterMarkImageOperation, param)
} | go | func (image *Image) WaterMarkImage(param *WaterMarkImageParam) *Image {
return image.setActionParam(WaterMarkImageOperation, param)
} | [
"func",
"(",
"image",
"*",
"Image",
")",
"WaterMarkImage",
"(",
"param",
"*",
"WaterMarkImageParam",
")",
"*",
"Image",
"{",
"return",
"image",
".",
"setActionParam",
"(",
"WaterMarkImageOperation",
",",
"param",
")",
"\n",
"}"
] | // WaterMarkImage is operation of watermark image. | [
"WaterMarkImage",
"is",
"operation",
"of",
"watermark",
"image",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/image/image.go#L185-L187 |
144,415 | yunify/qingstor-sdk-go | client/image/image.go | Process | func (image *Image) Process() (*service.ImageProcessOutput, error) {
defer func(input *service.ImageProcessInput) {
input.Action = nil
}(image.input)
return image.bucket.ImageProcess(*image.key, image.input)
} | go | func (image *Image) Process() (*service.ImageProcessOutput, error) {
defer func(input *service.ImageProcessInput) {
input.Action = nil
}(image.input)
return image.bucket.ImageProcess(*image.key, image.input)
} | [
"func",
"(",
"image",
"*",
"Image",
")",
"Process",
"(",
")",
"(",
"*",
"service",
".",
"ImageProcessOutput",
",",
"error",
")",
"{",
"defer",
"func",
"(",
"input",
"*",
"service",
".",
"ImageProcessInput",
")",
"{",
"input",
".",
"Action",
"=",
"nil",... | // Process does Image process. | [
"Process",
"does",
"Image",
"process",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/image/image.go#L190-L195 |
144,416 | yunify/qingstor-sdk-go | utils/escape.go | URLQueryEscape | func URLQueryEscape(origin string) string {
escaped := url.QueryEscape(origin)
escaped = strings.Replace(escaped, "%2F", "/", -1)
escaped = strings.Replace(escaped, "%3D", "=", -1)
escaped = strings.Replace(escaped, "+", "%20", -1)
return escaped
} | go | func URLQueryEscape(origin string) string {
escaped := url.QueryEscape(origin)
escaped = strings.Replace(escaped, "%2F", "/", -1)
escaped = strings.Replace(escaped, "%3D", "=", -1)
escaped = strings.Replace(escaped, "+", "%20", -1)
return escaped
} | [
"func",
"URLQueryEscape",
"(",
"origin",
"string",
")",
"string",
"{",
"escaped",
":=",
"url",
".",
"QueryEscape",
"(",
"origin",
")",
"\n",
"escaped",
"=",
"strings",
".",
"Replace",
"(",
"escaped",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
"... | // URLQueryEscape escapes the original string. | [
"URLQueryEscape",
"escapes",
"the",
"original",
"string",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/utils/escape.go#L9-L15 |
144,417 | yunify/qingstor-sdk-go | utils/escape.go | URLQueryUnescape | func URLQueryUnescape(escaped string) (string, error) {
escaped = strings.Replace(escaped, "/", "%2F", -1)
escaped = strings.Replace(escaped, "=", "%3D", -1)
escaped = strings.Replace(escaped, "%20", " ", -1)
return url.QueryUnescape(escaped)
} | go | func URLQueryUnescape(escaped string) (string, error) {
escaped = strings.Replace(escaped, "/", "%2F", -1)
escaped = strings.Replace(escaped, "=", "%3D", -1)
escaped = strings.Replace(escaped, "%20", " ", -1)
return url.QueryUnescape(escaped)
} | [
"func",
"URLQueryUnescape",
"(",
"escaped",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"escaped",
"=",
"strings",
".",
"Replace",
"(",
"escaped",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"escaped",
"=",
"strings",
".",
... | // URLQueryUnescape unescapes the escaped string. | [
"URLQueryUnescape",
"unescapes",
"the",
"escaped",
"string",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/utils/escape.go#L18-L23 |
144,418 | yunify/qingstor-sdk-go | request/signer/qingstor.go | WriteSignature | func (qss *QingStorSigner) WriteSignature(request *http.Request) error {
authorization, err := qss.BuildSignature(request)
if err != nil {
return err
}
request.Header.Set("Authorization", authorization)
return nil
} | go | func (qss *QingStorSigner) WriteSignature(request *http.Request) error {
authorization, err := qss.BuildSignature(request)
if err != nil {
return err
}
request.Header.Set("Authorization", authorization)
return nil
} | [
"func",
"(",
"qss",
"*",
"QingStorSigner",
")",
"WriteSignature",
"(",
"request",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"authorization",
",",
"err",
":=",
"qss",
".",
"BuildSignature",
"(",
"request",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // WriteSignature calculates signature and write it to http request header. | [
"WriteSignature",
"calculates",
"signature",
"and",
"write",
"it",
"to",
"http",
"request",
"header",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/signer/qingstor.go#L41-L50 |
144,419 | yunify/qingstor-sdk-go | request/signer/qingstor.go | WriteQuerySignature | func (qss *QingStorSigner) WriteQuerySignature(request *http.Request, expires int) error {
query, err := qss.BuildQuerySignature(request, expires)
if err != nil {
return err
}
if request.URL.RawQuery != "" {
query = "?" + request.URL.RawQuery + "&" + query
} else {
query = "?" + query
}
newRequest, err :... | go | func (qss *QingStorSigner) WriteQuerySignature(request *http.Request, expires int) error {
query, err := qss.BuildQuerySignature(request, expires)
if err != nil {
return err
}
if request.URL.RawQuery != "" {
query = "?" + request.URL.RawQuery + "&" + query
} else {
query = "?" + query
}
newRequest, err :... | [
"func",
"(",
"qss",
"*",
"QingStorSigner",
")",
"WriteQuerySignature",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"expires",
"int",
")",
"error",
"{",
"query",
",",
"err",
":=",
"qss",
".",
"BuildQuerySignature",
"(",
"request",
",",
"expires",
")",... | // WriteQuerySignature calculates signature and write it to http request url. | [
"WriteQuerySignature",
"calculates",
"signature",
"and",
"write",
"it",
"to",
"http",
"request",
"url",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/signer/qingstor.go#L53-L73 |
144,420 | yunify/qingstor-sdk-go | request/signer/qingstor.go | BuildSignature | func (qss *QingStorSigner) BuildSignature(request *http.Request) (string, error) {
stringToSign, err := qss.BuildStringToSign(request)
if err != nil {
return "", err
}
h := hmac.New(sha256.New, []byte(qss.SecretAccessKey))
h.Write([]byte(stringToSign))
signature := strings.TrimSpace(base64.StdEncoding.EncodeT... | go | func (qss *QingStorSigner) BuildSignature(request *http.Request) (string, error) {
stringToSign, err := qss.BuildStringToSign(request)
if err != nil {
return "", err
}
h := hmac.New(sha256.New, []byte(qss.SecretAccessKey))
h.Write([]byte(stringToSign))
signature := strings.TrimSpace(base64.StdEncoding.EncodeT... | [
"func",
"(",
"qss",
"*",
"QingStorSigner",
")",
"BuildSignature",
"(",
"request",
"*",
"http",
".",
"Request",
")",
"(",
"string",
",",
"error",
")",
"{",
"stringToSign",
",",
"err",
":=",
"qss",
".",
"BuildStringToSign",
"(",
"request",
")",
"\n",
"if",... | // BuildSignature calculates the signature string. | [
"BuildSignature",
"calculates",
"the",
"signature",
"string",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/signer/qingstor.go#L76-L95 |
144,421 | yunify/qingstor-sdk-go | request/signer/qingstor.go | BuildQuerySignature | func (qss *QingStorSigner) BuildQuerySignature(request *http.Request, expires int) (string, error) {
stringToSign, err := qss.BuildQueryStringToSign(request, expires)
if err != nil {
return "", err
}
h := hmac.New(sha256.New, []byte(qss.SecretAccessKey))
h.Write([]byte(stringToSign))
signature := strings.Trim... | go | func (qss *QingStorSigner) BuildQuerySignature(request *http.Request, expires int) (string, error) {
stringToSign, err := qss.BuildQueryStringToSign(request, expires)
if err != nil {
return "", err
}
h := hmac.New(sha256.New, []byte(qss.SecretAccessKey))
h.Write([]byte(stringToSign))
signature := strings.Trim... | [
"func",
"(",
"qss",
"*",
"QingStorSigner",
")",
"BuildQuerySignature",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"expires",
"int",
")",
"(",
"string",
",",
"error",
")",
"{",
"stringToSign",
",",
"err",
":=",
"qss",
".",
"BuildQueryStringToSign",
"... | // BuildQuerySignature calculates the signature string for query. | [
"BuildQuerySignature",
"calculates",
"the",
"signature",
"string",
"for",
"query",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/signer/qingstor.go#L98-L121 |
144,422 | yunify/qingstor-sdk-go | request/signer/qingstor.go | BuildStringToSign | func (qss *QingStorSigner) BuildStringToSign(request *http.Request) (string, error) {
date := request.Header.Get("Date")
if request.Header.Get("X-QS-Date") != "" {
date = ""
}
stringToSign := fmt.Sprintf(
"%s\n%s\n%s\n%s\n",
request.Method,
request.Header.Get("Content-MD5"),
request.Header.Get("Content-Ty... | go | func (qss *QingStorSigner) BuildStringToSign(request *http.Request) (string, error) {
date := request.Header.Get("Date")
if request.Header.Get("X-QS-Date") != "" {
date = ""
}
stringToSign := fmt.Sprintf(
"%s\n%s\n%s\n%s\n",
request.Method,
request.Header.Get("Content-MD5"),
request.Header.Get("Content-Ty... | [
"func",
"(",
"qss",
"*",
"QingStorSigner",
")",
"BuildStringToSign",
"(",
"request",
"*",
"http",
".",
"Request",
")",
"(",
"string",
",",
"error",
")",
"{",
"date",
":=",
"request",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"reque... | // BuildStringToSign build the string to sign. | [
"BuildStringToSign",
"build",
"the",
"string",
"to",
"sign",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/signer/qingstor.go#L124-L151 |
144,423 | yunify/qingstor-sdk-go | request/unpacker/base.go | UnpackHTTPRequest | func (b *BaseUnpacker) UnpackHTTPRequest(o *data.Operation, r *http.Response, x *reflect.Value) error {
b.operation = o
b.httpResponse = r
b.output = x
err := b.exposeStatusCode()
if err != nil {
return err
}
err = b.parseResponseHeaders()
if err != nil {
return err
}
err = b.parseResponseBody()
if err ... | go | func (b *BaseUnpacker) UnpackHTTPRequest(o *data.Operation, r *http.Response, x *reflect.Value) error {
b.operation = o
b.httpResponse = r
b.output = x
err := b.exposeStatusCode()
if err != nil {
return err
}
err = b.parseResponseHeaders()
if err != nil {
return err
}
err = b.parseResponseBody()
if err ... | [
"func",
"(",
"b",
"*",
"BaseUnpacker",
")",
"UnpackHTTPRequest",
"(",
"o",
"*",
"data",
".",
"Operation",
",",
"r",
"*",
"http",
".",
"Response",
",",
"x",
"*",
"reflect",
".",
"Value",
")",
"error",
"{",
"b",
".",
"operation",
"=",
"o",
"\n",
"b",... | // UnpackHTTPRequest unpacks http response with an operation and an output. | [
"UnpackHTTPRequest",
"unpacks",
"http",
"response",
"with",
"an",
"operation",
"and",
"an",
"output",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/unpacker/base.go#L42-L65 |
144,424 | yunify/qingstor-sdk-go | logger/logger.go | CheckLevel | func CheckLevel(level string) error {
if _, err := log.ParseLevel(level); err != nil {
return fmt.Errorf(`log level not valid: "%s"`, level)
}
return nil
} | go | func CheckLevel(level string) error {
if _, err := log.ParseLevel(level); err != nil {
return fmt.Errorf(`log level not valid: "%s"`, level)
}
return nil
} | [
"func",
"CheckLevel",
"(",
"level",
"string",
")",
"error",
"{",
"if",
"_",
",",
"err",
":=",
"log",
".",
"ParseLevel",
"(",
"level",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"`log level not valid: \"%s\"`",
",",
"level",
... | // CheckLevel checks whether the log level is valid. | [
"CheckLevel",
"checks",
"whether",
"the",
"log",
"level",
"is",
"valid",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/logger/logger.go#L38-L43 |
144,425 | yunify/qingstor-sdk-go | logger/logger.go | GetLevel | func GetLevel() string {
if l, ok := instance.(*log.Logger); ok {
return l.GetLevel()
}
return "UNKNOWN"
} | go | func GetLevel() string {
if l, ok := instance.(*log.Logger); ok {
return l.GetLevel()
}
return "UNKNOWN"
} | [
"func",
"GetLevel",
"(",
")",
"string",
"{",
"if",
"l",
",",
"ok",
":=",
"instance",
".",
"(",
"*",
"log",
".",
"Logger",
")",
";",
"ok",
"{",
"return",
"l",
".",
"GetLevel",
"(",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] | // GetLevel get the log level string. | [
"GetLevel",
"get",
"the",
"log",
"level",
"string",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/logger/logger.go#L46-L51 |
144,426 | yunify/qingstor-sdk-go | logger/logger.go | SetLevel | func SetLevel(level string) {
if l, ok := instance.(*log.Logger); ok {
err := l.SetLevel(level)
if err != nil {
Fatalf(nil, fmt.Sprintf(`log level not valid: "%s"`, level))
}
}
} | go | func SetLevel(level string) {
if l, ok := instance.(*log.Logger); ok {
err := l.SetLevel(level)
if err != nil {
Fatalf(nil, fmt.Sprintf(`log level not valid: "%s"`, level))
}
}
} | [
"func",
"SetLevel",
"(",
"level",
"string",
")",
"{",
"if",
"l",
",",
"ok",
":=",
"instance",
".",
"(",
"*",
"log",
".",
"Logger",
")",
";",
"ok",
"{",
"err",
":=",
"l",
".",
"SetLevel",
"(",
"level",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // SetLevel sets the log level.
// Valid levels are "debug", "info", "warn", "error", and "fatal". | [
"SetLevel",
"sets",
"the",
"log",
"level",
".",
"Valid",
"levels",
"are",
"debug",
"info",
"warn",
"error",
"and",
"fatal",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/logger/logger.go#L55-L62 |
144,427 | yunify/qingstor-sdk-go | logger/logger.go | Debugf | func Debugf(ctx context.Context, format string, v ...interface{}) {
instance.Debugf(ctx, format, v...)
} | go | func Debugf(ctx context.Context, format string, v ...interface{}) {
instance.Debugf(ctx, format, v...)
} | [
"func",
"Debugf",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"instance",
".",
"Debugf",
"(",
"ctx",
",",
"format",
",",
"v",
"...",
")",
"\n",
"}"
] | // Debugf logs a message with severity DEBUG. | [
"Debugf",
"logs",
"a",
"message",
"with",
"severity",
"DEBUG",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/logger/logger.go#L70-L72 |
144,428 | yunify/qingstor-sdk-go | logger/logger.go | Infof | func Infof(ctx context.Context, format string, v ...interface{}) {
instance.Infof(ctx, format, v...)
} | go | func Infof(ctx context.Context, format string, v ...interface{}) {
instance.Infof(ctx, format, v...)
} | [
"func",
"Infof",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"instance",
".",
"Infof",
"(",
"ctx",
",",
"format",
",",
"v",
"...",
")",
"\n",
"}"
] | // Infof logs a message with severity INFO. | [
"Infof",
"logs",
"a",
"message",
"with",
"severity",
"INFO",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/logger/logger.go#L75-L77 |
144,429 | yunify/qingstor-sdk-go | logger/logger.go | Warnf | func Warnf(ctx context.Context, format string, v ...interface{}) {
instance.Warnf(ctx, format, v...)
} | go | func Warnf(ctx context.Context, format string, v ...interface{}) {
instance.Warnf(ctx, format, v...)
} | [
"func",
"Warnf",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"instance",
".",
"Warnf",
"(",
"ctx",
",",
"format",
",",
"v",
"...",
")",
"\n",
"}"
] | // Warnf logs a message with severity WARN. | [
"Warnf",
"logs",
"a",
"message",
"with",
"severity",
"WARN",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/logger/logger.go#L80-L82 |
144,430 | yunify/qingstor-sdk-go | logger/logger.go | Errorf | func Errorf(ctx context.Context, format string, v ...interface{}) {
instance.Errorf(ctx, format, v...)
} | go | func Errorf(ctx context.Context, format string, v ...interface{}) {
instance.Errorf(ctx, format, v...)
} | [
"func",
"Errorf",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"instance",
".",
"Errorf",
"(",
"ctx",
",",
"format",
",",
"v",
"...",
")",
"\n",
"}"
] | // Errorf logs a message with severity ERROR. | [
"Errorf",
"logs",
"a",
"message",
"with",
"severity",
"ERROR",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/logger/logger.go#L85-L87 |
144,431 | yunify/qingstor-sdk-go | service/bucket.go | Bucket | func (s *Service) Bucket(bucketName string, zone string) (*Bucket, error) {
zone = strings.ToLower(zone)
properties := &Properties{
BucketName: &bucketName,
Zone: &zone,
}
return &Bucket{Config: s.Config, Properties: properties}, nil
} | go | func (s *Service) Bucket(bucketName string, zone string) (*Bucket, error) {
zone = strings.ToLower(zone)
properties := &Properties{
BucketName: &bucketName,
Zone: &zone,
}
return &Bucket{Config: s.Config, Properties: properties}, nil
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"Bucket",
"(",
"bucketName",
"string",
",",
"zone",
"string",
")",
"(",
"*",
"Bucket",
",",
"error",
")",
"{",
"zone",
"=",
"strings",
".",
"ToLower",
"(",
"zone",
")",
"\n",
"properties",
":=",
"&",
"Properties... | // Bucket initializes a new bucket. | [
"Bucket",
"initializes",
"a",
"new",
"bucket",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L46-L54 |
144,432 | yunify/qingstor-sdk-go | service/bucket.go | DeleteMultipleObjectsRequest | func (s *Bucket) DeleteMultipleObjectsRequest(input *DeleteMultipleObjectsInput) (*request.Request, *DeleteMultipleObjectsOutput, error) {
if input == nil {
input = &DeleteMultipleObjectsInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APINa... | go | func (s *Bucket) DeleteMultipleObjectsRequest(input *DeleteMultipleObjectsInput) (*request.Request, *DeleteMultipleObjectsOutput, error) {
if input == nil {
input = &DeleteMultipleObjectsInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APINa... | [
"func",
"(",
"s",
"*",
"Bucket",
")",
"DeleteMultipleObjectsRequest",
"(",
"input",
"*",
"DeleteMultipleObjectsInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"DeleteMultipleObjectsOutput",
",",
"error",
")",
"{",
"if",
"input",
"==",
"nil",
"{",
... | // DeleteMultipleObjectsRequest creates request and output object of DeleteMultipleObjects. | [
"DeleteMultipleObjectsRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"DeleteMultipleObjects",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L389-L415 |
144,433 | yunify/qingstor-sdk-go | service/bucket.go | Validate | func (v *DeleteMultipleObjectsInput) Validate() error {
if len(v.Objects) == 0 {
return errors.ParameterRequiredError{
ParameterName: "Objects",
ParentName: "DeleteMultipleObjectsInput",
}
}
if len(v.Objects) > 0 {
for _, property := range v.Objects {
if err := property.Validate(); err != nil {
... | go | func (v *DeleteMultipleObjectsInput) Validate() error {
if len(v.Objects) == 0 {
return errors.ParameterRequiredError{
ParameterName: "Objects",
ParentName: "DeleteMultipleObjectsInput",
}
}
if len(v.Objects) > 0 {
for _, property := range v.Objects {
if err := property.Validate(); err != nil {
... | [
"func",
"(",
"v",
"*",
"DeleteMultipleObjectsInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"v",
".",
"Objects",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"Pare... | // Validate validates the input for DeleteMultipleObjects. | [
"Validate",
"validates",
"the",
"input",
"for",
"DeleteMultipleObjects",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L427-L445 |
144,434 | yunify/qingstor-sdk-go | service/bucket.go | GetACLRequest | func (s *Bucket) GetACLRequest() (*request.Request, *GetBucketACLOutput, error) {
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "GET Bucket ACL",
RequestMethod: "GET",
RequestURI: "/<bucket-name>?acl",
StatusCodes: []int{
200,... | go | func (s *Bucket) GetACLRequest() (*request.Request, *GetBucketACLOutput, error) {
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "GET Bucket ACL",
RequestMethod: "GET",
RequestURI: "/<bucket-name>?acl",
StatusCodes: []int{
200,... | [
"func",
"(",
"s",
"*",
"Bucket",
")",
"GetACLRequest",
"(",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"GetBucketACLOutput",
",",
"error",
")",
"{",
"properties",
":=",
"*",
"s",
".",
"Properties",
"\n\n",
"o",
":=",
"&",
"data",
".",
"Opera... | // GetACLRequest creates request and output object of GetBucketACL. | [
"GetACLRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"GetBucketACL",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L480-L502 |
144,435 | yunify/qingstor-sdk-go | service/bucket.go | ListMultipartUploadsRequest | func (s *Bucket) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) (*request.Request, *ListMultipartUploadsOutput, error) {
if input == nil {
input = &ListMultipartUploadsInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: ... | go | func (s *Bucket) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) (*request.Request, *ListMultipartUploadsOutput, error) {
if input == nil {
input = &ListMultipartUploadsInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: ... | [
"func",
"(",
"s",
"*",
"Bucket",
")",
"ListMultipartUploadsRequest",
"(",
"input",
"*",
"ListMultipartUploadsInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"ListMultipartUploadsOutput",
",",
"error",
")",
"{",
"if",
"input",
"==",
"nil",
"{",
"i... | // ListMultipartUploadsRequest creates request and output object of ListMultipartUploads. | [
"ListMultipartUploadsRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"ListMultipartUploads",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L932-L958 |
144,436 | yunify/qingstor-sdk-go | service/bucket.go | ListObjectsRequest | func (s *Bucket) ListObjectsRequest(input *ListObjectsInput) (*request.Request, *ListObjectsOutput, error) {
if input == nil {
input = &ListObjectsInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "GET Bucket (List Objects)",
... | go | func (s *Bucket) ListObjectsRequest(input *ListObjectsInput) (*request.Request, *ListObjectsOutput, error) {
if input == nil {
input = &ListObjectsInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "GET Bucket (List Objects)",
... | [
"func",
"(",
"s",
"*",
"Bucket",
")",
"ListObjectsRequest",
"(",
"input",
"*",
"ListObjectsInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"ListObjectsOutput",
",",
"error",
")",
"{",
"if",
"input",
"==",
"nil",
"{",
"input",
"=",
"&",
"Lis... | // ListObjectsRequest creates request and output object of ListObjects. | [
"ListObjectsRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"ListObjects",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1027-L1053 |
144,437 | yunify/qingstor-sdk-go | service/bucket.go | PutACLRequest | func (s *Bucket) PutACLRequest(input *PutBucketACLInput) (*request.Request, *PutBucketACLOutput, error) {
if input == nil {
input = &PutBucketACLInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "PUT Bucket ACL",
RequestMetho... | go | func (s *Bucket) PutACLRequest(input *PutBucketACLInput) (*request.Request, *PutBucketACLOutput, error) {
if input == nil {
input = &PutBucketACLInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "PUT Bucket ACL",
RequestMetho... | [
"func",
"(",
"s",
"*",
"Bucket",
")",
"PutACLRequest",
"(",
"input",
"*",
"PutBucketACLInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"PutBucketACLOutput",
",",
"error",
")",
"{",
"if",
"input",
"==",
"nil",
"{",
"input",
"=",
"&",
"PutBuc... | // PutACLRequest creates request and output object of PutBucketACL. | [
"PutACLRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"PutBucketACL",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1174-L1200 |
144,438 | yunify/qingstor-sdk-go | service/bucket.go | Validate | func (v *PutBucketACLInput) Validate() error {
if len(v.ACL) == 0 {
return errors.ParameterRequiredError{
ParameterName: "ACL",
ParentName: "PutBucketACLInput",
}
}
if len(v.ACL) > 0 {
for _, property := range v.ACL {
if err := property.Validate(); err != nil {
return err
}
}
}
return... | go | func (v *PutBucketACLInput) Validate() error {
if len(v.ACL) == 0 {
return errors.ParameterRequiredError{
ParameterName: "ACL",
ParentName: "PutBucketACLInput",
}
}
if len(v.ACL) > 0 {
for _, property := range v.ACL {
if err := property.Validate(); err != nil {
return err
}
}
}
return... | [
"func",
"(",
"v",
"*",
"PutBucketACLInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"v",
".",
"ACL",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":... | // Validate validates the input for PutBucketACL. | [
"Validate",
"validates",
"the",
"input",
"for",
"PutBucketACL",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1210-L1228 |
144,439 | yunify/qingstor-sdk-go | service/bucket.go | PutCORSRequest | func (s *Bucket) PutCORSRequest(input *PutBucketCORSInput) (*request.Request, *PutBucketCORSOutput, error) {
if input == nil {
input = &PutBucketCORSInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "PUT Bucket CORS",
Request... | go | func (s *Bucket) PutCORSRequest(input *PutBucketCORSInput) (*request.Request, *PutBucketCORSOutput, error) {
if input == nil {
input = &PutBucketCORSInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "PUT Bucket CORS",
Request... | [
"func",
"(",
"s",
"*",
"Bucket",
")",
"PutCORSRequest",
"(",
"input",
"*",
"PutBucketCORSInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"PutBucketCORSOutput",
",",
"error",
")",
"{",
"if",
"input",
"==",
"nil",
"{",
"input",
"=",
"&",
"Put... | // PutCORSRequest creates request and output object of PutBucketCORS. | [
"PutCORSRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"PutBucketCORS",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1258-L1284 |
144,440 | yunify/qingstor-sdk-go | service/bucket.go | Validate | func (v *PutBucketCORSInput) Validate() error {
if len(v.CORSRules) == 0 {
return errors.ParameterRequiredError{
ParameterName: "CORSRules",
ParentName: "PutBucketCORSInput",
}
}
if len(v.CORSRules) > 0 {
for _, property := range v.CORSRules {
if err := property.Validate(); err != nil {
retur... | go | func (v *PutBucketCORSInput) Validate() error {
if len(v.CORSRules) == 0 {
return errors.ParameterRequiredError{
ParameterName: "CORSRules",
ParentName: "PutBucketCORSInput",
}
}
if len(v.CORSRules) > 0 {
for _, property := range v.CORSRules {
if err := property.Validate(); err != nil {
retur... | [
"func",
"(",
"v",
"*",
"PutBucketCORSInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"v",
".",
"CORSRules",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName... | // Validate validates the input for PutBucketCORS. | [
"Validate",
"validates",
"the",
"input",
"for",
"PutBucketCORS",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1294-L1312 |
144,441 | yunify/qingstor-sdk-go | service/bucket.go | PutExternalMirrorRequest | func (s *Bucket) PutExternalMirrorRequest(input *PutBucketExternalMirrorInput) (*request.Request, *PutBucketExternalMirrorOutput, error) {
if input == nil {
input = &PutBucketExternalMirrorInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
API... | go | func (s *Bucket) PutExternalMirrorRequest(input *PutBucketExternalMirrorInput) (*request.Request, *PutBucketExternalMirrorOutput, error) {
if input == nil {
input = &PutBucketExternalMirrorInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
API... | [
"func",
"(",
"s",
"*",
"Bucket",
")",
"PutExternalMirrorRequest",
"(",
"input",
"*",
"PutBucketExternalMirrorInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"PutBucketExternalMirrorOutput",
",",
"error",
")",
"{",
"if",
"input",
"==",
"nil",
"{",
... | // PutExternalMirrorRequest creates request and output object of PutBucketExternalMirror. | [
"PutExternalMirrorRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"PutBucketExternalMirror",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1342-L1368 |
144,442 | yunify/qingstor-sdk-go | service/bucket.go | Validate | func (v *PutBucketExternalMirrorInput) Validate() error {
if v.SourceSite == nil {
return errors.ParameterRequiredError{
ParameterName: "SourceSite",
ParentName: "PutBucketExternalMirrorInput",
}
}
return nil
} | go | func (v *PutBucketExternalMirrorInput) Validate() error {
if v.SourceSite == nil {
return errors.ParameterRequiredError{
ParameterName: "SourceSite",
ParentName: "PutBucketExternalMirrorInput",
}
}
return nil
} | [
"func",
"(",
"v",
"*",
"PutBucketExternalMirrorInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"SourceSite",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":",
... | // Validate validates the input for PutBucketExternalMirror. | [
"Validate",
"validates",
"the",
"input",
"for",
"PutBucketExternalMirror",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1378-L1388 |
144,443 | yunify/qingstor-sdk-go | service/bucket.go | PutLifecycleRequest | func (s *Bucket) PutLifecycleRequest(input *PutBucketLifecycleInput) (*request.Request, *PutBucketLifecycleOutput, error) {
if input == nil {
input = &PutBucketLifecycleInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "PUT Buc... | go | func (s *Bucket) PutLifecycleRequest(input *PutBucketLifecycleInput) (*request.Request, *PutBucketLifecycleOutput, error) {
if input == nil {
input = &PutBucketLifecycleInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "PUT Buc... | [
"func",
"(",
"s",
"*",
"Bucket",
")",
"PutLifecycleRequest",
"(",
"input",
"*",
"PutBucketLifecycleInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"PutBucketLifecycleOutput",
",",
"error",
")",
"{",
"if",
"input",
"==",
"nil",
"{",
"input",
"="... | // PutLifecycleRequest creates request and output object of PutBucketLifecycle. | [
"PutLifecycleRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"PutBucketLifecycle",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1418-L1444 |
144,444 | yunify/qingstor-sdk-go | service/bucket.go | Validate | func (v *PutBucketLifecycleInput) Validate() error {
if len(v.Rule) == 0 {
return errors.ParameterRequiredError{
ParameterName: "Rule",
ParentName: "PutBucketLifecycleInput",
}
}
if len(v.Rule) > 0 {
for _, property := range v.Rule {
if err := property.Validate(); err != nil {
return err
}... | go | func (v *PutBucketLifecycleInput) Validate() error {
if len(v.Rule) == 0 {
return errors.ParameterRequiredError{
ParameterName: "Rule",
ParentName: "PutBucketLifecycleInput",
}
}
if len(v.Rule) > 0 {
for _, property := range v.Rule {
if err := property.Validate(); err != nil {
return err
}... | [
"func",
"(",
"v",
"*",
"PutBucketLifecycleInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"v",
".",
"Rule",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName... | // Validate validates the input for PutBucketLifecycle. | [
"Validate",
"validates",
"the",
"input",
"for",
"PutBucketLifecycle",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1454-L1472 |
144,445 | yunify/qingstor-sdk-go | service/bucket.go | PutNotificationRequest | func (s *Bucket) PutNotificationRequest(input *PutBucketNotificationInput) (*request.Request, *PutBucketNotificationOutput, error) {
if input == nil {
input = &PutBucketNotificationInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: ... | go | func (s *Bucket) PutNotificationRequest(input *PutBucketNotificationInput) (*request.Request, *PutBucketNotificationOutput, error) {
if input == nil {
input = &PutBucketNotificationInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: ... | [
"func",
"(",
"s",
"*",
"Bucket",
")",
"PutNotificationRequest",
"(",
"input",
"*",
"PutBucketNotificationInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"PutBucketNotificationOutput",
",",
"error",
")",
"{",
"if",
"input",
"==",
"nil",
"{",
"inpu... | // PutNotificationRequest creates request and output object of PutBucketNotification. | [
"PutNotificationRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"PutBucketNotification",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1502-L1528 |
144,446 | yunify/qingstor-sdk-go | service/bucket.go | Validate | func (v *PutBucketNotificationInput) Validate() error {
if len(v.Notifications) == 0 {
return errors.ParameterRequiredError{
ParameterName: "Notifications",
ParentName: "PutBucketNotificationInput",
}
}
if len(v.Notifications) > 0 {
for _, property := range v.Notifications {
if err := property.Va... | go | func (v *PutBucketNotificationInput) Validate() error {
if len(v.Notifications) == 0 {
return errors.ParameterRequiredError{
ParameterName: "Notifications",
ParentName: "PutBucketNotificationInput",
}
}
if len(v.Notifications) > 0 {
for _, property := range v.Notifications {
if err := property.Va... | [
"func",
"(",
"v",
"*",
"PutBucketNotificationInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"v",
".",
"Notifications",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
... | // Validate validates the input for PutBucketNotification. | [
"Validate",
"validates",
"the",
"input",
"for",
"PutBucketNotification",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1538-L1556 |
144,447 | yunify/qingstor-sdk-go | service/bucket.go | PutPolicyRequest | func (s *Bucket) PutPolicyRequest(input *PutBucketPolicyInput) (*request.Request, *PutBucketPolicyOutput, error) {
if input == nil {
input = &PutBucketPolicyInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "PUT Bucket Policy",... | go | func (s *Bucket) PutPolicyRequest(input *PutBucketPolicyInput) (*request.Request, *PutBucketPolicyOutput, error) {
if input == nil {
input = &PutBucketPolicyInput{}
}
properties := *s.Properties
o := &data.Operation{
Config: s.Config,
Properties: &properties,
APIName: "PUT Bucket Policy",... | [
"func",
"(",
"s",
"*",
"Bucket",
")",
"PutPolicyRequest",
"(",
"input",
"*",
"PutBucketPolicyInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"PutBucketPolicyOutput",
",",
"error",
")",
"{",
"if",
"input",
"==",
"nil",
"{",
"input",
"=",
"&",
... | // PutPolicyRequest creates request and output object of PutBucketPolicy. | [
"PutPolicyRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"PutBucketPolicy",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1586-L1612 |
144,448 | yunify/qingstor-sdk-go | service/bucket.go | Validate | func (v *PutBucketPolicyInput) Validate() error {
if len(v.Statement) == 0 {
return errors.ParameterRequiredError{
ParameterName: "Statement",
ParentName: "PutBucketPolicyInput",
}
}
if len(v.Statement) > 0 {
for _, property := range v.Statement {
if err := property.Validate(); err != nil {
r... | go | func (v *PutBucketPolicyInput) Validate() error {
if len(v.Statement) == 0 {
return errors.ParameterRequiredError{
ParameterName: "Statement",
ParentName: "PutBucketPolicyInput",
}
}
if len(v.Statement) > 0 {
for _, property := range v.Statement {
if err := property.Validate(); err != nil {
r... | [
"func",
"(",
"v",
"*",
"PutBucketPolicyInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"v",
".",
"Statement",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentNa... | // Validate validates the input for PutBucketPolicy. | [
"Validate",
"validates",
"the",
"input",
"for",
"PutBucketPolicy",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/bucket.go#L1622-L1640 |
144,449 | yunify/qingstor-sdk-go | client/upload/upload_client.go | Init | func Init(bucket *service.Bucket, partSize int) *Uploader {
return &Uploader{
bucket: bucket,
partSize: partSize,
}
} | go | func Init(bucket *service.Bucket, partSize int) *Uploader {
return &Uploader{
bucket: bucket,
partSize: partSize,
}
} | [
"func",
"Init",
"(",
"bucket",
"*",
"service",
".",
"Bucket",
",",
"partSize",
"int",
")",
"*",
"Uploader",
"{",
"return",
"&",
"Uploader",
"{",
"bucket",
":",
"bucket",
",",
"partSize",
":",
"partSize",
",",
"}",
"\n",
"}"
] | //Init creates a uploader struct | [
"Init",
"creates",
"a",
"uploader",
"struct"
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/upload/upload_client.go#L19-L24 |
144,450 | yunify/qingstor-sdk-go | client/upload/upload_client.go | Upload | func (u *Uploader) Upload(fd io.Reader, objectKey string) error {
if u.partSize < smallestPartSize {
logger.Errorf(nil, "Part size error")
return errors.New("the part size is too small")
}
uploadID, err := u.init(objectKey)
if err != nil {
logger.Errorf(nil, "Init multipart upload error, %v.", err)
return ... | go | func (u *Uploader) Upload(fd io.Reader, objectKey string) error {
if u.partSize < smallestPartSize {
logger.Errorf(nil, "Part size error")
return errors.New("the part size is too small")
}
uploadID, err := u.init(objectKey)
if err != nil {
logger.Errorf(nil, "Init multipart upload error, %v.", err)
return ... | [
"func",
"(",
"u",
"*",
"Uploader",
")",
"Upload",
"(",
"fd",
"io",
".",
"Reader",
",",
"objectKey",
"string",
")",
"error",
"{",
"if",
"u",
".",
"partSize",
"<",
"smallestPartSize",
"{",
"logger",
".",
"Errorf",
"(",
"nil",
",",
"\"",
"\"",
")",
"\... | // Upload uploads multi parts of large object | [
"Upload",
"uploads",
"multi",
"parts",
"of",
"large",
"object"
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/upload/upload_client.go#L27-L52 |
144,451 | yunify/qingstor-sdk-go | client/upload/chunk.go | newChunk | func newChunk(fd io.Reader, partSize int) *chunk {
f := &chunk{
fd: fd,
partSize: partSize,
}
f.initSize()
return f
} | go | func newChunk(fd io.Reader, partSize int) *chunk {
f := &chunk{
fd: fd,
partSize: partSize,
}
f.initSize()
return f
} | [
"func",
"newChunk",
"(",
"fd",
"io",
".",
"Reader",
",",
"partSize",
"int",
")",
"*",
"chunk",
"{",
"f",
":=",
"&",
"chunk",
"{",
"fd",
":",
"fd",
",",
"partSize",
":",
"partSize",
",",
"}",
"\n",
"f",
".",
"initSize",
"(",
")",
"\n\n",
"return",... | // newChunk creates a FileChunk struct | [
"newChunk",
"creates",
"a",
"FileChunk",
"struct"
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/upload/chunk.go#L25-L33 |
144,452 | yunify/qingstor-sdk-go | client/upload/chunk.go | nextPart | func (f *chunk) nextPart() (io.ReadSeeker, error) {
type readerAtSeeker interface {
io.ReaderAt
io.ReadSeeker
}
switch r := f.fd.(type) {
case readerAtSeeker:
var sectionSize int64
var err error
leftSize := f.size - f.cur
if leftSize >= int64(f.partSize) {
sectionSize = int64(f.partSize)
} else if ... | go | func (f *chunk) nextPart() (io.ReadSeeker, error) {
type readerAtSeeker interface {
io.ReaderAt
io.ReadSeeker
}
switch r := f.fd.(type) {
case readerAtSeeker:
var sectionSize int64
var err error
leftSize := f.size - f.cur
if leftSize >= int64(f.partSize) {
sectionSize = int64(f.partSize)
} else if ... | [
"func",
"(",
"f",
"*",
"chunk",
")",
"nextPart",
"(",
")",
"(",
"io",
".",
"ReadSeeker",
",",
"error",
")",
"{",
"type",
"readerAtSeeker",
"interface",
"{",
"io",
".",
"ReaderAt",
"\n",
"io",
".",
"ReadSeeker",
"\n",
"}",
"\n",
"switch",
"r",
":=",
... | // nextPart reads the next part of the file | [
"nextPart",
"reads",
"the",
"next",
"part",
"of",
"the",
"file"
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/upload/chunk.go#L36-L80 |
144,453 | yunify/qingstor-sdk-go | client/upload/chunk.go | initSize | func (f *chunk) initSize() {
f.size = -1
switch r := f.fd.(type) {
case io.Seeker:
pos, _ := r.Seek(0, 1)
defer r.Seek(pos, 0)
n, err := r.Seek(0, 2)
if err != nil {
return
}
f.size = n
// Try to adjust partSize if it is too small and account for
// integer division truncation.
if f.size/int6... | go | func (f *chunk) initSize() {
f.size = -1
switch r := f.fd.(type) {
case io.Seeker:
pos, _ := r.Seek(0, 1)
defer r.Seek(pos, 0)
n, err := r.Seek(0, 2)
if err != nil {
return
}
f.size = n
// Try to adjust partSize if it is too small and account for
// integer division truncation.
if f.size/int6... | [
"func",
"(",
"f",
"*",
"chunk",
")",
"initSize",
"(",
")",
"{",
"f",
".",
"size",
"=",
"-",
"1",
"\n\n",
"switch",
"r",
":=",
"f",
".",
"fd",
".",
"(",
"type",
")",
"{",
"case",
"io",
".",
"Seeker",
":",
"pos",
",",
"_",
":=",
"r",
".",
"... | // initSize tries to detect the total stream size, setting u.size. If
// the size is not known, size is set to -1. | [
"initSize",
"tries",
"to",
"detect",
"the",
"total",
"stream",
"size",
"setting",
"u",
".",
"size",
".",
"If",
"the",
"size",
"is",
"not",
"known",
"size",
"is",
"set",
"to",
"-",
"1",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/client/upload/chunk.go#L84-L106 |
144,454 | yunify/qingstor-sdk-go | request/errors/qingstor.go | Error | func (qse QingStorError) Error() string {
return fmt.Sprintf(
"QingStor Error: StatusCode \"%d\", Code \"%s\", Message \"%s\", Request ID \"%s\", Reference URL \"%s\"",
qse.StatusCode, qse.Code, qse.Message, qse.RequestID, qse.ReferenceURL)
} | go | func (qse QingStorError) Error() string {
return fmt.Sprintf(
"QingStor Error: StatusCode \"%d\", Code \"%s\", Message \"%s\", Request ID \"%s\", Reference URL \"%s\"",
qse.StatusCode, qse.Code, qse.Message, qse.RequestID, qse.ReferenceURL)
} | [
"func",
"(",
"qse",
"QingStorError",
")",
"Error",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"qse",
".",
"StatusCode",
",",
"qse",
"... | // Error returns the description of QingStor error response. | [
"Error",
"returns",
"the",
"description",
"of",
"QingStor",
"error",
"response",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/errors/qingstor.go#L32-L36 |
144,455 | yunify/qingstor-sdk-go | config/config.go | New | func New(accessKeyID, secretAccessKey string) (c *Config, err error) {
c, err = NewDefault()
if err != nil {
c = nil
return
}
c.AccessKeyID = accessKeyID
c.SecretAccessKey = secretAccessKey
return
} | go | func New(accessKeyID, secretAccessKey string) (c *Config, err error) {
c, err = NewDefault()
if err != nil {
c = nil
return
}
c.AccessKeyID = accessKeyID
c.SecretAccessKey = secretAccessKey
return
} | [
"func",
"New",
"(",
"accessKeyID",
",",
"secretAccessKey",
"string",
")",
"(",
"c",
"*",
"Config",
",",
"err",
"error",
")",
"{",
"c",
",",
"err",
"=",
"NewDefault",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
"=",
"nil",
"\n",
"return",
... | // New create a Config with given AccessKeyID and SecretAccessKey. | [
"New",
"create",
"a",
"Config",
"with",
"given",
"AccessKeyID",
"and",
"SecretAccessKey",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/config/config.go#L97-L107 |
144,456 | yunify/qingstor-sdk-go | config/config.go | NewDefault | func NewDefault() (c *Config, err error) {
c = &Config{}
err = c.LoadDefaultConfig()
if err != nil {
c = nil
return
}
return
} | go | func NewDefault() (c *Config, err error) {
c = &Config{}
err = c.LoadDefaultConfig()
if err != nil {
c = nil
return
}
return
} | [
"func",
"NewDefault",
"(",
")",
"(",
"c",
"*",
"Config",
",",
"err",
"error",
")",
"{",
"c",
"=",
"&",
"Config",
"{",
"}",
"\n",
"err",
"=",
"c",
".",
"LoadDefaultConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
"=",
"nil",
"\n",
... | // NewDefault create a Config with default configuration. | [
"NewDefault",
"create",
"a",
"Config",
"with",
"default",
"configuration",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/config/config.go#L110-L118 |
144,457 | yunify/qingstor-sdk-go | config/config.go | Check | func (c *Config) Check() (err error) {
if c.AccessKeyID == "" {
err = errors.New("access key ID not specified")
return
}
if c.SecretAccessKey == "" {
err = errors.New("secret access key not specified")
return
}
if c.Host == "" {
err = errors.New("server host not specified")
return
}
if c.Port <= 0 {... | go | func (c *Config) Check() (err error) {
if c.AccessKeyID == "" {
err = errors.New("access key ID not specified")
return
}
if c.SecretAccessKey == "" {
err = errors.New("secret access key not specified")
return
}
if c.Host == "" {
err = errors.New("server host not specified")
return
}
if c.Port <= 0 {... | [
"func",
"(",
"c",
"*",
"Config",
")",
"Check",
"(",
")",
"(",
"err",
"error",
")",
"{",
"if",
"c",
".",
"AccessKeyID",
"==",
"\"",
"\"",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"c",
... | // Check checks the configuration. | [
"Check",
"checks",
"the",
"configuration",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/config/config.go#L121-L160 |
144,458 | yunify/qingstor-sdk-go | config/config.go | LoadDefaultConfig | func (c *Config) LoadDefaultConfig() (err error) {
c.HTTPSettings = DefaultHTTPClientSettings
err = yaml.Unmarshal([]byte(DefaultConfigFileContent), c)
if err != nil {
logger.Errorf(nil, "Config parse error, %v.", err)
return
}
logger.SetLevel(c.LogLevel)
c.InitHTTPClient()
return
} | go | func (c *Config) LoadDefaultConfig() (err error) {
c.HTTPSettings = DefaultHTTPClientSettings
err = yaml.Unmarshal([]byte(DefaultConfigFileContent), c)
if err != nil {
logger.Errorf(nil, "Config parse error, %v.", err)
return
}
logger.SetLevel(c.LogLevel)
c.InitHTTPClient()
return
} | [
"func",
"(",
"c",
"*",
"Config",
")",
"LoadDefaultConfig",
"(",
")",
"(",
"err",
"error",
")",
"{",
"c",
".",
"HTTPSettings",
"=",
"DefaultHTTPClientSettings",
"\n\n",
"err",
"=",
"yaml",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"DefaultConfigFileCont... | // LoadDefaultConfig loads the default configuration for Config.
// It returns error if yaml decode failed. | [
"LoadDefaultConfig",
"loads",
"the",
"default",
"configuration",
"for",
"Config",
".",
"It",
"returns",
"error",
"if",
"yaml",
"decode",
"failed",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/config/config.go#L164-L178 |
144,459 | yunify/qingstor-sdk-go | config/config.go | LoadConfigFromFilePath | func (c *Config) LoadConfigFromFilePath(filePath string) (err error) {
if strings.Index(filePath, "~/") == 0 {
filePath = strings.Replace(filePath, "~/", getHome()+"/", 1)
}
yamlString, err := ioutil.ReadFile(filePath)
if err != nil {
logger.Errorf(nil, "File not found: %s.", filePath)
return err
}
return... | go | func (c *Config) LoadConfigFromFilePath(filePath string) (err error) {
if strings.Index(filePath, "~/") == 0 {
filePath = strings.Replace(filePath, "~/", getHome()+"/", 1)
}
yamlString, err := ioutil.ReadFile(filePath)
if err != nil {
logger.Errorf(nil, "File not found: %s.", filePath)
return err
}
return... | [
"func",
"(",
"c",
"*",
"Config",
")",
"LoadConfigFromFilePath",
"(",
"filePath",
"string",
")",
"(",
"err",
"error",
")",
"{",
"if",
"strings",
".",
"Index",
"(",
"filePath",
",",
"\"",
"\"",
")",
"==",
"0",
"{",
"filePath",
"=",
"strings",
".",
"Rep... | // LoadConfigFromFilePath loads configuration from a specified local path.
// It returns error if file not found or yaml decode failed. | [
"LoadConfigFromFilePath",
"loads",
"configuration",
"from",
"a",
"specified",
"local",
"path",
".",
"It",
"returns",
"error",
"if",
"file",
"not",
"found",
"or",
"yaml",
"decode",
"failed",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/config/config.go#L194-L206 |
144,460 | yunify/qingstor-sdk-go | config/config.go | LoadConfigFromContent | func (c *Config) LoadConfigFromContent(content []byte) (err error) {
c.LoadDefaultConfig()
err = yaml.Unmarshal(content, c)
if err != nil {
logger.Errorf(nil, "Config parse error, %v.", err)
return
}
err = c.Check()
if err != nil {
return
}
logger.SetLevel(c.LogLevel)
c.InitHTTPClient()
return
} | go | func (c *Config) LoadConfigFromContent(content []byte) (err error) {
c.LoadDefaultConfig()
err = yaml.Unmarshal(content, c)
if err != nil {
logger.Errorf(nil, "Config parse error, %v.", err)
return
}
err = c.Check()
if err != nil {
return
}
logger.SetLevel(c.LogLevel)
c.InitHTTPClient()
return
} | [
"func",
"(",
"c",
"*",
"Config",
")",
"LoadConfigFromContent",
"(",
"content",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"c",
".",
"LoadDefaultConfig",
"(",
")",
"\n\n",
"err",
"=",
"yaml",
".",
"Unmarshal",
"(",
"content",
",",
"c",
")",... | // LoadConfigFromContent loads configuration from a given byte slice.
// It returns error if yaml decode failed. | [
"LoadConfigFromContent",
"loads",
"configuration",
"from",
"a",
"given",
"byte",
"slice",
".",
"It",
"returns",
"error",
"if",
"yaml",
"decode",
"failed",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/config/config.go#L210-L228 |
144,461 | yunify/qingstor-sdk-go | service/types.go | Validate | func (v *AbortIncompleteMultipartUploadType) Validate() error {
if v.DaysAfterInitiation == nil {
return errors.ParameterRequiredError{
ParameterName: "DaysAfterInitiation",
ParentName: "AbortIncompleteMultipartUpload",
}
}
return nil
} | go | func (v *AbortIncompleteMultipartUploadType) Validate() error {
if v.DaysAfterInitiation == nil {
return errors.ParameterRequiredError{
ParameterName: "DaysAfterInitiation",
ParentName: "AbortIncompleteMultipartUpload",
}
}
return nil
} | [
"func",
"(",
"v",
"*",
"AbortIncompleteMultipartUploadType",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"DaysAfterInitiation",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"Paren... | // Validate validates the AbortIncompleteMultipartUpload. | [
"Validate",
"validates",
"the",
"AbortIncompleteMultipartUpload",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/types.go#L44-L54 |
144,462 | yunify/qingstor-sdk-go | service/types.go | Validate | func (v *ACLType) Validate() error {
if v.Grantee != nil {
if err := v.Grantee.Validate(); err != nil {
return err
}
}
if v.Grantee == nil {
return errors.ParameterRequiredError{
ParameterName: "Grantee",
ParentName: "ACL",
}
}
if v.Permission == nil {
return errors.ParameterRequiredError{... | go | func (v *ACLType) Validate() error {
if v.Grantee != nil {
if err := v.Grantee.Validate(); err != nil {
return err
}
}
if v.Grantee == nil {
return errors.ParameterRequiredError{
ParameterName: "Grantee",
ParentName: "ACL",
}
}
if v.Permission == nil {
return errors.ParameterRequiredError{... | [
"func",
"(",
"v",
"*",
"ACLType",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"Grantee",
"!=",
"nil",
"{",
"if",
"err",
":=",
"v",
".",
"Grantee",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",... | // Validate validates the ACL. | [
"Validate",
"validates",
"the",
"ACL",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/types.go#L66-L109 |
144,463 | yunify/qingstor-sdk-go | service/types.go | Validate | func (v *ConditionType) Validate() error {
if v.IPAddress != nil {
if err := v.IPAddress.Validate(); err != nil {
return err
}
}
if v.IsNull != nil {
if err := v.IsNull.Validate(); err != nil {
return err
}
}
if v.NotIPAddress != nil {
if err := v.NotIPAddress.Validate(); err != nil {
return ... | go | func (v *ConditionType) Validate() error {
if v.IPAddress != nil {
if err := v.IPAddress.Validate(); err != nil {
return err
}
}
if v.IsNull != nil {
if err := v.IsNull.Validate(); err != nil {
return err
}
}
if v.NotIPAddress != nil {
if err := v.NotIPAddress.Validate(); err != nil {
return ... | [
"func",
"(",
"v",
"*",
"ConditionType",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"IPAddress",
"!=",
"nil",
"{",
"if",
"err",
":=",
"v",
".",
"IPAddress",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\... | // Validate validates the Condition. | [
"Validate",
"validates",
"the",
"Condition",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/types.go#L160-L193 |
144,464 | yunify/qingstor-sdk-go | service/types.go | Validate | func (v *CORSRuleType) Validate() error {
if len(v.AllowedMethods) == 0 {
return errors.ParameterRequiredError{
ParameterName: "AllowedMethods",
ParentName: "CORSRule",
}
}
if v.AllowedOrigin == nil {
return errors.ParameterRequiredError{
ParameterName: "AllowedOrigin",
ParentName: "CORSRul... | go | func (v *CORSRuleType) Validate() error {
if len(v.AllowedMethods) == 0 {
return errors.ParameterRequiredError{
ParameterName: "AllowedMethods",
ParentName: "CORSRule",
}
}
if v.AllowedOrigin == nil {
return errors.ParameterRequiredError{
ParameterName: "AllowedOrigin",
ParentName: "CORSRul... | [
"func",
"(",
"v",
"*",
"CORSRuleType",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"v",
".",
"AllowedMethods",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName"... | // Validate validates the CORSRule. | [
"Validate",
"validates",
"the",
"CORSRule",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/types.go#L210-L227 |
144,465 | yunify/qingstor-sdk-go | service/types.go | Validate | func (v *FilterType) Validate() error {
if v.Prefix == nil {
return errors.ParameterRequiredError{
ParameterName: "Prefix",
ParentName: "Filter",
}
}
return nil
} | go | func (v *FilterType) Validate() error {
if v.Prefix == nil {
return errors.ParameterRequiredError{
ParameterName: "Prefix",
ParentName: "Filter",
}
}
return nil
} | [
"func",
"(",
"v",
"*",
"FilterType",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"Prefix",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":",
"\"",
"\"",
",",... | // Validate validates the Filter. | [
"Validate",
"validates",
"the",
"Filter",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/types.go#L249-L259 |
144,466 | yunify/qingstor-sdk-go | service/types.go | Validate | func (v *GranteeType) Validate() error {
if v.Type == nil {
return errors.ParameterRequiredError{
ParameterName: "Type",
ParentName: "Grantee",
}
}
if v.Type != nil {
typeValidValues := []string{"user", "group"}
typeParameterValue := fmt.Sprint(*v.Type)
typeIsValid := false
for _, value := ra... | go | func (v *GranteeType) Validate() error {
if v.Type == nil {
return errors.ParameterRequiredError{
ParameterName: "Type",
ParentName: "Grantee",
}
}
if v.Type != nil {
typeValidValues := []string{"user", "group"}
typeParameterValue := fmt.Sprint(*v.Type)
typeIsValid := false
for _, value := ra... | [
"func",
"(",
"v",
"*",
"GranteeType",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"Type",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":",
"\"",
"\"",
",",
... | // Validate validates the Grantee. | [
"Validate",
"validates",
"the",
"Grantee",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/types.go#L274-L304 |
144,467 | yunify/qingstor-sdk-go | service/types.go | Validate | func (v *NotificationType) Validate() error {
if v.Cloudfunc == nil {
return errors.ParameterRequiredError{
ParameterName: "Cloudfunc",
ParentName: "Notification",
}
}
if v.Cloudfunc != nil {
cloudfuncValidValues := []string{"tupu-porn", "notifier", "image"}
cloudfuncParameterValue := fmt.Sprint(*... | go | func (v *NotificationType) Validate() error {
if v.Cloudfunc == nil {
return errors.ParameterRequiredError{
ParameterName: "Cloudfunc",
ParentName: "Notification",
}
}
if v.Cloudfunc != nil {
cloudfuncValidValues := []string{"tupu-porn", "notifier", "image"}
cloudfuncParameterValue := fmt.Sprint(*... | [
"func",
"(",
"v",
"*",
"NotificationType",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"Cloudfunc",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":",
"\"",
"\"... | // Validate validates the Notification. | [
"Validate",
"validates",
"the",
"Notification",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/types.go#L401-L451 |
144,468 | yunify/qingstor-sdk-go | service/types.go | Validate | func (v *ObjectPartType) Validate() error {
if v.PartNumber == nil {
return errors.ParameterRequiredError{
ParameterName: "PartNumber",
ParentName: "ObjectPart",
}
}
return nil
} | go | func (v *ObjectPartType) Validate() error {
if v.PartNumber == nil {
return errors.ParameterRequiredError{
ParameterName: "PartNumber",
ParentName: "ObjectPart",
}
}
return nil
} | [
"func",
"(",
"v",
"*",
"ObjectPartType",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"PartNumber",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":",
"\"",
"\""... | // Validate validates the ObjectPart. | [
"Validate",
"validates",
"the",
"ObjectPart",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/types.go#L466-L476 |
144,469 | yunify/qingstor-sdk-go | service/types.go | Validate | func (v *RuleType) Validate() error {
if v.AbortIncompleteMultipartUpload != nil {
if err := v.AbortIncompleteMultipartUpload.Validate(); err != nil {
return err
}
}
if v.Expiration != nil {
if err := v.Expiration.Validate(); err != nil {
return err
}
}
if v.Filter != nil {
if err := v.Filter.Va... | go | func (v *RuleType) Validate() error {
if v.AbortIncompleteMultipartUpload != nil {
if err := v.AbortIncompleteMultipartUpload.Validate(); err != nil {
return err
}
}
if v.Expiration != nil {
if err := v.Expiration.Validate(); err != nil {
return err
}
}
if v.Filter != nil {
if err := v.Filter.Va... | [
"func",
"(",
"v",
"*",
"RuleType",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"AbortIncompleteMultipartUpload",
"!=",
"nil",
"{",
"if",
"err",
":=",
"v",
".",
"AbortIncompleteMultipartUpload",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"n... | // Validate validates the Rule. | [
"Validate",
"validates",
"the",
"Rule",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/types.go#L506-L574 |
144,470 | yunify/qingstor-sdk-go | service/types.go | Validate | func (v *StatementType) Validate() error {
if len(v.Action) == 0 {
return errors.ParameterRequiredError{
ParameterName: "Action",
ParentName: "Statement",
}
}
if v.Condition != nil {
if err := v.Condition.Validate(); err != nil {
return err
}
}
if v.Effect == nil {
return errors.ParameterR... | go | func (v *StatementType) Validate() error {
if len(v.Action) == 0 {
return errors.ParameterRequiredError{
ParameterName: "Action",
ParentName: "Statement",
}
}
if v.Condition != nil {
if err := v.Condition.Validate(); err != nil {
return err
}
}
if v.Effect == nil {
return errors.ParameterR... | [
"func",
"(",
"v",
"*",
"StatementType",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"v",
".",
"Action",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":"... | // Validate validates the Statement. | [
"Validate",
"validates",
"the",
"Statement",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/types.go#L594-L651 |
144,471 | yunify/qingstor-sdk-go | service/types.go | Validate | func (v *TransitionType) Validate() error {
if v.StorageClass == nil {
return errors.ParameterRequiredError{
ParameterName: "StorageClass",
ParentName: "Transition",
}
}
return nil
} | go | func (v *TransitionType) Validate() error {
if v.StorageClass == nil {
return errors.ParameterRequiredError{
ParameterName: "StorageClass",
ParentName: "Transition",
}
}
return nil
} | [
"func",
"(",
"v",
"*",
"TransitionType",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"StorageClass",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":",
"\"",
"\... | // Validate validates the Transition. | [
"Validate",
"validates",
"the",
"Transition",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/types.go#L687-L697 |
144,472 | yunify/qingstor-sdk-go | service/object.go | Validate | func (v *CompleteMultipartUploadInput) Validate() error {
if v.UploadID == nil {
return errors.ParameterRequiredError{
ParameterName: "UploadID",
ParentName: "CompleteMultipartUploadInput",
}
}
if len(v.ObjectParts) == 0 {
return errors.ParameterRequiredError{
ParameterName: "ObjectParts",
Par... | go | func (v *CompleteMultipartUploadInput) Validate() error {
if v.UploadID == nil {
return errors.ParameterRequiredError{
ParameterName: "UploadID",
ParentName: "CompleteMultipartUploadInput",
}
}
if len(v.ObjectParts) == 0 {
return errors.ParameterRequiredError{
ParameterName: "ObjectParts",
Par... | [
"func",
"(",
"v",
"*",
"CompleteMultipartUploadInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"UploadID",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":",
... | // Validate validates the input for CompleteMultipartUpload. | [
"Validate",
"validates",
"the",
"input",
"for",
"CompleteMultipartUpload",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/object.go#L188-L213 |
144,473 | yunify/qingstor-sdk-go | service/object.go | GetObjectRequest | func (s *Bucket) GetObjectRequest(objectKey string, input *GetObjectInput) (*request.Request, *GetObjectOutput, error) {
if input == nil {
input = &GetObjectInput{}
}
properties := *s.Properties
properties.ObjectKey = &objectKey
o := &data.Operation{
Config: s.Config,
Properties: &properties,
... | go | func (s *Bucket) GetObjectRequest(objectKey string, input *GetObjectInput) (*request.Request, *GetObjectOutput, error) {
if input == nil {
input = &GetObjectInput{}
}
properties := *s.Properties
properties.ObjectKey = &objectKey
o := &data.Operation{
Config: s.Config,
Properties: &properties,
... | [
"func",
"(",
"s",
"*",
"Bucket",
")",
"GetObjectRequest",
"(",
"objectKey",
"string",
",",
"input",
"*",
"GetObjectInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"GetObjectOutput",
",",
"error",
")",
"{",
"if",
"input",
"==",
"nil",
"{",
"... | // GetObjectRequest creates request and output object of GetObject. | [
"GetObjectRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"GetObject",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/object.go#L300-L331 |
144,474 | yunify/qingstor-sdk-go | service/object.go | Validate | func (v *ImageProcessInput) Validate() error {
if v.Action == nil {
return errors.ParameterRequiredError{
ParameterName: "Action",
ParentName: "ImageProcessInput",
}
}
return nil
} | go | func (v *ImageProcessInput) Validate() error {
if v.Action == nil {
return errors.ParameterRequiredError{
ParameterName: "Action",
ParentName: "ImageProcessInput",
}
}
return nil
} | [
"func",
"(",
"v",
"*",
"ImageProcessInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"Action",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":",
"\"",
"\"",... | // Validate validates the input for ImageProcess. | [
"Validate",
"validates",
"the",
"input",
"for",
"ImageProcess",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/object.go#L582-L592 |
144,475 | yunify/qingstor-sdk-go | service/object.go | Validate | func (v *InitiateMultipartUploadInput) Validate() error {
if v.XQSStorageClass != nil {
xQSStorageClassValidValues := []string{"STANDARD", "STANDARD_IA"}
xQSStorageClassParameterValue := fmt.Sprint(*v.XQSStorageClass)
xQSStorageClassIsValid := false
for _, value := range xQSStorageClassValidValues {
if va... | go | func (v *InitiateMultipartUploadInput) Validate() error {
if v.XQSStorageClass != nil {
xQSStorageClassValidValues := []string{"STANDARD", "STANDARD_IA"}
xQSStorageClassParameterValue := fmt.Sprint(*v.XQSStorageClass)
xQSStorageClassIsValid := false
for _, value := range xQSStorageClassValidValues {
if va... | [
"func",
"(",
"v",
"*",
"InitiateMultipartUploadInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"XQSStorageClass",
"!=",
"nil",
"{",
"xQSStorageClassValidValues",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"xQS... | // Validate validates the input for InitiateMultipartUpload. | [
"Validate",
"validates",
"the",
"input",
"for",
"InitiateMultipartUpload",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/object.go#L682-L705 |
144,476 | yunify/qingstor-sdk-go | service/object.go | Validate | func (v *ListMultipartInput) Validate() error {
if v.UploadID == nil {
return errors.ParameterRequiredError{
ParameterName: "UploadID",
ParentName: "ListMultipartInput",
}
}
return nil
} | go | func (v *ListMultipartInput) Validate() error {
if v.UploadID == nil {
return errors.ParameterRequiredError{
ParameterName: "UploadID",
ParentName: "ListMultipartInput",
}
}
return nil
} | [
"func",
"(",
"v",
"*",
"ListMultipartInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"UploadID",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":",
"\"",
"\... | // Validate validates the input for ListMultipart. | [
"Validate",
"validates",
"the",
"input",
"for",
"ListMultipart",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/object.go#L787-L797 |
144,477 | yunify/qingstor-sdk-go | service/object.go | Validate | func (v *OptionsObjectInput) Validate() error {
if v.AccessControlRequestMethod == nil {
return errors.ParameterRequiredError{
ParameterName: "AccessControlRequestMethod",
ParentName: "OptionsObjectInput",
}
}
if v.Origin == nil {
return errors.ParameterRequiredError{
ParameterName: "Origin",
... | go | func (v *OptionsObjectInput) Validate() error {
if v.AccessControlRequestMethod == nil {
return errors.ParameterRequiredError{
ParameterName: "AccessControlRequestMethod",
ParentName: "OptionsObjectInput",
}
}
if v.Origin == nil {
return errors.ParameterRequiredError{
ParameterName: "Origin",
... | [
"func",
"(",
"v",
"*",
"OptionsObjectInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"AccessControlRequestMethod",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
... | // Validate validates the input for OptionsObject. | [
"Validate",
"validates",
"the",
"input",
"for",
"OptionsObject",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/object.go#L876-L893 |
144,478 | yunify/qingstor-sdk-go | service/object.go | Validate | func (v *UploadMultipartInput) Validate() error {
if v.PartNumber == nil {
return errors.ParameterRequiredError{
ParameterName: "PartNumber",
ParentName: "UploadMultipartInput",
}
}
if v.UploadID == nil {
return errors.ParameterRequiredError{
ParameterName: "UploadID",
ParentName: "UploadMu... | go | func (v *UploadMultipartInput) Validate() error {
if v.PartNumber == nil {
return errors.ParameterRequiredError{
ParameterName: "PartNumber",
ParentName: "UploadMultipartInput",
}
}
if v.UploadID == nil {
return errors.ParameterRequiredError{
ParameterName: "UploadID",
ParentName: "UploadMu... | [
"func",
"(",
"v",
"*",
"UploadMultipartInput",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"v",
".",
"PartNumber",
"==",
"nil",
"{",
"return",
"errors",
".",
"ParameterRequiredError",
"{",
"ParameterName",
":",
"\"",
"\"",
",",
"ParentName",
":",
"\"",
... | // Validate validates the input for UploadMultipart. | [
"Validate",
"validates",
"the",
"input",
"for",
"UploadMultipart",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/object.go#L1144-L1161 |
144,479 | yunify/qingstor-sdk-go | config/contract.go | InstallDefaultUserConfig | func InstallDefaultUserConfig() error {
err := os.MkdirAll(path.Dir(GetUserConfigFilePath()), 0755)
if err != nil {
return err
}
return ioutil.WriteFile(GetUserConfigFilePath(), []byte(DefaultConfigFileContent), 0644)
} | go | func InstallDefaultUserConfig() error {
err := os.MkdirAll(path.Dir(GetUserConfigFilePath()), 0755)
if err != nil {
return err
}
return ioutil.WriteFile(GetUserConfigFilePath(), []byte(DefaultConfigFileContent), 0644)
} | [
"func",
"InstallDefaultUserConfig",
"(",
")",
"error",
"{",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"path",
".",
"Dir",
"(",
"GetUserConfigFilePath",
"(",
")",
")",
",",
"0755",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"... | // InstallDefaultUserConfig will install default config file. | [
"InstallDefaultUserConfig",
"will",
"install",
"default",
"config",
"file",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/config/contract.go#L55-L62 |
144,480 | yunify/qingstor-sdk-go | request/request.go | New | func New(o *data.Operation, i data.Input, x interface{}) (*Request, error) {
input := reflect.ValueOf(i)
if input.IsValid() && input.Elem().IsValid() {
err := i.Validate()
if err != nil {
return nil, err
}
}
output := reflect.ValueOf(x)
return &Request{
Operation: o,
Input: &input,
Output: &... | go | func New(o *data.Operation, i data.Input, x interface{}) (*Request, error) {
input := reflect.ValueOf(i)
if input.IsValid() && input.Elem().IsValid() {
err := i.Validate()
if err != nil {
return nil, err
}
}
output := reflect.ValueOf(x)
return &Request{
Operation: o,
Input: &input,
Output: &... | [
"func",
"New",
"(",
"o",
"*",
"data",
".",
"Operation",
",",
"i",
"data",
".",
"Input",
",",
"x",
"interface",
"{",
"}",
")",
"(",
"*",
"Request",
",",
"error",
")",
"{",
"input",
":=",
"reflect",
".",
"ValueOf",
"(",
"i",
")",
"\n",
"if",
"inp... | // New create a Request from given Operation, Input and Output.
// It returns a Request. | [
"New",
"create",
"a",
"Request",
"from",
"given",
"Operation",
"Input",
"and",
"Output",
".",
"It",
"returns",
"a",
"Request",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/request.go#L48-L63 |
144,481 | yunify/qingstor-sdk-go | request/request.go | Send | func (r *Request) Send() error {
err := r.Build()
if err != nil {
return err
}
err = r.Sign()
if err != nil {
return err
}
err = r.Do()
if err != nil {
return err
}
return nil
} | go | func (r *Request) Send() error {
err := r.Build()
if err != nil {
return err
}
err = r.Sign()
if err != nil {
return err
}
err = r.Do()
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"Send",
"(",
")",
"error",
"{",
"err",
":=",
"r",
".",
"Build",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"r",
".",
"Sign",
"(",
")",
"\n",
"if",
"e... | // Send sends API request.
// It returns error if error occurred. | [
"Send",
"sends",
"API",
"request",
".",
"It",
"returns",
"error",
"if",
"error",
"occurred",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/request.go#L67-L84 |
144,482 | yunify/qingstor-sdk-go | request/request.go | Build | func (r *Request) Build() error {
err := r.check()
if err != nil {
return err
}
err = r.build()
if err != nil {
return err
}
return nil
} | go | func (r *Request) Build() error {
err := r.check()
if err != nil {
return err
}
err = r.build()
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"Build",
"(",
")",
"error",
"{",
"err",
":=",
"r",
".",
"check",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"r",
".",
"build",
"(",
")",
"\n",
"if",
... | // Build checks and builds the API request.
// It returns error if error occurred. | [
"Build",
"checks",
"and",
"builds",
"the",
"API",
"request",
".",
"It",
"returns",
"error",
"if",
"error",
"occurred",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/request.go#L88-L100 |
144,483 | yunify/qingstor-sdk-go | request/request.go | Do | func (r *Request) Do() error {
err := r.send()
if err != nil {
return err
}
err = r.unpack()
if err != nil {
return err
}
return nil
} | go | func (r *Request) Do() error {
err := r.send()
if err != nil {
return err
}
err = r.unpack()
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"Do",
"(",
")",
"error",
"{",
"err",
":=",
"r",
".",
"send",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"r",
".",
"unpack",
"(",
")",
"\n",
"if",
"er... | // Do sends and unpacks the API request.
// It returns error if error occurred. | [
"Do",
"sends",
"and",
"unpacks",
"the",
"API",
"request",
".",
"It",
"returns",
"error",
"if",
"error",
"occurred",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/request.go#L104-L115 |
144,484 | yunify/qingstor-sdk-go | request/request.go | Sign | func (r *Request) Sign() error {
err := r.sign()
if err != nil {
return err
}
return nil
} | go | func (r *Request) Sign() error {
err := r.sign()
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"Sign",
"(",
")",
"error",
"{",
"err",
":=",
"r",
".",
"sign",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Sign sign the API request by setting the authorization header.
// It returns error if error occurred. | [
"Sign",
"sign",
"the",
"API",
"request",
"by",
"setting",
"the",
"authorization",
"header",
".",
"It",
"returns",
"error",
"if",
"error",
"occurred",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/request.go#L119-L126 |
144,485 | yunify/qingstor-sdk-go | request/request.go | SignQuery | func (r *Request) SignQuery(timeoutSeconds int) error {
err := r.signQuery(int(time.Now().Unix()) + timeoutSeconds)
if err != nil {
return err
}
return nil
} | go | func (r *Request) SignQuery(timeoutSeconds int) error {
err := r.signQuery(int(time.Now().Unix()) + timeoutSeconds)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"SignQuery",
"(",
"timeoutSeconds",
"int",
")",
"error",
"{",
"err",
":=",
"r",
".",
"signQuery",
"(",
"int",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Unix",
"(",
")",
")",
"+",
"timeoutSeconds",
")",
"\n",
... | // SignQuery sign the API request by appending query string.
// It returns error if error occurred. | [
"SignQuery",
"sign",
"the",
"API",
"request",
"by",
"appending",
"query",
"string",
".",
"It",
"returns",
"error",
"if",
"error",
"occurred",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/request.go#L130-L137 |
144,486 | yunify/qingstor-sdk-go | request/request.go | ApplySignature | func (r *Request) ApplySignature(authorization string) error {
r.HTTPRequest.Header.Set("Authorization", authorization)
return nil
} | go | func (r *Request) ApplySignature(authorization string) error {
r.HTTPRequest.Header.Set("Authorization", authorization)
return nil
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"ApplySignature",
"(",
"authorization",
"string",
")",
"error",
"{",
"r",
".",
"HTTPRequest",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"authorization",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // ApplySignature applies the Authorization header.
// It returns error if error occurred. | [
"ApplySignature",
"applies",
"the",
"Authorization",
"header",
".",
"It",
"returns",
"error",
"if",
"error",
"occurred",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/request.go#L141-L144 |
144,487 | yunify/qingstor-sdk-go | request/request.go | ApplyQuerySignature | func (r *Request) ApplyQuerySignature(accessKeyID string, expires int, signature string) error {
queryValue := r.HTTPRequest.URL.Query()
queryValue.Set("access_key_id", accessKeyID)
queryValue.Set("expires", strconv.Itoa(expires))
queryValue.Set("signature", signature)
r.HTTPRequest.URL.RawQuery = queryValue.Enco... | go | func (r *Request) ApplyQuerySignature(accessKeyID string, expires int, signature string) error {
queryValue := r.HTTPRequest.URL.Query()
queryValue.Set("access_key_id", accessKeyID)
queryValue.Set("expires", strconv.Itoa(expires))
queryValue.Set("signature", signature)
r.HTTPRequest.URL.RawQuery = queryValue.Enco... | [
"func",
"(",
"r",
"*",
"Request",
")",
"ApplyQuerySignature",
"(",
"accessKeyID",
"string",
",",
"expires",
"int",
",",
"signature",
"string",
")",
"error",
"{",
"queryValue",
":=",
"r",
".",
"HTTPRequest",
".",
"URL",
".",
"Query",
"(",
")",
"\n",
"quer... | // ApplyQuerySignature applies the query signature.
// It returns error if error occurred. | [
"ApplyQuerySignature",
"applies",
"the",
"query",
"signature",
".",
"It",
"returns",
"error",
"if",
"error",
"occurred",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/request.go#L148-L156 |
144,488 | yunify/qingstor-sdk-go | request/errors/parameters.go | Error | func (e ParameterRequiredError) Error() string {
return fmt.Sprintf(`"%s" is required in "%s"`, e.ParameterName, e.ParentName)
} | go | func (e ParameterRequiredError) Error() string {
return fmt.Sprintf(`"%s" is required in "%s"`, e.ParameterName, e.ParentName)
} | [
"func",
"(",
"e",
"ParameterRequiredError",
")",
"Error",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"`\"%s\" is required in \"%s\"`",
",",
"e",
".",
"ParameterName",
",",
"e",
".",
"ParentName",
")",
"\n",
"}"
] | // Error returns the description of ParameterRequiredError. | [
"Error",
"returns",
"the",
"description",
"of",
"ParameterRequiredError",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/errors/parameters.go#L31-L33 |
144,489 | yunify/qingstor-sdk-go | request/errors/parameters.go | Error | func (e ParameterValueNotAllowedError) Error() string {
allowedValues := []string{}
for _, value := range e.AllowedValues {
allowedValues = append(allowedValues, "\""+value+"\"")
}
return fmt.Sprintf(
`"%s" value "%s" is not allowed, should be one of %s`,
e.ParameterName,
e.ParameterValue,
strings.Join(al... | go | func (e ParameterValueNotAllowedError) Error() string {
allowedValues := []string{}
for _, value := range e.AllowedValues {
allowedValues = append(allowedValues, "\""+value+"\"")
}
return fmt.Sprintf(
`"%s" value "%s" is not allowed, should be one of %s`,
e.ParameterName,
e.ParameterValue,
strings.Join(al... | [
"func",
"(",
"e",
"ParameterValueNotAllowedError",
")",
"Error",
"(",
")",
"string",
"{",
"allowedValues",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"value",
":=",
"range",
"e",
".",
"AllowedValues",
"{",
"allowedValues",
"=",
"append",
... | // Error returns the description of ParameterValueNotAllowedError. | [
"Error",
"returns",
"the",
"description",
"of",
"ParameterValueNotAllowedError",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/errors/parameters.go#L43-L53 |
144,490 | yunify/qingstor-sdk-go | request/unpacker/qingstor.go | UnpackHTTPRequest | func (qu *QingStorUnpacker) UnpackHTTPRequest(o *data.Operation, r *http.Response, x *reflect.Value) error {
qu.baseUnpacker = &BaseUnpacker{}
err := qu.baseUnpacker.UnpackHTTPRequest(o, r, x)
if err != nil {
return err
}
err = qu.parseError()
if err != nil {
return err
}
// Close body for every API excep... | go | func (qu *QingStorUnpacker) UnpackHTTPRequest(o *data.Operation, r *http.Response, x *reflect.Value) error {
qu.baseUnpacker = &BaseUnpacker{}
err := qu.baseUnpacker.UnpackHTTPRequest(o, r, x)
if err != nil {
return err
}
err = qu.parseError()
if err != nil {
return err
}
// Close body for every API excep... | [
"func",
"(",
"qu",
"*",
"QingStorUnpacker",
")",
"UnpackHTTPRequest",
"(",
"o",
"*",
"data",
".",
"Operation",
",",
"r",
"*",
"http",
".",
"Response",
",",
"x",
"*",
"reflect",
".",
"Value",
")",
"error",
"{",
"qu",
".",
"baseUnpacker",
"=",
"&",
"Ba... | // UnpackHTTPRequest unpack the http response with an operation, http response and an output. | [
"UnpackHTTPRequest",
"unpack",
"the",
"http",
"response",
"with",
"an",
"operation",
"http",
"response",
"and",
"an",
"output",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/request/unpacker/qingstor.go#L35-L58 |
144,491 | drhodes/golorem | lorem.go | genWordLen | func genWordLen() int {
f := rand.Float32() * 100
// a table of word lengths and their frequencies.
switch {
case f < 1.939:
return 1
case f < 19.01:
return 2
case f < 38.00:
return 3
case f < 50.41:
return 4
case f < 61.00:
return 5
case f < 70.09:
return 6
case f < 78.97:
return 7
case f < 85... | go | func genWordLen() int {
f := rand.Float32() * 100
// a table of word lengths and their frequencies.
switch {
case f < 1.939:
return 1
case f < 19.01:
return 2
case f < 38.00:
return 3
case f < 50.41:
return 4
case f < 61.00:
return 5
case f < 70.09:
return 6
case f < 78.97:
return 7
case f < 85... | [
"func",
"genWordLen",
"(",
")",
"int",
"{",
"f",
":=",
"rand",
".",
"Float32",
"(",
")",
"*",
"100",
"\n",
"// a table of word lengths and their frequencies.",
"switch",
"{",
"case",
"f",
"<",
"1.939",
":",
"return",
"1",
"\n",
"case",
"f",
"<",
"19.01",
... | // Generate a natural word len. | [
"Generate",
"a",
"natural",
"word",
"len",
"."
] | ecccc744c2d953a1e13cbe5e5fc5d4cbc9b8daeb | https://github.com/drhodes/golorem/blob/ecccc744c2d953a1e13cbe5e5fc5d4cbc9b8daeb/lorem.go#L13-L45 |
144,492 | drhodes/golorem | lorem.go | Word | func Word(min, max int) string {
n := intRange(min, max)
return word(n)
} | go | func Word(min, max int) string {
n := intRange(min, max)
return word(n)
} | [
"func",
"Word",
"(",
"min",
",",
"max",
"int",
")",
"string",
"{",
"n",
":=",
"intRange",
"(",
"min",
",",
"max",
")",
"\n",
"return",
"word",
"(",
"n",
")",
"\n",
"}"
] | // Generate a word in a specfied range of letters. | [
"Generate",
"a",
"word",
"in",
"a",
"specfied",
"range",
"of",
"letters",
"."
] | ecccc744c2d953a1e13cbe5e5fc5d4cbc9b8daeb | https://github.com/drhodes/golorem/blob/ecccc744c2d953a1e13cbe5e5fc5d4cbc9b8daeb/lorem.go#L80-L83 |
144,493 | drhodes/golorem | lorem.go | Sentence | func Sentence(min, max int) string {
n := intRange(min, max)
// grab some words
ws := []string{}
maxcommas := 2
numcomma := 0
for i := 0; i < n; i++ {
ws = append(ws, (word(genWordLen())))
// maybe insert a comma, if there are currently < 2 commas, and
// the current word is not the last or first
if (ra... | go | func Sentence(min, max int) string {
n := intRange(min, max)
// grab some words
ws := []string{}
maxcommas := 2
numcomma := 0
for i := 0; i < n; i++ {
ws = append(ws, (word(genWordLen())))
// maybe insert a comma, if there are currently < 2 commas, and
// the current word is not the last or first
if (ra... | [
"func",
"Sentence",
"(",
"min",
",",
"max",
"int",
")",
"string",
"{",
"n",
":=",
"intRange",
"(",
"min",
",",
"max",
")",
"\n\n",
"// grab some words",
"ws",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"maxcommas",
":=",
"2",
"\n",
"numcomma",
":=",
... | // Generate a sentence with a specified range of words. | [
"Generate",
"a",
"sentence",
"with",
"a",
"specified",
"range",
"of",
"words",
"."
] | ecccc744c2d953a1e13cbe5e5fc5d4cbc9b8daeb | https://github.com/drhodes/golorem/blob/ecccc744c2d953a1e13cbe5e5fc5d4cbc9b8daeb/lorem.go#L86-L108 |
144,494 | drhodes/golorem | lorem.go | Url | func Url() string {
n := intRange(0, 3)
base := `http://www.` + Host()
switch n {
case 0:
break
case 1:
base += "/" + Word(2, 8)
case 2:
base += "/" + Word(2, 8) + "/" + Word(2, 8) + ".html"
}
return base
} | go | func Url() string {
n := intRange(0, 3)
base := `http://www.` + Host()
switch n {
case 0:
break
case 1:
base += "/" + Word(2, 8)
case 2:
base += "/" + Word(2, 8) + "/" + Word(2, 8) + ".html"
}
return base
} | [
"func",
"Url",
"(",
")",
"string",
"{",
"n",
":=",
"intRange",
"(",
"0",
",",
"3",
")",
"\n\n",
"base",
":=",
"`http://www.`",
"+",
"Host",
"(",
")",
"\n\n",
"switch",
"n",
"{",
"case",
"0",
":",
"break",
"\n",
"case",
"1",
":",
"base",
"+=",
"... | // Generate a random URL | [
"Generate",
"a",
"random",
"URL"
] | ecccc744c2d953a1e13cbe5e5fc5d4cbc9b8daeb | https://github.com/drhodes/golorem/blob/ecccc744c2d953a1e13cbe5e5fc5d4cbc9b8daeb/lorem.go#L127-L141 |
144,495 | yunify/qingstor-sdk-go | service/qingstor.go | Init | func Init(c *config.Config) (*Service, error) {
return &Service{Config: c}, nil
} | go | func Init(c *config.Config) (*Service, error) {
return &Service{Config: c}, nil
} | [
"func",
"Init",
"(",
"c",
"*",
"config",
".",
"Config",
")",
"(",
"*",
"Service",
",",
"error",
")",
"{",
"return",
"&",
"Service",
"{",
"Config",
":",
"c",
"}",
",",
"nil",
"\n",
"}"
] | // Init initializes a new service. | [
"Init",
"initializes",
"a",
"new",
"service",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/qingstor.go#L36-L38 |
144,496 | yunify/qingstor-sdk-go | service/qingstor.go | ListBucketsRequest | func (s *Service) ListBucketsRequest(input *ListBucketsInput) (*request.Request, *ListBucketsOutput, error) {
if input == nil {
input = &ListBucketsInput{}
}
o := &data.Operation{
Config: s.Config,
APIName: "Get Service",
RequestMethod: "GET",
RequestURI: "/",
StatusCodes: []int{
200... | go | func (s *Service) ListBucketsRequest(input *ListBucketsInput) (*request.Request, *ListBucketsOutput, error) {
if input == nil {
input = &ListBucketsInput{}
}
o := &data.Operation{
Config: s.Config,
APIName: "Get Service",
RequestMethod: "GET",
RequestURI: "/",
StatusCodes: []int{
200... | [
"func",
"(",
"s",
"*",
"Service",
")",
"ListBucketsRequest",
"(",
"input",
"*",
"ListBucketsInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"ListBucketsOutput",
",",
"error",
")",
"{",
"if",
"input",
"==",
"nil",
"{",
"input",
"=",
"&",
"Li... | // ListBucketsRequest creates request and output object of ListBuckets. | [
"ListBucketsRequest",
"creates",
"request",
"and",
"output",
"object",
"of",
"ListBuckets",
"."
] | 60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65 | https://github.com/yunify/qingstor-sdk-go/blob/60a6f6383677f560fbcc9ac5ce6b47a44a8d2b65/service/qingstor.go#L61-L84 |
144,497 | tambet/go-asana | asana/asana.go | NewClient | func NewClient(doer Doer) *Client {
if doer == nil {
doer = http.DefaultClient
}
baseURL, _ := url.Parse(defaultBaseURL)
client := &Client{doer: doer, BaseURL: baseURL, UserAgent: userAgent}
return client
} | go | func NewClient(doer Doer) *Client {
if doer == nil {
doer = http.DefaultClient
}
baseURL, _ := url.Parse(defaultBaseURL)
client := &Client{doer: doer, BaseURL: baseURL, UserAgent: userAgent}
return client
} | [
"func",
"NewClient",
"(",
"doer",
"Doer",
")",
"*",
"Client",
"{",
"if",
"doer",
"==",
"nil",
"{",
"doer",
"=",
"http",
".",
"DefaultClient",
"\n",
"}",
"\n",
"baseURL",
",",
"_",
":=",
"url",
".",
"Parse",
"(",
"defaultBaseURL",
")",
"\n",
"client",... | // NewClient created new asana client with doer.
// If doer is nil then http.DefaultClient used intead. | [
"NewClient",
"created",
"new",
"asana",
"client",
"with",
"doer",
".",
"If",
"doer",
"is",
"nil",
"then",
"http",
".",
"DefaultClient",
"used",
"intead",
"."
] | 6c0cb7090a14aaf5861c43a10e6db9d32c1fe555 | https://github.com/tambet/go-asana/blob/6c0cb7090a14aaf5861c43a10e6db9d32c1fe555/asana/asana.go#L167-L174 |
144,498 | tambet/go-asana | asana/asana.go | request | func (c *Client) request(ctx context.Context, method string, path string, data interface{}, form url.Values, opt *Filter, v interface{}) error {
if opt == nil {
opt = &Filter{}
}
if len(opt.OptFields) == 0 {
// We should not modify opt provided to Request.
newOpt := *opt
opt = &newOpt
opt.OptFields = defau... | go | func (c *Client) request(ctx context.Context, method string, path string, data interface{}, form url.Values, opt *Filter, v interface{}) error {
if opt == nil {
opt = &Filter{}
}
if len(opt.OptFields) == 0 {
// We should not modify opt provided to Request.
newOpt := *opt
opt = &newOpt
opt.OptFields = defau... | [
"func",
"(",
"c",
"*",
"Client",
")",
"request",
"(",
"ctx",
"context",
".",
"Context",
",",
"method",
"string",
",",
"path",
"string",
",",
"data",
"interface",
"{",
"}",
",",
"form",
"url",
".",
"Values",
",",
"opt",
"*",
"Filter",
",",
"v",
"int... | // request makes a request to Asana API, using method, at path, sending data or form with opt filter.
// Only data or form could be sent at the same time. If both provided form will be omitted.
// Also it's possible to do request with nil data and form.
// The response is populated into v, and any error is returned. | [
"request",
"makes",
"a",
"request",
"to",
"Asana",
"API",
"using",
"method",
"at",
"path",
"sending",
"data",
"or",
"form",
"with",
"opt",
"filter",
".",
"Only",
"data",
"or",
"form",
"could",
"be",
"sent",
"at",
"the",
"same",
"time",
".",
"If",
"both... | 6c0cb7090a14aaf5861c43a10e6db9d32c1fe555 | https://github.com/tambet/go-asana/blob/6c0cb7090a14aaf5861c43a10e6db9d32c1fe555/asana/asana.go#L262-L318 |
144,499 | billputer/go-namecheap | registrant.go | newRegistrant | func newRegistrant(
firstName, lastName,
addr1, addr2,
city, state, postalCode, country,
phone, email string,
) *Registrant {
return &Registrant{
RegistrantFirstName: firstName,
RegistrantLastName: lastName,
RegistrantAddress1: addr1,
RegistrantAddress2: addr2,
RegistrantCity: ... | go | func newRegistrant(
firstName, lastName,
addr1, addr2,
city, state, postalCode, country,
phone, email string,
) *Registrant {
return &Registrant{
RegistrantFirstName: firstName,
RegistrantLastName: lastName,
RegistrantAddress1: addr1,
RegistrantAddress2: addr2,
RegistrantCity: ... | [
"func",
"newRegistrant",
"(",
"firstName",
",",
"lastName",
",",
"addr1",
",",
"addr2",
",",
"city",
",",
"state",
",",
"postalCode",
",",
"country",
",",
"phone",
",",
"email",
"string",
",",
")",
"*",
"Registrant",
"{",
"return",
"&",
"Registrant",
"{"... | // newRegistrant return a new registrant where all the required fields are the same.
// Feel free to change them as needed | [
"newRegistrant",
"return",
"a",
"new",
"registrant",
"where",
"all",
"the",
"required",
"fields",
"are",
"the",
"same",
".",
"Feel",
"free",
"to",
"change",
"them",
"as",
"needed"
] | ebca3d36eda400848b1fefb99a8409f5a13a834d | https://github.com/billputer/go-namecheap/blob/ebca3d36eda400848b1fefb99a8409f5a13a834d/registrant.go#L39-L87 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.