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 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
libopenstorage/openstorage | api/client/request.go | Resource | func (r *Request) Resource(resource string) *Request {
if r.err == nil {
r.err = checkSet("resource", &r.resource, resource)
}
return r
} | go | func (r *Request) Resource(resource string) *Request {
if r.err == nil {
r.err = checkSet("resource", &r.resource, resource)
}
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"Resource",
"(",
"resource",
"string",
")",
"*",
"Request",
"{",
"if",
"r",
".",
"err",
"==",
"nil",
"{",
"r",
".",
"err",
"=",
"checkSet",
"(",
"\"",
"\"",
",",
"&",
"r",
".",
"resource",
",",
"resource",
")",
"\n",
"}",
"\n",
"return",
"r",
"\n",
"}"
] | // Resource specifies the resource to be accessed. | [
"Resource",
"specifies",
"the",
"resource",
"to",
"be",
"accessed",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L91-L96 | train |
libopenstorage/openstorage | api/client/request.go | Instance | func (r *Request) Instance(instance string) *Request {
if r.err == nil {
r.err = checkExists("resource", "instance")
if r.err == nil {
r.err = checkSet("instance", &r.instance, instance)
}
}
return r
} | go | func (r *Request) Instance(instance string) *Request {
if r.err == nil {
r.err = checkExists("resource", "instance")
if r.err == nil {
r.err = checkSet("instance", &r.instance, instance)
}
}
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"Instance",
"(",
"instance",
"string",
")",
"*",
"Request",
"{",
"if",
"r",
".",
"err",
"==",
"nil",
"{",
"r",
".",
"err",
"=",
"checkExists",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"r",
".",
"err",
"==",
"nil",
"{",
"r",
".",
"err",
"=",
"checkSet",
"(",
"\"",
"\"",
",",
"&",
"r",
".",
"instance",
",",
"instance",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"r",
"\n",
"}"
] | // Instance specifies the instance of the resource to be accessed. | [
"Instance",
"specifies",
"the",
"instance",
"of",
"the",
"resource",
"to",
"be",
"accessed",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L99-L107 | train |
libopenstorage/openstorage | api/client/request.go | UsePath | func (r *Request) UsePath(path string) *Request {
if r.err == nil {
r.err = checkSet("path", &r.path, path)
}
return r
} | go | func (r *Request) UsePath(path string) *Request {
if r.err == nil {
r.err = checkSet("path", &r.path, path)
}
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"UsePath",
"(",
"path",
"string",
")",
"*",
"Request",
"{",
"if",
"r",
".",
"err",
"==",
"nil",
"{",
"r",
".",
"err",
"=",
"checkSet",
"(",
"\"",
"\"",
",",
"&",
"r",
".",
"path",
",",
"path",
")",
"\n",
"}",
"\n",
"return",
"r",
"\n",
"}"
] | // UsePath use the specified path and don't build up a request. | [
"UsePath",
"use",
"the",
"specified",
"path",
"and",
"don",
"t",
"build",
"up",
"a",
"request",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L110-L115 | train |
libopenstorage/openstorage | api/client/request.go | QueryOption | func (r *Request) QueryOption(key string, value string) *Request {
if r.err != nil {
return r
}
if r.params == nil {
r.params = make(url.Values)
}
r.params.Add(string(key), value)
return r
} | go | func (r *Request) QueryOption(key string, value string) *Request {
if r.err != nil {
return r
}
if r.params == nil {
r.params = make(url.Values)
}
r.params.Add(string(key), value)
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"QueryOption",
"(",
"key",
"string",
",",
"value",
"string",
")",
"*",
"Request",
"{",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"r",
"\n",
"}",
"\n",
"if",
"r",
".",
"params",
"==",
"nil",
"{",
"r",
".",
"params",
"=",
"make",
"(",
"url",
".",
"Values",
")",
"\n",
"}",
"\n",
"r",
".",
"params",
".",
"Add",
"(",
"string",
"(",
"key",
")",
",",
"value",
")",
"\n",
"return",
"r",
"\n",
"}"
] | // QueryOption adds specified options to query. | [
"QueryOption",
"adds",
"specified",
"options",
"to",
"query",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L118-L127 | train |
libopenstorage/openstorage | api/client/request.go | QueryOptionLabel | func (r *Request) QueryOptionLabel(key string, labels map[string]string) *Request {
if r.err != nil {
return r
}
if b, err := json.Marshal(labels); err != nil {
r.err = err
} else {
if r.params == nil {
r.params = make(url.Values)
}
r.params.Add(string(key), string(b))
}
return r
} | go | func (r *Request) QueryOptionLabel(key string, labels map[string]string) *Request {
if r.err != nil {
return r
}
if b, err := json.Marshal(labels); err != nil {
r.err = err
} else {
if r.params == nil {
r.params = make(url.Values)
}
r.params.Add(string(key), string(b))
}
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"QueryOptionLabel",
"(",
"key",
"string",
",",
"labels",
"map",
"[",
"string",
"]",
"string",
")",
"*",
"Request",
"{",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"r",
"\n",
"}",
"\n",
"if",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"labels",
")",
";",
"err",
"!=",
"nil",
"{",
"r",
".",
"err",
"=",
"err",
"\n",
"}",
"else",
"{",
"if",
"r",
".",
"params",
"==",
"nil",
"{",
"r",
".",
"params",
"=",
"make",
"(",
"url",
".",
"Values",
")",
"\n",
"}",
"\n",
"r",
".",
"params",
".",
"Add",
"(",
"string",
"(",
"key",
")",
",",
"string",
"(",
"b",
")",
")",
"\n",
"}",
"\n",
"return",
"r",
"\n",
"}"
] | // QueryOptionLabel adds specified label to query. | [
"QueryOptionLabel",
"adds",
"specified",
"label",
"to",
"query",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L130-L143 | train |
libopenstorage/openstorage | api/client/request.go | Body | func (r *Request) Body(v interface{}) *Request {
var err error
if r.err != nil {
return r
}
r.body, err = json.Marshal(v)
if err != nil {
r.err = err
return r
}
return r
} | go | func (r *Request) Body(v interface{}) *Request {
var err error
if r.err != nil {
return r
}
r.body, err = json.Marshal(v)
if err != nil {
r.err = err
return r
}
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"Body",
"(",
"v",
"interface",
"{",
"}",
")",
"*",
"Request",
"{",
"var",
"err",
"error",
"\n",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"r",
"\n",
"}",
"\n",
"r",
".",
"body",
",",
"err",
"=",
"json",
".",
"Marshal",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"r",
".",
"err",
"=",
"err",
"\n",
"return",
"r",
"\n",
"}",
"\n",
"return",
"r",
"\n",
"}"
] | // Body sets the request Body. | [
"Body",
"sets",
"the",
"request",
"Body",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L165-L176 | train |
libopenstorage/openstorage | api/client/request.go | headerVal | func headerVal(key string, resp *http.Response) (int, bool) {
if h := resp.Header.Get(key); len(h) > 0 {
if i, err := strconv.Atoi(h); err == nil {
return i, true
}
}
return 0, false
} | go | func headerVal(key string, resp *http.Response) (int, bool) {
if h := resp.Header.Get(key); len(h) > 0 {
if i, err := strconv.Atoi(h); err == nil {
return i, true
}
}
return 0, false
} | [
"func",
"headerVal",
"(",
"key",
"string",
",",
"resp",
"*",
"http",
".",
"Response",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"h",
":=",
"resp",
".",
"Header",
".",
"Get",
"(",
"key",
")",
";",
"len",
"(",
"h",
")",
">",
"0",
"{",
"if",
"i",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"h",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"i",
",",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"0",
",",
"false",
"\n",
"}"
] | // headerVal for key as an int. Return false if header is not present or valid. | [
"headerVal",
"for",
"key",
"as",
"an",
"int",
".",
"Return",
"false",
"if",
"header",
"is",
"not",
"present",
"or",
"valid",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L209-L216 | train |
libopenstorage/openstorage | api/client/request.go | Do | func (r *Request) Do() *Response {
var (
err error
req *http.Request
resp *http.Response
url string
body []byte
)
if r.err != nil {
return &Response{err: r.err}
}
url = r.URL().String()
req, err = http.NewRequest(r.verb, url, bytes.NewBuffer(r.body))
if err != nil {
return &Response{err: err}
}
if r.headers == nil {
r.headers = http.Header{}
}
req.Header = r.headers
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Date", time.Now().String())
if len(r.authstring) > 0 {
if auth.IsJwtToken(r.authstring) {
req.Header.Set("Authorization", "bearer "+r.authstring)
} else {
req.Header.Set("Authorization", "Basic "+r.authstring)
}
}
if len(r.accesstoken) > 0 {
req.Header.Set("Access-Token", r.accesstoken)
}
start := time.Now()
attemptNum := 0
for {
if resp, err = r.client.Do(req); err != nil {
return &Response{err: err}
}
if time.Since(start) >= maxRetryDuration ||
resp.StatusCode != http.StatusServiceUnavailable {
break
}
attemptNum++
handleServiceUnavailable(resp, attemptNum)
}
if resp.Body != nil {
defer resp.Body.Close()
if body, err = ioutil.ReadAll(resp.Body); err != nil {
return &Response{err: err}
}
}
return &Response{
status: resp.Status,
statusCode: resp.StatusCode,
body: body,
err: parseHTTPStatus(resp, body),
}
} | go | func (r *Request) Do() *Response {
var (
err error
req *http.Request
resp *http.Response
url string
body []byte
)
if r.err != nil {
return &Response{err: r.err}
}
url = r.URL().String()
req, err = http.NewRequest(r.verb, url, bytes.NewBuffer(r.body))
if err != nil {
return &Response{err: err}
}
if r.headers == nil {
r.headers = http.Header{}
}
req.Header = r.headers
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Date", time.Now().String())
if len(r.authstring) > 0 {
if auth.IsJwtToken(r.authstring) {
req.Header.Set("Authorization", "bearer "+r.authstring)
} else {
req.Header.Set("Authorization", "Basic "+r.authstring)
}
}
if len(r.accesstoken) > 0 {
req.Header.Set("Access-Token", r.accesstoken)
}
start := time.Now()
attemptNum := 0
for {
if resp, err = r.client.Do(req); err != nil {
return &Response{err: err}
}
if time.Since(start) >= maxRetryDuration ||
resp.StatusCode != http.StatusServiceUnavailable {
break
}
attemptNum++
handleServiceUnavailable(resp, attemptNum)
}
if resp.Body != nil {
defer resp.Body.Close()
if body, err = ioutil.ReadAll(resp.Body); err != nil {
return &Response{err: err}
}
}
return &Response{
status: resp.Status,
statusCode: resp.StatusCode,
body: body,
err: parseHTTPStatus(resp, body),
}
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"Do",
"(",
")",
"*",
"Response",
"{",
"var",
"(",
"err",
"error",
"\n",
"req",
"*",
"http",
".",
"Request",
"\n",
"resp",
"*",
"http",
".",
"Response",
"\n",
"url",
"string",
"\n",
"body",
"[",
"]",
"byte",
"\n",
")",
"\n\n",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Response",
"{",
"err",
":",
"r",
".",
"err",
"}",
"\n",
"}",
"\n",
"url",
"=",
"r",
".",
"URL",
"(",
")",
".",
"String",
"(",
")",
"\n",
"req",
",",
"err",
"=",
"http",
".",
"NewRequest",
"(",
"r",
".",
"verb",
",",
"url",
",",
"bytes",
".",
"NewBuffer",
"(",
"r",
".",
"body",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Response",
"{",
"err",
":",
"err",
"}",
"\n",
"}",
"\n",
"if",
"r",
".",
"headers",
"==",
"nil",
"{",
"r",
".",
"headers",
"=",
"http",
".",
"Header",
"{",
"}",
"\n",
"}",
"\n\n",
"req",
".",
"Header",
"=",
"r",
".",
"headers",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"time",
".",
"Now",
"(",
")",
".",
"String",
"(",
")",
")",
"\n\n",
"if",
"len",
"(",
"r",
".",
"authstring",
")",
">",
"0",
"{",
"if",
"auth",
".",
"IsJwtToken",
"(",
"r",
".",
"authstring",
")",
"{",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"r",
".",
"authstring",
")",
"\n",
"}",
"else",
"{",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"r",
".",
"authstring",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"r",
".",
"accesstoken",
")",
">",
"0",
"{",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"r",
".",
"accesstoken",
")",
"\n",
"}",
"\n\n",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"attemptNum",
":=",
"0",
"\n",
"for",
"{",
"if",
"resp",
",",
"err",
"=",
"r",
".",
"client",
".",
"Do",
"(",
"req",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Response",
"{",
"err",
":",
"err",
"}",
"\n",
"}",
"\n\n",
"if",
"time",
".",
"Since",
"(",
"start",
")",
">=",
"maxRetryDuration",
"||",
"resp",
".",
"StatusCode",
"!=",
"http",
".",
"StatusServiceUnavailable",
"{",
"break",
"\n",
"}",
"\n",
"attemptNum",
"++",
"\n",
"handleServiceUnavailable",
"(",
"resp",
",",
"attemptNum",
")",
"\n",
"}",
"\n\n",
"if",
"resp",
".",
"Body",
"!=",
"nil",
"{",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"body",
",",
"err",
"=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Response",
"{",
"err",
":",
"err",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"Response",
"{",
"status",
":",
"resp",
".",
"Status",
",",
"statusCode",
":",
"resp",
".",
"StatusCode",
",",
"body",
":",
"body",
",",
"err",
":",
"parseHTTPStatus",
"(",
"resp",
",",
"body",
")",
",",
"}",
"\n",
"}"
] | // Do executes the request and returns a Response. | [
"Do",
"executes",
"the",
"request",
"and",
"returns",
"a",
"Response",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L235-L300 | train |
libopenstorage/openstorage | api/client/request.go | Unmarshal | func (r Response) Unmarshal(v interface{}) error {
if r.err != nil {
return r.err
}
return json.Unmarshal(r.body, v)
} | go | func (r Response) Unmarshal(v interface{}) error {
if r.err != nil {
return r.err
}
return json.Unmarshal(r.body, v)
} | [
"func",
"(",
"r",
"Response",
")",
"Unmarshal",
"(",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"r",
".",
"err",
"\n",
"}",
"\n",
"return",
"json",
".",
"Unmarshal",
"(",
"r",
".",
"body",
",",
"v",
")",
"\n",
"}"
] | // Unmarshal result into obj | [
"Unmarshal",
"result",
"into",
"obj"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L326-L331 | train |
libopenstorage/openstorage | api/client/request.go | FormatError | func (r Response) FormatError() error {
if len(r.body) == 0 {
return fmt.Errorf("Error: %v", r.err)
}
return fmt.Errorf("%v", strings.TrimSpace(string(r.body)))
} | go | func (r Response) FormatError() error {
if len(r.body) == 0 {
return fmt.Errorf("Error: %v", r.err)
}
return fmt.Errorf("%v", strings.TrimSpace(string(r.body)))
} | [
"func",
"(",
"r",
"Response",
")",
"FormatError",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"r",
".",
"body",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"err",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"strings",
".",
"TrimSpace",
"(",
"string",
"(",
"r",
".",
"body",
")",
")",
")",
"\n",
"}"
] | // FormatError formats the error | [
"FormatError",
"formats",
"the",
"error"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L339-L344 | train |
libopenstorage/openstorage | pkg/mount/bind_mount.go | NewBindMounter | func NewBindMounter(
rootSubstrings []string,
mountImpl MountImpl,
allowedDirs []string,
trashLocation string,
) (*bindMounter, error) {
b := &bindMounter{
Mounter: Mounter{
mountImpl: mountImpl,
mounts: make(DeviceMap),
paths: make(PathMap),
allowedDirs: allowedDirs,
kl: keylock.New(),
trashLocation: trashLocation,
},
}
if err := b.Load(rootSubstrings); err != nil {
return nil, err
}
return b, nil
} | go | func NewBindMounter(
rootSubstrings []string,
mountImpl MountImpl,
allowedDirs []string,
trashLocation string,
) (*bindMounter, error) {
b := &bindMounter{
Mounter: Mounter{
mountImpl: mountImpl,
mounts: make(DeviceMap),
paths: make(PathMap),
allowedDirs: allowedDirs,
kl: keylock.New(),
trashLocation: trashLocation,
},
}
if err := b.Load(rootSubstrings); err != nil {
return nil, err
}
return b, nil
} | [
"func",
"NewBindMounter",
"(",
"rootSubstrings",
"[",
"]",
"string",
",",
"mountImpl",
"MountImpl",
",",
"allowedDirs",
"[",
"]",
"string",
",",
"trashLocation",
"string",
",",
")",
"(",
"*",
"bindMounter",
",",
"error",
")",
"{",
"b",
":=",
"&",
"bindMounter",
"{",
"Mounter",
":",
"Mounter",
"{",
"mountImpl",
":",
"mountImpl",
",",
"mounts",
":",
"make",
"(",
"DeviceMap",
")",
",",
"paths",
":",
"make",
"(",
"PathMap",
")",
",",
"allowedDirs",
":",
"allowedDirs",
",",
"kl",
":",
"keylock",
".",
"New",
"(",
")",
",",
"trashLocation",
":",
"trashLocation",
",",
"}",
",",
"}",
"\n",
"if",
"err",
":=",
"b",
".",
"Load",
"(",
"rootSubstrings",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"b",
",",
"nil",
"\n",
"}"
] | // NewBindMounter returns a new bindMounter | [
"NewBindMounter",
"returns",
"a",
"new",
"bindMounter"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/mount/bind_mount.go#L22-L42 | train |
libopenstorage/openstorage | pkg/options/options.go | IsBoolOptionSet | func IsBoolOptionSet(options map[string]string, key string) bool {
if options != nil {
if value, ok := options[key]; ok {
if b, err := strconv.ParseBool(value); err == nil {
return b
}
}
}
return false
} | go | func IsBoolOptionSet(options map[string]string, key string) bool {
if options != nil {
if value, ok := options[key]; ok {
if b, err := strconv.ParseBool(value); err == nil {
return b
}
}
}
return false
} | [
"func",
"IsBoolOptionSet",
"(",
"options",
"map",
"[",
"string",
"]",
"string",
",",
"key",
"string",
")",
"bool",
"{",
"if",
"options",
"!=",
"nil",
"{",
"if",
"value",
",",
"ok",
":=",
"options",
"[",
"key",
"]",
";",
"ok",
"{",
"if",
"b",
",",
"err",
":=",
"strconv",
".",
"ParseBool",
"(",
"value",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"b",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] | // IsBoolOptionSet checks if a boolean option key is set | [
"IsBoolOptionSet",
"checks",
"if",
"a",
"boolean",
"option",
"key",
"is",
"set"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/options/options.go#L57-L67 | train |
libopenstorage/openstorage | pkg/options/options.go | NewVolumeAttachOptions | func NewVolumeAttachOptions(options map[string]string) *api.SdkVolumeAttachOptions {
return &api.SdkVolumeAttachOptions{
SecretName: options[OptionsSecret],
SecretKey: options[OptionsSecretKey],
SecretContext: options[OptionsSecretContext],
}
} | go | func NewVolumeAttachOptions(options map[string]string) *api.SdkVolumeAttachOptions {
return &api.SdkVolumeAttachOptions{
SecretName: options[OptionsSecret],
SecretKey: options[OptionsSecretKey],
SecretContext: options[OptionsSecretContext],
}
} | [
"func",
"NewVolumeAttachOptions",
"(",
"options",
"map",
"[",
"string",
"]",
"string",
")",
"*",
"api",
".",
"SdkVolumeAttachOptions",
"{",
"return",
"&",
"api",
".",
"SdkVolumeAttachOptions",
"{",
"SecretName",
":",
"options",
"[",
"OptionsSecret",
"]",
",",
"SecretKey",
":",
"options",
"[",
"OptionsSecretKey",
"]",
",",
"SecretContext",
":",
"options",
"[",
"OptionsSecretContext",
"]",
",",
"}",
"\n",
"}"
] | // NewVolumeAttachOptions converts a map of options to api.SdkVolumeAttachOptions | [
"NewVolumeAttachOptions",
"converts",
"a",
"map",
"of",
"options",
"to",
"api",
".",
"SdkVolumeAttachOptions"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/options/options.go#L70-L76 | train |
libopenstorage/openstorage | pkg/options/options.go | NewVolumeUnmountOptions | func NewVolumeUnmountOptions(options map[string]string) *api.SdkVolumeUnmountOptions {
return &api.SdkVolumeUnmountOptions{
DeleteMountPath: IsBoolOptionSet(options, OptionsDeleteAfterUnmount),
NoDelayBeforeDeletingMountPath: IsBoolOptionSet(options, OptionsWaitBeforeDelete),
}
} | go | func NewVolumeUnmountOptions(options map[string]string) *api.SdkVolumeUnmountOptions {
return &api.SdkVolumeUnmountOptions{
DeleteMountPath: IsBoolOptionSet(options, OptionsDeleteAfterUnmount),
NoDelayBeforeDeletingMountPath: IsBoolOptionSet(options, OptionsWaitBeforeDelete),
}
} | [
"func",
"NewVolumeUnmountOptions",
"(",
"options",
"map",
"[",
"string",
"]",
"string",
")",
"*",
"api",
".",
"SdkVolumeUnmountOptions",
"{",
"return",
"&",
"api",
".",
"SdkVolumeUnmountOptions",
"{",
"DeleteMountPath",
":",
"IsBoolOptionSet",
"(",
"options",
",",
"OptionsDeleteAfterUnmount",
")",
",",
"NoDelayBeforeDeletingMountPath",
":",
"IsBoolOptionSet",
"(",
"options",
",",
"OptionsWaitBeforeDelete",
")",
",",
"}",
"\n",
"}"
] | // NewVolumeUnmountOptions converts a map of options to api.SdkVolumeUnmounOptions | [
"NewVolumeUnmountOptions",
"converts",
"a",
"map",
"of",
"options",
"to",
"api",
".",
"SdkVolumeUnmounOptions"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/options/options.go#L79-L84 | train |
libopenstorage/openstorage | graph/drivers/chainfs/chainfs.go | Create | func (d *Driver) Create(id string, parent string, ml string, storageOpts map[string]string) error {
if parent != "" {
logrus.Infof("Creating layer %s with parent %s", id, parent)
} else {
logrus.Infof("Creating parent layer %s", id)
}
cID := C.CString(id)
cParent := C.CString(parent)
ret, err := C.create_layer(cID, cParent)
if int(ret) != 0 {
logrus.Warnf("Error while creating layer %s", id)
return err
}
return nil
} | go | func (d *Driver) Create(id string, parent string, ml string, storageOpts map[string]string) error {
if parent != "" {
logrus.Infof("Creating layer %s with parent %s", id, parent)
} else {
logrus.Infof("Creating parent layer %s", id)
}
cID := C.CString(id)
cParent := C.CString(parent)
ret, err := C.create_layer(cID, cParent)
if int(ret) != 0 {
logrus.Warnf("Error while creating layer %s", id)
return err
}
return nil
} | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Create",
"(",
"id",
"string",
",",
"parent",
"string",
",",
"ml",
"string",
",",
"storageOpts",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"if",
"parent",
"!=",
"\"",
"\"",
"{",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"id",
",",
"parent",
")",
"\n",
"}",
"else",
"{",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"}",
"\n\n",
"cID",
":=",
"C",
".",
"CString",
"(",
"id",
")",
"\n",
"cParent",
":=",
"C",
".",
"CString",
"(",
"parent",
")",
"\n\n",
"ret",
",",
"err",
":=",
"C",
".",
"create_layer",
"(",
"cID",
",",
"cParent",
")",
"\n",
"if",
"int",
"(",
"ret",
")",
"!=",
"0",
"{",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Create creates a new, empty, filesystem layer with the
// specified id and parent and mountLabel. Parent and mountLabel may be "". | [
"Create",
"creates",
"a",
"new",
"empty",
"filesystem",
"layer",
"with",
"the",
"specified",
"id",
"and",
"parent",
"and",
"mountLabel",
".",
"Parent",
"and",
"mountLabel",
"may",
"be",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/chainfs/chainfs.go#L80-L97 | train |
libopenstorage/openstorage | graph/drivers/chainfs/chainfs.go | Remove | func (d *Driver) Remove(id string) error {
logrus.Infof("Removing layer %s", id)
cID := C.CString(id)
ret, err := C.remove_layer(cID)
if int(ret) != 0 {
logrus.Warnf("Error while removing layer %s", id)
return err
}
return nil
} | go | func (d *Driver) Remove(id string) error {
logrus.Infof("Removing layer %s", id)
cID := C.CString(id)
ret, err := C.remove_layer(cID)
if int(ret) != 0 {
logrus.Warnf("Error while removing layer %s", id)
return err
}
return nil
} | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Remove",
"(",
"id",
"string",
")",
"error",
"{",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"id",
")",
"\n\n",
"cID",
":=",
"C",
".",
"CString",
"(",
"id",
")",
"\n",
"ret",
",",
"err",
":=",
"C",
".",
"remove_layer",
"(",
"cID",
")",
"\n",
"if",
"int",
"(",
"ret",
")",
"!=",
"0",
"{",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Remove attempts to remove the filesystem layer with this id. | [
"Remove",
"attempts",
"to",
"remove",
"the",
"filesystem",
"layer",
"with",
"this",
"id",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/chainfs/chainfs.go#L100-L111 | train |
libopenstorage/openstorage | graph/drivers/chainfs/chainfs.go | Get | func (d *Driver) Get(id, mountLabel string) (string, error) {
cID := C.CString(id)
ret, err := C.alloc_chainfs(cID)
if int(ret) != 0 {
logrus.Warnf("Error while creating a chain FS for %s", id)
return "", err
} else {
logrus.Debugf("Created a chain FS for %s", id)
chainPath := path.Join(virtPath, id)
return chainPath, err
}
} | go | func (d *Driver) Get(id, mountLabel string) (string, error) {
cID := C.CString(id)
ret, err := C.alloc_chainfs(cID)
if int(ret) != 0 {
logrus.Warnf("Error while creating a chain FS for %s", id)
return "", err
} else {
logrus.Debugf("Created a chain FS for %s", id)
chainPath := path.Join(virtPath, id)
return chainPath, err
}
} | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Get",
"(",
"id",
",",
"mountLabel",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"cID",
":=",
"C",
".",
"CString",
"(",
"id",
")",
"\n\n",
"ret",
",",
"err",
":=",
"C",
".",
"alloc_chainfs",
"(",
"cID",
")",
"\n",
"if",
"int",
"(",
"ret",
")",
"!=",
"0",
"{",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"else",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"chainPath",
":=",
"path",
".",
"Join",
"(",
"virtPath",
",",
"id",
")",
"\n",
"return",
"chainPath",
",",
"err",
"\n",
"}",
"\n",
"}"
] | // Get returns the mountpoint for the layered filesystem referred
// to by this id. You can optionally specify a mountLabel or "".
// Returns the absolute path to the mounted layered filesystem. | [
"Get",
"returns",
"the",
"mountpoint",
"for",
"the",
"layered",
"filesystem",
"referred",
"to",
"by",
"this",
"id",
".",
"You",
"can",
"optionally",
"specify",
"a",
"mountLabel",
"or",
".",
"Returns",
"the",
"absolute",
"path",
"to",
"the",
"mounted",
"layered",
"filesystem",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/chainfs/chainfs.go#L122-L134 | train |
libopenstorage/openstorage | graph/drivers/chainfs/chainfs.go | Exists | func (d *Driver) Exists(id string) bool {
path := path.Join(virtPath, id)
_, err := os.Stat(path)
if err == nil {
return true
} else {
return false
}
} | go | func (d *Driver) Exists(id string) bool {
path := path.Join(virtPath, id)
_, err := os.Stat(path)
if err == nil {
return true
} else {
return false
}
} | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Exists",
"(",
"id",
"string",
")",
"bool",
"{",
"path",
":=",
"path",
".",
"Join",
"(",
"virtPath",
",",
"id",
")",
"\n\n",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"path",
")",
"\n\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"true",
"\n",
"}",
"else",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}"
] | // Exists returns whether a filesystem layer with the specified
// ID exists on this driver.
// All cache entries exist. | [
"Exists",
"returns",
"whether",
"a",
"filesystem",
"layer",
"with",
"the",
"specified",
"ID",
"exists",
"on",
"this",
"driver",
".",
"All",
"cache",
"entries",
"exist",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/chainfs/chainfs.go#L152-L162 | train |
libopenstorage/openstorage | graph/drivers/chainfs/chainfs.go | ApplyDiff | func (d *Driver) ApplyDiff(id string, parent string, diff archive.Reader) (size int64, err error) {
dir := path.Join(virtPath, id)
// dir := path.Join("/tmp/chainfs/", id)
logrus.Infof("Applying diff at path %s\n", dir)
if err := chrootarchive.UntarUncompressed(diff, dir, nil); err != nil {
logrus.Warnf("Error while applying diff to %s: %v", id, err)
return 0, err
}
// show invalid whiteouts warning.
files, err := ioutil.ReadDir(path.Join(dir, archive.WhiteoutLinkDir))
if err == nil && len(files) > 0 {
logrus.Warnf("Archive contains aufs hardlink references that are not supported.")
}
return d.DiffSize(id, parent)
} | go | func (d *Driver) ApplyDiff(id string, parent string, diff archive.Reader) (size int64, err error) {
dir := path.Join(virtPath, id)
// dir := path.Join("/tmp/chainfs/", id)
logrus.Infof("Applying diff at path %s\n", dir)
if err := chrootarchive.UntarUncompressed(diff, dir, nil); err != nil {
logrus.Warnf("Error while applying diff to %s: %v", id, err)
return 0, err
}
// show invalid whiteouts warning.
files, err := ioutil.ReadDir(path.Join(dir, archive.WhiteoutLinkDir))
if err == nil && len(files) > 0 {
logrus.Warnf("Archive contains aufs hardlink references that are not supported.")
}
return d.DiffSize(id, parent)
} | [
"func",
"(",
"d",
"*",
"Driver",
")",
"ApplyDiff",
"(",
"id",
"string",
",",
"parent",
"string",
",",
"diff",
"archive",
".",
"Reader",
")",
"(",
"size",
"int64",
",",
"err",
"error",
")",
"{",
"dir",
":=",
"path",
".",
"Join",
"(",
"virtPath",
",",
"id",
")",
"\n",
"// dir := path.Join(\"/tmp/chainfs/\", id)",
"logrus",
".",
"Infof",
"(",
"\"",
"\\n",
"\"",
",",
"dir",
")",
"\n\n",
"if",
"err",
":=",
"chrootarchive",
".",
"UntarUncompressed",
"(",
"diff",
",",
"dir",
",",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"id",
",",
"err",
")",
"\n",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// show invalid whiteouts warning.",
"files",
",",
"err",
":=",
"ioutil",
".",
"ReadDir",
"(",
"path",
".",
"Join",
"(",
"dir",
",",
"archive",
".",
"WhiteoutLinkDir",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"&&",
"len",
"(",
"files",
")",
">",
"0",
"{",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"d",
".",
"DiffSize",
"(",
"id",
",",
"parent",
")",
"\n",
"}"
] | // ApplyDiff extracts the changeset from the given diff into the
// layer with the specified id and parent, returning the size of the
// new layer in bytes.
// The archive.Reader must be an uncompressed stream. | [
"ApplyDiff",
"extracts",
"the",
"changeset",
"from",
"the",
"given",
"diff",
"into",
"the",
"layer",
"with",
"the",
"specified",
"id",
"and",
"parent",
"returning",
"the",
"size",
"of",
"the",
"new",
"layer",
"in",
"bytes",
".",
"The",
"archive",
".",
"Reader",
"must",
"be",
"an",
"uncompressed",
"stream",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/chainfs/chainfs.go#L168-L186 | train |
libopenstorage/openstorage | pkg/jsonpb/jsonpb.go | RegisterSimpleStringEnum | func RegisterSimpleStringEnum(typeName string, typePrefix string, valueMap map[string]int32) {
if _, ok := simpleStringValueMaps[typeName]; ok {
panic("jsonpb: duplicate enum registered: " + typeName)
}
m := make(map[string]int32)
for key, value := range valueMap {
m[strings.TrimPrefix(strings.ToLower(key), fmt.Sprintf("%s_", strings.ToLower(typePrefix)))] = value
}
simpleStringValueMaps[typeName] = m
} | go | func RegisterSimpleStringEnum(typeName string, typePrefix string, valueMap map[string]int32) {
if _, ok := simpleStringValueMaps[typeName]; ok {
panic("jsonpb: duplicate enum registered: " + typeName)
}
m := make(map[string]int32)
for key, value := range valueMap {
m[strings.TrimPrefix(strings.ToLower(key), fmt.Sprintf("%s_", strings.ToLower(typePrefix)))] = value
}
simpleStringValueMaps[typeName] = m
} | [
"func",
"RegisterSimpleStringEnum",
"(",
"typeName",
"string",
",",
"typePrefix",
"string",
",",
"valueMap",
"map",
"[",
"string",
"]",
"int32",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"simpleStringValueMaps",
"[",
"typeName",
"]",
";",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"typeName",
")",
"\n",
"}",
"\n",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"int32",
")",
"\n",
"for",
"key",
",",
"value",
":=",
"range",
"valueMap",
"{",
"m",
"[",
"strings",
".",
"TrimPrefix",
"(",
"strings",
".",
"ToLower",
"(",
"key",
")",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"ToLower",
"(",
"typePrefix",
")",
")",
")",
"]",
"=",
"value",
"\n",
"}",
"\n",
"simpleStringValueMaps",
"[",
"typeName",
"]",
"=",
"m",
"\n",
"}"
] | // RegisterSimpleStringEnum registers a simple string value map. | [
"RegisterSimpleStringEnum",
"registers",
"a",
"simple",
"string",
"value",
"map",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/jsonpb/jsonpb.go#L64-L73 | train |
libopenstorage/openstorage | pkg/jsonpb/jsonpb.go | UnmarshalString | func UnmarshalString(str string, pb proto.Message) error {
return Unmarshal(strings.NewReader(str), pb)
} | go | func UnmarshalString(str string, pb proto.Message) error {
return Unmarshal(strings.NewReader(str), pb)
} | [
"func",
"UnmarshalString",
"(",
"str",
"string",
",",
"pb",
"proto",
".",
"Message",
")",
"error",
"{",
"return",
"Unmarshal",
"(",
"strings",
".",
"NewReader",
"(",
"str",
")",
",",
"pb",
")",
"\n",
"}"
] | // UnmarshalString will populate the fields of a protocol buffer based
// on a JSON string. This function is lenient and will decode any options
// permutations of the related Marshaler. | [
"UnmarshalString",
"will",
"populate",
"the",
"fields",
"of",
"a",
"protocol",
"buffer",
"based",
"on",
"a",
"JSON",
"string",
".",
"This",
"function",
"is",
"lenient",
"and",
"will",
"decode",
"any",
"options",
"permutations",
"of",
"the",
"related",
"Marshaler",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/jsonpb/jsonpb.go#L391-L393 | train |
libopenstorage/openstorage | pkg/jsonpb/jsonpb.go | jsonProperties | func jsonProperties(f reflect.StructField) *proto.Properties {
var prop proto.Properties
prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f)
return &prop
} | go | func jsonProperties(f reflect.StructField) *proto.Properties {
var prop proto.Properties
prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f)
return &prop
} | [
"func",
"jsonProperties",
"(",
"f",
"reflect",
".",
"StructField",
")",
"*",
"proto",
".",
"Properties",
"{",
"var",
"prop",
"proto",
".",
"Properties",
"\n",
"prop",
".",
"Init",
"(",
"f",
".",
"Type",
",",
"f",
".",
"Name",
",",
"f",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"&",
"f",
")",
"\n",
"return",
"&",
"prop",
"\n",
"}"
] | // jsonProperties returns parsed proto.Properties for the field. | [
"jsonProperties",
"returns",
"parsed",
"proto",
".",
"Properties",
"for",
"the",
"field",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/jsonpb/jsonpb.go#L554-L558 | train |
libopenstorage/openstorage | graph/drivers/layer0/layer0.go | Create | func (l *Layer0) Create(id string, parent string, mountLabel string, storageOpts map[string]string) error {
id, vol, err := l.create(id, parent)
if err != nil {
return err
}
err = l.Driver.Create(id, parent, mountLabel, storageOpts)
if err != nil || vol == nil {
return err
}
// This is layer0. Restore saved upper dir, if one exists.
savedUpper := path.Join(vol.path, "upper")
if _, err := os.Stat(savedUpper); err != nil {
// It's not an error if didn't have a saved upper
return nil
}
// We found a saved upper, restore to newly created upper.
upperDir := path.Join(path.Join(l.home, id), "upper")
os.RemoveAll(upperDir)
return os.Rename(savedUpper, upperDir)
} | go | func (l *Layer0) Create(id string, parent string, mountLabel string, storageOpts map[string]string) error {
id, vol, err := l.create(id, parent)
if err != nil {
return err
}
err = l.Driver.Create(id, parent, mountLabel, storageOpts)
if err != nil || vol == nil {
return err
}
// This is layer0. Restore saved upper dir, if one exists.
savedUpper := path.Join(vol.path, "upper")
if _, err := os.Stat(savedUpper); err != nil {
// It's not an error if didn't have a saved upper
return nil
}
// We found a saved upper, restore to newly created upper.
upperDir := path.Join(path.Join(l.home, id), "upper")
os.RemoveAll(upperDir)
return os.Rename(savedUpper, upperDir)
} | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"Create",
"(",
"id",
"string",
",",
"parent",
"string",
",",
"mountLabel",
"string",
",",
"storageOpts",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"id",
",",
"vol",
",",
"err",
":=",
"l",
".",
"create",
"(",
"id",
",",
"parent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"l",
".",
"Driver",
".",
"Create",
"(",
"id",
",",
"parent",
",",
"mountLabel",
",",
"storageOpts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"vol",
"==",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// This is layer0. Restore saved upper dir, if one exists.",
"savedUpper",
":=",
"path",
".",
"Join",
"(",
"vol",
".",
"path",
",",
"\"",
"\"",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"savedUpper",
")",
";",
"err",
"!=",
"nil",
"{",
"// It's not an error if didn't have a saved upper",
"return",
"nil",
"\n",
"}",
"\n",
"// We found a saved upper, restore to newly created upper.",
"upperDir",
":=",
"path",
".",
"Join",
"(",
"path",
".",
"Join",
"(",
"l",
".",
"home",
",",
"id",
")",
",",
"\"",
"\"",
")",
"\n",
"os",
".",
"RemoveAll",
"(",
"upperDir",
")",
"\n",
"return",
"os",
".",
"Rename",
"(",
"savedUpper",
",",
"upperDir",
")",
"\n",
"}"
] | // Create creates a new and empty filesystem layer | [
"Create",
"creates",
"a",
"new",
"and",
"empty",
"filesystem",
"layer"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L214-L233 | train |
libopenstorage/openstorage | graph/drivers/layer0/layer0.go | Remove | func (l *Layer0) Remove(id string) error {
if !l.isLayer0(id) {
return l.Driver.Remove(l.realID(id))
}
l.Lock()
defer l.Unlock()
var err error
v, ok := l.volumes[id]
if ok {
atomic.AddInt32(&v.ref, -1)
if v.ref == 0 {
// Save the upper dir and blow away the rest.
upperDir := path.Join(path.Join(l.home, l.realID(id)), "upper")
err := os.Rename(upperDir, path.Join(v.path, "upper"))
if err != nil {
logrus.Warnf("Failed in rename(%v): %v", id, err)
}
l.Driver.Remove(l.realID(id))
opts := make(map[string]string)
opts[options.OptionsDeleteAfterUnmount] = "true"
err = l.volDriver.Unmount(v.volumeID, v.path, opts)
if l.volDriver.Type() == api.DriverType_DRIVER_TYPE_BLOCK {
_ = l.volDriver.Detach(v.volumeID, nil)
}
err = os.RemoveAll(v.path)
delete(l.volumes, v.id)
}
} else {
logrus.Warnf("Failed to find layer0 vol for id %v", id)
}
return err
} | go | func (l *Layer0) Remove(id string) error {
if !l.isLayer0(id) {
return l.Driver.Remove(l.realID(id))
}
l.Lock()
defer l.Unlock()
var err error
v, ok := l.volumes[id]
if ok {
atomic.AddInt32(&v.ref, -1)
if v.ref == 0 {
// Save the upper dir and blow away the rest.
upperDir := path.Join(path.Join(l.home, l.realID(id)), "upper")
err := os.Rename(upperDir, path.Join(v.path, "upper"))
if err != nil {
logrus.Warnf("Failed in rename(%v): %v", id, err)
}
l.Driver.Remove(l.realID(id))
opts := make(map[string]string)
opts[options.OptionsDeleteAfterUnmount] = "true"
err = l.volDriver.Unmount(v.volumeID, v.path, opts)
if l.volDriver.Type() == api.DriverType_DRIVER_TYPE_BLOCK {
_ = l.volDriver.Detach(v.volumeID, nil)
}
err = os.RemoveAll(v.path)
delete(l.volumes, v.id)
}
} else {
logrus.Warnf("Failed to find layer0 vol for id %v", id)
}
return err
} | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"Remove",
"(",
"id",
"string",
")",
"error",
"{",
"if",
"!",
"l",
".",
"isLayer0",
"(",
"id",
")",
"{",
"return",
"l",
".",
"Driver",
".",
"Remove",
"(",
"l",
".",
"realID",
"(",
"id",
")",
")",
"\n",
"}",
"\n",
"l",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"Unlock",
"(",
")",
"\n",
"var",
"err",
"error",
"\n",
"v",
",",
"ok",
":=",
"l",
".",
"volumes",
"[",
"id",
"]",
"\n\n",
"if",
"ok",
"{",
"atomic",
".",
"AddInt32",
"(",
"&",
"v",
".",
"ref",
",",
"-",
"1",
")",
"\n",
"if",
"v",
".",
"ref",
"==",
"0",
"{",
"// Save the upper dir and blow away the rest.",
"upperDir",
":=",
"path",
".",
"Join",
"(",
"path",
".",
"Join",
"(",
"l",
".",
"home",
",",
"l",
".",
"realID",
"(",
"id",
")",
")",
",",
"\"",
"\"",
")",
"\n",
"err",
":=",
"os",
".",
"Rename",
"(",
"upperDir",
",",
"path",
".",
"Join",
"(",
"v",
".",
"path",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"id",
",",
"err",
")",
"\n",
"}",
"\n",
"l",
".",
"Driver",
".",
"Remove",
"(",
"l",
".",
"realID",
"(",
"id",
")",
")",
"\n\n",
"opts",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"opts",
"[",
"options",
".",
"OptionsDeleteAfterUnmount",
"]",
"=",
"\"",
"\"",
"\n\n",
"err",
"=",
"l",
".",
"volDriver",
".",
"Unmount",
"(",
"v",
".",
"volumeID",
",",
"v",
".",
"path",
",",
"opts",
")",
"\n",
"if",
"l",
".",
"volDriver",
".",
"Type",
"(",
")",
"==",
"api",
".",
"DriverType_DRIVER_TYPE_BLOCK",
"{",
"_",
"=",
"l",
".",
"volDriver",
".",
"Detach",
"(",
"v",
".",
"volumeID",
",",
"nil",
")",
"\n",
"}",
"\n",
"err",
"=",
"os",
".",
"RemoveAll",
"(",
"v",
".",
"path",
")",
"\n",
"delete",
"(",
"l",
".",
"volumes",
",",
"v",
".",
"id",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] | // Remove removes a layer based on its id | [
"Remove",
"removes",
"a",
"layer",
"based",
"on",
"its",
"id"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L236-L270 | train |
libopenstorage/openstorage | graph/drivers/layer0/layer0.go | Get | func (l *Layer0) Get(id string, mountLabel string) (string, error) {
id = l.realID(id)
return l.Driver.Get(id, mountLabel)
} | go | func (l *Layer0) Get(id string, mountLabel string) (string, error) {
id = l.realID(id)
return l.Driver.Get(id, mountLabel)
} | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"Get",
"(",
"id",
"string",
",",
"mountLabel",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"id",
"=",
"l",
".",
"realID",
"(",
"id",
")",
"\n",
"return",
"l",
".",
"Driver",
".",
"Get",
"(",
"id",
",",
"mountLabel",
")",
"\n",
"}"
] | // Get returns the mountpoint for the layered filesystem | [
"Get",
"returns",
"the",
"mountpoint",
"for",
"the",
"layered",
"filesystem"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L273-L276 | train |
libopenstorage/openstorage | graph/drivers/layer0/layer0.go | Put | func (l *Layer0) Put(id string) error {
id = l.realID(id)
return l.Driver.Put(id)
} | go | func (l *Layer0) Put(id string) error {
id = l.realID(id)
return l.Driver.Put(id)
} | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"Put",
"(",
"id",
"string",
")",
"error",
"{",
"id",
"=",
"l",
".",
"realID",
"(",
"id",
")",
"\n",
"return",
"l",
".",
"Driver",
".",
"Put",
"(",
"id",
")",
"\n",
"}"
] | // Put releases the system resources for the specified id | [
"Put",
"releases",
"the",
"system",
"resources",
"for",
"the",
"specified",
"id"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L279-L282 | train |
libopenstorage/openstorage | graph/drivers/layer0/layer0.go | ApplyDiff | func (l *Layer0) ApplyDiff(id string, parent string, diff archive.Reader) (size int64, err error) {
id = l.realID(id)
return l.Driver.ApplyDiff(id, parent, diff)
} | go | func (l *Layer0) ApplyDiff(id string, parent string, diff archive.Reader) (size int64, err error) {
id = l.realID(id)
return l.Driver.ApplyDiff(id, parent, diff)
} | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"ApplyDiff",
"(",
"id",
"string",
",",
"parent",
"string",
",",
"diff",
"archive",
".",
"Reader",
")",
"(",
"size",
"int64",
",",
"err",
"error",
")",
"{",
"id",
"=",
"l",
".",
"realID",
"(",
"id",
")",
"\n",
"return",
"l",
".",
"Driver",
".",
"ApplyDiff",
"(",
"id",
",",
"parent",
",",
"diff",
")",
"\n",
"}"
] | // ApplyDiff extracts the changeset between the specified layer and its parent | [
"ApplyDiff",
"extracts",
"the",
"changeset",
"between",
"the",
"specified",
"layer",
"and",
"its",
"parent"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L285-L288 | train |
libopenstorage/openstorage | graph/drivers/layer0/layer0.go | Exists | func (l *Layer0) Exists(id string) bool {
id = l.realID(id)
return l.Driver.Exists(id)
} | go | func (l *Layer0) Exists(id string) bool {
id = l.realID(id)
return l.Driver.Exists(id)
} | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"Exists",
"(",
"id",
"string",
")",
"bool",
"{",
"id",
"=",
"l",
".",
"realID",
"(",
"id",
")",
"\n",
"return",
"l",
".",
"Driver",
".",
"Exists",
"(",
"id",
")",
"\n",
"}"
] | // Exists checks if leyr exists | [
"Exists",
"checks",
"if",
"leyr",
"exists"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L291-L294 | train |
libopenstorage/openstorage | graph/drivers/layer0/layer0.go | GetMetadata | func (l *Layer0) GetMetadata(id string) (map[string]string, error) {
id = l.realID(id)
return l.Driver.GetMetadata(id)
} | go | func (l *Layer0) GetMetadata(id string) (map[string]string, error) {
id = l.realID(id)
return l.Driver.GetMetadata(id)
} | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"GetMetadata",
"(",
"id",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"id",
"=",
"l",
".",
"realID",
"(",
"id",
")",
"\n",
"return",
"l",
".",
"Driver",
".",
"GetMetadata",
"(",
"id",
")",
"\n",
"}"
] | // GetMetadata returns key-value pairs | [
"GetMetadata",
"returns",
"key",
"-",
"value",
"pairs"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L297-L300 | train |
libopenstorage/openstorage | pkg/auth/userinfo.go | ContextSaveUserInfo | func ContextSaveUserInfo(ctx context.Context, u *UserInfo) context.Context {
return context.WithValue(ctx, InterceptorContextTokenKey, u)
} | go | func ContextSaveUserInfo(ctx context.Context, u *UserInfo) context.Context {
return context.WithValue(ctx, InterceptorContextTokenKey, u)
} | [
"func",
"ContextSaveUserInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"u",
"*",
"UserInfo",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"InterceptorContextTokenKey",
",",
"u",
")",
"\n",
"}"
] | // ContextSaveUserInfo saves user information in the context for other functions to consume | [
"ContextSaveUserInfo",
"saves",
"user",
"information",
"in",
"the",
"context",
"for",
"other",
"functions",
"to",
"consume"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/auth/userinfo.go#L43-L45 | train |
libopenstorage/openstorage | pkg/auth/userinfo.go | NewUserInfoFromContext | func NewUserInfoFromContext(ctx context.Context) (*UserInfo, bool) {
u, ok := ctx.Value(InterceptorContextTokenKey).(*UserInfo)
return u, ok
} | go | func NewUserInfoFromContext(ctx context.Context) (*UserInfo, bool) {
u, ok := ctx.Value(InterceptorContextTokenKey).(*UserInfo)
return u, ok
} | [
"func",
"NewUserInfoFromContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"UserInfo",
",",
"bool",
")",
"{",
"u",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"InterceptorContextTokenKey",
")",
".",
"(",
"*",
"UserInfo",
")",
"\n",
"return",
"u",
",",
"ok",
"\n",
"}"
] | // NewUserInfoFromContext returns user information in the context if available.
// If not available means that the system is running without auth. | [
"NewUserInfoFromContext",
"returns",
"user",
"information",
"in",
"the",
"context",
"if",
"available",
".",
"If",
"not",
"available",
"means",
"that",
"the",
"system",
"is",
"running",
"without",
"auth",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/auth/userinfo.go#L49-L52 | train |
libopenstorage/openstorage | api/server/sdk/server.go | New | func New(config *ServerConfig) (*Server, error) {
if config == nil {
return nil, fmt.Errorf("Must provide configuration")
}
// If no security set, initialize the object as empty
if config.Security == nil {
config.Security = &SecurityConfig{}
}
// Check if the socket is provided to enable the REST gateway to communicate
// to the unix domain socket
if len(config.Socket) == 0 {
return nil, fmt.Errorf("Must provide unix domain socket for SDK")
}
if len(config.RestPort) == 0 {
return nil, fmt.Errorf("Must provide REST Gateway port for the SDK")
}
// Set default log locations
var (
accessLog, auditLog *os.File
err error
)
if config.AuditOutput == nil {
auditLog, err = openLog(defaultAuditLog)
if err != nil {
return nil, err
}
config.AuditOutput = auditLog
}
if config.AccessOutput == nil {
accessLog, err := openLog(defaultAccessLog)
if err != nil {
return nil, err
}
config.AccessOutput = accessLog
}
// Create a gRPC server on the network
netServer, err := newSdkGrpcServer(config)
if err != nil {
return nil, err
}
// Create a gRPC server on a unix domain socket
udsConfig := *config
udsConfig.Net = "unix"
udsConfig.Address = config.Socket
udsServer, err := newSdkGrpcServer(&udsConfig)
if err != nil {
return nil, err
}
// Create REST Gateway and connect it to the unix domain socket server
restGateway, err := newSdkRestGateway(config, udsServer)
if err != nil {
return nil, err
}
return &Server{
config: *config,
netServer: netServer,
udsServer: udsServer,
restGateway: restGateway,
auditLog: auditLog,
accessLog: accessLog,
}, nil
} | go | func New(config *ServerConfig) (*Server, error) {
if config == nil {
return nil, fmt.Errorf("Must provide configuration")
}
// If no security set, initialize the object as empty
if config.Security == nil {
config.Security = &SecurityConfig{}
}
// Check if the socket is provided to enable the REST gateway to communicate
// to the unix domain socket
if len(config.Socket) == 0 {
return nil, fmt.Errorf("Must provide unix domain socket for SDK")
}
if len(config.RestPort) == 0 {
return nil, fmt.Errorf("Must provide REST Gateway port for the SDK")
}
// Set default log locations
var (
accessLog, auditLog *os.File
err error
)
if config.AuditOutput == nil {
auditLog, err = openLog(defaultAuditLog)
if err != nil {
return nil, err
}
config.AuditOutput = auditLog
}
if config.AccessOutput == nil {
accessLog, err := openLog(defaultAccessLog)
if err != nil {
return nil, err
}
config.AccessOutput = accessLog
}
// Create a gRPC server on the network
netServer, err := newSdkGrpcServer(config)
if err != nil {
return nil, err
}
// Create a gRPC server on a unix domain socket
udsConfig := *config
udsConfig.Net = "unix"
udsConfig.Address = config.Socket
udsServer, err := newSdkGrpcServer(&udsConfig)
if err != nil {
return nil, err
}
// Create REST Gateway and connect it to the unix domain socket server
restGateway, err := newSdkRestGateway(config, udsServer)
if err != nil {
return nil, err
}
return &Server{
config: *config,
netServer: netServer,
udsServer: udsServer,
restGateway: restGateway,
auditLog: auditLog,
accessLog: accessLog,
}, nil
} | [
"func",
"New",
"(",
"config",
"*",
"ServerConfig",
")",
"(",
"*",
"Server",
",",
"error",
")",
"{",
"if",
"config",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// If no security set, initialize the object as empty",
"if",
"config",
".",
"Security",
"==",
"nil",
"{",
"config",
".",
"Security",
"=",
"&",
"SecurityConfig",
"{",
"}",
"\n",
"}",
"\n\n",
"// Check if the socket is provided to enable the REST gateway to communicate",
"// to the unix domain socket",
"if",
"len",
"(",
"config",
".",
"Socket",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"config",
".",
"RestPort",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Set default log locations",
"var",
"(",
"accessLog",
",",
"auditLog",
"*",
"os",
".",
"File",
"\n",
"err",
"error",
"\n",
")",
"\n",
"if",
"config",
".",
"AuditOutput",
"==",
"nil",
"{",
"auditLog",
",",
"err",
"=",
"openLog",
"(",
"defaultAuditLog",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"config",
".",
"AuditOutput",
"=",
"auditLog",
"\n",
"}",
"\n",
"if",
"config",
".",
"AccessOutput",
"==",
"nil",
"{",
"accessLog",
",",
"err",
":=",
"openLog",
"(",
"defaultAccessLog",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"config",
".",
"AccessOutput",
"=",
"accessLog",
"\n",
"}",
"\n\n",
"// Create a gRPC server on the network",
"netServer",
",",
"err",
":=",
"newSdkGrpcServer",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Create a gRPC server on a unix domain socket",
"udsConfig",
":=",
"*",
"config",
"\n",
"udsConfig",
".",
"Net",
"=",
"\"",
"\"",
"\n",
"udsConfig",
".",
"Address",
"=",
"config",
".",
"Socket",
"\n",
"udsServer",
",",
"err",
":=",
"newSdkGrpcServer",
"(",
"&",
"udsConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Create REST Gateway and connect it to the unix domain socket server",
"restGateway",
",",
"err",
":=",
"newSdkRestGateway",
"(",
"config",
",",
"udsServer",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"Server",
"{",
"config",
":",
"*",
"config",
",",
"netServer",
":",
"netServer",
",",
"udsServer",
":",
"udsServer",
",",
"restGateway",
":",
"restGateway",
",",
"auditLog",
":",
"auditLog",
",",
"accessLog",
":",
"accessLog",
",",
"}",
",",
"nil",
"\n",
"}"
] | // New creates a new SDK server | [
"New",
"creates",
"a",
"new",
"SDK",
"server"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/server.go#L183-L252 | train |
libopenstorage/openstorage | api/server/sdk/server.go | Start | func (s *Server) Start() error {
if err := s.netServer.Start(); err != nil {
return err
} else if err := s.udsServer.Start(); err != nil {
return err
} else if err := s.restGateway.Start(); err != nil {
return err
}
return nil
} | go | func (s *Server) Start() error {
if err := s.netServer.Start(); err != nil {
return err
} else if err := s.udsServer.Start(); err != nil {
return err
} else if err := s.restGateway.Start(); err != nil {
return err
}
return nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"Start",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"s",
".",
"netServer",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"else",
"if",
"err",
":=",
"s",
".",
"udsServer",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"else",
"if",
"err",
":=",
"s",
".",
"restGateway",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Start all servers | [
"Start",
"all",
"servers"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/server.go#L255-L265 | train |
libopenstorage/openstorage | api/server/sdk/server.go | UseCluster | func (s *Server) UseCluster(c cluster.Cluster) {
s.netServer.useCluster(c)
s.udsServer.useCluster(c)
} | go | func (s *Server) UseCluster(c cluster.Cluster) {
s.netServer.useCluster(c)
s.udsServer.useCluster(c)
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"UseCluster",
"(",
"c",
"cluster",
".",
"Cluster",
")",
"{",
"s",
".",
"netServer",
".",
"useCluster",
"(",
"c",
")",
"\n",
"s",
".",
"udsServer",
".",
"useCluster",
"(",
"c",
")",
"\n",
"}"
] | // UseCluster will setup a new cluster object for the gRPC handlers | [
"UseCluster",
"will",
"setup",
"a",
"new",
"cluster",
"object",
"for",
"the",
"gRPC",
"handlers"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/server.go#L289-L292 | train |
libopenstorage/openstorage | api/server/sdk/server.go | UseVolumeDrivers | func (s *Server) UseVolumeDrivers(d map[string]volume.VolumeDriver) {
s.netServer.useVolumeDrivers(d)
s.udsServer.useVolumeDrivers(d)
} | go | func (s *Server) UseVolumeDrivers(d map[string]volume.VolumeDriver) {
s.netServer.useVolumeDrivers(d)
s.udsServer.useVolumeDrivers(d)
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"UseVolumeDrivers",
"(",
"d",
"map",
"[",
"string",
"]",
"volume",
".",
"VolumeDriver",
")",
"{",
"s",
".",
"netServer",
".",
"useVolumeDrivers",
"(",
"d",
")",
"\n",
"s",
".",
"udsServer",
".",
"useVolumeDrivers",
"(",
"d",
")",
"\n",
"}"
] | // UseVolumeDrivers will setup a new driver object for the gRPC handlers | [
"UseVolumeDrivers",
"will",
"setup",
"a",
"new",
"driver",
"object",
"for",
"the",
"gRPC",
"handlers"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/server.go#L295-L298 | train |
libopenstorage/openstorage | api/server/sdk/server.go | UseAlert | func (s *Server) UseAlert(a alerts.FilterDeleter) {
s.netServer.useAlert(a)
s.udsServer.useAlert(a)
} | go | func (s *Server) UseAlert(a alerts.FilterDeleter) {
s.netServer.useAlert(a)
s.udsServer.useAlert(a)
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"UseAlert",
"(",
"a",
"alerts",
".",
"FilterDeleter",
")",
"{",
"s",
".",
"netServer",
".",
"useAlert",
"(",
"a",
")",
"\n",
"s",
".",
"udsServer",
".",
"useAlert",
"(",
"a",
")",
"\n",
"}"
] | // UseAlert will setup a new alert object for the gRPC handlers | [
"UseAlert",
"will",
"setup",
"a",
"new",
"alert",
"object",
"for",
"the",
"gRPC",
"handlers"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/server.go#L301-L304 | train |
libopenstorage/openstorage | api/server/sdk/server.go | newSdkGrpcServer | func newSdkGrpcServer(config *ServerConfig) (*sdkGrpcServer, error) {
if nil == config {
return nil, fmt.Errorf("Configuration must be provided")
}
// Create a log object for this server
name := "SDK-" + config.Net
log := logrus.WithFields(logrus.Fields{
"name": name,
})
// Save the driver for future calls
var (
d volume.VolumeDriver
err error
)
if len(config.DriverName) != 0 {
d, err = volumedrivers.Get(config.DriverName)
if err != nil {
return nil, fmt.Errorf("Unable to get driver %s info: %s", config.DriverName, err.Error())
}
}
// Setup authentication
for issuer, _ := range config.Security.Authenticators {
log.Infof("Authentication enabled for issuer: %s", issuer)
// Check the necessary security config options are set
if config.Security.Role == nil {
return nil, fmt.Errorf("Must supply role manager when authentication enabled")
}
}
if config.StoragePolicy == nil {
return nil, fmt.Errorf("Must supply storage policy server")
}
// Create gRPC server
gServer, err := grpcserver.New(&grpcserver.GrpcServerConfig{
Name: name,
Net: config.Net,
Address: config.Address,
})
if err != nil {
return nil, fmt.Errorf("Unable to setup %s server: %v", name, err)
}
s := &sdkGrpcServer{
GrpcServer: gServer,
accessLogOutput: config.AccessOutput,
auditLogOutput: config.AuditOutput,
config: *config,
name: name,
log: log,
clusterHandler: config.Cluster,
driverHandlers: map[string]volume.VolumeDriver{
config.DriverName: d,
DefaultDriverName: d,
},
alertHandler: config.AlertsFilterDeleter,
policyServer: config.StoragePolicy,
}
s.identityServer = &IdentityServer{
server: s,
}
s.clusterServer = &ClusterServer{
server: s,
}
s.nodeServer = &NodeServer{
server: s,
}
s.volumeServer = &VolumeServer{
server: s,
specHandler: spec.NewSpecHandler(),
}
s.objectstoreServer = &ObjectstoreServer{
server: s,
}
s.schedulePolicyServer = &SchedulePolicyServer{
server: s,
}
s.cloudBackupServer = &CloudBackupServer{
server: s,
}
s.credentialServer = &CredentialServer{
server: s,
}
s.alertsServer = &alertsServer{
server: s,
}
s.clusterPairServer = &ClusterPairServer{
server: s,
}
s.clusterDomainsServer = &ClusterDomainsServer{
server: s,
}
s.roleServer = config.Security.Role
s.policyServer = config.StoragePolicy
return s, nil
} | go | func newSdkGrpcServer(config *ServerConfig) (*sdkGrpcServer, error) {
if nil == config {
return nil, fmt.Errorf("Configuration must be provided")
}
// Create a log object for this server
name := "SDK-" + config.Net
log := logrus.WithFields(logrus.Fields{
"name": name,
})
// Save the driver for future calls
var (
d volume.VolumeDriver
err error
)
if len(config.DriverName) != 0 {
d, err = volumedrivers.Get(config.DriverName)
if err != nil {
return nil, fmt.Errorf("Unable to get driver %s info: %s", config.DriverName, err.Error())
}
}
// Setup authentication
for issuer, _ := range config.Security.Authenticators {
log.Infof("Authentication enabled for issuer: %s", issuer)
// Check the necessary security config options are set
if config.Security.Role == nil {
return nil, fmt.Errorf("Must supply role manager when authentication enabled")
}
}
if config.StoragePolicy == nil {
return nil, fmt.Errorf("Must supply storage policy server")
}
// Create gRPC server
gServer, err := grpcserver.New(&grpcserver.GrpcServerConfig{
Name: name,
Net: config.Net,
Address: config.Address,
})
if err != nil {
return nil, fmt.Errorf("Unable to setup %s server: %v", name, err)
}
s := &sdkGrpcServer{
GrpcServer: gServer,
accessLogOutput: config.AccessOutput,
auditLogOutput: config.AuditOutput,
config: *config,
name: name,
log: log,
clusterHandler: config.Cluster,
driverHandlers: map[string]volume.VolumeDriver{
config.DriverName: d,
DefaultDriverName: d,
},
alertHandler: config.AlertsFilterDeleter,
policyServer: config.StoragePolicy,
}
s.identityServer = &IdentityServer{
server: s,
}
s.clusterServer = &ClusterServer{
server: s,
}
s.nodeServer = &NodeServer{
server: s,
}
s.volumeServer = &VolumeServer{
server: s,
specHandler: spec.NewSpecHandler(),
}
s.objectstoreServer = &ObjectstoreServer{
server: s,
}
s.schedulePolicyServer = &SchedulePolicyServer{
server: s,
}
s.cloudBackupServer = &CloudBackupServer{
server: s,
}
s.credentialServer = &CredentialServer{
server: s,
}
s.alertsServer = &alertsServer{
server: s,
}
s.clusterPairServer = &ClusterPairServer{
server: s,
}
s.clusterDomainsServer = &ClusterDomainsServer{
server: s,
}
s.roleServer = config.Security.Role
s.policyServer = config.StoragePolicy
return s, nil
} | [
"func",
"newSdkGrpcServer",
"(",
"config",
"*",
"ServerConfig",
")",
"(",
"*",
"sdkGrpcServer",
",",
"error",
")",
"{",
"if",
"nil",
"==",
"config",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Create a log object for this server",
"name",
":=",
"\"",
"\"",
"+",
"config",
".",
"Net",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"name",
",",
"}",
")",
"\n\n",
"// Save the driver for future calls",
"var",
"(",
"d",
"volume",
".",
"VolumeDriver",
"\n",
"err",
"error",
"\n",
")",
"\n",
"if",
"len",
"(",
"config",
".",
"DriverName",
")",
"!=",
"0",
"{",
"d",
",",
"err",
"=",
"volumedrivers",
".",
"Get",
"(",
"config",
".",
"DriverName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"config",
".",
"DriverName",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Setup authentication",
"for",
"issuer",
",",
"_",
":=",
"range",
"config",
".",
"Security",
".",
"Authenticators",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"issuer",
")",
"\n\n",
"// Check the necessary security config options are set",
"if",
"config",
".",
"Security",
".",
"Role",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"config",
".",
"StoragePolicy",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Create gRPC server",
"gServer",
",",
"err",
":=",
"grpcserver",
".",
"New",
"(",
"&",
"grpcserver",
".",
"GrpcServerConfig",
"{",
"Name",
":",
"name",
",",
"Net",
":",
"config",
".",
"Net",
",",
"Address",
":",
"config",
".",
"Address",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"err",
")",
"\n",
"}",
"\n\n",
"s",
":=",
"&",
"sdkGrpcServer",
"{",
"GrpcServer",
":",
"gServer",
",",
"accessLogOutput",
":",
"config",
".",
"AccessOutput",
",",
"auditLogOutput",
":",
"config",
".",
"AuditOutput",
",",
"config",
":",
"*",
"config",
",",
"name",
":",
"name",
",",
"log",
":",
"log",
",",
"clusterHandler",
":",
"config",
".",
"Cluster",
",",
"driverHandlers",
":",
"map",
"[",
"string",
"]",
"volume",
".",
"VolumeDriver",
"{",
"config",
".",
"DriverName",
":",
"d",
",",
"DefaultDriverName",
":",
"d",
",",
"}",
",",
"alertHandler",
":",
"config",
".",
"AlertsFilterDeleter",
",",
"policyServer",
":",
"config",
".",
"StoragePolicy",
",",
"}",
"\n",
"s",
".",
"identityServer",
"=",
"&",
"IdentityServer",
"{",
"server",
":",
"s",
",",
"}",
"\n",
"s",
".",
"clusterServer",
"=",
"&",
"ClusterServer",
"{",
"server",
":",
"s",
",",
"}",
"\n",
"s",
".",
"nodeServer",
"=",
"&",
"NodeServer",
"{",
"server",
":",
"s",
",",
"}",
"\n",
"s",
".",
"volumeServer",
"=",
"&",
"VolumeServer",
"{",
"server",
":",
"s",
",",
"specHandler",
":",
"spec",
".",
"NewSpecHandler",
"(",
")",
",",
"}",
"\n",
"s",
".",
"objectstoreServer",
"=",
"&",
"ObjectstoreServer",
"{",
"server",
":",
"s",
",",
"}",
"\n",
"s",
".",
"schedulePolicyServer",
"=",
"&",
"SchedulePolicyServer",
"{",
"server",
":",
"s",
",",
"}",
"\n",
"s",
".",
"cloudBackupServer",
"=",
"&",
"CloudBackupServer",
"{",
"server",
":",
"s",
",",
"}",
"\n",
"s",
".",
"credentialServer",
"=",
"&",
"CredentialServer",
"{",
"server",
":",
"s",
",",
"}",
"\n",
"s",
".",
"alertsServer",
"=",
"&",
"alertsServer",
"{",
"server",
":",
"s",
",",
"}",
"\n",
"s",
".",
"clusterPairServer",
"=",
"&",
"ClusterPairServer",
"{",
"server",
":",
"s",
",",
"}",
"\n",
"s",
".",
"clusterDomainsServer",
"=",
"&",
"ClusterDomainsServer",
"{",
"server",
":",
"s",
",",
"}",
"\n",
"s",
".",
"roleServer",
"=",
"config",
".",
"Security",
".",
"Role",
"\n",
"s",
".",
"policyServer",
"=",
"config",
".",
"StoragePolicy",
"\n",
"return",
"s",
",",
"nil",
"\n",
"}"
] | // New creates a new SDK gRPC server | [
"New",
"creates",
"a",
"new",
"SDK",
"gRPC",
"server"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/server.go#L307-L406 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | NewMockVolumeDriver | func NewMockVolumeDriver(ctrl *gomock.Controller) *MockVolumeDriver {
mock := &MockVolumeDriver{ctrl: ctrl}
mock.recorder = &MockVolumeDriverMockRecorder{mock}
return mock
} | go | func NewMockVolumeDriver(ctrl *gomock.Controller) *MockVolumeDriver {
mock := &MockVolumeDriver{ctrl: ctrl}
mock.recorder = &MockVolumeDriverMockRecorder{mock}
return mock
} | [
"func",
"NewMockVolumeDriver",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockVolumeDriver",
"{",
"mock",
":=",
"&",
"MockVolumeDriver",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockVolumeDriverMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] | // NewMockVolumeDriver creates a new mock instance | [
"NewMockVolumeDriver",
"creates",
"a",
"new",
"mock",
"instance"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L25-L29 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | Attach | func (m *MockVolumeDriver) Attach(arg0 string, arg1 map[string]string) (string, error) {
ret := m.ctrl.Call(m, "Attach", arg0, arg1)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) Attach(arg0 string, arg1 map[string]string) (string, error) {
ret := m.ctrl.Call(m, "Attach", arg0, arg1)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"Attach",
"(",
"arg0",
"string",
",",
"arg1",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"string",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // Attach mocks base method | [
"Attach",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L37-L42 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CapacityUsage | func (m *MockVolumeDriver) CapacityUsage(arg0 string) (*api.CapacityUsageResponse, error) {
ret := m.ctrl.Call(m, "CapacityUsage", arg0)
ret0, _ := ret[0].(*api.CapacityUsageResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CapacityUsage(arg0 string) (*api.CapacityUsageResponse, error) {
ret := m.ctrl.Call(m, "CapacityUsage", arg0)
ret0, _ := ret[0].(*api.CapacityUsageResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CapacityUsage",
"(",
"arg0",
"string",
")",
"(",
"*",
"api",
".",
"CapacityUsageResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CapacityUsageResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CapacityUsage mocks base method | [
"CapacityUsage",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L50-L55 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | Catalog | func (m *MockVolumeDriver) Catalog(arg0, arg1, arg2 string) (api.CatalogResponse, error) {
ret := m.ctrl.Call(m, "Catalog", arg0, arg1, arg2)
ret0, _ := ret[0].(api.CatalogResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) Catalog(arg0, arg1, arg2 string) (api.CatalogResponse, error) {
ret := m.ctrl.Call(m, "Catalog", arg0, arg1, arg2)
ret0, _ := ret[0].(api.CatalogResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"Catalog",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
"string",
")",
"(",
"api",
".",
"CatalogResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"api",
".",
"CatalogResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // Catalog mocks base method | [
"Catalog",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L63-L68 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupCatalog | func (m *MockVolumeDriver) CloudBackupCatalog(arg0 *api.CloudBackupCatalogRequest) (*api.CloudBackupCatalogResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupCatalog", arg0)
ret0, _ := ret[0].(*api.CloudBackupCatalogResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudBackupCatalog(arg0 *api.CloudBackupCatalogRequest) (*api.CloudBackupCatalogResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupCatalog", arg0)
ret0, _ := ret[0].(*api.CloudBackupCatalogResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupCatalog",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupCatalogRequest",
")",
"(",
"*",
"api",
".",
"CloudBackupCatalogResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudBackupCatalogResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudBackupCatalog mocks base method | [
"CloudBackupCatalog",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L76-L81 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupCreate | func (m *MockVolumeDriver) CloudBackupCreate(arg0 *api.CloudBackupCreateRequest) (*api.CloudBackupCreateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupCreate", arg0)
ret0, _ := ret[0].(*api.CloudBackupCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudBackupCreate(arg0 *api.CloudBackupCreateRequest) (*api.CloudBackupCreateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupCreate", arg0)
ret0, _ := ret[0].(*api.CloudBackupCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupCreate",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupCreateRequest",
")",
"(",
"*",
"api",
".",
"CloudBackupCreateResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudBackupCreateResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudBackupCreate mocks base method | [
"CloudBackupCreate",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L89-L94 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupDelete | func (m *MockVolumeDriver) CloudBackupDelete(arg0 *api.CloudBackupDeleteRequest) error {
ret := m.ctrl.Call(m, "CloudBackupDelete", arg0)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockVolumeDriver) CloudBackupDelete(arg0 *api.CloudBackupDeleteRequest) error {
ret := m.ctrl.Call(m, "CloudBackupDelete", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupDelete",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupDeleteRequest",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] | // CloudBackupDelete mocks base method | [
"CloudBackupDelete",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L102-L106 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupDeleteAll | func (m *MockVolumeDriver) CloudBackupDeleteAll(arg0 *api.CloudBackupDeleteAllRequest) error {
ret := m.ctrl.Call(m, "CloudBackupDeleteAll", arg0)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockVolumeDriver) CloudBackupDeleteAll(arg0 *api.CloudBackupDeleteAllRequest) error {
ret := m.ctrl.Call(m, "CloudBackupDeleteAll", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupDeleteAll",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupDeleteAllRequest",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] | // CloudBackupDeleteAll mocks base method | [
"CloudBackupDeleteAll",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L114-L118 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupEnumerate | func (m *MockVolumeDriver) CloudBackupEnumerate(arg0 *api.CloudBackupEnumerateRequest) (*api.CloudBackupEnumerateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupEnumerate", arg0)
ret0, _ := ret[0].(*api.CloudBackupEnumerateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudBackupEnumerate(arg0 *api.CloudBackupEnumerateRequest) (*api.CloudBackupEnumerateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupEnumerate", arg0)
ret0, _ := ret[0].(*api.CloudBackupEnumerateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupEnumerate",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupEnumerateRequest",
")",
"(",
"*",
"api",
".",
"CloudBackupEnumerateResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudBackupEnumerateResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudBackupEnumerate mocks base method | [
"CloudBackupEnumerate",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L126-L131 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupGroupCreate | func (m *MockVolumeDriver) CloudBackupGroupCreate(arg0 *api.CloudBackupGroupCreateRequest) (*api.CloudBackupGroupCreateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupGroupCreate", arg0)
ret0, _ := ret[0].(*api.CloudBackupGroupCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudBackupGroupCreate(arg0 *api.CloudBackupGroupCreateRequest) (*api.CloudBackupGroupCreateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupGroupCreate", arg0)
ret0, _ := ret[0].(*api.CloudBackupGroupCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupGroupCreate",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupGroupCreateRequest",
")",
"(",
"*",
"api",
".",
"CloudBackupGroupCreateResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudBackupGroupCreateResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudBackupGroupCreate mocks base method | [
"CloudBackupGroupCreate",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L139-L144 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupGroupSchedCreate | func (m *MockVolumeDriver) CloudBackupGroupSchedCreate(arg0 *api.CloudBackupGroupSchedCreateRequest) (*api.CloudBackupSchedCreateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupGroupSchedCreate", arg0)
ret0, _ := ret[0].(*api.CloudBackupSchedCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudBackupGroupSchedCreate(arg0 *api.CloudBackupGroupSchedCreateRequest) (*api.CloudBackupSchedCreateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupGroupSchedCreate", arg0)
ret0, _ := ret[0].(*api.CloudBackupSchedCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupGroupSchedCreate",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupGroupSchedCreateRequest",
")",
"(",
"*",
"api",
".",
"CloudBackupSchedCreateResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudBackupSchedCreateResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudBackupGroupSchedCreate mocks base method | [
"CloudBackupGroupSchedCreate",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L152-L157 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupGroupSchedCreate | func (mr *MockVolumeDriverMockRecorder) CloudBackupGroupSchedCreate(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloudBackupGroupSchedCreate", reflect.TypeOf((*MockVolumeDriver)(nil).CloudBackupGroupSchedCreate), arg0)
} | go | func (mr *MockVolumeDriverMockRecorder) CloudBackupGroupSchedCreate(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloudBackupGroupSchedCreate", reflect.TypeOf((*MockVolumeDriver)(nil).CloudBackupGroupSchedCreate), arg0)
} | [
"func",
"(",
"mr",
"*",
"MockVolumeDriverMockRecorder",
")",
"CloudBackupGroupSchedCreate",
"(",
"arg0",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockVolumeDriver",
")",
"(",
"nil",
")",
".",
"CloudBackupGroupSchedCreate",
")",
",",
"arg0",
")",
"\n",
"}"
] | // CloudBackupGroupSchedCreate indicates an expected call of CloudBackupGroupSchedCreate | [
"CloudBackupGroupSchedCreate",
"indicates",
"an",
"expected",
"call",
"of",
"CloudBackupGroupSchedCreate"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L160-L162 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupHistory | func (m *MockVolumeDriver) CloudBackupHistory(arg0 *api.CloudBackupHistoryRequest) (*api.CloudBackupHistoryResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupHistory", arg0)
ret0, _ := ret[0].(*api.CloudBackupHistoryResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudBackupHistory(arg0 *api.CloudBackupHistoryRequest) (*api.CloudBackupHistoryResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupHistory", arg0)
ret0, _ := ret[0].(*api.CloudBackupHistoryResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupHistory",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupHistoryRequest",
")",
"(",
"*",
"api",
".",
"CloudBackupHistoryResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudBackupHistoryResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudBackupHistory mocks base method | [
"CloudBackupHistory",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L165-L170 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupRestore | func (m *MockVolumeDriver) CloudBackupRestore(arg0 *api.CloudBackupRestoreRequest) (*api.CloudBackupRestoreResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupRestore", arg0)
ret0, _ := ret[0].(*api.CloudBackupRestoreResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudBackupRestore(arg0 *api.CloudBackupRestoreRequest) (*api.CloudBackupRestoreResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupRestore", arg0)
ret0, _ := ret[0].(*api.CloudBackupRestoreResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupRestore",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupRestoreRequest",
")",
"(",
"*",
"api",
".",
"CloudBackupRestoreResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudBackupRestoreResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudBackupRestore mocks base method | [
"CloudBackupRestore",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L178-L183 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupSchedCreate | func (m *MockVolumeDriver) CloudBackupSchedCreate(arg0 *api.CloudBackupSchedCreateRequest) (*api.CloudBackupSchedCreateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupSchedCreate", arg0)
ret0, _ := ret[0].(*api.CloudBackupSchedCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudBackupSchedCreate(arg0 *api.CloudBackupSchedCreateRequest) (*api.CloudBackupSchedCreateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupSchedCreate", arg0)
ret0, _ := ret[0].(*api.CloudBackupSchedCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupSchedCreate",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupSchedCreateRequest",
")",
"(",
"*",
"api",
".",
"CloudBackupSchedCreateResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudBackupSchedCreateResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudBackupSchedCreate mocks base method | [
"CloudBackupSchedCreate",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L191-L196 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupSchedDelete | func (m *MockVolumeDriver) CloudBackupSchedDelete(arg0 *api.CloudBackupSchedDeleteRequest) error {
ret := m.ctrl.Call(m, "CloudBackupSchedDelete", arg0)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockVolumeDriver) CloudBackupSchedDelete(arg0 *api.CloudBackupSchedDeleteRequest) error {
ret := m.ctrl.Call(m, "CloudBackupSchedDelete", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupSchedDelete",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupSchedDeleteRequest",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] | // CloudBackupSchedDelete mocks base method | [
"CloudBackupSchedDelete",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L204-L208 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupSchedEnumerate | func (m *MockVolumeDriver) CloudBackupSchedEnumerate() (*api.CloudBackupSchedEnumerateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupSchedEnumerate")
ret0, _ := ret[0].(*api.CloudBackupSchedEnumerateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudBackupSchedEnumerate() (*api.CloudBackupSchedEnumerateResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupSchedEnumerate")
ret0, _ := ret[0].(*api.CloudBackupSchedEnumerateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupSchedEnumerate",
"(",
")",
"(",
"*",
"api",
".",
"CloudBackupSchedEnumerateResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudBackupSchedEnumerateResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudBackupSchedEnumerate mocks base method | [
"CloudBackupSchedEnumerate",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L216-L221 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupStateChange | func (m *MockVolumeDriver) CloudBackupStateChange(arg0 *api.CloudBackupStateChangeRequest) error {
ret := m.ctrl.Call(m, "CloudBackupStateChange", arg0)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockVolumeDriver) CloudBackupStateChange(arg0 *api.CloudBackupStateChangeRequest) error {
ret := m.ctrl.Call(m, "CloudBackupStateChange", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupStateChange",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupStateChangeRequest",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] | // CloudBackupStateChange mocks base method | [
"CloudBackupStateChange",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L229-L233 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudBackupStatus | func (m *MockVolumeDriver) CloudBackupStatus(arg0 *api.CloudBackupStatusRequest) (*api.CloudBackupStatusResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupStatus", arg0)
ret0, _ := ret[0].(*api.CloudBackupStatusResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudBackupStatus(arg0 *api.CloudBackupStatusRequest) (*api.CloudBackupStatusResponse, error) {
ret := m.ctrl.Call(m, "CloudBackupStatus", arg0)
ret0, _ := ret[0].(*api.CloudBackupStatusResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudBackupStatus",
"(",
"arg0",
"*",
"api",
".",
"CloudBackupStatusRequest",
")",
"(",
"*",
"api",
".",
"CloudBackupStatusResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudBackupStatusResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudBackupStatus mocks base method | [
"CloudBackupStatus",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L241-L246 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudMigrateCancel | func (m *MockVolumeDriver) CloudMigrateCancel(arg0 *api.CloudMigrateCancelRequest) error {
ret := m.ctrl.Call(m, "CloudMigrateCancel", arg0)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockVolumeDriver) CloudMigrateCancel(arg0 *api.CloudMigrateCancelRequest) error {
ret := m.ctrl.Call(m, "CloudMigrateCancel", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudMigrateCancel",
"(",
"arg0",
"*",
"api",
".",
"CloudMigrateCancelRequest",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] | // CloudMigrateCancel mocks base method | [
"CloudMigrateCancel",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L254-L258 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudMigrateStart | func (m *MockVolumeDriver) CloudMigrateStart(arg0 *api.CloudMigrateStartRequest) (*api.CloudMigrateStartResponse, error) {
ret := m.ctrl.Call(m, "CloudMigrateStart", arg0)
ret0, _ := ret[0].(*api.CloudMigrateStartResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudMigrateStart(arg0 *api.CloudMigrateStartRequest) (*api.CloudMigrateStartResponse, error) {
ret := m.ctrl.Call(m, "CloudMigrateStart", arg0)
ret0, _ := ret[0].(*api.CloudMigrateStartResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudMigrateStart",
"(",
"arg0",
"*",
"api",
".",
"CloudMigrateStartRequest",
")",
"(",
"*",
"api",
".",
"CloudMigrateStartResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudMigrateStartResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudMigrateStart mocks base method | [
"CloudMigrateStart",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L266-L271 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CloudMigrateStatus | func (m *MockVolumeDriver) CloudMigrateStatus(arg0 *api.CloudMigrateStatusRequest) (*api.CloudMigrateStatusResponse, error) {
ret := m.ctrl.Call(m, "CloudMigrateStatus", arg0)
ret0, _ := ret[0].(*api.CloudMigrateStatusResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CloudMigrateStatus(arg0 *api.CloudMigrateStatusRequest) (*api.CloudMigrateStatusResponse, error) {
ret := m.ctrl.Call(m, "CloudMigrateStatus", arg0)
ret0, _ := ret[0].(*api.CloudMigrateStatusResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CloudMigrateStatus",
"(",
"arg0",
"*",
"api",
".",
"CloudMigrateStatusRequest",
")",
"(",
"*",
"api",
".",
"CloudMigrateStatusResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"CloudMigrateStatusResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CloudMigrateStatus mocks base method | [
"CloudMigrateStatus",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L279-L284 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CredsCreate | func (m *MockVolumeDriver) CredsCreate(arg0 map[string]string) (string, error) {
ret := m.ctrl.Call(m, "CredsCreate", arg0)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CredsCreate(arg0 map[string]string) (string, error) {
ret := m.ctrl.Call(m, "CredsCreate", arg0)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CredsCreate",
"(",
"arg0",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"string",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CredsCreate mocks base method | [
"CredsCreate",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L305-L310 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | CredsEnumerate | func (m *MockVolumeDriver) CredsEnumerate() (map[string]interface{}, error) {
ret := m.ctrl.Call(m, "CredsEnumerate")
ret0, _ := ret[0].(map[string]interface{})
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) CredsEnumerate() (map[string]interface{}, error) {
ret := m.ctrl.Call(m, "CredsEnumerate")
ret0, _ := ret[0].(map[string]interface{})
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"CredsEnumerate",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CredsEnumerate mocks base method | [
"CredsEnumerate",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L330-L335 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | Detach | func (m *MockVolumeDriver) Detach(arg0 string, arg1 map[string]string) error {
ret := m.ctrl.Call(m, "Detach", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockVolumeDriver) Detach(arg0 string, arg1 map[string]string) error {
ret := m.ctrl.Call(m, "Detach", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"Detach",
"(",
"arg0",
"string",
",",
"arg1",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] | // Detach mocks base method | [
"Detach",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L367-L371 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | GetActiveRequests | func (m *MockVolumeDriver) GetActiveRequests() (*api.ActiveRequests, error) {
ret := m.ctrl.Call(m, "GetActiveRequests")
ret0, _ := ret[0].(*api.ActiveRequests)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) GetActiveRequests() (*api.ActiveRequests, error) {
ret := m.ctrl.Call(m, "GetActiveRequests")
ret0, _ := ret[0].(*api.ActiveRequests)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"GetActiveRequests",
"(",
")",
"(",
"*",
"api",
".",
"ActiveRequests",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"ActiveRequests",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // GetActiveRequests mocks base method | [
"GetActiveRequests",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L404-L409 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | MountedAt | func (m *MockVolumeDriver) MountedAt(arg0 string) string {
ret := m.ctrl.Call(m, "MountedAt", arg0)
ret0, _ := ret[0].(string)
return ret0
} | go | func (m *MockVolumeDriver) MountedAt(arg0 string) string {
ret := m.ctrl.Call(m, "MountedAt", arg0)
ret0, _ := ret[0].(string)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"MountedAt",
"(",
"arg0",
"string",
")",
"string",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"string",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] | // MountedAt mocks base method | [
"MountedAt",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L442-L446 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | SnapEnumerate | func (m *MockVolumeDriver) SnapEnumerate(arg0 []string, arg1 map[string]string) ([]*api.Volume, error) {
ret := m.ctrl.Call(m, "SnapEnumerate", arg0, arg1)
ret0, _ := ret[0].([]*api.Volume)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) SnapEnumerate(arg0 []string, arg1 map[string]string) ([]*api.Volume, error) {
ret := m.ctrl.Call(m, "SnapEnumerate", arg0, arg1)
ret0, _ := ret[0].([]*api.Volume)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"SnapEnumerate",
"(",
"arg0",
"[",
"]",
"string",
",",
"arg1",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"[",
"]",
"*",
"api",
".",
"Volume",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"[",
"]",
"*",
"api",
".",
"Volume",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // SnapEnumerate mocks base method | [
"SnapEnumerate",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L525-L530 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | Snapshot | func (m *MockVolumeDriver) Snapshot(arg0 string, arg1 bool, arg2 *api.VolumeLocator, arg3 bool) (string, error) {
ret := m.ctrl.Call(m, "Snapshot", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) Snapshot(arg0 string, arg1 bool, arg2 *api.VolumeLocator, arg3 bool) (string, error) {
ret := m.ctrl.Call(m, "Snapshot", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"Snapshot",
"(",
"arg0",
"string",
",",
"arg1",
"bool",
",",
"arg2",
"*",
"api",
".",
"VolumeLocator",
",",
"arg3",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
",",
"arg3",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"string",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // Snapshot mocks base method | [
"Snapshot",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L538-L543 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | SnapshotGroup | func (m *MockVolumeDriver) SnapshotGroup(arg0 string, arg1 map[string]string, arg2 []string) (*api.GroupSnapCreateResponse, error) {
ret := m.ctrl.Call(m, "SnapshotGroup", arg0, arg1, arg2)
ret0, _ := ret[0].(*api.GroupSnapCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) SnapshotGroup(arg0 string, arg1 map[string]string, arg2 []string) (*api.GroupSnapCreateResponse, error) {
ret := m.ctrl.Call(m, "SnapshotGroup", arg0, arg1, arg2)
ret0, _ := ret[0].(*api.GroupSnapCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"SnapshotGroup",
"(",
"arg0",
"string",
",",
"arg1",
"map",
"[",
"string",
"]",
"string",
",",
"arg2",
"[",
"]",
"string",
")",
"(",
"*",
"api",
".",
"GroupSnapCreateResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"GroupSnapCreateResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // SnapshotGroup mocks base method | [
"SnapshotGroup",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L551-L556 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | Status | func (mr *MockVolumeDriverMockRecorder) Status() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Status", reflect.TypeOf((*MockVolumeDriver)(nil).Status))
} | go | func (mr *MockVolumeDriverMockRecorder) Status() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Status", reflect.TypeOf((*MockVolumeDriver)(nil).Status))
} | [
"func",
"(",
"mr",
"*",
"MockVolumeDriverMockRecorder",
")",
"Status",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockVolumeDriver",
")",
"(",
"nil",
")",
".",
"Status",
")",
")",
"\n",
"}"
] | // Status indicates an expected call of Status | [
"Status",
"indicates",
"an",
"expected",
"call",
"of",
"Status"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L584-L586 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | Unmount | func (m *MockVolumeDriver) Unmount(arg0, arg1 string, arg2 map[string]string) error {
ret := m.ctrl.Call(m, "Unmount", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockVolumeDriver) Unmount(arg0, arg1 string, arg2 map[string]string) error {
ret := m.ctrl.Call(m, "Unmount", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"Unmount",
"(",
"arg0",
",",
"arg1",
"string",
",",
"arg2",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] | // Unmount mocks base method | [
"Unmount",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L601-L605 | train |
libopenstorage/openstorage | volume/drivers/mock/driver.mock.go | UsedSize | func (m *MockVolumeDriver) UsedSize(arg0 string) (uint64, error) {
ret := m.ctrl.Call(m, "UsedSize", arg0)
ret0, _ := ret[0].(uint64)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockVolumeDriver) UsedSize(arg0 string) (uint64, error) {
ret := m.ctrl.Call(m, "UsedSize", arg0)
ret0, _ := ret[0].(uint64)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockVolumeDriver",
")",
"UsedSize",
"(",
"arg0",
"string",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"uint64",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // UsedSize mocks base method | [
"UsedSize",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/mock/driver.mock.go#L625-L630 | train |
libopenstorage/openstorage | api/client/volume/volume.go | GetAuthSupportedDriverVersions | func GetAuthSupportedDriverVersions(driverName, host, authstring, accesstoken string, tlsConfig *tls.Config) ([]string, error) {
// Get a client handler
if host == "" {
host = client.GetUnixServerPath(driverName, volume.DriverAPIBase)
}
client, err := client.NewAuthClient(host, "", authstring, accesstoken, "")
if err != nil {
return []string{}, err
}
if tlsConfig != nil {
client.SetTLS(tlsConfig)
}
versions, err := client.Versions(api.OsdVolumePath)
if err != nil {
return []string{}, err
}
return versions, nil
} | go | func GetAuthSupportedDriverVersions(driverName, host, authstring, accesstoken string, tlsConfig *tls.Config) ([]string, error) {
// Get a client handler
if host == "" {
host = client.GetUnixServerPath(driverName, volume.DriverAPIBase)
}
client, err := client.NewAuthClient(host, "", authstring, accesstoken, "")
if err != nil {
return []string{}, err
}
if tlsConfig != nil {
client.SetTLS(tlsConfig)
}
versions, err := client.Versions(api.OsdVolumePath)
if err != nil {
return []string{}, err
}
return versions, nil
} | [
"func",
"GetAuthSupportedDriverVersions",
"(",
"driverName",
",",
"host",
",",
"authstring",
",",
"accesstoken",
"string",
",",
"tlsConfig",
"*",
"tls",
".",
"Config",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// Get a client handler",
"if",
"host",
"==",
"\"",
"\"",
"{",
"host",
"=",
"client",
".",
"GetUnixServerPath",
"(",
"driverName",
",",
"volume",
".",
"DriverAPIBase",
")",
"\n",
"}",
"\n\n",
"client",
",",
"err",
":=",
"client",
".",
"NewAuthClient",
"(",
"host",
",",
"\"",
"\"",
",",
"authstring",
",",
"accesstoken",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"tlsConfig",
"!=",
"nil",
"{",
"client",
".",
"SetTLS",
"(",
"tlsConfig",
")",
"\n",
"}",
"\n\n",
"versions",
",",
"err",
":=",
"client",
".",
"Versions",
"(",
"api",
".",
"OsdVolumePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"versions",
",",
"nil",
"\n",
"}"
] | // GetAuthSupportedDriverVersions returns a list of supported versions
// for the provided driver. It uses the given security params and
// server endpoint or the standard unix domain socket
// authstring can be set to the JWT Token and accesstoken set to an empty string. | [
"GetAuthSupportedDriverVersions",
"returns",
"a",
"list",
"of",
"supported",
"versions",
"for",
"the",
"provided",
"driver",
".",
"It",
"uses",
"the",
"given",
"security",
"params",
"and",
"server",
"endpoint",
"or",
"the",
"standard",
"unix",
"domain",
"socket",
"authstring",
"can",
"be",
"set",
"to",
"the",
"JWT",
"Token",
"and",
"accesstoken",
"set",
"to",
"an",
"empty",
"string",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/volume/volume.go#L57-L77 | train |
libopenstorage/openstorage | api/client/volume/volume.go | GetSupportedDriverVersions | func GetSupportedDriverVersions(driverName, host string) ([]string, error) {
// Get a client handler
if host == "" {
host = client.GetUnixServerPath(driverName, volume.DriverAPIBase)
}
client, err := client.NewClient(host, "", "")
if err != nil {
return []string{}, err
}
versions, err := client.Versions(api.OsdVolumePath)
if err != nil {
return []string{}, err
}
return versions, nil
} | go | func GetSupportedDriverVersions(driverName, host string) ([]string, error) {
// Get a client handler
if host == "" {
host = client.GetUnixServerPath(driverName, volume.DriverAPIBase)
}
client, err := client.NewClient(host, "", "")
if err != nil {
return []string{}, err
}
versions, err := client.Versions(api.OsdVolumePath)
if err != nil {
return []string{}, err
}
return versions, nil
} | [
"func",
"GetSupportedDriverVersions",
"(",
"driverName",
",",
"host",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// Get a client handler",
"if",
"host",
"==",
"\"",
"\"",
"{",
"host",
"=",
"client",
".",
"GetUnixServerPath",
"(",
"driverName",
",",
"volume",
".",
"DriverAPIBase",
")",
"\n",
"}",
"\n\n",
"client",
",",
"err",
":=",
"client",
".",
"NewClient",
"(",
"host",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"versions",
",",
"err",
":=",
"client",
".",
"Versions",
"(",
"api",
".",
"OsdVolumePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"versions",
",",
"nil",
"\n",
"}"
] | // GetSupportedDriverVersions returns a list of supported versions
// for the provided driver. It uses the given server endpoint or the
// standard unix domain socket | [
"GetSupportedDriverVersions",
"returns",
"a",
"list",
"of",
"supported",
"versions",
"for",
"the",
"provided",
"driver",
".",
"It",
"uses",
"the",
"given",
"server",
"endpoint",
"or",
"the",
"standard",
"unix",
"domain",
"socket"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/volume/volume.go#L82-L97 | train |
libopenstorage/openstorage | pkg/clusterdomain/clusterdomain.go | GetActiveMapFromClusterDomainInfos | func GetActiveMapFromClusterDomainInfos(clusterDomainInfos []*ClusterDomainInfo) types.ClusterDomainsActiveMap {
activeMap := make(types.ClusterDomainsActiveMap)
for _, clusterDomainInfo := range clusterDomainInfos {
activeMap[clusterDomainInfo.Name] = clusterDomainInfo.State
}
return activeMap
} | go | func GetActiveMapFromClusterDomainInfos(clusterDomainInfos []*ClusterDomainInfo) types.ClusterDomainsActiveMap {
activeMap := make(types.ClusterDomainsActiveMap)
for _, clusterDomainInfo := range clusterDomainInfos {
activeMap[clusterDomainInfo.Name] = clusterDomainInfo.State
}
return activeMap
} | [
"func",
"GetActiveMapFromClusterDomainInfos",
"(",
"clusterDomainInfos",
"[",
"]",
"*",
"ClusterDomainInfo",
")",
"types",
".",
"ClusterDomainsActiveMap",
"{",
"activeMap",
":=",
"make",
"(",
"types",
".",
"ClusterDomainsActiveMap",
")",
"\n",
"for",
"_",
",",
"clusterDomainInfo",
":=",
"range",
"clusterDomainInfos",
"{",
"activeMap",
"[",
"clusterDomainInfo",
".",
"Name",
"]",
"=",
"clusterDomainInfo",
".",
"State",
"\n",
"}",
"\n",
"return",
"activeMap",
"\n",
"}"
] | // GetActiveMapFromClusterDomainInfos is a helper function that converts a list of ClusterDomainInfo
// objects into a gossip cluster domain active map | [
"GetActiveMapFromClusterDomainInfos",
"is",
"a",
"helper",
"function",
"that",
"converts",
"a",
"list",
"of",
"ClusterDomainInfo",
"objects",
"into",
"a",
"gossip",
"cluster",
"domain",
"active",
"map"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/clusterdomain/clusterdomain.go#L84-L90 | train |
libopenstorage/openstorage | api/server/sdk/volume_snapshot.go | SnapshotCreate | func (s *VolumeServer) SnapshotCreate(
ctx context.Context,
req *api.SdkVolumeSnapshotCreateRequest,
) (*api.SdkVolumeSnapshotCreateResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply volume id")
} else if len(req.GetName()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply a name")
}
// Get access rights
if err := s.checkAccessForVolumeId(ctx, req.GetVolumeId(), api.Ownership_Read); err != nil {
return nil, err
}
readonly := true
snapshotID, err := s.driver(ctx).Snapshot(req.GetVolumeId(), readonly, &api.VolumeLocator{
Name: req.GetName(),
VolumeLabels: req.GetLabels(),
}, false)
if err != nil {
if err == kvdb.ErrNotFound {
return nil, status.Errorf(
codes.NotFound,
"Id %s not found",
req.GetVolumeId())
}
return nil, status.Errorf(codes.Internal, "Failed to create snapshot: %v", err.Error())
}
return &api.SdkVolumeSnapshotCreateResponse{
SnapshotId: snapshotID,
}, nil
} | go | func (s *VolumeServer) SnapshotCreate(
ctx context.Context,
req *api.SdkVolumeSnapshotCreateRequest,
) (*api.SdkVolumeSnapshotCreateResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply volume id")
} else if len(req.GetName()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply a name")
}
// Get access rights
if err := s.checkAccessForVolumeId(ctx, req.GetVolumeId(), api.Ownership_Read); err != nil {
return nil, err
}
readonly := true
snapshotID, err := s.driver(ctx).Snapshot(req.GetVolumeId(), readonly, &api.VolumeLocator{
Name: req.GetName(),
VolumeLabels: req.GetLabels(),
}, false)
if err != nil {
if err == kvdb.ErrNotFound {
return nil, status.Errorf(
codes.NotFound,
"Id %s not found",
req.GetVolumeId())
}
return nil, status.Errorf(codes.Internal, "Failed to create snapshot: %v", err.Error())
}
return &api.SdkVolumeSnapshotCreateResponse{
SnapshotId: snapshotID,
}, nil
} | [
"func",
"(",
"s",
"*",
"VolumeServer",
")",
"SnapshotCreate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkVolumeSnapshotCreateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkVolumeSnapshotCreateResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"cluster",
"(",
")",
"==",
"nil",
"||",
"s",
".",
"driver",
"(",
"ctx",
")",
"==",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"Unavailable",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"req",
".",
"GetVolumeId",
"(",
")",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"if",
"len",
"(",
"req",
".",
"GetName",
"(",
")",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Get access rights",
"if",
"err",
":=",
"s",
".",
"checkAccessForVolumeId",
"(",
"ctx",
",",
"req",
".",
"GetVolumeId",
"(",
")",
",",
"api",
".",
"Ownership_Read",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"readonly",
":=",
"true",
"\n",
"snapshotID",
",",
"err",
":=",
"s",
".",
"driver",
"(",
"ctx",
")",
".",
"Snapshot",
"(",
"req",
".",
"GetVolumeId",
"(",
")",
",",
"readonly",
",",
"&",
"api",
".",
"VolumeLocator",
"{",
"Name",
":",
"req",
".",
"GetName",
"(",
")",
",",
"VolumeLabels",
":",
"req",
".",
"GetLabels",
"(",
")",
",",
"}",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"kvdb",
".",
"ErrNotFound",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"NotFound",
",",
"\"",
"\"",
",",
"req",
".",
"GetVolumeId",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"Internal",
",",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"api",
".",
"SdkVolumeSnapshotCreateResponse",
"{",
"SnapshotId",
":",
"snapshotID",
",",
"}",
",",
"nil",
"\n",
"}"
] | // SnapshotCreate creates a read-only snapshot of a volume | [
"SnapshotCreate",
"creates",
"a",
"read",
"-",
"only",
"snapshot",
"of",
"a",
"volume"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/volume_snapshot.go#L30-L67 | train |
libopenstorage/openstorage | api/server/sdk/volume_snapshot.go | SnapshotRestore | func (s *VolumeServer) SnapshotRestore(
ctx context.Context,
req *api.SdkVolumeSnapshotRestoreRequest,
) (*api.SdkVolumeSnapshotRestoreResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply volume id")
} else if len(req.GetSnapshotId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply snapshot id")
}
// Get access rights
if err := s.checkAccessForVolumeId(ctx, req.GetVolumeId(), api.Ownership_Write); err != nil {
return nil, err
}
err := s.driver(ctx).Restore(req.GetVolumeId(), req.GetSnapshotId())
if err != nil {
if err == kvdb.ErrNotFound {
return nil, status.Errorf(
codes.NotFound,
"Id %s or %s not found",
req.GetVolumeId(), req.GetSnapshotId())
}
return nil, status.Errorf(
codes.Internal,
"Failed to restore volume %s to snapshot %s: %v",
req.GetVolumeId(),
req.GetSnapshotId(),
err.Error())
}
return &api.SdkVolumeSnapshotRestoreResponse{}, nil
} | go | func (s *VolumeServer) SnapshotRestore(
ctx context.Context,
req *api.SdkVolumeSnapshotRestoreRequest,
) (*api.SdkVolumeSnapshotRestoreResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply volume id")
} else if len(req.GetSnapshotId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply snapshot id")
}
// Get access rights
if err := s.checkAccessForVolumeId(ctx, req.GetVolumeId(), api.Ownership_Write); err != nil {
return nil, err
}
err := s.driver(ctx).Restore(req.GetVolumeId(), req.GetSnapshotId())
if err != nil {
if err == kvdb.ErrNotFound {
return nil, status.Errorf(
codes.NotFound,
"Id %s or %s not found",
req.GetVolumeId(), req.GetSnapshotId())
}
return nil, status.Errorf(
codes.Internal,
"Failed to restore volume %s to snapshot %s: %v",
req.GetVolumeId(),
req.GetSnapshotId(),
err.Error())
}
return &api.SdkVolumeSnapshotRestoreResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"VolumeServer",
")",
"SnapshotRestore",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkVolumeSnapshotRestoreRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkVolumeSnapshotRestoreResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"cluster",
"(",
")",
"==",
"nil",
"||",
"s",
".",
"driver",
"(",
"ctx",
")",
"==",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"Unavailable",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"req",
".",
"GetVolumeId",
"(",
")",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"if",
"len",
"(",
"req",
".",
"GetSnapshotId",
"(",
")",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Get access rights",
"if",
"err",
":=",
"s",
".",
"checkAccessForVolumeId",
"(",
"ctx",
",",
"req",
".",
"GetVolumeId",
"(",
")",
",",
"api",
".",
"Ownership_Write",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"err",
":=",
"s",
".",
"driver",
"(",
"ctx",
")",
".",
"Restore",
"(",
"req",
".",
"GetVolumeId",
"(",
")",
",",
"req",
".",
"GetSnapshotId",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"kvdb",
".",
"ErrNotFound",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"NotFound",
",",
"\"",
"\"",
",",
"req",
".",
"GetVolumeId",
"(",
")",
",",
"req",
".",
"GetSnapshotId",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"Internal",
",",
"\"",
"\"",
",",
"req",
".",
"GetVolumeId",
"(",
")",
",",
"req",
".",
"GetSnapshotId",
"(",
")",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"api",
".",
"SdkVolumeSnapshotRestoreResponse",
"{",
"}",
",",
"nil",
"\n",
"}"
] | // SnapshotRestore restores a volume to the specified snapshot id | [
"SnapshotRestore",
"restores",
"a",
"volume",
"to",
"the",
"specified",
"snapshot",
"id"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/volume_snapshot.go#L70-L106 | train |
libopenstorage/openstorage | api/server/sdk/volume_snapshot.go | SnapshotEnumerate | func (s *VolumeServer) SnapshotEnumerate(
ctx context.Context,
req *api.SdkVolumeSnapshotEnumerateRequest,
) (*api.SdkVolumeSnapshotEnumerateResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
resp, err := s.SnapshotEnumerateWithFilters(
ctx,
&api.SdkVolumeSnapshotEnumerateWithFiltersRequest{
VolumeId: req.GetVolumeId(),
},
)
if err != nil {
return nil, err
}
return &api.SdkVolumeSnapshotEnumerateResponse{
VolumeSnapshotIds: resp.GetVolumeSnapshotIds(),
}, nil
} | go | func (s *VolumeServer) SnapshotEnumerate(
ctx context.Context,
req *api.SdkVolumeSnapshotEnumerateRequest,
) (*api.SdkVolumeSnapshotEnumerateResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
resp, err := s.SnapshotEnumerateWithFilters(
ctx,
&api.SdkVolumeSnapshotEnumerateWithFiltersRequest{
VolumeId: req.GetVolumeId(),
},
)
if err != nil {
return nil, err
}
return &api.SdkVolumeSnapshotEnumerateResponse{
VolumeSnapshotIds: resp.GetVolumeSnapshotIds(),
}, nil
} | [
"func",
"(",
"s",
"*",
"VolumeServer",
")",
"SnapshotEnumerate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkVolumeSnapshotEnumerateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkVolumeSnapshotEnumerateResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"cluster",
"(",
")",
"==",
"nil",
"||",
"s",
".",
"driver",
"(",
"ctx",
")",
"==",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"Unavailable",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
":=",
"s",
".",
"SnapshotEnumerateWithFilters",
"(",
"ctx",
",",
"&",
"api",
".",
"SdkVolumeSnapshotEnumerateWithFiltersRequest",
"{",
"VolumeId",
":",
"req",
".",
"GetVolumeId",
"(",
")",
",",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"api",
".",
"SdkVolumeSnapshotEnumerateResponse",
"{",
"VolumeSnapshotIds",
":",
"resp",
".",
"GetVolumeSnapshotIds",
"(",
")",
",",
"}",
",",
"nil",
"\n\n",
"}"
] | // SnapshotEnumerate returns a list of snapshots for the specified volume | [
"SnapshotEnumerate",
"returns",
"a",
"list",
"of",
"snapshots",
"for",
"the",
"specified",
"volume"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/volume_snapshot.go#L109-L131 | train |
libopenstorage/openstorage | api/server/sdk/volume_snapshot.go | SnapshotEnumerateWithFilters | func (s *VolumeServer) SnapshotEnumerateWithFilters(
ctx context.Context,
req *api.SdkVolumeSnapshotEnumerateWithFiltersRequest,
) (*api.SdkVolumeSnapshotEnumerateWithFiltersResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// Get access rights
var volReq []string
if len(req.GetVolumeId()) != 0 {
if err := s.checkAccessForVolumeId(ctx, req.GetVolumeId(), api.Ownership_Read); err != nil {
return nil, err
}
volReq = []string{req.GetVolumeId()}
} else {
volReq = nil
}
snapshots, err := s.driver(ctx).SnapEnumerate(volReq, req.GetLabels())
if err != nil {
return nil, status.Errorf(
codes.Internal,
"Failed to enumerate snapshots in volume %s: %v",
req.GetVolumeId(),
err.Error())
}
ids := make([]string, 0)
for _, snapshot := range snapshots {
// Check access
if snapshot.IsPermitted(ctx, api.Ownership_Read) {
ids = append(ids, snapshot.GetId())
}
}
return &api.SdkVolumeSnapshotEnumerateWithFiltersResponse{
VolumeSnapshotIds: ids,
}, nil
} | go | func (s *VolumeServer) SnapshotEnumerateWithFilters(
ctx context.Context,
req *api.SdkVolumeSnapshotEnumerateWithFiltersRequest,
) (*api.SdkVolumeSnapshotEnumerateWithFiltersResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// Get access rights
var volReq []string
if len(req.GetVolumeId()) != 0 {
if err := s.checkAccessForVolumeId(ctx, req.GetVolumeId(), api.Ownership_Read); err != nil {
return nil, err
}
volReq = []string{req.GetVolumeId()}
} else {
volReq = nil
}
snapshots, err := s.driver(ctx).SnapEnumerate(volReq, req.GetLabels())
if err != nil {
return nil, status.Errorf(
codes.Internal,
"Failed to enumerate snapshots in volume %s: %v",
req.GetVolumeId(),
err.Error())
}
ids := make([]string, 0)
for _, snapshot := range snapshots {
// Check access
if snapshot.IsPermitted(ctx, api.Ownership_Read) {
ids = append(ids, snapshot.GetId())
}
}
return &api.SdkVolumeSnapshotEnumerateWithFiltersResponse{
VolumeSnapshotIds: ids,
}, nil
} | [
"func",
"(",
"s",
"*",
"VolumeServer",
")",
"SnapshotEnumerateWithFilters",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkVolumeSnapshotEnumerateWithFiltersRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkVolumeSnapshotEnumerateWithFiltersResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"cluster",
"(",
")",
"==",
"nil",
"||",
"s",
".",
"driver",
"(",
"ctx",
")",
"==",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"Unavailable",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Get access rights",
"var",
"volReq",
"[",
"]",
"string",
"\n",
"if",
"len",
"(",
"req",
".",
"GetVolumeId",
"(",
")",
")",
"!=",
"0",
"{",
"if",
"err",
":=",
"s",
".",
"checkAccessForVolumeId",
"(",
"ctx",
",",
"req",
".",
"GetVolumeId",
"(",
")",
",",
"api",
".",
"Ownership_Read",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"volReq",
"=",
"[",
"]",
"string",
"{",
"req",
".",
"GetVolumeId",
"(",
")",
"}",
"\n",
"}",
"else",
"{",
"volReq",
"=",
"nil",
"\n",
"}",
"\n\n",
"snapshots",
",",
"err",
":=",
"s",
".",
"driver",
"(",
"ctx",
")",
".",
"SnapEnumerate",
"(",
"volReq",
",",
"req",
".",
"GetLabels",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"Internal",
",",
"\"",
"\"",
",",
"req",
".",
"GetVolumeId",
"(",
")",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"ids",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"for",
"_",
",",
"snapshot",
":=",
"range",
"snapshots",
"{",
"// Check access",
"if",
"snapshot",
".",
"IsPermitted",
"(",
"ctx",
",",
"api",
".",
"Ownership_Read",
")",
"{",
"ids",
"=",
"append",
"(",
"ids",
",",
"snapshot",
".",
"GetId",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"api",
".",
"SdkVolumeSnapshotEnumerateWithFiltersResponse",
"{",
"VolumeSnapshotIds",
":",
"ids",
",",
"}",
",",
"nil",
"\n",
"}"
] | // SnapshotEnumerateWithFilters returns a list of snapshots for the specified
// volume and labels | [
"SnapshotEnumerateWithFilters",
"returns",
"a",
"list",
"of",
"snapshots",
"for",
"the",
"specified",
"volume",
"and",
"labels"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/volume_snapshot.go#L135-L174 | train |
libopenstorage/openstorage | api/server/sdk/volume_snapshot.go | SnapshotScheduleUpdate | func (s *VolumeServer) SnapshotScheduleUpdate(
ctx context.Context,
req *api.SdkVolumeSnapshotScheduleUpdateRequest,
) (*api.SdkVolumeSnapshotScheduleUpdateResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply volume id")
}
// Get volume specification
// This checks for access also
resp, err := s.Inspect(ctx, &api.SdkVolumeInspectRequest{
VolumeId: req.GetVolumeId(),
})
if err != nil {
return nil, err
}
// Check if caller has access to affect volume
if !resp.GetVolume().IsPermitted(ctx, api.Ownership_Write) {
return nil, status.Errorf(
codes.PermissionDenied,
"Cannot change the snapshot schedule for volume %s",
req.GetVolumeId())
}
// Determine if they exist
for _, name := range req.GetSnapshotScheduleNames() {
_, err := s.cluster().SchedPolicyGet(name)
if err != nil {
return nil, status.Errorf(
codes.Aborted,
"Error accessing schedule policy %s: %v",
name, err)
}
}
// Apply names to snapshot schedule in the Volume specification
// merging with any schedule already there in "schedule" format.
var pt *sched.PolicyTags
if len(req.GetSnapshotScheduleNames()) != 0 {
pt, err = sched.NewPolicyTagsFromSlice(req.GetSnapshotScheduleNames())
if err != nil {
return nil, status.Errorf(
codes.Internal,
"Unable to parse policies: %v", err)
}
}
snapscheds, _, err := sched.ParseScheduleAndPolicies(resp.GetVolume().GetSpec().GetSnapshotSchedule())
if err != nil {
return nil, status.Errorf(
codes.Internal,
"Unable to parse snapshot schedule: %v", err)
}
snapshotSchedule := sched.ScheduleSummary(snapscheds, pt)
// Update the volume specification
_, err = s.Update(ctx, &api.SdkVolumeUpdateRequest{
VolumeId: req.GetVolumeId(),
Spec: &api.VolumeSpecUpdate{
SnapshotScheduleOpt: &api.VolumeSpecUpdate_SnapshotSchedule{
SnapshotSchedule: snapshotSchedule,
},
},
})
if err != nil {
return nil, err
}
return &api.SdkVolumeSnapshotScheduleUpdateResponse{}, nil
} | go | func (s *VolumeServer) SnapshotScheduleUpdate(
ctx context.Context,
req *api.SdkVolumeSnapshotScheduleUpdateRequest,
) (*api.SdkVolumeSnapshotScheduleUpdateResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply volume id")
}
// Get volume specification
// This checks for access also
resp, err := s.Inspect(ctx, &api.SdkVolumeInspectRequest{
VolumeId: req.GetVolumeId(),
})
if err != nil {
return nil, err
}
// Check if caller has access to affect volume
if !resp.GetVolume().IsPermitted(ctx, api.Ownership_Write) {
return nil, status.Errorf(
codes.PermissionDenied,
"Cannot change the snapshot schedule for volume %s",
req.GetVolumeId())
}
// Determine if they exist
for _, name := range req.GetSnapshotScheduleNames() {
_, err := s.cluster().SchedPolicyGet(name)
if err != nil {
return nil, status.Errorf(
codes.Aborted,
"Error accessing schedule policy %s: %v",
name, err)
}
}
// Apply names to snapshot schedule in the Volume specification
// merging with any schedule already there in "schedule" format.
var pt *sched.PolicyTags
if len(req.GetSnapshotScheduleNames()) != 0 {
pt, err = sched.NewPolicyTagsFromSlice(req.GetSnapshotScheduleNames())
if err != nil {
return nil, status.Errorf(
codes.Internal,
"Unable to parse policies: %v", err)
}
}
snapscheds, _, err := sched.ParseScheduleAndPolicies(resp.GetVolume().GetSpec().GetSnapshotSchedule())
if err != nil {
return nil, status.Errorf(
codes.Internal,
"Unable to parse snapshot schedule: %v", err)
}
snapshotSchedule := sched.ScheduleSummary(snapscheds, pt)
// Update the volume specification
_, err = s.Update(ctx, &api.SdkVolumeUpdateRequest{
VolumeId: req.GetVolumeId(),
Spec: &api.VolumeSpecUpdate{
SnapshotScheduleOpt: &api.VolumeSpecUpdate_SnapshotSchedule{
SnapshotSchedule: snapshotSchedule,
},
},
})
if err != nil {
return nil, err
}
return &api.SdkVolumeSnapshotScheduleUpdateResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"VolumeServer",
")",
"SnapshotScheduleUpdate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkVolumeSnapshotScheduleUpdateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkVolumeSnapshotScheduleUpdateResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"cluster",
"(",
")",
"==",
"nil",
"||",
"s",
".",
"driver",
"(",
"ctx",
")",
"==",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"Unavailable",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"req",
".",
"GetVolumeId",
"(",
")",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Get volume specification",
"// This checks for access also",
"resp",
",",
"err",
":=",
"s",
".",
"Inspect",
"(",
"ctx",
",",
"&",
"api",
".",
"SdkVolumeInspectRequest",
"{",
"VolumeId",
":",
"req",
".",
"GetVolumeId",
"(",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Check if caller has access to affect volume",
"if",
"!",
"resp",
".",
"GetVolume",
"(",
")",
".",
"IsPermitted",
"(",
"ctx",
",",
"api",
".",
"Ownership_Write",
")",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"PermissionDenied",
",",
"\"",
"\"",
",",
"req",
".",
"GetVolumeId",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// Determine if they exist",
"for",
"_",
",",
"name",
":=",
"range",
"req",
".",
"GetSnapshotScheduleNames",
"(",
")",
"{",
"_",
",",
"err",
":=",
"s",
".",
"cluster",
"(",
")",
".",
"SchedPolicyGet",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"Aborted",
",",
"\"",
"\"",
",",
"name",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Apply names to snapshot schedule in the Volume specification",
"// merging with any schedule already there in \"schedule\" format.",
"var",
"pt",
"*",
"sched",
".",
"PolicyTags",
"\n",
"if",
"len",
"(",
"req",
".",
"GetSnapshotScheduleNames",
"(",
")",
")",
"!=",
"0",
"{",
"pt",
",",
"err",
"=",
"sched",
".",
"NewPolicyTagsFromSlice",
"(",
"req",
".",
"GetSnapshotScheduleNames",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"Internal",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"snapscheds",
",",
"_",
",",
"err",
":=",
"sched",
".",
"ParseScheduleAndPolicies",
"(",
"resp",
".",
"GetVolume",
"(",
")",
".",
"GetSpec",
"(",
")",
".",
"GetSnapshotSchedule",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"Internal",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"snapshotSchedule",
":=",
"sched",
".",
"ScheduleSummary",
"(",
"snapscheds",
",",
"pt",
")",
"\n\n",
"// Update the volume specification",
"_",
",",
"err",
"=",
"s",
".",
"Update",
"(",
"ctx",
",",
"&",
"api",
".",
"SdkVolumeUpdateRequest",
"{",
"VolumeId",
":",
"req",
".",
"GetVolumeId",
"(",
")",
",",
"Spec",
":",
"&",
"api",
".",
"VolumeSpecUpdate",
"{",
"SnapshotScheduleOpt",
":",
"&",
"api",
".",
"VolumeSpecUpdate_SnapshotSchedule",
"{",
"SnapshotSchedule",
":",
"snapshotSchedule",
",",
"}",
",",
"}",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"api",
".",
"SdkVolumeSnapshotScheduleUpdateResponse",
"{",
"}",
",",
"nil",
"\n",
"}"
] | // SnapshotScheduleUpdate updates the snapshot schedule in the volume.
// It only manages the PolicyTags | [
"SnapshotScheduleUpdate",
"updates",
"the",
"snapshot",
"schedule",
"in",
"the",
"volume",
".",
"It",
"only",
"manages",
"the",
"PolicyTags"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/volume_snapshot.go#L178-L251 | train |
libopenstorage/openstorage | api/server/sdk/credentials.go | Create | func (s *CredentialServer) Create(
ctx context.Context,
req *api.SdkCredentialCreateRequest,
) (*api.SdkCredentialCreateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetName()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply a name")
} else if aws := req.GetAwsCredential(); aws != nil {
return s.awsCreate(ctx, req, aws)
} else if azure := req.GetAzureCredential(); azure != nil {
return s.azureCreate(ctx, req, azure)
} else if google := req.GetGoogleCredential(); google != nil {
return s.googleCreate(ctx, req, google)
}
return nil, status.Error(codes.InvalidArgument, "Unknown credential type")
} | go | func (s *CredentialServer) Create(
ctx context.Context,
req *api.SdkCredentialCreateRequest,
) (*api.SdkCredentialCreateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetName()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply a name")
} else if aws := req.GetAwsCredential(); aws != nil {
return s.awsCreate(ctx, req, aws)
} else if azure := req.GetAzureCredential(); azure != nil {
return s.azureCreate(ctx, req, azure)
} else if google := req.GetGoogleCredential(); google != nil {
return s.googleCreate(ctx, req, google)
}
return nil, status.Error(codes.InvalidArgument, "Unknown credential type")
} | [
"func",
"(",
"s",
"*",
"CredentialServer",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCredentialCreateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCredentialCreateResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"driver",
"(",
"ctx",
")",
"==",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"Unavailable",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"req",
".",
"GetName",
"(",
")",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"if",
"aws",
":=",
"req",
".",
"GetAwsCredential",
"(",
")",
";",
"aws",
"!=",
"nil",
"{",
"return",
"s",
".",
"awsCreate",
"(",
"ctx",
",",
"req",
",",
"aws",
")",
"\n",
"}",
"else",
"if",
"azure",
":=",
"req",
".",
"GetAzureCredential",
"(",
")",
";",
"azure",
"!=",
"nil",
"{",
"return",
"s",
".",
"azureCreate",
"(",
"ctx",
",",
"req",
",",
"azure",
")",
"\n",
"}",
"else",
"if",
"google",
":=",
"req",
".",
"GetGoogleCredential",
"(",
")",
";",
"google",
"!=",
"nil",
"{",
"return",
"s",
".",
"googleCreate",
"(",
"ctx",
",",
"req",
",",
"google",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n\n",
"}"
] | // Create method creates credentials | [
"Create",
"method",
"creates",
"credentials"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/credentials.go#L42-L61 | train |
libopenstorage/openstorage | api/server/sdk/credentials.go | Validate | func (s *CredentialServer) Validate(
ctx context.Context,
req *api.SdkCredentialValidateRequest,
) (*api.SdkCredentialValidateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetCredentialId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must provide credentials uuid")
}
// Check ownership
_, err := s.Inspect(ctx, &api.SdkCredentialInspectRequest{
CredentialId: req.GetCredentialId(),
})
if err != nil {
return nil, err
}
err = s.driver(ctx).CredsValidate(req.GetCredentialId())
if err != nil {
return nil, status.Errorf(
codes.Internal,
"failed to validate credentials: %v",
err.Error())
}
return &api.SdkCredentialValidateResponse{}, nil
} | go | func (s *CredentialServer) Validate(
ctx context.Context,
req *api.SdkCredentialValidateRequest,
) (*api.SdkCredentialValidateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetCredentialId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must provide credentials uuid")
}
// Check ownership
_, err := s.Inspect(ctx, &api.SdkCredentialInspectRequest{
CredentialId: req.GetCredentialId(),
})
if err != nil {
return nil, err
}
err = s.driver(ctx).CredsValidate(req.GetCredentialId())
if err != nil {
return nil, status.Errorf(
codes.Internal,
"failed to validate credentials: %v",
err.Error())
}
return &api.SdkCredentialValidateResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"CredentialServer",
")",
"Validate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCredentialValidateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCredentialValidateResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"driver",
"(",
"ctx",
")",
"==",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"Unavailable",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"req",
".",
"GetCredentialId",
"(",
")",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Check ownership",
"_",
",",
"err",
":=",
"s",
".",
"Inspect",
"(",
"ctx",
",",
"&",
"api",
".",
"SdkCredentialInspectRequest",
"{",
"CredentialId",
":",
"req",
".",
"GetCredentialId",
"(",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"s",
".",
"driver",
"(",
"ctx",
")",
".",
"CredsValidate",
"(",
"req",
".",
"GetCredentialId",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"Internal",
",",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"&",
"api",
".",
"SdkCredentialValidateResponse",
"{",
"}",
",",
"nil",
"\n\n",
"}"
] | // Validate validates a specified Credential. | [
"Validate",
"validates",
"a",
"specified",
"Credential",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/credentials.go#L196-L225 | train |
libopenstorage/openstorage | api/server/sdk/credentials.go | Delete | func (s *CredentialServer) Delete(
ctx context.Context,
req *api.SdkCredentialDeleteRequest,
) (*api.SdkCredentialDeleteResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetCredentialId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must provide credentials uuid")
}
// Check ownership
resp, err := s.Inspect(ctx, &api.SdkCredentialInspectRequest{
CredentialId: req.GetCredentialId(),
})
// This checks at least for READ access type to credential
if err != nil {
return nil, err
}
// This checks for admin access type to credential to be able to delete it
if !resp.GetOwnership().IsPermittedByContext(ctx, api.Ownership_Admin) {
return nil,
status.Errorf(
codes.PermissionDenied,
"Only admin access type to credential is allowed to delete %v",
req.GetCredentialId())
}
err = s.driver(ctx).CredsDelete(req.GetCredentialId())
if err != nil {
return nil, status.Errorf(
codes.Internal,
"failed to delete credentials: %v",
err.Error())
}
return &api.SdkCredentialDeleteResponse{}, nil
} | go | func (s *CredentialServer) Delete(
ctx context.Context,
req *api.SdkCredentialDeleteRequest,
) (*api.SdkCredentialDeleteResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetCredentialId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must provide credentials uuid")
}
// Check ownership
resp, err := s.Inspect(ctx, &api.SdkCredentialInspectRequest{
CredentialId: req.GetCredentialId(),
})
// This checks at least for READ access type to credential
if err != nil {
return nil, err
}
// This checks for admin access type to credential to be able to delete it
if !resp.GetOwnership().IsPermittedByContext(ctx, api.Ownership_Admin) {
return nil,
status.Errorf(
codes.PermissionDenied,
"Only admin access type to credential is allowed to delete %v",
req.GetCredentialId())
}
err = s.driver(ctx).CredsDelete(req.GetCredentialId())
if err != nil {
return nil, status.Errorf(
codes.Internal,
"failed to delete credentials: %v",
err.Error())
}
return &api.SdkCredentialDeleteResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"CredentialServer",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCredentialDeleteRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCredentialDeleteResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"driver",
"(",
"ctx",
")",
"==",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"Unavailable",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"req",
".",
"GetCredentialId",
"(",
")",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Check ownership",
"resp",
",",
"err",
":=",
"s",
".",
"Inspect",
"(",
"ctx",
",",
"&",
"api",
".",
"SdkCredentialInspectRequest",
"{",
"CredentialId",
":",
"req",
".",
"GetCredentialId",
"(",
")",
",",
"}",
")",
"\n",
"// This checks at least for READ access type to credential",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"// This checks for admin access type to credential to be able to delete it",
"if",
"!",
"resp",
".",
"GetOwnership",
"(",
")",
".",
"IsPermittedByContext",
"(",
"ctx",
",",
"api",
".",
"Ownership_Admin",
")",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"PermissionDenied",
",",
"\"",
"\"",
",",
"req",
".",
"GetCredentialId",
"(",
")",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"s",
".",
"driver",
"(",
"ctx",
")",
".",
"CredsDelete",
"(",
"req",
".",
"GetCredentialId",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"Internal",
",",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"api",
".",
"SdkCredentialDeleteResponse",
"{",
"}",
",",
"nil",
"\n",
"}"
] | // Delete deletes a specified credential | [
"Delete",
"deletes",
"a",
"specified",
"credential"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/credentials.go#L228-L266 | train |
libopenstorage/openstorage | api/server/sdk/credentials.go | Enumerate | func (s *CredentialServer) Enumerate(
ctx context.Context,
req *api.SdkCredentialEnumerateRequest,
) (*api.SdkCredentialEnumerateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credList, err := s.driver(ctx).CredsEnumerate()
if err != nil {
return nil, status.Errorf(
codes.Internal,
"Unable to enumerate credentials AWS: %v",
err.Error())
}
ids := make([]string, 0)
for credId, cred := range credList {
if s.isPermitted(ctx, api.Ownership_Read, cred) {
ids = append(ids, credId)
}
}
return &api.SdkCredentialEnumerateResponse{
CredentialIds: ids,
}, nil
} | go | func (s *CredentialServer) Enumerate(
ctx context.Context,
req *api.SdkCredentialEnumerateRequest,
) (*api.SdkCredentialEnumerateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credList, err := s.driver(ctx).CredsEnumerate()
if err != nil {
return nil, status.Errorf(
codes.Internal,
"Unable to enumerate credentials AWS: %v",
err.Error())
}
ids := make([]string, 0)
for credId, cred := range credList {
if s.isPermitted(ctx, api.Ownership_Read, cred) {
ids = append(ids, credId)
}
}
return &api.SdkCredentialEnumerateResponse{
CredentialIds: ids,
}, nil
} | [
"func",
"(",
"s",
"*",
"CredentialServer",
")",
"Enumerate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCredentialEnumerateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCredentialEnumerateResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"driver",
"(",
"ctx",
")",
"==",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"Unavailable",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"credList",
",",
"err",
":=",
"s",
".",
"driver",
"(",
"ctx",
")",
".",
"CredsEnumerate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"Internal",
",",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"ids",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"for",
"credId",
",",
"cred",
":=",
"range",
"credList",
"{",
"if",
"s",
".",
"isPermitted",
"(",
"ctx",
",",
"api",
".",
"Ownership_Read",
",",
"cred",
")",
"{",
"ids",
"=",
"append",
"(",
"ids",
",",
"credId",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"api",
".",
"SdkCredentialEnumerateResponse",
"{",
"CredentialIds",
":",
"ids",
",",
"}",
",",
"nil",
"\n\n",
"}"
] | // Enumerate returns a list credentials ids | [
"Enumerate",
"returns",
"a",
"list",
"credentials",
"ids"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/credentials.go#L269-L296 | train |
libopenstorage/openstorage | api/client/cluster/client.go | Enumerate | func (c *clusterClient) Enumerate() (api.Cluster, error) {
clusterInfo := api.Cluster{}
if err := c.c.Get().Resource(clusterPath + "/enumerate").Do().Unmarshal(&clusterInfo); err != nil {
return clusterInfo, err
}
return clusterInfo, nil
} | go | func (c *clusterClient) Enumerate() (api.Cluster, error) {
clusterInfo := api.Cluster{}
if err := c.c.Get().Resource(clusterPath + "/enumerate").Do().Unmarshal(&clusterInfo); err != nil {
return clusterInfo, err
}
return clusterInfo, nil
} | [
"func",
"(",
"c",
"*",
"clusterClient",
")",
"Enumerate",
"(",
")",
"(",
"api",
".",
"Cluster",
",",
"error",
")",
"{",
"clusterInfo",
":=",
"api",
".",
"Cluster",
"{",
"}",
"\n\n",
"if",
"err",
":=",
"c",
".",
"c",
".",
"Get",
"(",
")",
".",
"Resource",
"(",
"clusterPath",
"+",
"\"",
"\"",
")",
".",
"Do",
"(",
")",
".",
"Unmarshal",
"(",
"&",
"clusterInfo",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"clusterInfo",
",",
"err",
"\n",
"}",
"\n",
"return",
"clusterInfo",
",",
"nil",
"\n",
"}"
] | // Enumerate returns information about the cluster and its nodes | [
"Enumerate",
"returns",
"information",
"about",
"the",
"cluster",
"and",
"its",
"nodes"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/cluster/client.go#L165-L172 | train |
libopenstorage/openstorage | api/client/cluster/client.go | SecretGetDefaultSecretKey | func (c *clusterClient) SecretGetDefaultSecretKey() (interface{}, error) {
var defaultKeyResp interface{}
path := clusterPath + secretPath + "/defaultsecretkey"
request := c.c.Get().Resource(path)
err := request.Do().Unmarshal(&defaultKeyResp)
if err != nil {
return defaultKeyResp, err
}
return defaultKeyResp, nil
} | go | func (c *clusterClient) SecretGetDefaultSecretKey() (interface{}, error) {
var defaultKeyResp interface{}
path := clusterPath + secretPath + "/defaultsecretkey"
request := c.c.Get().Resource(path)
err := request.Do().Unmarshal(&defaultKeyResp)
if err != nil {
return defaultKeyResp, err
}
return defaultKeyResp, nil
} | [
"func",
"(",
"c",
"*",
"clusterClient",
")",
"SecretGetDefaultSecretKey",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"var",
"defaultKeyResp",
"interface",
"{",
"}",
"\n",
"path",
":=",
"clusterPath",
"+",
"secretPath",
"+",
"\"",
"\"",
"\n",
"request",
":=",
"c",
".",
"c",
".",
"Get",
"(",
")",
".",
"Resource",
"(",
"path",
")",
"\n",
"err",
":=",
"request",
".",
"Do",
"(",
")",
".",
"Unmarshal",
"(",
"&",
"defaultKeyResp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"defaultKeyResp",
",",
"err",
"\n",
"}",
"\n",
"return",
"defaultKeyResp",
",",
"nil",
"\n",
"}"
] | // SecretGetDefaultSecretKey returns cluster wide secret key's value | [
"SecretGetDefaultSecretKey",
"returns",
"cluster",
"wide",
"secret",
"key",
"s",
"value"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/cluster/client.go#L353-L362 | train |
libopenstorage/openstorage | api/client/cluster/client.go | SecretCheckLogin | func (c *clusterClient) SecretCheckLogin() error {
path := clusterPath + secretPath + "/verify"
request := c.c.Get().Resource(path)
resp := request.Do()
if resp.Error() != nil {
return resp.FormatError()
}
return nil
} | go | func (c *clusterClient) SecretCheckLogin() error {
path := clusterPath + secretPath + "/verify"
request := c.c.Get().Resource(path)
resp := request.Do()
if resp.Error() != nil {
return resp.FormatError()
}
return nil
} | [
"func",
"(",
"c",
"*",
"clusterClient",
")",
"SecretCheckLogin",
"(",
")",
"error",
"{",
"path",
":=",
"clusterPath",
"+",
"secretPath",
"+",
"\"",
"\"",
"\n",
"request",
":=",
"c",
".",
"c",
".",
"Get",
"(",
")",
".",
"Resource",
"(",
"path",
")",
"\n",
"resp",
":=",
"request",
".",
"Do",
"(",
")",
"\n",
"if",
"resp",
".",
"Error",
"(",
")",
"!=",
"nil",
"{",
"return",
"resp",
".",
"FormatError",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // SecretCheckLogin validates session with secret store | [
"SecretCheckLogin",
"validates",
"session",
"with",
"secret",
"store"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/cluster/client.go#L392-L400 | train |
libopenstorage/openstorage | api/client/cluster/client.go | SchedPolicyEnumerate | func (c *clusterClient) SchedPolicyEnumerate() ([]*sched.SchedPolicy, error) {
var schedPolicies []*sched.SchedPolicy
req := c.c.Get().Resource(clusterPath + SchedPath)
if err := req.Do().Unmarshal(&schedPolicies); err != nil {
return nil, err
}
return schedPolicies, nil
} | go | func (c *clusterClient) SchedPolicyEnumerate() ([]*sched.SchedPolicy, error) {
var schedPolicies []*sched.SchedPolicy
req := c.c.Get().Resource(clusterPath + SchedPath)
if err := req.Do().Unmarshal(&schedPolicies); err != nil {
return nil, err
}
return schedPolicies, nil
} | [
"func",
"(",
"c",
"*",
"clusterClient",
")",
"SchedPolicyEnumerate",
"(",
")",
"(",
"[",
"]",
"*",
"sched",
".",
"SchedPolicy",
",",
"error",
")",
"{",
"var",
"schedPolicies",
"[",
"]",
"*",
"sched",
".",
"SchedPolicy",
"\n",
"req",
":=",
"c",
".",
"c",
".",
"Get",
"(",
")",
".",
"Resource",
"(",
"clusterPath",
"+",
"SchedPath",
")",
"\n\n",
"if",
"err",
":=",
"req",
".",
"Do",
"(",
")",
".",
"Unmarshal",
"(",
"&",
"schedPolicies",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"schedPolicies",
",",
"nil",
"\n",
"}"
] | // SchedPolicyEnumerate enumerates all configured policies | [
"SchedPolicyEnumerate",
"enumerates",
"all",
"configured",
"policies"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/cluster/client.go#L418-L427 | train |
libopenstorage/openstorage | api/client/cluster/client.go | SchedPolicyCreate | func (c *clusterClient) SchedPolicyCreate(name, schedule string) error {
request := &sched.SchedPolicy{
Name: name,
Schedule: schedule,
}
req := c.c.Post().Resource(clusterPath + SchedPath).Body(request)
res := req.Do()
if res.Error() != nil {
return res.FormatError()
}
return nil
} | go | func (c *clusterClient) SchedPolicyCreate(name, schedule string) error {
request := &sched.SchedPolicy{
Name: name,
Schedule: schedule,
}
req := c.c.Post().Resource(clusterPath + SchedPath).Body(request)
res := req.Do()
if res.Error() != nil {
return res.FormatError()
}
return nil
} | [
"func",
"(",
"c",
"*",
"clusterClient",
")",
"SchedPolicyCreate",
"(",
"name",
",",
"schedule",
"string",
")",
"error",
"{",
"request",
":=",
"&",
"sched",
".",
"SchedPolicy",
"{",
"Name",
":",
"name",
",",
"Schedule",
":",
"schedule",
",",
"}",
"\n\n",
"req",
":=",
"c",
".",
"c",
".",
"Post",
"(",
")",
".",
"Resource",
"(",
"clusterPath",
"+",
"SchedPath",
")",
".",
"Body",
"(",
"request",
")",
"\n",
"res",
":=",
"req",
".",
"Do",
"(",
")",
"\n",
"if",
"res",
".",
"Error",
"(",
")",
"!=",
"nil",
"{",
"return",
"res",
".",
"FormatError",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // SchedPolicyCreate creates a policy with given name and schedule | [
"SchedPolicyCreate",
"creates",
"a",
"policy",
"with",
"given",
"name",
"and",
"schedule"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/cluster/client.go#L430-L443 | train |
libopenstorage/openstorage | api/client/cluster/client.go | SchedPolicyDelete | func (c *clusterClient) SchedPolicyDelete(name string) error {
req := c.c.Delete().Resource(clusterPath + SchedPath).Instance(name)
res := req.Do()
if res.Error() != nil {
return res.FormatError()
}
return nil
} | go | func (c *clusterClient) SchedPolicyDelete(name string) error {
req := c.c.Delete().Resource(clusterPath + SchedPath).Instance(name)
res := req.Do()
if res.Error() != nil {
return res.FormatError()
}
return nil
} | [
"func",
"(",
"c",
"*",
"clusterClient",
")",
"SchedPolicyDelete",
"(",
"name",
"string",
")",
"error",
"{",
"req",
":=",
"c",
".",
"c",
".",
"Delete",
"(",
")",
".",
"Resource",
"(",
"clusterPath",
"+",
"SchedPath",
")",
".",
"Instance",
"(",
"name",
")",
"\n",
"res",
":=",
"req",
".",
"Do",
"(",
")",
"\n\n",
"if",
"res",
".",
"Error",
"(",
")",
"!=",
"nil",
"{",
"return",
"res",
".",
"FormatError",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // SchedPolicyDelete deletes a policy with given name | [
"SchedPolicyDelete",
"deletes",
"a",
"policy",
"with",
"given",
"name"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/cluster/client.go#L462-L471 | train |
libopenstorage/openstorage | alerts/mock/alerts.mock.go | NewMockFilterDeleter | func NewMockFilterDeleter(ctrl *gomock.Controller) *MockFilterDeleter {
mock := &MockFilterDeleter{ctrl: ctrl}
mock.recorder = &MockFilterDeleterMockRecorder{mock}
return mock
} | go | func NewMockFilterDeleter(ctrl *gomock.Controller) *MockFilterDeleter {
mock := &MockFilterDeleter{ctrl: ctrl}
mock.recorder = &MockFilterDeleterMockRecorder{mock}
return mock
} | [
"func",
"NewMockFilterDeleter",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockFilterDeleter",
"{",
"mock",
":=",
"&",
"MockFilterDeleter",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockFilterDeleterMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] | // NewMockFilterDeleter creates a new mock instance | [
"NewMockFilterDeleter",
"creates",
"a",
"new",
"mock",
"instance"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/mock/alerts.mock.go#L26-L30 | train |
libopenstorage/openstorage | alerts/mock/alerts.mock.go | Filter | func (mr *MockFilterDeleterMockRecorder) Filter(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
varargs := append([]interface{}{arg0}, arg1...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Filter", reflect.TypeOf((*MockFilterDeleter)(nil).Filter), varargs...)
} | go | func (mr *MockFilterDeleterMockRecorder) Filter(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
varargs := append([]interface{}{arg0}, arg1...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Filter", reflect.TypeOf((*MockFilterDeleter)(nil).Filter), varargs...)
} | [
"func",
"(",
"mr",
"*",
"MockFilterDeleterMockRecorder",
")",
"Filter",
"(",
"arg0",
"interface",
"{",
"}",
",",
"arg1",
"...",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"varargs",
":=",
"append",
"(",
"[",
"]",
"interface",
"{",
"}",
"{",
"arg0",
"}",
",",
"arg1",
"...",
")",
"\n",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockFilterDeleter",
")",
"(",
"nil",
")",
".",
"Filter",
")",
",",
"varargs",
"...",
")",
"\n",
"}"
] | // Filter indicates an expected call of Filter | [
"Filter",
"indicates",
"an",
"expected",
"call",
"of",
"Filter"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/mock/alerts.mock.go#L83-L86 | train |
libopenstorage/openstorage | cluster/mock/cluster.mock.go | NewMockCluster | func NewMockCluster(ctrl *gomock.Controller) *MockCluster {
mock := &MockCluster{ctrl: ctrl}
mock.recorder = &MockClusterMockRecorder{mock}
return mock
} | go | func NewMockCluster(ctrl *gomock.Controller) *MockCluster {
mock := &MockCluster{ctrl: ctrl}
mock.recorder = &MockClusterMockRecorder{mock}
return mock
} | [
"func",
"NewMockCluster",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockCluster",
"{",
"mock",
":=",
"&",
"MockCluster",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockClusterMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] | // NewMockCluster creates a new mock instance | [
"NewMockCluster",
"creates",
"a",
"new",
"mock",
"instance"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/mock/cluster.mock.go#L32-L36 | train |
libopenstorage/openstorage | cluster/mock/cluster.mock.go | AddEventListener | func (m *MockCluster) AddEventListener(arg0 cluster.ClusterListener) error {
ret := m.ctrl.Call(m, "AddEventListener", arg0)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockCluster) AddEventListener(arg0 cluster.ClusterListener) error {
ret := m.ctrl.Call(m, "AddEventListener", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockCluster",
")",
"AddEventListener",
"(",
"arg0",
"cluster",
".",
"ClusterListener",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] | // AddEventListener mocks base method | [
"AddEventListener",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/mock/cluster.mock.go#L44-L48 | train |
libopenstorage/openstorage | cluster/mock/cluster.mock.go | ClusterNotifyClusterDomainsUpdate | func (m *MockCluster) ClusterNotifyClusterDomainsUpdate(arg0 types.ClusterDomainsActiveMap) error {
ret := m.ctrl.Call(m, "ClusterNotifyClusterDomainsUpdate", arg0)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockCluster) ClusterNotifyClusterDomainsUpdate(arg0 types.ClusterDomainsActiveMap) error {
ret := m.ctrl.Call(m, "ClusterNotifyClusterDomainsUpdate", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockCluster",
")",
"ClusterNotifyClusterDomainsUpdate",
"(",
"arg0",
"types",
".",
"ClusterDomainsActiveMap",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] | // ClusterNotifyClusterDomainsUpdate mocks base method | [
"ClusterNotifyClusterDomainsUpdate",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/mock/cluster.mock.go#L56-L60 | train |
libopenstorage/openstorage | cluster/mock/cluster.mock.go | CreatePair | func (m *MockCluster) CreatePair(arg0 *api.ClusterPairCreateRequest) (*api.ClusterPairCreateResponse, error) {
ret := m.ctrl.Call(m, "CreatePair", arg0)
ret0, _ := ret[0].(*api.ClusterPairCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockCluster) CreatePair(arg0 *api.ClusterPairCreateRequest) (*api.ClusterPairCreateResponse, error) {
ret := m.ctrl.Call(m, "CreatePair", arg0)
ret0, _ := ret[0].(*api.ClusterPairCreateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockCluster",
")",
"CreatePair",
"(",
"arg0",
"*",
"api",
".",
"ClusterPairCreateRequest",
")",
"(",
"*",
"api",
".",
"ClusterPairCreateResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"ClusterPairCreateResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // CreatePair mocks base method | [
"CreatePair",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/mock/cluster.mock.go#L81-L86 | train |
libopenstorage/openstorage | cluster/mock/cluster.mock.go | EnumerateAlerts | func (m *MockCluster) EnumerateAlerts(arg0, arg1 time.Time, arg2 api.ResourceType) (*api.Alerts, error) {
ret := m.ctrl.Call(m, "EnumerateAlerts", arg0, arg1, arg2)
ret0, _ := ret[0].(*api.Alerts)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockCluster) EnumerateAlerts(arg0, arg1 time.Time, arg2 api.ResourceType) (*api.Alerts, error) {
ret := m.ctrl.Call(m, "EnumerateAlerts", arg0, arg1, arg2)
ret0, _ := ret[0].(*api.Alerts)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockCluster",
")",
"EnumerateAlerts",
"(",
"arg0",
",",
"arg1",
"time",
".",
"Time",
",",
"arg2",
"api",
".",
"ResourceType",
")",
"(",
"*",
"api",
".",
"Alerts",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"Alerts",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // EnumerateAlerts mocks base method | [
"EnumerateAlerts",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/mock/cluster.mock.go#L167-L172 | train |
libopenstorage/openstorage | cluster/mock/cluster.mock.go | EnumerateNodeConf | func (m *MockCluster) EnumerateNodeConf() (*osdconfig.NodesConfig, error) {
ret := m.ctrl.Call(m, "EnumerateNodeConf")
ret0, _ := ret[0].(*osdconfig.NodesConfig)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockCluster) EnumerateNodeConf() (*osdconfig.NodesConfig, error) {
ret := m.ctrl.Call(m, "EnumerateNodeConf")
ret0, _ := ret[0].(*osdconfig.NodesConfig)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockCluster",
")",
"EnumerateNodeConf",
"(",
")",
"(",
"*",
"osdconfig",
".",
"NodesConfig",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"osdconfig",
".",
"NodesConfig",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // EnumerateNodeConf mocks base method | [
"EnumerateNodeConf",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/mock/cluster.mock.go#L193-L198 | train |
libopenstorage/openstorage | cluster/mock/cluster.mock.go | EnumerateNodeConf | func (mr *MockClusterMockRecorder) EnumerateNodeConf() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnumerateNodeConf", reflect.TypeOf((*MockCluster)(nil).EnumerateNodeConf))
} | go | func (mr *MockClusterMockRecorder) EnumerateNodeConf() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnumerateNodeConf", reflect.TypeOf((*MockCluster)(nil).EnumerateNodeConf))
} | [
"func",
"(",
"mr",
"*",
"MockClusterMockRecorder",
")",
"EnumerateNodeConf",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockCluster",
")",
"(",
"nil",
")",
".",
"EnumerateNodeConf",
")",
")",
"\n",
"}"
] | // EnumerateNodeConf indicates an expected call of EnumerateNodeConf | [
"EnumerateNodeConf",
"indicates",
"an",
"expected",
"call",
"of",
"EnumerateNodeConf"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/mock/cluster.mock.go#L201-L203 | train |
libopenstorage/openstorage | cluster/mock/cluster.mock.go | EnumeratePairs | func (m *MockCluster) EnumeratePairs() (*api.ClusterPairsEnumerateResponse, error) {
ret := m.ctrl.Call(m, "EnumeratePairs")
ret0, _ := ret[0].(*api.ClusterPairsEnumerateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockCluster) EnumeratePairs() (*api.ClusterPairsEnumerateResponse, error) {
ret := m.ctrl.Call(m, "EnumeratePairs")
ret0, _ := ret[0].(*api.ClusterPairsEnumerateResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockCluster",
")",
"EnumeratePairs",
"(",
")",
"(",
"*",
"api",
".",
"ClusterPairsEnumerateResponse",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"api",
".",
"ClusterPairsEnumerateResponse",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // EnumeratePairs mocks base method | [
"EnumeratePairs",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/mock/cluster.mock.go#L206-L211 | train |
libopenstorage/openstorage | cluster/mock/cluster.mock.go | EraseAlert | func (m *MockCluster) EraseAlert(arg0 api.ResourceType, arg1 int64) error {
ret := m.ctrl.Call(m, "EraseAlert", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockCluster) EraseAlert(arg0 api.ResourceType, arg1 int64) error {
ret := m.ctrl.Call(m, "EraseAlert", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockCluster",
")",
"EraseAlert",
"(",
"arg0",
"api",
".",
"ResourceType",
",",
"arg1",
"int64",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] | // EraseAlert mocks base method | [
"EraseAlert",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/mock/cluster.mock.go#L219-L223 | train |
libopenstorage/openstorage | cluster/mock/cluster.mock.go | GetClusterConf | func (m *MockCluster) GetClusterConf() (*osdconfig.ClusterConfig, error) {
ret := m.ctrl.Call(m, "GetClusterConf")
ret0, _ := ret[0].(*osdconfig.ClusterConfig)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockCluster) GetClusterConf() (*osdconfig.ClusterConfig, error) {
ret := m.ctrl.Call(m, "GetClusterConf")
ret0, _ := ret[0].(*osdconfig.ClusterConfig)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockCluster",
")",
"GetClusterConf",
"(",
")",
"(",
"*",
"osdconfig",
".",
"ClusterConfig",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"osdconfig",
".",
"ClusterConfig",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] | // GetClusterConf mocks base method | [
"GetClusterConf",
"mocks",
"base",
"method"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/mock/cluster.mock.go#L231-L236 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.