id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
137,400 | go-playground/lars | util.go | wrapHandlerWithName | func (l *LARS) wrapHandlerWithName(h Handler) (chain HandlerFunc, handlerName string) {
chain = l.wrapHandler(h)
handlerName = runtime.FuncForPC(reflect.ValueOf(h).Pointer()).Name()
return
} | go | func (l *LARS) wrapHandlerWithName(h Handler) (chain HandlerFunc, handlerName string) {
chain = l.wrapHandler(h)
handlerName = runtime.FuncForPC(reflect.ValueOf(h).Pointer()).Name()
return
} | [
"func",
"(",
"l",
"*",
"LARS",
")",
"wrapHandlerWithName",
"(",
"h",
"Handler",
")",
"(",
"chain",
"HandlerFunc",
",",
"handlerName",
"string",
")",
"{",
"chain",
"=",
"l",
".",
"wrapHandler",
"(",
"h",
")",
"\n",
"handlerName",
"=",
"runtime",
".",
"F... | // wrapHandlerWithName wraps Handler type and returns it including it's name before wrapping | [
"wrapHandlerWithName",
"wraps",
"Handler",
"type",
"and",
"returns",
"it",
"including",
"it",
"s",
"name",
"before",
"wrapping"
] | 4dc376e72ef7f96a295a328f06e83e2b9ab85422 | https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/util.go#L108-L113 |
137,401 | go-playground/lars | context.go | NewContext | func NewContext(l *LARS) *Ctx {
c := &Ctx{
params: make(Params, l.mostParams),
}
c.response = newResponse(nil, c)
return c
} | go | func NewContext(l *LARS) *Ctx {
c := &Ctx{
params: make(Params, l.mostParams),
}
c.response = newResponse(nil, c)
return c
} | [
"func",
"NewContext",
"(",
"l",
"*",
"LARS",
")",
"*",
"Ctx",
"{",
"c",
":=",
"&",
"Ctx",
"{",
"params",
":",
"make",
"(",
"Params",
",",
"l",
".",
"mostParams",
")",
",",
"}",
"\n\n",
"c",
".",
"response",
"=",
"newResponse",
"(",
"nil",
",",
... | // NewContext returns a new default lars Context object. | [
"NewContext",
"returns",
"a",
"new",
"default",
"lars",
"Context",
"object",
"."
] | 4dc376e72ef7f96a295a328f06e83e2b9ab85422 | https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context.go#L27-L36 |
137,402 | go-playground/lars | context.go | Param | func (c *Ctx) Param(name string) string {
for _, entry := range c.params {
if entry.Key == name {
return entry.Value
}
}
return blank
} | go | func (c *Ctx) Param(name string) string {
for _, entry := range c.params {
if entry.Key == name {
return entry.Value
}
}
return blank
} | [
"func",
"(",
"c",
"*",
"Ctx",
")",
"Param",
"(",
"name",
"string",
")",
"string",
"{",
"for",
"_",
",",
"entry",
":=",
"range",
"c",
".",
"params",
"{",
"if",
"entry",
".",
"Key",
"==",
"name",
"{",
"return",
"entry",
".",
"Value",
"\n",
"}",
"... | // Param returns the value of the first Param which key matches the given name.
// If no matching Param is found, an empty string is returned. | [
"Param",
"returns",
"the",
"value",
"of",
"the",
"first",
"Param",
"which",
"key",
"matches",
"the",
"given",
"name",
".",
"If",
"no",
"matching",
"Param",
"is",
"found",
"an",
"empty",
"string",
"is",
"returned",
"."
] | 4dc376e72ef7f96a295a328f06e83e2b9ab85422 | https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context.go#L67-L76 |
137,403 | go-playground/lars | context.go | ParseMultipartForm | func (c *Ctx) ParseMultipartForm(maxMemory int64) error {
if c.multipartFormParsed {
return nil
}
if err := c.request.ParseMultipartForm(maxMemory); err != nil {
return err
}
for _, entry := range c.params {
c.request.Form.Add(entry.Key, entry.Value)
}
c.multipartFormParsed = true
return nil
} | go | func (c *Ctx) ParseMultipartForm(maxMemory int64) error {
if c.multipartFormParsed {
return nil
}
if err := c.request.ParseMultipartForm(maxMemory); err != nil {
return err
}
for _, entry := range c.params {
c.request.Form.Add(entry.Key, entry.Value)
}
c.multipartFormParsed = true
return nil
} | [
"func",
"(",
"c",
"*",
"Ctx",
")",
"ParseMultipartForm",
"(",
"maxMemory",
"int64",
")",
"error",
"{",
"if",
"c",
".",
"multipartFormParsed",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"c",
".",
"request",
".",
"ParseMultipartForm",
"(",... | // ParseMultipartForm calls the underlying http.Request ParseMultipartForm
// but also adds the URL params to the request Form as if they were defined
// as query params i.e. ?id=13&ok=true but does not add the params to the
// http.Request.URL.RawQuery for SEO purposes | [
"ParseMultipartForm",
"calls",
"the",
"underlying",
"http",
".",
"Request",
"ParseMultipartForm",
"but",
"also",
"adds",
"the",
"URL",
"params",
"to",
"the",
"request",
"Form",
"as",
"if",
"they",
"were",
"defined",
"as",
"query",
"params",
"i",
".",
"e",
".... | 4dc376e72ef7f96a295a328f06e83e2b9ab85422 | https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context.go#L122-L139 |
137,404 | go-playground/lars | context.go | Next | func (c *Ctx) Next() {
c.index++
c.handlers[c.index](c.parent)
} | go | func (c *Ctx) Next() {
c.index++
c.handlers[c.index](c.parent)
} | [
"func",
"(",
"c",
"*",
"Ctx",
")",
"Next",
"(",
")",
"{",
"c",
".",
"index",
"++",
"\n",
"c",
".",
"handlers",
"[",
"c",
".",
"index",
"]",
"(",
"c",
".",
"parent",
")",
"\n",
"}"
] | // Next should be used only inside middleware.
// It executes the pending handlers in the chain inside the calling handler.
// See example in github. | [
"Next",
"should",
"be",
"used",
"only",
"inside",
"middleware",
".",
"It",
"executes",
"the",
"pending",
"handlers",
"in",
"the",
"chain",
"inside",
"the",
"calling",
"handler",
".",
"See",
"example",
"in",
"github",
"."
] | 4dc376e72ef7f96a295a328f06e83e2b9ab85422 | https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context.go#L144-L147 |
137,405 | go-playground/lars | context.go | JSON | func (c *Ctx) JSON(code int, i interface{}) (err error) {
b, err := json.Marshal(i)
if err != nil {
return err
}
return c.JSONBytes(code, b)
} | go | func (c *Ctx) JSON(code int, i interface{}) (err error) {
b, err := json.Marshal(i)
if err != nil {
return err
}
return c.JSONBytes(code, b)
} | [
"func",
"(",
"c",
"*",
"Ctx",
")",
"JSON",
"(",
"code",
"int",
",",
"i",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"i",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // http response helpers
// JSON marshals provided interface + returns JSON + status code | [
"http",
"response",
"helpers",
"JSON",
"marshals",
"provided",
"interface",
"+",
"returns",
"JSON",
"+",
"status",
"code"
] | 4dc376e72ef7f96a295a328f06e83e2b9ab85422 | https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context.go#L152-L160 |
137,406 | go-playground/lars | context.go | Text | func (c *Ctx) Text(code int, s string) error {
return c.TextBytes(code, []byte(s))
} | go | func (c *Ctx) Text(code int, s string) error {
return c.TextBytes(code, []byte(s))
} | [
"func",
"(",
"c",
"*",
"Ctx",
")",
"Text",
"(",
"code",
"int",
",",
"s",
"string",
")",
"error",
"{",
"return",
"c",
".",
"TextBytes",
"(",
"code",
",",
"[",
"]",
"byte",
"(",
"s",
")",
")",
"\n",
"}"
] | // Text returns the provided string with status code | [
"Text",
"returns",
"the",
"provided",
"string",
"with",
"status",
"code"
] | 4dc376e72ef7f96a295a328f06e83e2b9ab85422 | https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context.go#L219-L221 |
137,407 | go-playground/lars | context.go | TextBytes | func (c *Ctx) TextBytes(code int, b []byte) (err error) {
c.response.Header().Set(ContentType, TextPlainCharsetUTF8)
c.response.WriteHeader(code)
_, err = c.response.Write(b)
return
} | go | func (c *Ctx) TextBytes(code int, b []byte) (err error) {
c.response.Header().Set(ContentType, TextPlainCharsetUTF8)
c.response.WriteHeader(code)
_, err = c.response.Write(b)
return
} | [
"func",
"(",
"c",
"*",
"Ctx",
")",
"TextBytes",
"(",
"code",
"int",
",",
"b",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"c",
".",
"response",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"ContentType",
",",
"TextPlainCharsetUTF8",
")",
"... | // TextBytes returns the provided response with status code | [
"TextBytes",
"returns",
"the",
"provided",
"response",
"with",
"status",
"code"
] | 4dc376e72ef7f96a295a328f06e83e2b9ab85422 | https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context.go#L224-L230 |
137,408 | go-playground/lars | context.go | Stream | func (c *Ctx) Stream(step func(w io.Writer) bool) {
w := c.response
clientGone := w.CloseNotify()
for {
select {
case <-clientGone:
return
default:
keepOpen := step(w)
w.Flush()
if !keepOpen {
return
}
}
}
} | go | func (c *Ctx) Stream(step func(w io.Writer) bool) {
w := c.response
clientGone := w.CloseNotify()
for {
select {
case <-clientGone:
return
default:
keepOpen := step(w)
w.Flush()
if !keepOpen {
return
}
}
}
} | [
"func",
"(",
"c",
"*",
"Ctx",
")",
"Stream",
"(",
"step",
"func",
"(",
"w",
"io",
".",
"Writer",
")",
"bool",
")",
"{",
"w",
":=",
"c",
".",
"response",
"\n",
"clientGone",
":=",
"w",
".",
"CloseNotify",
"(",
")",
"\n\n",
"for",
"{",
"select",
... | // Stream provides HTTP Streaming | [
"Stream",
"provides",
"HTTP",
"Streaming"
] | 4dc376e72ef7f96a295a328f06e83e2b9ab85422 | https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context.go#L305-L321 |
137,409 | yvasiyarov/gorelic | http_status_metrics.go | addHTTPStatusMetricsToComponent | func addHTTPStatusMetricsToComponent(component newrelic_platform_go.IComponent, statusCounters map[int]metrics.Counter) {
for statusCode, counter := range statusCounters {
component.AddMetrica(&counterByStatusMetrica{
counter: counter,
name: fmt.Sprintf("http/status/%d", statusCode),
units: "count",
... | go | func addHTTPStatusMetricsToComponent(component newrelic_platform_go.IComponent, statusCounters map[int]metrics.Counter) {
for statusCode, counter := range statusCounters {
component.AddMetrica(&counterByStatusMetrica{
counter: counter,
name: fmt.Sprintf("http/status/%d", statusCode),
units: "count",
... | [
"func",
"addHTTPStatusMetricsToComponent",
"(",
"component",
"newrelic_platform_go",
".",
"IComponent",
",",
"statusCounters",
"map",
"[",
"int",
"]",
"metrics",
".",
"Counter",
")",
"{",
"for",
"statusCode",
",",
"counter",
":=",
"range",
"statusCounters",
"{",
"... | // addHTTPStatusMetricsToComponent initializes counter metrics for all http statuses and adds them to the component. | [
"addHTTPStatusMetricsToComponent",
"initializes",
"counter",
"metrics",
"for",
"all",
"http",
"statuses",
"and",
"adds",
"them",
"to",
"the",
"component",
"."
] | 635ca6035f2355e29fc558effa613d0d5867aac8 | https://github.com/yvasiyarov/gorelic/blob/635ca6035f2355e29fc558effa613d0d5867aac8/http_status_metrics.go#L25-L33 |
137,410 | yvasiyarov/gorelic | agent.go | NewAgent | func NewAgent() *Agent {
agent := &Agent{
NewrelicName: DefaultAgentName,
NewrelicPollInterval: DefaultNewRelicPollInterval,
Verbose: false,
CollectGcStat: true,
CollectMemoryStat: true,
GCPollInterval: DefaultGcPollIntervalInSe... | go | func NewAgent() *Agent {
agent := &Agent{
NewrelicName: DefaultAgentName,
NewrelicPollInterval: DefaultNewRelicPollInterval,
Verbose: false,
CollectGcStat: true,
CollectMemoryStat: true,
GCPollInterval: DefaultGcPollIntervalInSe... | [
"func",
"NewAgent",
"(",
")",
"*",
"Agent",
"{",
"agent",
":=",
"&",
"Agent",
"{",
"NewrelicName",
":",
"DefaultAgentName",
",",
"NewrelicPollInterval",
":",
"DefaultNewRelicPollInterval",
",",
"Verbose",
":",
"false",
",",
"CollectGcStat",
":",
"true",
",",
"... | // NewAgent builds new Agent objects. | [
"NewAgent",
"builds",
"new",
"Agent",
"objects",
"."
] | 635ca6035f2355e29fc558effa613d0d5867aac8 | https://github.com/yvasiyarov/gorelic/blob/635ca6035f2355e29fc558effa613d0d5867aac8/agent.go#L66-L81 |
137,411 | yvasiyarov/gorelic | agent.go | ClearSentData | func (c resettableComponent) ClearSentData() {
c.IComponent.ClearSentData()
for _, counter := range c.counters {
counter.Clear()
}
} | go | func (c resettableComponent) ClearSentData() {
c.IComponent.ClearSentData()
for _, counter := range c.counters {
counter.Clear()
}
} | [
"func",
"(",
"c",
"resettableComponent",
")",
"ClearSentData",
"(",
")",
"{",
"c",
".",
"IComponent",
".",
"ClearSentData",
"(",
")",
"\n",
"for",
"_",
",",
"counter",
":=",
"range",
"c",
".",
"counters",
"{",
"counter",
".",
"Clear",
"(",
")",
"\n",
... | // newrelic_platform_go.IComponent interface implementation | [
"newrelic_platform_go",
".",
"IComponent",
"interface",
"implementation"
] | 635ca6035f2355e29fc558effa613d0d5867aac8 | https://github.com/yvasiyarov/gorelic/blob/635ca6035f2355e29fc558effa613d0d5867aac8/agent.go#L90-L95 |
137,412 | yvasiyarov/gorelic | agent.go | WrapHTTPHandlerFunc | func (agent *Agent) WrapHTTPHandlerFunc(h tHTTPHandlerFunc) tHTTPHandlerFunc {
agent.CollectHTTPStat = true
agent.initTimer()
return func(w http.ResponseWriter, req *http.Request) {
proxy := newHTTPHandlerFunc(h)
proxy.timer = agent.HTTPTimer
//set the http status counters before serving request.
proxy.httpS... | go | func (agent *Agent) WrapHTTPHandlerFunc(h tHTTPHandlerFunc) tHTTPHandlerFunc {
agent.CollectHTTPStat = true
agent.initTimer()
return func(w http.ResponseWriter, req *http.Request) {
proxy := newHTTPHandlerFunc(h)
proxy.timer = agent.HTTPTimer
//set the http status counters before serving request.
proxy.httpS... | [
"func",
"(",
"agent",
"*",
"Agent",
")",
"WrapHTTPHandlerFunc",
"(",
"h",
"tHTTPHandlerFunc",
")",
"tHTTPHandlerFunc",
"{",
"agent",
".",
"CollectHTTPStat",
"=",
"true",
"\n",
"agent",
".",
"initTimer",
"(",
")",
"\n",
"return",
"func",
"(",
"w",
"http",
"... | //WrapHTTPHandlerFunc instrument HTTP handler functions to collect HTTP metrics | [
"WrapHTTPHandlerFunc",
"instrument",
"HTTP",
"handler",
"functions",
"to",
"collect",
"HTTP",
"metrics"
] | 635ca6035f2355e29fc558effa613d0d5867aac8 | https://github.com/yvasiyarov/gorelic/blob/635ca6035f2355e29fc558effa613d0d5867aac8/agent.go#L98-L108 |
137,413 | yvasiyarov/gorelic | agent.go | WrapHTTPHandler | func (agent *Agent) WrapHTTPHandler(h http.Handler) http.Handler {
agent.CollectHTTPStat = true
agent.initTimer()
proxy := newHTTPHandler(h)
proxy.timer = agent.HTTPTimer
return proxy
} | go | func (agent *Agent) WrapHTTPHandler(h http.Handler) http.Handler {
agent.CollectHTTPStat = true
agent.initTimer()
proxy := newHTTPHandler(h)
proxy.timer = agent.HTTPTimer
return proxy
} | [
"func",
"(",
"agent",
"*",
"Agent",
")",
"WrapHTTPHandler",
"(",
"h",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"agent",
".",
"CollectHTTPStat",
"=",
"true",
"\n",
"agent",
".",
"initTimer",
"(",
")",
"\n\n",
"proxy",
":=",
"newHTTPHandle... | //WrapHTTPHandler instrument HTTP handler object to collect HTTP metrics | [
"WrapHTTPHandler",
"instrument",
"HTTP",
"handler",
"object",
"to",
"collect",
"HTTP",
"metrics"
] | 635ca6035f2355e29fc558effa613d0d5867aac8 | https://github.com/yvasiyarov/gorelic/blob/635ca6035f2355e29fc558effa613d0d5867aac8/agent.go#L111-L118 |
137,414 | yvasiyarov/gorelic | agent.go | AddCustomMetric | func (agent *Agent) AddCustomMetric(metric newrelic_platform_go.IMetrica) {
agent.CustomMetrics = append(agent.CustomMetrics, metric)
} | go | func (agent *Agent) AddCustomMetric(metric newrelic_platform_go.IMetrica) {
agent.CustomMetrics = append(agent.CustomMetrics, metric)
} | [
"func",
"(",
"agent",
"*",
"Agent",
")",
"AddCustomMetric",
"(",
"metric",
"newrelic_platform_go",
".",
"IMetrica",
")",
"{",
"agent",
".",
"CustomMetrics",
"=",
"append",
"(",
"agent",
".",
"CustomMetrics",
",",
"metric",
")",
"\n",
"}"
] | //AddCustomMetric adds metric to be collected periodically with NewrelicPollInterval interval | [
"AddCustomMetric",
"adds",
"metric",
"to",
"be",
"collected",
"periodically",
"with",
"NewrelicPollInterval",
"interval"
] | 635ca6035f2355e29fc558effa613d0d5867aac8 | https://github.com/yvasiyarov/gorelic/blob/635ca6035f2355e29fc558effa613d0d5867aac8/agent.go#L121-L123 |
137,415 | yvasiyarov/gorelic | agent.go | Run | func (agent *Agent) Run() error {
if agent.NewrelicLicense == "" {
return errors.New("please, pass a valid newrelic license key")
}
var component newrelic_platform_go.IComponent
component = newrelic_platform_go.NewPluginComponent(agent.NewrelicName, agent.AgentGUID, agent.Verbose)
// Add default metrics and tr... | go | func (agent *Agent) Run() error {
if agent.NewrelicLicense == "" {
return errors.New("please, pass a valid newrelic license key")
}
var component newrelic_platform_go.IComponent
component = newrelic_platform_go.NewPluginComponent(agent.NewrelicName, agent.AgentGUID, agent.Verbose)
// Add default metrics and tr... | [
"func",
"(",
"agent",
"*",
"Agent",
")",
"Run",
"(",
")",
"error",
"{",
"if",
"agent",
".",
"NewrelicLicense",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"component",
"newrelic_platform_go",
... | //Run initialize Agent instance and start harvest go routine | [
"Run",
"initialize",
"Agent",
"instance",
"and",
"start",
"harvest",
"go",
"routine"
] | 635ca6035f2355e29fc558effa613d0d5867aac8 | https://github.com/yvasiyarov/gorelic/blob/635ca6035f2355e29fc558effa613d0d5867aac8/agent.go#L126-L178 |
137,416 | yvasiyarov/gorelic | agent.go | initTimer | func (agent *Agent) initTimer() {
if agent.HTTPTimer == nil {
agent.HTTPTimer = metrics.NewTimer()
}
} | go | func (agent *Agent) initTimer() {
if agent.HTTPTimer == nil {
agent.HTTPTimer = metrics.NewTimer()
}
} | [
"func",
"(",
"agent",
"*",
"Agent",
")",
"initTimer",
"(",
")",
"{",
"if",
"agent",
".",
"HTTPTimer",
"==",
"nil",
"{",
"agent",
".",
"HTTPTimer",
"=",
"metrics",
".",
"NewTimer",
"(",
")",
"\n",
"}",
"\n",
"}"
] | //Initialize global metrics.Timer object, used to collect HTTP metrics | [
"Initialize",
"global",
"metrics",
".",
"Timer",
"object",
"used",
"to",
"collect",
"HTTP",
"metrics"
] | 635ca6035f2355e29fc558effa613d0d5867aac8 | https://github.com/yvasiyarov/gorelic/blob/635ca6035f2355e29fc558effa613d0d5867aac8/agent.go#L181-L185 |
137,417 | yvasiyarov/gorelic | agent.go | initStatusCounters | func (agent *Agent) initStatusCounters() {
httpStatuses := []int{
http.StatusContinue, http.StatusSwitchingProtocols,
http.StatusOK, http.StatusCreated, http.StatusAccepted, http.StatusNonAuthoritativeInfo,
http.StatusNoContent, http.StatusResetContent, http.StatusPartialContent,
http.StatusMultipleChoices, ... | go | func (agent *Agent) initStatusCounters() {
httpStatuses := []int{
http.StatusContinue, http.StatusSwitchingProtocols,
http.StatusOK, http.StatusCreated, http.StatusAccepted, http.StatusNonAuthoritativeInfo,
http.StatusNoContent, http.StatusResetContent, http.StatusPartialContent,
http.StatusMultipleChoices, ... | [
"func",
"(",
"agent",
"*",
"Agent",
")",
"initStatusCounters",
"(",
")",
"{",
"httpStatuses",
":=",
"[",
"]",
"int",
"{",
"http",
".",
"StatusContinue",
",",
"http",
".",
"StatusSwitchingProtocols",
",",
"http",
".",
"StatusOK",
",",
"http",
".",
"StatusCr... | //Initialize metrics.Counters objects, used to collect HTTP statuses | [
"Initialize",
"metrics",
".",
"Counters",
"objects",
"used",
"to",
"collect",
"HTTP",
"statuses"
] | 635ca6035f2355e29fc558effa613d0d5867aac8 | https://github.com/yvasiyarov/gorelic/blob/635ca6035f2355e29fc558effa613d0d5867aac8/agent.go#L188-L212 |
137,418 | yvasiyarov/gorelic | agent.go | debug | func (agent *Agent) debug(msg string) {
if agent.Verbose {
log.Println(msg)
}
} | go | func (agent *Agent) debug(msg string) {
if agent.Verbose {
log.Println(msg)
}
} | [
"func",
"(",
"agent",
"*",
"Agent",
")",
"debug",
"(",
"msg",
"string",
")",
"{",
"if",
"agent",
".",
"Verbose",
"{",
"log",
".",
"Println",
"(",
"msg",
")",
"\n",
"}",
"\n",
"}"
] | //Print debug messages | [
"Print",
"debug",
"messages"
] | 635ca6035f2355e29fc558effa613d0d5867aac8 | https://github.com/yvasiyarov/gorelic/blob/635ca6035f2355e29fc558effa613d0d5867aac8/agent.go#L215-L219 |
137,419 | lestrrat-go/backoff | option.go | WithMaxInterval | func WithMaxInterval(v time.Duration) Option {
return &option{
name: optkeyMaxInterval,
value: float64(v),
}
} | go | func WithMaxInterval(v time.Duration) Option {
return &option{
name: optkeyMaxInterval,
value: float64(v),
}
} | [
"func",
"WithMaxInterval",
"(",
"v",
"time",
".",
"Duration",
")",
"Option",
"{",
"return",
"&",
"option",
"{",
"name",
":",
"optkeyMaxInterval",
",",
"value",
":",
"float64",
"(",
"v",
")",
",",
"}",
"\n",
"}"
] | // WithMaxInterval specifies the maximum interval between retries, and is
// currently only applicable to exponential backoffs.
//
// By default this is capped at 2 minutes. If you would like to change this
// value, you must explicitly specify it through this option.
//
// If a value of 0 is specified, then there is n... | [
"WithMaxInterval",
"specifies",
"the",
"maximum",
"interval",
"between",
"retries",
"and",
"is",
"currently",
"only",
"applicable",
"to",
"exponential",
"backoffs",
".",
"By",
"default",
"this",
"is",
"capped",
"at",
"2",
"minutes",
".",
"If",
"you",
"would",
... | 0bc2a4274cd0f8baa49f2d598df5ef0cc3069c80 | https://github.com/lestrrat-go/backoff/blob/0bc2a4274cd0f8baa49f2d598df5ef0cc3069c80/option.go#L42-L47 |
137,420 | lestrrat-go/backoff | option.go | WithMaxElapsedTime | func WithMaxElapsedTime(v time.Duration) Option{
return &option{
name: optkeyMaxElapsedTime,
value: v,
}
} | go | func WithMaxElapsedTime(v time.Duration) Option{
return &option{
name: optkeyMaxElapsedTime,
value: v,
}
} | [
"func",
"WithMaxElapsedTime",
"(",
"v",
"time",
".",
"Duration",
")",
"Option",
"{",
"return",
"&",
"option",
"{",
"name",
":",
"optkeyMaxElapsedTime",
",",
"value",
":",
"v",
",",
"}",
"\n",
"}"
] | // WithMaxElapsedTime specifies the maximum amount of accumulative time that
// the backoff is allowed to wait before it is considered failed. | [
"WithMaxElapsedTime",
"specifies",
"the",
"maximum",
"amount",
"of",
"accumulative",
"time",
"that",
"the",
"backoff",
"is",
"allowed",
"to",
"wait",
"before",
"it",
"is",
"considered",
"failed",
"."
] | 0bc2a4274cd0f8baa49f2d598df5ef0cc3069c80 | https://github.com/lestrrat-go/backoff/blob/0bc2a4274cd0f8baa49f2d598df5ef0cc3069c80/option.go#L63-L68 |
137,421 | lestrrat-go/backoff | backoff.go | IsPermanentError | func IsPermanentError(err error) bool {
if err == nil {
return false
}
if perr, ok := err.(PermanentError); ok {
return perr.IsPermanent()
}
if cerr := errors.Cause(err); cerr != err {
return IsPermanentError(cerr)
}
return false
} | go | func IsPermanentError(err error) bool {
if err == nil {
return false
}
if perr, ok := err.(PermanentError); ok {
return perr.IsPermanent()
}
if cerr := errors.Cause(err); cerr != err {
return IsPermanentError(cerr)
}
return false
} | [
"func",
"IsPermanentError",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"perr",
",",
"ok",
":=",
"err",
".",
"(",
"PermanentError",
")",
";",
"ok",
"{",
"return",
"perr",
".",
"IsP... | // IsPermanentError returns true if the given error is a permanent error. Permanent
// errors are those that implements the `PermanentError` interface and returns
// `true` for the `IsPermanent` method. | [
"IsPermanentError",
"returns",
"true",
"if",
"the",
"given",
"error",
"is",
"a",
"permanent",
"error",
".",
"Permanent",
"errors",
"are",
"those",
"that",
"implements",
"the",
"PermanentError",
"interface",
"and",
"returns",
"true",
"for",
"the",
"IsPermanent",
... | 0bc2a4274cd0f8baa49f2d598df5ef0cc3069c80 | https://github.com/lestrrat-go/backoff/blob/0bc2a4274cd0f8baa49f2d598df5ef0cc3069c80/backoff.go#L43-L54 |
137,422 | lestrrat-go/backoff | backoff.go | Continue | func Continue(b Backoff) bool {
select {
case <-b.Done():
return false
case <-b.Next():
return true
}
} | go | func Continue(b Backoff) bool {
select {
case <-b.Done():
return false
case <-b.Next():
return true
}
} | [
"func",
"Continue",
"(",
"b",
"Backoff",
")",
"bool",
"{",
"select",
"{",
"case",
"<-",
"b",
".",
"Done",
"(",
")",
":",
"return",
"false",
"\n",
"case",
"<-",
"b",
".",
"Next",
"(",
")",
":",
"return",
"true",
"\n",
"}",
"\n",
"}"
] | // Continue is a convenience wrapper around the | [
"Continue",
"is",
"a",
"convenience",
"wrapper",
"around",
"the"
] | 0bc2a4274cd0f8baa49f2d598df5ef0cc3069c80 | https://github.com/lestrrat-go/backoff/blob/0bc2a4274cd0f8baa49f2d598df5ef0cc3069c80/backoff.go#L57-L64 |
137,423 | lestrrat-go/backoff | backoff.go | Retry | func Retry(ctx context.Context, p Policy, e Executer) error {
b, cancel := p.Start(ctx)
defer cancel()
for Continue(b) {
err := e.Execute(ctx)
if err == nil {
return nil
}
if IsPermanentError(err) {
return errors.Wrap(err, `permanent error`)
}
}
return errors.New(`retry attempts failed`)
} | go | func Retry(ctx context.Context, p Policy, e Executer) error {
b, cancel := p.Start(ctx)
defer cancel()
for Continue(b) {
err := e.Execute(ctx)
if err == nil {
return nil
}
if IsPermanentError(err) {
return errors.Wrap(err, `permanent error`)
}
}
return errors.New(`retry attempts failed`)
} | [
"func",
"Retry",
"(",
"ctx",
"context",
".",
"Context",
",",
"p",
"Policy",
",",
"e",
"Executer",
")",
"error",
"{",
"b",
",",
"cancel",
":=",
"p",
".",
"Start",
"(",
"ctx",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"for",
"Continue",
"(",
... | // Retry is a convenience wrapper around the backoff algorithm. If your target
// operation can be nicely enclosed in the `Executer` interface, this will
// remove your need to write much of the boilerplate. | [
"Retry",
"is",
"a",
"convenience",
"wrapper",
"around",
"the",
"backoff",
"algorithm",
".",
"If",
"your",
"target",
"operation",
"can",
"be",
"nicely",
"enclosed",
"in",
"the",
"Executer",
"interface",
"this",
"will",
"remove",
"your",
"need",
"to",
"write",
... | 0bc2a4274cd0f8baa49f2d598df5ef0cc3069c80 | https://github.com/lestrrat-go/backoff/blob/0bc2a4274cd0f8baa49f2d598df5ef0cc3069c80/backoff.go#L69-L84 |
137,424 | exoscale/egoscale | runstatus_event.go | UpdateRunstatusIncident | func (client *Client) UpdateRunstatusIncident(ctx context.Context, incident RunstatusIncident, event RunstatusEvent) error {
if incident.EventsURL == "" {
return fmt.Errorf("empty Events URL for %#v", incident)
}
_, err := client.runstatusRequest(ctx, incident.EventsURL, event, "POST")
return err
} | go | func (client *Client) UpdateRunstatusIncident(ctx context.Context, incident RunstatusIncident, event RunstatusEvent) error {
if incident.EventsURL == "" {
return fmt.Errorf("empty Events URL for %#v", incident)
}
_, err := client.runstatusRequest(ctx, incident.EventsURL, event, "POST")
return err
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"UpdateRunstatusIncident",
"(",
"ctx",
"context",
".",
"Context",
",",
"incident",
"RunstatusIncident",
",",
"event",
"RunstatusEvent",
")",
"error",
"{",
"if",
"incident",
".",
"EventsURL",
"==",
"\"",
"\"",
"{",
"... | // UpdateRunstatusIncident create runstatus incident event
// Events can be updates or final message with status completed. | [
"UpdateRunstatusIncident",
"create",
"runstatus",
"incident",
"event",
"Events",
"can",
"be",
"updates",
"or",
"final",
"message",
"with",
"status",
"completed",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_event.go#L19-L26 |
137,425 | exoscale/egoscale | runstatus_event.go | UpdateRunstatusMaintenance | func (client *Client) UpdateRunstatusMaintenance(ctx context.Context, maintenance RunstatusMaintenance, event RunstatusEvent) error {
if maintenance.EventsURL == "" {
return fmt.Errorf("empty Events URL for %#v", maintenance)
}
_, err := client.runstatusRequest(ctx, maintenance.EventsURL, event, "POST")
return e... | go | func (client *Client) UpdateRunstatusMaintenance(ctx context.Context, maintenance RunstatusMaintenance, event RunstatusEvent) error {
if maintenance.EventsURL == "" {
return fmt.Errorf("empty Events URL for %#v", maintenance)
}
_, err := client.runstatusRequest(ctx, maintenance.EventsURL, event, "POST")
return e... | [
"func",
"(",
"client",
"*",
"Client",
")",
"UpdateRunstatusMaintenance",
"(",
"ctx",
"context",
".",
"Context",
",",
"maintenance",
"RunstatusMaintenance",
",",
"event",
"RunstatusEvent",
")",
"error",
"{",
"if",
"maintenance",
".",
"EventsURL",
"==",
"\"",
"\""... | // UpdateRunstatusMaintenance adds a event to a maintenance.
// Events can be updates or final message with status completed. | [
"UpdateRunstatusMaintenance",
"adds",
"a",
"event",
"to",
"a",
"maintenance",
".",
"Events",
"can",
"be",
"updates",
"or",
"final",
"message",
"with",
"status",
"completed",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_event.go#L30-L37 |
137,426 | exoscale/egoscale | events.go | ListRequest | func (event Event) ListRequest() (ListCommand, error) {
req := &ListEvents{
ID: event.ID,
Level: event.Level,
Type: event.Type,
}
return req, nil
} | go | func (event Event) ListRequest() (ListCommand, error) {
req := &ListEvents{
ID: event.ID,
Level: event.Level,
Type: event.Type,
}
return req, nil
} | [
"func",
"(",
"event",
"Event",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"req",
":=",
"&",
"ListEvents",
"{",
"ID",
":",
"event",
".",
"ID",
",",
"Level",
":",
"event",
".",
"Level",
",",
"Type",
":",
"event",
".",
... | // ListRequest builds the ListEvents request | [
"ListRequest",
"builds",
"the",
"ListEvents",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/events.go#L17-L25 |
137,427 | exoscale/egoscale | volumes.go | ListRequest | func (vol Volume) ListRequest() (ListCommand, error) {
req := &ListVolumes{
Name: vol.Name,
Type: vol.Type,
VirtualMachineID: vol.VirtualMachineID,
ZoneID: vol.ZoneID,
}
return req, nil
} | go | func (vol Volume) ListRequest() (ListCommand, error) {
req := &ListVolumes{
Name: vol.Name,
Type: vol.Type,
VirtualMachineID: vol.VirtualMachineID,
ZoneID: vol.ZoneID,
}
return req, nil
} | [
"func",
"(",
"vol",
"Volume",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"req",
":=",
"&",
"ListVolumes",
"{",
"Name",
":",
"vol",
".",
"Name",
",",
"Type",
":",
"vol",
".",
"Type",
",",
"VirtualMachineID",
":",
"vol",
... | // ListRequest builds the ListVolumes request | [
"ListRequest",
"builds",
"the",
"ListVolumes",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/volumes.go#L63-L72 |
137,428 | exoscale/egoscale | templates.go | ListRequest | func (template Template) ListRequest() (ListCommand, error) {
req := &ListTemplates{
ID: template.ID,
Name: template.Name,
ZoneID: template.ZoneID,
}
if template.IsFeatured {
req.TemplateFilter = "featured"
}
if template.Removed != "" {
*req.ShowRemoved = true
}
for i := range template.Tags {
... | go | func (template Template) ListRequest() (ListCommand, error) {
req := &ListTemplates{
ID: template.ID,
Name: template.Name,
ZoneID: template.ZoneID,
}
if template.IsFeatured {
req.TemplateFilter = "featured"
}
if template.Removed != "" {
*req.ShowRemoved = true
}
for i := range template.Tags {
... | [
"func",
"(",
"template",
"Template",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"req",
":=",
"&",
"ListTemplates",
"{",
"ID",
":",
"template",
".",
"ID",
",",
"Name",
":",
"template",
".",
"Name",
",",
"ZoneID",
":",
"t... | // ListRequest builds the ListTemplates request | [
"ListRequest",
"builds",
"the",
"ListTemplates",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/templates.go#L49-L67 |
137,429 | exoscale/egoscale | templates.go | ListRequest | func (osCat OSCategory) ListRequest() (ListCommand, error) {
req := &ListOSCategories{
Name: osCat.Name,
ID: osCat.ID,
}
return req, nil
} | go | func (osCat OSCategory) ListRequest() (ListCommand, error) {
req := &ListOSCategories{
Name: osCat.Name,
ID: osCat.ID,
}
return req, nil
} | [
"func",
"(",
"osCat",
"OSCategory",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"req",
":=",
"&",
"ListOSCategories",
"{",
"Name",
":",
"osCat",
".",
"Name",
",",
"ID",
":",
"osCat",
".",
"ID",
",",
"}",
"\n\n",
"return"... | // ListRequest builds the ListOSCategories request | [
"ListRequest",
"builds",
"the",
"ListOSCategories",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/templates.go#L98-L105 |
137,430 | exoscale/egoscale | uuid.go | DeepCopy | func (u *UUID) DeepCopy() *UUID {
if u == nil {
return nil
}
out := [uuid.Size]byte{}
copy(out[:], u.Bytes())
return &UUID{
(uuid.UUID)(out),
}
} | go | func (u *UUID) DeepCopy() *UUID {
if u == nil {
return nil
}
out := [uuid.Size]byte{}
copy(out[:], u.Bytes())
return &UUID{
(uuid.UUID)(out),
}
} | [
"func",
"(",
"u",
"*",
"UUID",
")",
"DeepCopy",
"(",
")",
"*",
"UUID",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"out",
":=",
"[",
"uuid",
".",
"Size",
"]",
"byte",
"{",
"}",
"\n",
"copy",
"(",
"out",
"[",
":",
"... | // DeepCopy create a true copy of the receiver. | [
"DeepCopy",
"create",
"a",
"true",
"copy",
"of",
"the",
"receiver",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/uuid.go#L16-L27 |
137,431 | exoscale/egoscale | uuid.go | DeepCopyInto | func (u *UUID) DeepCopyInto(out *UUID) {
o := [uuid.Size]byte{}
copy(o[:], u.Bytes())
out.UUID = (uuid.UUID)(o)
} | go | func (u *UUID) DeepCopyInto(out *UUID) {
o := [uuid.Size]byte{}
copy(o[:], u.Bytes())
out.UUID = (uuid.UUID)(o)
} | [
"func",
"(",
"u",
"*",
"UUID",
")",
"DeepCopyInto",
"(",
"out",
"*",
"UUID",
")",
"{",
"o",
":=",
"[",
"uuid",
".",
"Size",
"]",
"byte",
"{",
"}",
"\n",
"copy",
"(",
"o",
"[",
":",
"]",
",",
"u",
".",
"Bytes",
"(",
")",
")",
"\n\n",
"out",
... | // DeepCopyInto copies the receiver into out.
//
// In must be non nil. | [
"DeepCopyInto",
"copies",
"the",
"receiver",
"into",
"out",
".",
"In",
"must",
"be",
"non",
"nil",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/uuid.go#L32-L37 |
137,432 | exoscale/egoscale | uuid.go | UnmarshalJSON | func (u *UUID) UnmarshalJSON(b []byte) error {
var s string
if err := json.Unmarshal(b, &s); err != nil {
return err
}
new, err := ParseUUID(s)
if err == nil {
u.UUID = new.UUID
}
return err
} | go | func (u *UUID) UnmarshalJSON(b []byte) error {
var s string
if err := json.Unmarshal(b, &s); err != nil {
return err
}
new, err := ParseUUID(s)
if err == nil {
u.UUID = new.UUID
}
return err
} | [
"func",
"(",
"u",
"*",
"UUID",
")",
"UnmarshalJSON",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"s",
"string",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"b",
",",
"&",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
... | // UnmarshalJSON unmarshals the raw JSON into the UUID. | [
"UnmarshalJSON",
"unmarshals",
"the",
"raw",
"JSON",
"into",
"the",
"UUID",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/uuid.go#L45-L56 |
137,433 | exoscale/egoscale | uuid.go | ParseUUID | func ParseUUID(s string) (*UUID, error) {
u, err := uuid.FromString(s)
if err != nil {
return nil, err
}
return &UUID{u}, nil
} | go | func ParseUUID(s string) (*UUID, error) {
u, err := uuid.FromString(s)
if err != nil {
return nil, err
}
return &UUID{u}, nil
} | [
"func",
"ParseUUID",
"(",
"s",
"string",
")",
"(",
"*",
"UUID",
",",
"error",
")",
"{",
"u",
",",
"err",
":=",
"uuid",
".",
"FromString",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return"... | // ParseUUID parses a string into a UUID. | [
"ParseUUID",
"parses",
"a",
"string",
"into",
"a",
"UUID",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/uuid.go#L64-L70 |
137,434 | exoscale/egoscale | uuid.go | MustParseUUID | func MustParseUUID(s string) *UUID {
u, e := ParseUUID(s)
if e != nil {
panic(e)
}
return u
} | go | func MustParseUUID(s string) *UUID {
u, e := ParseUUID(s)
if e != nil {
panic(e)
}
return u
} | [
"func",
"MustParseUUID",
"(",
"s",
"string",
")",
"*",
"UUID",
"{",
"u",
",",
"e",
":=",
"ParseUUID",
"(",
"s",
")",
"\n",
"if",
"e",
"!=",
"nil",
"{",
"panic",
"(",
"e",
")",
"\n",
"}",
"\n",
"return",
"u",
"\n",
"}"
] | // MustParseUUID acts like ParseUUID but panic in case of a failure. | [
"MustParseUUID",
"acts",
"like",
"ParseUUID",
"but",
"panic",
"in",
"case",
"of",
"a",
"failure",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/uuid.go#L73-L79 |
137,435 | exoscale/egoscale | runstatus_service.go | Match | func (service RunstatusService) Match(other RunstatusService) bool {
if other.Name != "" && service.Name == other.Name {
return true
}
if other.ID > 0 && service.ID == other.ID {
return true
}
return false
} | go | func (service RunstatusService) Match(other RunstatusService) bool {
if other.Name != "" && service.Name == other.Name {
return true
}
if other.ID > 0 && service.ID == other.ID {
return true
}
return false
} | [
"func",
"(",
"service",
"RunstatusService",
")",
"Match",
"(",
"other",
"RunstatusService",
")",
"bool",
"{",
"if",
"other",
".",
"Name",
"!=",
"\"",
"\"",
"&&",
"service",
".",
"Name",
"==",
"other",
".",
"Name",
"{",
"return",
"true",
"\n",
"}",
"\n\... | // Match returns true if the other service has got similarities with itself | [
"Match",
"returns",
"true",
"if",
"the",
"other",
"service",
"has",
"got",
"similarities",
"with",
"itself"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_service.go#L47-L57 |
137,436 | exoscale/egoscale | runstatus_service.go | DeleteRunstatusService | func (client *Client) DeleteRunstatusService(ctx context.Context, service RunstatusService) error {
if service.URL == "" {
return fmt.Errorf("empty URL for %#v", service)
}
_, err := client.runstatusRequest(ctx, service.URL, nil, "DELETE")
return err
} | go | func (client *Client) DeleteRunstatusService(ctx context.Context, service RunstatusService) error {
if service.URL == "" {
return fmt.Errorf("empty URL for %#v", service)
}
_, err := client.runstatusRequest(ctx, service.URL, nil, "DELETE")
return err
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"DeleteRunstatusService",
"(",
"ctx",
"context",
".",
"Context",
",",
"service",
"RunstatusService",
")",
"error",
"{",
"if",
"service",
".",
"URL",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\... | // DeleteRunstatusService delete runstatus service | [
"DeleteRunstatusService",
"delete",
"runstatus",
"service"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_service.go#L67-L74 |
137,437 | exoscale/egoscale | runstatus_service.go | CreateRunstatusService | func (client *Client) CreateRunstatusService(ctx context.Context, service RunstatusService) (*RunstatusService, error) {
if service.PageURL == "" {
return nil, fmt.Errorf("empty Page URL for %#v", service)
}
page, err := client.GetRunstatusPage(ctx, RunstatusPage{URL: service.PageURL})
if err != nil {
return n... | go | func (client *Client) CreateRunstatusService(ctx context.Context, service RunstatusService) (*RunstatusService, error) {
if service.PageURL == "" {
return nil, fmt.Errorf("empty Page URL for %#v", service)
}
page, err := client.GetRunstatusPage(ctx, RunstatusPage{URL: service.PageURL})
if err != nil {
return n... | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateRunstatusService",
"(",
"ctx",
"context",
".",
"Context",
",",
"service",
"RunstatusService",
")",
"(",
"*",
"RunstatusService",
",",
"error",
")",
"{",
"if",
"service",
".",
"PageURL",
"==",
"\"",
"\"",
"{... | // CreateRunstatusService create runstatus service | [
"CreateRunstatusService",
"create",
"runstatus",
"service"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_service.go#L77-L98 |
137,438 | exoscale/egoscale | runstatus_service.go | GetRunstatusService | func (client *Client) GetRunstatusService(ctx context.Context, service RunstatusService) (*RunstatusService, error) {
if service.URL != "" {
return client.getRunstatusService(ctx, service.URL)
}
if service.PageURL == "" {
return nil, fmt.Errorf("empty Page URL in %#v", service)
}
page, err := client.getRunst... | go | func (client *Client) GetRunstatusService(ctx context.Context, service RunstatusService) (*RunstatusService, error) {
if service.URL != "" {
return client.getRunstatusService(ctx, service.URL)
}
if service.PageURL == "" {
return nil, fmt.Errorf("empty Page URL in %#v", service)
}
page, err := client.getRunst... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetRunstatusService",
"(",
"ctx",
"context",
".",
"Context",
",",
"service",
"RunstatusService",
")",
"(",
"*",
"RunstatusService",
",",
"error",
")",
"{",
"if",
"service",
".",
"URL",
"!=",
"\"",
"\"",
"{",
"r... | // GetRunstatusService displays service detail. | [
"GetRunstatusService",
"displays",
"service",
"detail",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_service.go#L101-L126 |
137,439 | exoscale/egoscale | runstatus_service.go | ListRunstatusServices | func (client *Client) ListRunstatusServices(ctx context.Context, page RunstatusPage) ([]RunstatusService, error) {
if page.ServicesURL == "" {
return nil, fmt.Errorf("empty Services URL for %#v", page)
}
results := make([]RunstatusService, 0)
var err error
client.PaginateRunstatusServices(ctx, page, func(servi... | go | func (client *Client) ListRunstatusServices(ctx context.Context, page RunstatusPage) ([]RunstatusService, error) {
if page.ServicesURL == "" {
return nil, fmt.Errorf("empty Services URL for %#v", page)
}
results := make([]RunstatusService, 0)
var err error
client.PaginateRunstatusServices(ctx, page, func(servi... | [
"func",
"(",
"client",
"*",
"Client",
")",
"ListRunstatusServices",
"(",
"ctx",
"context",
".",
"Context",
",",
"page",
"RunstatusPage",
")",
"(",
"[",
"]",
"RunstatusService",
",",
"error",
")",
"{",
"if",
"page",
".",
"ServicesURL",
"==",
"\"",
"\"",
"... | // ListRunstatusServices displays the list of services. | [
"ListRunstatusServices",
"displays",
"the",
"list",
"of",
"services",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_service.go#L147-L166 |
137,440 | exoscale/egoscale | runstatus_service.go | PaginateRunstatusServices | func (client *Client) PaginateRunstatusServices(ctx context.Context, page RunstatusPage, callback func(*RunstatusService, error) bool) { // nolint: dupl
if page.ServicesURL == "" {
callback(nil, fmt.Errorf("empty Services URL for %#v", page))
return
}
servicesURL := page.ServicesURL
for servicesURL != "" {
r... | go | func (client *Client) PaginateRunstatusServices(ctx context.Context, page RunstatusPage, callback func(*RunstatusService, error) bool) { // nolint: dupl
if page.ServicesURL == "" {
callback(nil, fmt.Errorf("empty Services URL for %#v", page))
return
}
servicesURL := page.ServicesURL
for servicesURL != "" {
r... | [
"func",
"(",
"client",
"*",
"Client",
")",
"PaginateRunstatusServices",
"(",
"ctx",
"context",
".",
"Context",
",",
"page",
"RunstatusPage",
",",
"callback",
"func",
"(",
"*",
"RunstatusService",
",",
"error",
")",
"bool",
")",
"{",
"// nolint: dupl",
"if",
... | // PaginateRunstatusServices paginates Services | [
"PaginateRunstatusServices",
"paginates",
"Services"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_service.go#L169-L201 |
137,441 | exoscale/egoscale | dns.go | CreateDomain | func (client *Client) CreateDomain(ctx context.Context, name string) (*DNSDomain, error) {
m, err := json.Marshal(DNSDomainResponse{
Domain: &DNSDomain{
Name: name,
},
})
if err != nil {
return nil, err
}
resp, err := client.dnsRequest(ctx, "/v1/domains", nil, string(m), "POST")
if err != nil {
return... | go | func (client *Client) CreateDomain(ctx context.Context, name string) (*DNSDomain, error) {
m, err := json.Marshal(DNSDomainResponse{
Domain: &DNSDomain{
Name: name,
},
})
if err != nil {
return nil, err
}
resp, err := client.dnsRequest(ctx, "/v1/domains", nil, string(m), "POST")
if err != nil {
return... | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateDomain",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"(",
"*",
"DNSDomain",
",",
"error",
")",
"{",
"m",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"DNSDomainResponse",
"{",
... | // CreateDomain creates a DNS domain | [
"CreateDomain",
"creates",
"a",
"DNS",
"domain"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/dns.go#L129-L150 |
137,442 | exoscale/egoscale | dns.go | GetDomain | func (client *Client) GetDomain(ctx context.Context, name string) (*DNSDomain, error) {
resp, err := client.dnsRequest(ctx, "/v1/domains/"+name, nil, "", "GET")
if err != nil {
return nil, err
}
var d *DNSDomainResponse
if err := json.Unmarshal(resp, &d); err != nil {
return nil, err
}
return d.Domain, nil... | go | func (client *Client) GetDomain(ctx context.Context, name string) (*DNSDomain, error) {
resp, err := client.dnsRequest(ctx, "/v1/domains/"+name, nil, "", "GET")
if err != nil {
return nil, err
}
var d *DNSDomainResponse
if err := json.Unmarshal(resp, &d); err != nil {
return nil, err
}
return d.Domain, nil... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetDomain",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"(",
"*",
"DNSDomain",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"client",
".",
"dnsRequest",
"(",
"ctx",
",",
"\"",
... | // GetDomain gets a DNS domain | [
"GetDomain",
"gets",
"a",
"DNS",
"domain"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/dns.go#L153-L165 |
137,443 | exoscale/egoscale | dns.go | GetDomains | func (client *Client) GetDomains(ctx context.Context) ([]DNSDomain, error) {
resp, err := client.dnsRequest(ctx, "/v1/domains", nil, "", "GET")
if err != nil {
return nil, err
}
var d []DNSDomainResponse
if err := json.Unmarshal(resp, &d); err != nil {
return nil, err
}
domains := make([]DNSDomain, len(d))... | go | func (client *Client) GetDomains(ctx context.Context) ([]DNSDomain, error) {
resp, err := client.dnsRequest(ctx, "/v1/domains", nil, "", "GET")
if err != nil {
return nil, err
}
var d []DNSDomainResponse
if err := json.Unmarshal(resp, &d); err != nil {
return nil, err
}
domains := make([]DNSDomain, len(d))... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetDomains",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"DNSDomain",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"client",
".",
"dnsRequest",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",... | // GetDomains gets DNS domains | [
"GetDomains",
"gets",
"DNS",
"domains"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/dns.go#L168-L184 |
137,444 | exoscale/egoscale | dns.go | DeleteDomain | func (client *Client) DeleteDomain(ctx context.Context, name string) error {
_, err := client.dnsRequest(ctx, "/v1/domains/"+name, nil, "", "DELETE")
return err
} | go | func (client *Client) DeleteDomain(ctx context.Context, name string) error {
_, err := client.dnsRequest(ctx, "/v1/domains/"+name, nil, "", "DELETE")
return err
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"DeleteDomain",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"client",
".",
"dnsRequest",
"(",
"ctx",
",",
"\"",
"\"",
"+",
"name",
",",
"nil",
",... | // DeleteDomain delets a DNS domain | [
"DeleteDomain",
"delets",
"a",
"DNS",
"domain"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/dns.go#L187-L190 |
137,445 | exoscale/egoscale | dns.go | GetRecord | func (client *Client) GetRecord(ctx context.Context, domain string, recordID int64) (*DNSRecord, error) {
id := strconv.FormatInt(recordID, 10)
resp, err := client.dnsRequest(ctx, "/v1/domains/"+domain+"/records/"+id, nil, "", "GET")
if err != nil {
return nil, err
}
var r DNSRecordResponse
if err = json.Unmar... | go | func (client *Client) GetRecord(ctx context.Context, domain string, recordID int64) (*DNSRecord, error) {
id := strconv.FormatInt(recordID, 10)
resp, err := client.dnsRequest(ctx, "/v1/domains/"+domain+"/records/"+id, nil, "", "GET")
if err != nil {
return nil, err
}
var r DNSRecordResponse
if err = json.Unmar... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetRecord",
"(",
"ctx",
"context",
".",
"Context",
",",
"domain",
"string",
",",
"recordID",
"int64",
")",
"(",
"*",
"DNSRecord",
",",
"error",
")",
"{",
"id",
":=",
"strconv",
".",
"FormatInt",
"(",
"recordI... | // GetRecord returns a DNS record | [
"GetRecord",
"returns",
"a",
"DNS",
"record"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/dns.go#L193-L206 |
137,446 | exoscale/egoscale | dns.go | GetRecords | func (client *Client) GetRecords(ctx context.Context, domain string) ([]DNSRecord, error) {
resp, err := client.dnsRequest(ctx, "/v1/domains/"+domain+"/records", nil, "", "GET")
if err != nil {
return nil, err
}
var r []DNSRecordResponse
if err = json.Unmarshal(resp, &r); err != nil {
return nil, err
}
rec... | go | func (client *Client) GetRecords(ctx context.Context, domain string) ([]DNSRecord, error) {
resp, err := client.dnsRequest(ctx, "/v1/domains/"+domain+"/records", nil, "", "GET")
if err != nil {
return nil, err
}
var r []DNSRecordResponse
if err = json.Unmarshal(resp, &r); err != nil {
return nil, err
}
rec... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetRecords",
"(",
"ctx",
"context",
".",
"Context",
",",
"domain",
"string",
")",
"(",
"[",
"]",
"DNSRecord",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"client",
".",
"dnsRequest",
"(",
"ctx",
",",
... | // GetRecords returns the DNS records | [
"GetRecords",
"returns",
"the",
"DNS",
"records"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/dns.go#L209-L226 |
137,447 | exoscale/egoscale | dns.go | CreateRecord | func (client *Client) CreateRecord(ctx context.Context, name string, rec DNSRecord) (*DNSRecord, error) {
body, err := json.Marshal(DNSRecordResponse{
Record: rec,
})
if err != nil {
return nil, err
}
resp, err := client.dnsRequest(ctx, "/v1/domains/"+name+"/records", nil, string(body), "POST")
if err != nil... | go | func (client *Client) CreateRecord(ctx context.Context, name string, rec DNSRecord) (*DNSRecord, error) {
body, err := json.Marshal(DNSRecordResponse{
Record: rec,
})
if err != nil {
return nil, err
}
resp, err := client.dnsRequest(ctx, "/v1/domains/"+name+"/records", nil, string(body), "POST")
if err != nil... | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateRecord",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
",",
"rec",
"DNSRecord",
")",
"(",
"*",
"DNSRecord",
",",
"error",
")",
"{",
"body",
",",
"err",
":=",
"json",
".",
"Marshal",
"(... | // CreateRecord creates a DNS record | [
"CreateRecord",
"creates",
"a",
"DNS",
"record"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/dns.go#L258-L277 |
137,448 | exoscale/egoscale | dns.go | UpdateRecord | func (client *Client) UpdateRecord(ctx context.Context, name string, rec UpdateDNSRecord) (*DNSRecord, error) {
body, err := json.Marshal(UpdateDNSRecordResponse{
Record: rec,
})
if err != nil {
return nil, err
}
id := strconv.FormatInt(rec.ID, 10)
resp, err := client.dnsRequest(ctx, "/v1/domains/"+name+"/re... | go | func (client *Client) UpdateRecord(ctx context.Context, name string, rec UpdateDNSRecord) (*DNSRecord, error) {
body, err := json.Marshal(UpdateDNSRecordResponse{
Record: rec,
})
if err != nil {
return nil, err
}
id := strconv.FormatInt(rec.ID, 10)
resp, err := client.dnsRequest(ctx, "/v1/domains/"+name+"/re... | [
"func",
"(",
"client",
"*",
"Client",
")",
"UpdateRecord",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
",",
"rec",
"UpdateDNSRecord",
")",
"(",
"*",
"DNSRecord",
",",
"error",
")",
"{",
"body",
",",
"err",
":=",
"json",
".",
"Marshal"... | // UpdateRecord updates a DNS record | [
"UpdateRecord",
"updates",
"a",
"DNS",
"record"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/dns.go#L280-L300 |
137,449 | exoscale/egoscale | dns.go | DeleteRecord | func (client *Client) DeleteRecord(ctx context.Context, name string, recordID int64) error {
id := strconv.FormatInt(recordID, 10)
_, err := client.dnsRequest(ctx, "/v1/domains/"+name+"/records/"+id, nil, "", "DELETE")
return err
} | go | func (client *Client) DeleteRecord(ctx context.Context, name string, recordID int64) error {
id := strconv.FormatInt(recordID, 10)
_, err := client.dnsRequest(ctx, "/v1/domains/"+name+"/records/"+id, nil, "", "DELETE")
return err
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"DeleteRecord",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
",",
"recordID",
"int64",
")",
"error",
"{",
"id",
":=",
"strconv",
".",
"FormatInt",
"(",
"recordID",
",",
"10",
")",
"\n",
"_",
... | // DeleteRecord deletes a record | [
"DeleteRecord",
"deletes",
"a",
"record"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/dns.go#L303-L308 |
137,450 | exoscale/egoscale | cidr.go | MarshalJSON | func (cidr CIDR) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("%q", cidr)), nil
} | go | func (cidr CIDR) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("%q", cidr)), nil
} | [
"func",
"(",
"cidr",
"CIDR",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"[",
"]",
"byte",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"cidr",
")",
")",
",",
"nil",
"\n",
"}"
] | // MarshalJSON converts the CIDR to a string representation | [
"MarshalJSON",
"converts",
"the",
"CIDR",
"to",
"a",
"string",
"representation"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/cidr.go#L31-L33 |
137,451 | exoscale/egoscale | cidr.go | ParseCIDR | func ParseCIDR(s string) (*CIDR, error) {
_, net, err := net.ParseCIDR(s)
if err != nil {
return nil, err
}
return &CIDR{*net}, nil
} | go | func ParseCIDR(s string) (*CIDR, error) {
_, net, err := net.ParseCIDR(s)
if err != nil {
return nil, err
}
return &CIDR{*net}, nil
} | [
"func",
"ParseCIDR",
"(",
"s",
"string",
")",
"(",
"*",
"CIDR",
",",
"error",
")",
"{",
"_",
",",
"net",
",",
"err",
":=",
"net",
".",
"ParseCIDR",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\... | // ParseCIDR parses a CIDR from a string | [
"ParseCIDR",
"parses",
"a",
"CIDR",
"from",
"a",
"string"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/cidr.go#L41-L47 |
137,452 | exoscale/egoscale | cidr.go | MustParseCIDR | func MustParseCIDR(s string) *CIDR {
cidr, err := ParseCIDR(s)
if err != nil {
panic(err)
}
return cidr
} | go | func MustParseCIDR(s string) *CIDR {
cidr, err := ParseCIDR(s)
if err != nil {
panic(err)
}
return cidr
} | [
"func",
"MustParseCIDR",
"(",
"s",
"string",
")",
"*",
"CIDR",
"{",
"cidr",
",",
"err",
":=",
"ParseCIDR",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"cidr",
"\n",
"}"
] | // MustParseCIDR forces parseCIDR or panics | [
"MustParseCIDR",
"forces",
"parseCIDR",
"or",
"panics"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/cidr.go#L50-L57 |
137,453 | exoscale/egoscale | cidr.go | Equal | func (cidr CIDR) Equal(c CIDR) bool {
return (cidr.IPNet.IP.Equal(c.IPNet.IP) && bytes.Equal(cidr.IPNet.Mask, c.IPNet.Mask))
} | go | func (cidr CIDR) Equal(c CIDR) bool {
return (cidr.IPNet.IP.Equal(c.IPNet.IP) && bytes.Equal(cidr.IPNet.Mask, c.IPNet.Mask))
} | [
"func",
"(",
"cidr",
"CIDR",
")",
"Equal",
"(",
"c",
"CIDR",
")",
"bool",
"{",
"return",
"(",
"cidr",
".",
"IPNet",
".",
"IP",
".",
"Equal",
"(",
"c",
".",
"IPNet",
".",
"IP",
")",
"&&",
"bytes",
".",
"Equal",
"(",
"cidr",
".",
"IPNet",
".",
... | // Equal compare two CIDR | [
"Equal",
"compare",
"two",
"CIDR"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/cidr.go#L60-L62 |
137,454 | exoscale/egoscale | networks.go | ListRequest | func (network Network) ListRequest() (ListCommand, error) {
//TODO add tags support
req := &ListNetworks{
ID: network.ID,
Keyword: network.Name, // this is a hack as listNetworks doesn't support to search by name.
PhysicalNetworkID: network.PhysicalNetworkID,
TrafficType: networ... | go | func (network Network) ListRequest() (ListCommand, error) {
//TODO add tags support
req := &ListNetworks{
ID: network.ID,
Keyword: network.Name, // this is a hack as listNetworks doesn't support to search by name.
PhysicalNetworkID: network.PhysicalNetworkID,
TrafficType: networ... | [
"func",
"(",
"network",
"Network",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"//TODO add tags support",
"req",
":=",
"&",
"ListNetworks",
"{",
"ID",
":",
"network",
".",
"ID",
",",
"Keyword",
":",
"network",
".",
"Name",
"... | // ListRequest builds the ListNetworks request | [
"ListRequest",
"builds",
"the",
"ListNetworks",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/networks.go#L58-L77 |
137,455 | exoscale/egoscale | request.go | Error | func (e ErrorResponse) Error() string {
return fmt.Sprintf("API error %s %d (%s %d): %s", e.ErrorCode, e.ErrorCode, e.CSErrorCode, e.CSErrorCode, e.ErrorText)
} | go | func (e ErrorResponse) Error() string {
return fmt.Sprintf("API error %s %d (%s %d): %s", e.ErrorCode, e.ErrorCode, e.CSErrorCode, e.CSErrorCode, e.ErrorText)
} | [
"func",
"(",
"e",
"ErrorResponse",
")",
"Error",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"e",
".",
"ErrorCode",
",",
"e",
".",
"ErrorCode",
",",
"e",
".",
"CSErrorCode",
",",
"e",
".",
"CSErrorCode",
",",
"e"... | // Error formats a CloudStack error into a standard error | [
"Error",
"formats",
"a",
"CloudStack",
"error",
"into",
"a",
"standard",
"error"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L22-L24 |
137,456 | exoscale/egoscale | request.go | Error | func (e BooleanResponse) Error() error {
if !e.Success {
return fmt.Errorf("API error: %s", e.DisplayText)
}
return nil
} | go | func (e BooleanResponse) Error() error {
if !e.Success {
return fmt.Errorf("API error: %s", e.DisplayText)
}
return nil
} | [
"func",
"(",
"e",
"BooleanResponse",
")",
"Error",
"(",
")",
"error",
"{",
"if",
"!",
"e",
".",
"Success",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"e",
".",
"DisplayText",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Error formats a CloudStack job response into a standard error | [
"Error",
"formats",
"a",
"CloudStack",
"job",
"response",
"into",
"a",
"standard",
"error"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L27-L33 |
137,457 | exoscale/egoscale | request.go | asyncRequest | func (client *Client) asyncRequest(ctx context.Context, asyncCommand AsyncCommand) (interface{}, error) {
var err error
resp := asyncCommand.AsyncResponse()
client.AsyncRequestWithContext(
ctx,
asyncCommand,
func(j *AsyncJobResult, e error) bool {
if e != nil {
err = e
return false
}
if j.Job... | go | func (client *Client) asyncRequest(ctx context.Context, asyncCommand AsyncCommand) (interface{}, error) {
var err error
resp := asyncCommand.AsyncResponse()
client.AsyncRequestWithContext(
ctx,
asyncCommand,
func(j *AsyncJobResult, e error) bool {
if e != nil {
err = e
return false
}
if j.Job... | [
"func",
"(",
"client",
"*",
"Client",
")",
"asyncRequest",
"(",
"ctx",
"context",
".",
"Context",
",",
"asyncCommand",
"AsyncCommand",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n\n",
"resp",
":=",
"asyncCommand",
"... | // asyncRequest perform an asynchronous job with a context | [
"asyncRequest",
"perform",
"an",
"asynchronous",
"job",
"with",
"a",
"context"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L114-L136 |
137,458 | exoscale/egoscale | request.go | SyncRequestWithContext | func (client *Client) SyncRequestWithContext(ctx context.Context, command Command) (interface{}, error) {
body, err := client.request(ctx, command)
if err != nil {
return nil, err
}
response := command.Response()
b, ok := response.(*BooleanResponse)
if ok {
m := make(map[string]interface{})
if errUnmarshal... | go | func (client *Client) SyncRequestWithContext(ctx context.Context, command Command) (interface{}, error) {
body, err := client.request(ctx, command)
if err != nil {
return nil, err
}
response := command.Response()
b, ok := response.(*BooleanResponse)
if ok {
m := make(map[string]interface{})
if errUnmarshal... | [
"func",
"(",
"client",
"*",
"Client",
")",
"SyncRequestWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"command",
"Command",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"body",
",",
"err",
":=",
"client",
".",
"request",
"(",
"ct... | // SyncRequestWithContext performs a sync request with a context | [
"SyncRequestWithContext",
"performs",
"a",
"sync",
"request",
"with",
"a",
"context"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L139-L175 |
137,459 | exoscale/egoscale | request.go | BooleanRequest | func (client *Client) BooleanRequest(command Command) error {
resp, err := client.Request(command)
if err != nil {
return err
}
if b, ok := resp.(*BooleanResponse); ok {
return b.Error()
}
panic(fmt.Errorf("command %q is not a proper boolean response. %#v", client.APIName(command), resp))
} | go | func (client *Client) BooleanRequest(command Command) error {
resp, err := client.Request(command)
if err != nil {
return err
}
if b, ok := resp.(*BooleanResponse); ok {
return b.Error()
}
panic(fmt.Errorf("command %q is not a proper boolean response. %#v", client.APIName(command), resp))
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"BooleanRequest",
"(",
"command",
"Command",
")",
"error",
"{",
"resp",
",",
"err",
":=",
"client",
".",
"Request",
"(",
"command",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n... | // BooleanRequest performs the given boolean command | [
"BooleanRequest",
"performs",
"the",
"given",
"boolean",
"command"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L178-L189 |
137,460 | exoscale/egoscale | request.go | BooleanRequestWithContext | func (client *Client) BooleanRequestWithContext(ctx context.Context, command Command) error {
resp, err := client.RequestWithContext(ctx, command)
if err != nil {
return err
}
if b, ok := resp.(*BooleanResponse); ok {
return b.Error()
}
panic(fmt.Errorf("command %q is not a proper boolean response. %#v", cl... | go | func (client *Client) BooleanRequestWithContext(ctx context.Context, command Command) error {
resp, err := client.RequestWithContext(ctx, command)
if err != nil {
return err
}
if b, ok := resp.(*BooleanResponse); ok {
return b.Error()
}
panic(fmt.Errorf("command %q is not a proper boolean response. %#v", cl... | [
"func",
"(",
"client",
"*",
"Client",
")",
"BooleanRequestWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"command",
"Command",
")",
"error",
"{",
"resp",
",",
"err",
":=",
"client",
".",
"RequestWithContext",
"(",
"ctx",
",",
"command",
")",
"\n... | // BooleanRequestWithContext performs the given boolean command | [
"BooleanRequestWithContext",
"performs",
"the",
"given",
"boolean",
"command"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L192-L203 |
137,461 | exoscale/egoscale | request.go | Request | func (client *Client) Request(command Command) (interface{}, error) {
ctx, cancel := context.WithTimeout(context.Background(), client.Timeout)
defer cancel()
return client.RequestWithContext(ctx, command)
} | go | func (client *Client) Request(command Command) (interface{}, error) {
ctx, cancel := context.WithTimeout(context.Background(), client.Timeout)
defer cancel()
return client.RequestWithContext(ctx, command)
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"Request",
"(",
"command",
"Command",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"cl... | // Request performs the given command | [
"Request",
"performs",
"the",
"given",
"command"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L206-L211 |
137,462 | exoscale/egoscale | request.go | RequestWithContext | func (client *Client) RequestWithContext(ctx context.Context, command Command) (interface{}, error) {
switch c := command.(type) {
case AsyncCommand:
return client.asyncRequest(ctx, c)
default:
return client.SyncRequestWithContext(ctx, command)
}
} | go | func (client *Client) RequestWithContext(ctx context.Context, command Command) (interface{}, error) {
switch c := command.(type) {
case AsyncCommand:
return client.asyncRequest(ctx, c)
default:
return client.SyncRequestWithContext(ctx, command)
}
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"RequestWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"command",
"Command",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"c",
":=",
"command",
".",
"(",
"type",
")",
"{",
"c... | // RequestWithContext preforms a command with a context | [
"RequestWithContext",
"preforms",
"a",
"command",
"with",
"a",
"context"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L214-L221 |
137,463 | exoscale/egoscale | request.go | SyncRequest | func (client *Client) SyncRequest(command Command) (interface{}, error) {
ctx, cancel := context.WithTimeout(context.Background(), client.Timeout)
defer cancel()
return client.SyncRequestWithContext(ctx, command)
} | go | func (client *Client) SyncRequest(command Command) (interface{}, error) {
ctx, cancel := context.WithTimeout(context.Background(), client.Timeout)
defer cancel()
return client.SyncRequestWithContext(ctx, command)
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"SyncRequest",
"(",
"command",
"Command",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
... | // SyncRequest performs the command as is | [
"SyncRequest",
"performs",
"the",
"command",
"as",
"is"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L224-L229 |
137,464 | exoscale/egoscale | request.go | AsyncRequest | func (client *Client) AsyncRequest(asyncCommand AsyncCommand, callback WaitAsyncJobResultFunc) {
ctx, cancel := context.WithTimeout(context.Background(), client.Timeout)
defer cancel()
client.AsyncRequestWithContext(ctx, asyncCommand, callback)
} | go | func (client *Client) AsyncRequest(asyncCommand AsyncCommand, callback WaitAsyncJobResultFunc) {
ctx, cancel := context.WithTimeout(context.Background(), client.Timeout)
defer cancel()
client.AsyncRequestWithContext(ctx, asyncCommand, callback)
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"AsyncRequest",
"(",
"asyncCommand",
"AsyncCommand",
",",
"callback",
"WaitAsyncJobResultFunc",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
... | // AsyncRequest performs the given command | [
"AsyncRequest",
"performs",
"the",
"given",
"command"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L232-L237 |
137,465 | exoscale/egoscale | request.go | AsyncRequestWithContext | func (client *Client) AsyncRequestWithContext(ctx context.Context, asyncCommand AsyncCommand, callback WaitAsyncJobResultFunc) {
result, err := client.SyncRequestWithContext(ctx, asyncCommand)
if err != nil {
if !callback(nil, err) {
return
}
}
jobResult, ok := result.(*AsyncJobResult)
if !ok {
callback(... | go | func (client *Client) AsyncRequestWithContext(ctx context.Context, asyncCommand AsyncCommand, callback WaitAsyncJobResultFunc) {
result, err := client.SyncRequestWithContext(ctx, asyncCommand)
if err != nil {
if !callback(nil, err) {
return
}
}
jobResult, ok := result.(*AsyncJobResult)
if !ok {
callback(... | [
"func",
"(",
"client",
"*",
"Client",
")",
"AsyncRequestWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"asyncCommand",
"AsyncCommand",
",",
"callback",
"WaitAsyncJobResultFunc",
")",
"{",
"result",
",",
"err",
":=",
"client",
".",
"SyncRequestWithContex... | // AsyncRequestWithContext preforms a request with a context | [
"AsyncRequestWithContext",
"preforms",
"a",
"request",
"with",
"a",
"context"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L240-L280 |
137,466 | exoscale/egoscale | request.go | Payload | func (client *Client) Payload(command Command) (url.Values, error) {
params, err := prepareValues("", command)
if err != nil {
return nil, err
}
if hookReq, ok := command.(onBeforeHook); ok {
if err := hookReq.onBeforeSend(params); err != nil {
return params, err
}
}
params.Set("apikey", client.APIKey)
... | go | func (client *Client) Payload(command Command) (url.Values, error) {
params, err := prepareValues("", command)
if err != nil {
return nil, err
}
if hookReq, ok := command.(onBeforeHook); ok {
if err := hookReq.onBeforeSend(params); err != nil {
return params, err
}
}
params.Set("apikey", client.APIKey)
... | [
"func",
"(",
"client",
"*",
"Client",
")",
"Payload",
"(",
"command",
"Command",
")",
"(",
"url",
".",
"Values",
",",
"error",
")",
"{",
"params",
",",
"err",
":=",
"prepareValues",
"(",
"\"",
"\"",
",",
"command",
")",
"\n",
"if",
"err",
"!=",
"ni... | // Payload builds the HTTP request params from the given command | [
"Payload",
"builds",
"the",
"HTTP",
"request",
"params",
"from",
"the",
"given",
"command"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L283-L303 |
137,467 | exoscale/egoscale | request.go | Sign | func (client *Client) Sign(params url.Values) (string, error) {
query := encodeValues(params)
query = strings.ToLower(query)
mac := hmac.New(sha1.New, []byte(client.apiSecret))
_, err := mac.Write([]byte(query))
if err != nil {
return "", err
}
signature := base64.StdEncoding.EncodeToString(mac.Sum(nil))
ret... | go | func (client *Client) Sign(params url.Values) (string, error) {
query := encodeValues(params)
query = strings.ToLower(query)
mac := hmac.New(sha1.New, []byte(client.apiSecret))
_, err := mac.Write([]byte(query))
if err != nil {
return "", err
}
signature := base64.StdEncoding.EncodeToString(mac.Sum(nil))
ret... | [
"func",
"(",
"client",
"*",
"Client",
")",
"Sign",
"(",
"params",
"url",
".",
"Values",
")",
"(",
"string",
",",
"error",
")",
"{",
"query",
":=",
"encodeValues",
"(",
"params",
")",
"\n",
"query",
"=",
"strings",
".",
"ToLower",
"(",
"query",
")",
... | // Sign signs the HTTP request and returns the signature as as base64 encoding | [
"Sign",
"signs",
"the",
"HTTP",
"request",
"and",
"returns",
"the",
"signature",
"as",
"as",
"base64",
"encoding"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L306-L317 |
137,468 | exoscale/egoscale | request.go | request | func (client *Client) request(ctx context.Context, command Command) (json.RawMessage, error) {
params, err := client.Payload(command)
if err != nil {
return nil, err
}
signature, err := client.Sign(params)
if err != nil {
return nil, err
}
params.Add("signature", signature)
method := "GET"
query := params... | go | func (client *Client) request(ctx context.Context, command Command) (json.RawMessage, error) {
params, err := client.Payload(command)
if err != nil {
return nil, err
}
signature, err := client.Sign(params)
if err != nil {
return nil, err
}
params.Add("signature", signature)
method := "GET"
query := params... | [
"func",
"(",
"client",
"*",
"Client",
")",
"request",
"(",
"ctx",
"context",
".",
"Context",
",",
"command",
"Command",
")",
"(",
"json",
".",
"RawMessage",
",",
"error",
")",
"{",
"params",
",",
"err",
":=",
"client",
".",
"Payload",
"(",
"command",
... | // request makes a Request while being close to the metal | [
"request",
"makes",
"a",
"Request",
"while",
"being",
"close",
"to",
"the",
"metal"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/request.go#L320-L373 |
137,469 | exoscale/egoscale | async_jobs.go | Error | func (a AsyncJobResult) Error() error {
r := new(ErrorResponse)
if e := json.Unmarshal(*a.JobResult, r); e != nil {
return e
}
return r
} | go | func (a AsyncJobResult) Error() error {
r := new(ErrorResponse)
if e := json.Unmarshal(*a.JobResult, r); e != nil {
return e
}
return r
} | [
"func",
"(",
"a",
"AsyncJobResult",
")",
"Error",
"(",
")",
"error",
"{",
"r",
":=",
"new",
"(",
"ErrorResponse",
")",
"\n",
"if",
"e",
":=",
"json",
".",
"Unmarshal",
"(",
"*",
"a",
".",
"JobResult",
",",
"r",
")",
";",
"e",
"!=",
"nil",
"{",
... | // Error builds an error message from the result | [
"Error",
"builds",
"an",
"error",
"message",
"from",
"the",
"result"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/async_jobs.go#L34-L40 |
137,470 | exoscale/egoscale | async_jobs.go | Result | func (a AsyncJobResult) Result(i interface{}) error {
if a.JobStatus == Failure {
return a.Error()
}
if a.JobStatus == Success {
m := map[string]json.RawMessage{}
err := json.Unmarshal(*(a.JobResult), &m)
if err == nil {
if len(m) >= 1 {
if _, ok := m["success"]; ok {
return json.Unmarshal(*(a.... | go | func (a AsyncJobResult) Result(i interface{}) error {
if a.JobStatus == Failure {
return a.Error()
}
if a.JobStatus == Success {
m := map[string]json.RawMessage{}
err := json.Unmarshal(*(a.JobResult), &m)
if err == nil {
if len(m) >= 1 {
if _, ok := m["success"]; ok {
return json.Unmarshal(*(a.... | [
"func",
"(",
"a",
"AsyncJobResult",
")",
"Result",
"(",
"i",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"a",
".",
"JobStatus",
"==",
"Failure",
"{",
"return",
"a",
".",
"Error",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"JobStatus",
"==",
... | // Result unmarshals the result of an AsyncJobResult into the given interface | [
"Result",
"unmarshals",
"the",
"result",
"of",
"an",
"AsyncJobResult",
"into",
"the",
"given",
"interface"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/async_jobs.go#L71-L96 |
137,471 | exoscale/egoscale | runstatus_incident.go | Match | func (incident RunstatusIncident) Match(other RunstatusIncident) bool {
if other.Title != "" && incident.Title == other.Title {
return true
}
if other.ID > 0 && incident.ID == other.ID {
return true
}
return false
} | go | func (incident RunstatusIncident) Match(other RunstatusIncident) bool {
if other.Title != "" && incident.Title == other.Title {
return true
}
if other.ID > 0 && incident.ID == other.ID {
return true
}
return false
} | [
"func",
"(",
"incident",
"RunstatusIncident",
")",
"Match",
"(",
"other",
"RunstatusIncident",
")",
"bool",
"{",
"if",
"other",
".",
"Title",
"!=",
"\"",
"\"",
"&&",
"incident",
".",
"Title",
"==",
"other",
".",
"Title",
"{",
"return",
"true",
"\n",
"}",... | // Match returns true if the other incident has got similarities with itself | [
"Match",
"returns",
"true",
"if",
"the",
"other",
"incident",
"has",
"got",
"similarities",
"with",
"itself"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_incident.go#L29-L39 |
137,472 | exoscale/egoscale | runstatus_incident.go | GetRunstatusIncident | func (client *Client) GetRunstatusIncident(ctx context.Context, incident RunstatusIncident) (*RunstatusIncident, error) {
if incident.URL != "" {
return client.getRunstatusIncident(ctx, incident.URL)
}
if incident.PageURL == "" {
return nil, fmt.Errorf("empty Page URL for %#v", incident)
}
page, err := clien... | go | func (client *Client) GetRunstatusIncident(ctx context.Context, incident RunstatusIncident) (*RunstatusIncident, error) {
if incident.URL != "" {
return client.getRunstatusIncident(ctx, incident.URL)
}
if incident.PageURL == "" {
return nil, fmt.Errorf("empty Page URL for %#v", incident)
}
page, err := clien... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetRunstatusIncident",
"(",
"ctx",
"context",
".",
"Context",
",",
"incident",
"RunstatusIncident",
")",
"(",
"*",
"RunstatusIncident",
",",
"error",
")",
"{",
"if",
"incident",
".",
"URL",
"!=",
"\"",
"\"",
"{",... | // GetRunstatusIncident retrieves the details of a specific incident. | [
"GetRunstatusIncident",
"retrieves",
"the",
"details",
"of",
"a",
"specific",
"incident",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_incident.go#L49-L71 |
137,473 | exoscale/egoscale | runstatus_incident.go | ListRunstatusIncidents | func (client *Client) ListRunstatusIncidents(ctx context.Context, page RunstatusPage) ([]RunstatusIncident, error) {
if page.IncidentsURL == "" {
return nil, fmt.Errorf("empty Incidents URL for %#v", page)
}
results := make([]RunstatusIncident, 0)
var err error
client.PaginateRunstatusIncidents(ctx, page, func... | go | func (client *Client) ListRunstatusIncidents(ctx context.Context, page RunstatusPage) ([]RunstatusIncident, error) {
if page.IncidentsURL == "" {
return nil, fmt.Errorf("empty Incidents URL for %#v", page)
}
results := make([]RunstatusIncident, 0)
var err error
client.PaginateRunstatusIncidents(ctx, page, func... | [
"func",
"(",
"client",
"*",
"Client",
")",
"ListRunstatusIncidents",
"(",
"ctx",
"context",
".",
"Context",
",",
"page",
"RunstatusPage",
")",
"(",
"[",
"]",
"RunstatusIncident",
",",
"error",
")",
"{",
"if",
"page",
".",
"IncidentsURL",
"==",
"\"",
"\"",
... | // ListRunstatusIncidents lists the incidents for a specific page. | [
"ListRunstatusIncidents",
"lists",
"the",
"incidents",
"for",
"a",
"specific",
"page",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_incident.go#L87-L106 |
137,474 | exoscale/egoscale | runstatus_incident.go | PaginateRunstatusIncidents | func (client *Client) PaginateRunstatusIncidents(ctx context.Context, page RunstatusPage, callback func(*RunstatusIncident, error) bool) {
if page.IncidentsURL == "" {
callback(nil, fmt.Errorf("empty Incidents URL for %#v", page))
return
}
incidentsURL := page.IncidentsURL
for incidentsURL != "" {
resp, err ... | go | func (client *Client) PaginateRunstatusIncidents(ctx context.Context, page RunstatusPage, callback func(*RunstatusIncident, error) bool) {
if page.IncidentsURL == "" {
callback(nil, fmt.Errorf("empty Incidents URL for %#v", page))
return
}
incidentsURL := page.IncidentsURL
for incidentsURL != "" {
resp, err ... | [
"func",
"(",
"client",
"*",
"Client",
")",
"PaginateRunstatusIncidents",
"(",
"ctx",
"context",
".",
"Context",
",",
"page",
"RunstatusPage",
",",
"callback",
"func",
"(",
"*",
"RunstatusIncident",
",",
"error",
")",
"bool",
")",
"{",
"if",
"page",
".",
"I... | // PaginateRunstatusIncidents paginate Incidents | [
"PaginateRunstatusIncidents",
"paginate",
"Incidents"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_incident.go#L109-L137 |
137,475 | exoscale/egoscale | runstatus_incident.go | CreateRunstatusIncident | func (client *Client) CreateRunstatusIncident(ctx context.Context, incident RunstatusIncident) (*RunstatusIncident, error) {
if incident.PageURL == "" {
return nil, fmt.Errorf("empty Page URL for %#v", incident)
}
page, err := client.getRunstatusPage(ctx, incident.PageURL)
if err != nil {
return nil, err
}
... | go | func (client *Client) CreateRunstatusIncident(ctx context.Context, incident RunstatusIncident) (*RunstatusIncident, error) {
if incident.PageURL == "" {
return nil, fmt.Errorf("empty Page URL for %#v", incident)
}
page, err := client.getRunstatusPage(ctx, incident.PageURL)
if err != nil {
return nil, err
}
... | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateRunstatusIncident",
"(",
"ctx",
"context",
".",
"Context",
",",
"incident",
"RunstatusIncident",
")",
"(",
"*",
"RunstatusIncident",
",",
"error",
")",
"{",
"if",
"incident",
".",
"PageURL",
"==",
"\"",
"\"",... | // CreateRunstatusIncident create runstatus incident | [
"CreateRunstatusIncident",
"create",
"runstatus",
"incident"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_incident.go#L140-L165 |
137,476 | exoscale/egoscale | runstatus_incident.go | DeleteRunstatusIncident | func (client *Client) DeleteRunstatusIncident(ctx context.Context, incident RunstatusIncident) error {
if incident.URL == "" {
return fmt.Errorf("empty URL for %#v", incident)
}
_, err := client.runstatusRequest(ctx, incident.URL, nil, "DELETE")
return err
} | go | func (client *Client) DeleteRunstatusIncident(ctx context.Context, incident RunstatusIncident) error {
if incident.URL == "" {
return fmt.Errorf("empty URL for %#v", incident)
}
_, err := client.runstatusRequest(ctx, incident.URL, nil, "DELETE")
return err
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"DeleteRunstatusIncident",
"(",
"ctx",
"context",
".",
"Context",
",",
"incident",
"RunstatusIncident",
")",
"error",
"{",
"if",
"incident",
".",
"URL",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
... | // DeleteRunstatusIncident delete runstatus incident | [
"DeleteRunstatusIncident",
"delete",
"runstatus",
"incident"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_incident.go#L168-L175 |
137,477 | exoscale/egoscale | snapshots.go | ListRequest | func (ss Snapshot) ListRequest() (ListCommand, error) {
// Restricted cannot be applied here because it really has three states
req := &ListSnapshots{
ID: ss.ID,
Name: ss.Name,
VolumeID: ss.VolumeID,
SnapshotType: ss.SnapshotType,
ZoneID: ss.ZoneID,
// TODO: tags
}
return re... | go | func (ss Snapshot) ListRequest() (ListCommand, error) {
// Restricted cannot be applied here because it really has three states
req := &ListSnapshots{
ID: ss.ID,
Name: ss.Name,
VolumeID: ss.VolumeID,
SnapshotType: ss.SnapshotType,
ZoneID: ss.ZoneID,
// TODO: tags
}
return re... | [
"func",
"(",
"ss",
"Snapshot",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"// Restricted cannot be applied here because it really has three states",
"req",
":=",
"&",
"ListSnapshots",
"{",
"ID",
":",
"ss",
".",
"ID",
",",
"Name",
"... | // ListRequest builds the ListSnapshot request | [
"ListRequest",
"builds",
"the",
"ListSnapshot",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/snapshots.go#L72-L84 |
137,478 | exoscale/egoscale | ssh_keypairs.go | Delete | func (ssh SSHKeyPair) Delete(ctx context.Context, client *Client) error {
if ssh.Name == "" {
return fmt.Errorf("an SSH Key Pair may only be deleted using Name")
}
return client.BooleanRequestWithContext(ctx, &DeleteSSHKeyPair{
Name: ssh.Name,
})
} | go | func (ssh SSHKeyPair) Delete(ctx context.Context, client *Client) error {
if ssh.Name == "" {
return fmt.Errorf("an SSH Key Pair may only be deleted using Name")
}
return client.BooleanRequestWithContext(ctx, &DeleteSSHKeyPair{
Name: ssh.Name,
})
} | [
"func",
"(",
"ssh",
"SSHKeyPair",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"Client",
")",
"error",
"{",
"if",
"ssh",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
... | // Delete removes the given SSH key, by Name | [
"Delete",
"removes",
"the",
"given",
"SSH",
"key",
"by",
"Name"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/ssh_keypairs.go#L18-L26 |
137,479 | exoscale/egoscale | ssh_keypairs.go | ListRequest | func (ssh SSHKeyPair) ListRequest() (ListCommand, error) {
req := &ListSSHKeyPairs{
Fingerprint: ssh.Fingerprint,
Name: ssh.Name,
}
return req, nil
} | go | func (ssh SSHKeyPair) ListRequest() (ListCommand, error) {
req := &ListSSHKeyPairs{
Fingerprint: ssh.Fingerprint,
Name: ssh.Name,
}
return req, nil
} | [
"func",
"(",
"ssh",
"SSHKeyPair",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"req",
":=",
"&",
"ListSSHKeyPairs",
"{",
"Fingerprint",
":",
"ssh",
".",
"Fingerprint",
",",
"Name",
":",
"ssh",
".",
"Name",
",",
"}",
"\n\n",... | // ListRequest builds the ListSSHKeyPairs request | [
"ListRequest",
"builds",
"the",
"ListSSHKeyPairs",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/ssh_keypairs.go#L29-L36 |
137,480 | exoscale/egoscale | security_groups.go | Delete | func (sg SecurityGroup) Delete(ctx context.Context, client *Client) error {
if sg.ID == nil && sg.Name == "" {
return fmt.Errorf("a SecurityGroup may only be deleted using ID or Name")
}
req := &DeleteSecurityGroup{}
if sg.ID != nil {
req.ID = sg.ID
} else {
req.Name = sg.Name
}
return client.BooleanReq... | go | func (sg SecurityGroup) Delete(ctx context.Context, client *Client) error {
if sg.ID == nil && sg.Name == "" {
return fmt.Errorf("a SecurityGroup may only be deleted using ID or Name")
}
req := &DeleteSecurityGroup{}
if sg.ID != nil {
req.ID = sg.ID
} else {
req.Name = sg.Name
}
return client.BooleanReq... | [
"func",
"(",
"sg",
"SecurityGroup",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"Client",
")",
"error",
"{",
"if",
"sg",
".",
"ID",
"==",
"nil",
"&&",
"sg",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"... | // Delete deletes the given Security Group | [
"Delete",
"deletes",
"the",
"given",
"Security",
"Group"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/security_groups.go#L39-L53 |
137,481 | exoscale/egoscale | security_groups.go | RuleByID | func (sg SecurityGroup) RuleByID(ruleID UUID) (*IngressRule, *EgressRule) {
for i, in := range sg.IngressRule {
if in.RuleID.Equal(ruleID) {
return &sg.IngressRule[i], nil
}
}
for i, out := range sg.EgressRule {
if out.RuleID.Equal(ruleID) {
return nil, &sg.EgressRule[i]
}
}
return nil, nil
} | go | func (sg SecurityGroup) RuleByID(ruleID UUID) (*IngressRule, *EgressRule) {
for i, in := range sg.IngressRule {
if in.RuleID.Equal(ruleID) {
return &sg.IngressRule[i], nil
}
}
for i, out := range sg.EgressRule {
if out.RuleID.Equal(ruleID) {
return nil, &sg.EgressRule[i]
}
}
return nil, nil
} | [
"func",
"(",
"sg",
"SecurityGroup",
")",
"RuleByID",
"(",
"ruleID",
"UUID",
")",
"(",
"*",
"IngressRule",
",",
"*",
"EgressRule",
")",
"{",
"for",
"i",
",",
"in",
":=",
"range",
"sg",
".",
"IngressRule",
"{",
"if",
"in",
".",
"RuleID",
".",
"Equal",
... | // RuleByID returns IngressRule or EgressRule by a rule ID | [
"RuleByID",
"returns",
"IngressRule",
"or",
"EgressRule",
"by",
"a",
"rule",
"ID"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/security_groups.go#L56-L70 |
137,482 | exoscale/egoscale | users.go | ListRequest | func (user User) ListRequest() (ListCommand, error) {
req := &ListUsers{
ID: user.ID,
UserName: user.UserName,
}
return req, nil
} | go | func (user User) ListRequest() (ListCommand, error) {
req := &ListUsers{
ID: user.ID,
UserName: user.UserName,
}
return req, nil
} | [
"func",
"(",
"user",
"User",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"req",
":=",
"&",
"ListUsers",
"{",
"ID",
":",
"user",
".",
"ID",
",",
"UserName",
":",
"user",
".",
"UserName",
",",
"}",
"\n\n",
"return",
"req... | // ListRequest builds the ListUsers request | [
"ListRequest",
"builds",
"the",
"ListUsers",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/users.go#L24-L31 |
137,483 | exoscale/egoscale | network_offerings.go | ListRequest | func (no NetworkOffering) ListRequest() (ListCommand, error) {
req := &ListNetworkOfferings{
Availability: no.Availability,
ID: no.ID,
Name: no.Name,
State: no.State,
TrafficType: no.TrafficType,
}
return req, nil
} | go | func (no NetworkOffering) ListRequest() (ListCommand, error) {
req := &ListNetworkOfferings{
Availability: no.Availability,
ID: no.ID,
Name: no.Name,
State: no.State,
TrafficType: no.TrafficType,
}
return req, nil
} | [
"func",
"(",
"no",
"NetworkOffering",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"req",
":=",
"&",
"ListNetworkOfferings",
"{",
"Availability",
":",
"no",
".",
"Availability",
",",
"ID",
":",
"no",
".",
"ID",
",",
"Name",
... | // ListRequest builds the ListNetworkOfferings request
//
// This doesn't take into account the IsDefault flag as the default value is true. | [
"ListRequest",
"builds",
"the",
"ListNetworkOfferings",
"request",
"This",
"doesn",
"t",
"take",
"into",
"account",
"the",
"IsDefault",
"flag",
"as",
"the",
"default",
"value",
"is",
"true",
"."
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/network_offerings.go#L31-L41 |
137,484 | exoscale/egoscale | addresses.go | ListRequest | func (ipaddress IPAddress) ListRequest() (ListCommand, error) {
req := &ListPublicIPAddresses{
AssociatedNetworkID: ipaddress.AssociatedNetworkID,
ID: ipaddress.ID,
IPAddress: ipaddress.IPAddress,
PhysicalNetworkID: ipaddress.PhysicalNetworkID,
VlanID: ipaddress.Vlan... | go | func (ipaddress IPAddress) ListRequest() (ListCommand, error) {
req := &ListPublicIPAddresses{
AssociatedNetworkID: ipaddress.AssociatedNetworkID,
ID: ipaddress.ID,
IPAddress: ipaddress.IPAddress,
PhysicalNetworkID: ipaddress.PhysicalNetworkID,
VlanID: ipaddress.Vlan... | [
"func",
"(",
"ipaddress",
"IPAddress",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"req",
":=",
"&",
"ListPublicIPAddresses",
"{",
"AssociatedNetworkID",
":",
"ipaddress",
".",
"AssociatedNetworkID",
",",
"ID",
":",
"ipaddress",
"... | // ListRequest builds the ListAdresses request | [
"ListRequest",
"builds",
"the",
"ListAdresses",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/addresses.go#L57-L77 |
137,485 | exoscale/egoscale | addresses.go | Delete | func (ipaddress IPAddress) Delete(ctx context.Context, client *Client) error {
if ipaddress.ID == nil {
return fmt.Errorf("an IPAddress may only be deleted using ID")
}
return client.BooleanRequestWithContext(ctx, &DisassociateIPAddress{
ID: ipaddress.ID,
})
} | go | func (ipaddress IPAddress) Delete(ctx context.Context, client *Client) error {
if ipaddress.ID == nil {
return fmt.Errorf("an IPAddress may only be deleted using ID")
}
return client.BooleanRequestWithContext(ctx, &DisassociateIPAddress{
ID: ipaddress.ID,
})
} | [
"func",
"(",
"ipaddress",
"IPAddress",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"Client",
")",
"error",
"{",
"if",
"ipaddress",
".",
"ID",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
... | // Delete removes the resource | [
"Delete",
"removes",
"the",
"resource"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/addresses.go#L80-L88 |
137,486 | exoscale/egoscale | serialization.go | info | func info(command interface{}) (*CommandInfo, error) {
typeof := reflect.TypeOf(command)
// Going up the pointer chain to find the underlying struct
for typeof.Kind() == reflect.Ptr {
typeof = typeof.Elem()
}
field, ok := typeof.FieldByName("_")
if !ok {
return nil, fmt.Errorf(`missing meta ("_") field in %... | go | func info(command interface{}) (*CommandInfo, error) {
typeof := reflect.TypeOf(command)
// Going up the pointer chain to find the underlying struct
for typeof.Kind() == reflect.Ptr {
typeof = typeof.Elem()
}
field, ok := typeof.FieldByName("_")
if !ok {
return nil, fmt.Errorf(`missing meta ("_") field in %... | [
"func",
"info",
"(",
"command",
"interface",
"{",
"}",
")",
"(",
"*",
"CommandInfo",
",",
"error",
")",
"{",
"typeof",
":=",
"reflect",
".",
"TypeOf",
"(",
"command",
")",
"\n\n",
"// Going up the pointer chain to find the underlying struct",
"for",
"typeof",
".... | // info returns the meta info of a command
//
// command is not a Command so it's easier to Test | [
"info",
"returns",
"the",
"meta",
"info",
"of",
"a",
"command",
"command",
"is",
"not",
"a",
"Command",
"so",
"it",
"s",
"easier",
"to",
"Test"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/serialization.go#L26-L52 |
137,487 | exoscale/egoscale | runstatus_page.go | Match | func (page RunstatusPage) Match(other RunstatusPage) bool {
if other.Subdomain != "" && page.Subdomain == other.Subdomain {
return true
}
if other.ID > 0 && page.ID == other.ID {
return true
}
return false
} | go | func (page RunstatusPage) Match(other RunstatusPage) bool {
if other.Subdomain != "" && page.Subdomain == other.Subdomain {
return true
}
if other.ID > 0 && page.ID == other.ID {
return true
}
return false
} | [
"func",
"(",
"page",
"RunstatusPage",
")",
"Match",
"(",
"other",
"RunstatusPage",
")",
"bool",
"{",
"if",
"other",
".",
"Subdomain",
"!=",
"\"",
"\"",
"&&",
"page",
".",
"Subdomain",
"==",
"other",
".",
"Subdomain",
"{",
"return",
"true",
"\n",
"}",
"... | // Match returns true if the other page has got similarities with itself | [
"Match",
"returns",
"true",
"if",
"the",
"other",
"page",
"has",
"got",
"similarities",
"with",
"itself"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_page.go#L42-L52 |
137,488 | exoscale/egoscale | runstatus_page.go | CreateRunstatusPage | func (client *Client) CreateRunstatusPage(ctx context.Context, page RunstatusPage) (*RunstatusPage, error) {
resp, err := client.runstatusRequest(ctx, client.Endpoint+runstatusPagesURL, page, "POST")
if err != nil {
return nil, err
}
var p *RunstatusPage
if err := json.Unmarshal(resp, &p); err != nil {
return... | go | func (client *Client) CreateRunstatusPage(ctx context.Context, page RunstatusPage) (*RunstatusPage, error) {
resp, err := client.runstatusRequest(ctx, client.Endpoint+runstatusPagesURL, page, "POST")
if err != nil {
return nil, err
}
var p *RunstatusPage
if err := json.Unmarshal(resp, &p); err != nil {
return... | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateRunstatusPage",
"(",
"ctx",
"context",
".",
"Context",
",",
"page",
"RunstatusPage",
")",
"(",
"*",
"RunstatusPage",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"client",
".",
"runstatusRequest",
"(",... | // CreateRunstatusPage create runstatus page | [
"CreateRunstatusPage",
"create",
"runstatus",
"page"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_page.go#L62-L74 |
137,489 | exoscale/egoscale | runstatus_page.go | DeleteRunstatusPage | func (client *Client) DeleteRunstatusPage(ctx context.Context, page RunstatusPage) error {
if page.URL == "" {
return fmt.Errorf("empty URL for %#v", page)
}
_, err := client.runstatusRequest(ctx, page.URL, nil, "DELETE")
return err
} | go | func (client *Client) DeleteRunstatusPage(ctx context.Context, page RunstatusPage) error {
if page.URL == "" {
return fmt.Errorf("empty URL for %#v", page)
}
_, err := client.runstatusRequest(ctx, page.URL, nil, "DELETE")
return err
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"DeleteRunstatusPage",
"(",
"ctx",
"context",
".",
"Context",
",",
"page",
"RunstatusPage",
")",
"error",
"{",
"if",
"page",
".",
"URL",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
... | // DeleteRunstatusPage delete runstatus page | [
"DeleteRunstatusPage",
"delete",
"runstatus",
"page"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_page.go#L77-L83 |
137,490 | exoscale/egoscale | runstatus_page.go | GetRunstatusPage | func (client *Client) GetRunstatusPage(ctx context.Context, page RunstatusPage) (*RunstatusPage, error) {
if page.URL != "" {
return client.getRunstatusPage(ctx, page.URL)
}
ps, err := client.ListRunstatusPages(ctx)
if err != nil {
return nil, err
}
for i := range ps {
if ps[i].Match(page) {
return cli... | go | func (client *Client) GetRunstatusPage(ctx context.Context, page RunstatusPage) (*RunstatusPage, error) {
if page.URL != "" {
return client.getRunstatusPage(ctx, page.URL)
}
ps, err := client.ListRunstatusPages(ctx)
if err != nil {
return nil, err
}
for i := range ps {
if ps[i].Match(page) {
return cli... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetRunstatusPage",
"(",
"ctx",
"context",
".",
"Context",
",",
"page",
"RunstatusPage",
")",
"(",
"*",
"RunstatusPage",
",",
"error",
")",
"{",
"if",
"page",
".",
"URL",
"!=",
"\"",
"\"",
"{",
"return",
"clie... | // GetRunstatusPage fetches the runstatus page | [
"GetRunstatusPage",
"fetches",
"the",
"runstatus",
"page"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_page.go#L86-L103 |
137,491 | exoscale/egoscale | runstatus_page.go | ListRunstatusPages | func (client *Client) ListRunstatusPages(ctx context.Context) ([]RunstatusPage, error) {
resp, err := client.runstatusRequest(ctx, client.Endpoint+runstatusPagesURL, nil, "GET")
if err != nil {
return nil, err
}
var p *RunstatusPageList
if err := json.Unmarshal(resp, &p); err != nil {
return nil, err
}
ret... | go | func (client *Client) ListRunstatusPages(ctx context.Context) ([]RunstatusPage, error) {
resp, err := client.runstatusRequest(ctx, client.Endpoint+runstatusPagesURL, nil, "GET")
if err != nil {
return nil, err
}
var p *RunstatusPageList
if err := json.Unmarshal(resp, &p); err != nil {
return nil, err
}
ret... | [
"func",
"(",
"client",
"*",
"Client",
")",
"ListRunstatusPages",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"RunstatusPage",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"client",
".",
"runstatusRequest",
"(",
"ctx",
",",
"client",
... | // ListRunstatusPages list all the runstatus pages | [
"ListRunstatusPages",
"list",
"all",
"the",
"runstatus",
"pages"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_page.go#L132-L144 |
137,492 | exoscale/egoscale | runstatus_page.go | PaginateRunstatusPages | func (client *Client) PaginateRunstatusPages(ctx context.Context, callback func(pages []RunstatusPage, e error) bool) {
pageURL := client.Endpoint + runstatusPagesURL
for pageURL != "" {
resp, err := client.runstatusRequest(ctx, pageURL, nil, "GET")
if err != nil {
callback(nil, err)
return
}
var p *Ru... | go | func (client *Client) PaginateRunstatusPages(ctx context.Context, callback func(pages []RunstatusPage, e error) bool) {
pageURL := client.Endpoint + runstatusPagesURL
for pageURL != "" {
resp, err := client.runstatusRequest(ctx, pageURL, nil, "GET")
if err != nil {
callback(nil, err)
return
}
var p *Ru... | [
"func",
"(",
"client",
"*",
"Client",
")",
"PaginateRunstatusPages",
"(",
"ctx",
"context",
".",
"Context",
",",
"callback",
"func",
"(",
"pages",
"[",
"]",
"RunstatusPage",
",",
"e",
"error",
")",
"bool",
")",
"{",
"pageURL",
":=",
"client",
".",
"Endpo... | //PaginateRunstatusPages paginate on runstatus pages | [
"PaginateRunstatusPages",
"paginate",
"on",
"runstatus",
"pages"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/runstatus_page.go#L147-L168 |
137,493 | exoscale/egoscale | instance_groups.go | ListRequest | func (ig InstanceGroup) ListRequest() (ListCommand, error) {
req := &ListInstanceGroups{
ID: ig.ID,
Name: ig.Name,
}
return req, nil
} | go | func (ig InstanceGroup) ListRequest() (ListCommand, error) {
req := &ListInstanceGroups{
ID: ig.ID,
Name: ig.Name,
}
return req, nil
} | [
"func",
"(",
"ig",
"InstanceGroup",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"req",
":=",
"&",
"ListInstanceGroups",
"{",
"ID",
":",
"ig",
".",
"ID",
",",
"Name",
":",
"ig",
".",
"Name",
",",
"}",
"\n\n",
"return",
... | // ListRequest builds the ListInstanceGroups request | [
"ListRequest",
"builds",
"the",
"ListInstanceGroups",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/instance_groups.go#L12-L19 |
137,494 | exoscale/egoscale | resource_limits.go | ListRequest | func (limit ResourceLimit) ListRequest() (ListCommand, error) {
req := &ListResourceLimits{
ResourceType: limit.ResourceType,
ResourceTypeName: limit.ResourceTypeName,
}
return req, nil
} | go | func (limit ResourceLimit) ListRequest() (ListCommand, error) {
req := &ListResourceLimits{
ResourceType: limit.ResourceType,
ResourceTypeName: limit.ResourceTypeName,
}
return req, nil
} | [
"func",
"(",
"limit",
"ResourceLimit",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"req",
":=",
"&",
"ListResourceLimits",
"{",
"ResourceType",
":",
"limit",
".",
"ResourceType",
",",
"ResourceTypeName",
":",
"limit",
".",
"Reso... | // ListRequest builds the ListResourceLimits request | [
"ListRequest",
"builds",
"the",
"ListResourceLimits",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/resource_limits.go#L73-L80 |
137,495 | exoscale/egoscale | resource_metadata.go | ListRequest | func (detail ResourceDetail) ListRequest() (ListCommand, error) {
if detail.ResourceType == "" {
return nil, fmt.Errorf("the resourcetype parameter is required")
}
req := &ListResourceDetails{
ResourceType: detail.ResourceType,
ResourceID: detail.ResourceID,
}
return req, nil
} | go | func (detail ResourceDetail) ListRequest() (ListCommand, error) {
if detail.ResourceType == "" {
return nil, fmt.Errorf("the resourcetype parameter is required")
}
req := &ListResourceDetails{
ResourceType: detail.ResourceType,
ResourceID: detail.ResourceID,
}
return req, nil
} | [
"func",
"(",
"detail",
"ResourceDetail",
")",
"ListRequest",
"(",
")",
"(",
"ListCommand",
",",
"error",
")",
"{",
"if",
"detail",
".",
"ResourceType",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"... | // ListRequest builds the ListResourceDetails request | [
"ListRequest",
"builds",
"the",
"ListResourceDetails",
"request"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/resource_metadata.go#L9-L20 |
137,496 | exoscale/egoscale | client.go | Get | func (client *Client) Get(ls Listable) (interface{}, error) {
ctx, cancel := context.WithTimeout(context.Background(), client.Timeout)
defer cancel()
return client.GetWithContext(ctx, ls)
} | go | func (client *Client) Get(ls Listable) (interface{}, error) {
ctx, cancel := context.WithTimeout(context.Background(), client.Timeout)
defer cancel()
return client.GetWithContext(ctx, ls)
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"Get",
"(",
"ls",
"Listable",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"client",
... | // Get populates the given resource or fails | [
"Get",
"populates",
"the",
"given",
"resource",
"or",
"fails"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/client.go#L99-L104 |
137,497 | exoscale/egoscale | client.go | GetWithContext | func (client *Client) GetWithContext(ctx context.Context, ls Listable) (interface{}, error) {
gs, err := client.ListWithContext(ctx, ls)
if err != nil {
return nil, err
}
count := len(gs)
if count != 1 {
req, err := ls.ListRequest()
if err != nil {
return nil, err
}
params, err := client.Payload(req)... | go | func (client *Client) GetWithContext(ctx context.Context, ls Listable) (interface{}, error) {
gs, err := client.ListWithContext(ctx, ls)
if err != nil {
return nil, err
}
count := len(gs)
if count != 1 {
req, err := ls.ListRequest()
if err != nil {
return nil, err
}
params, err := client.Payload(req)... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"ls",
"Listable",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"gs",
",",
"err",
":=",
"client",
".",
"ListWithContext",
"(",
"ctx",
... | // GetWithContext populates the given resource or fails | [
"GetWithContext",
"populates",
"the",
"given",
"resource",
"or",
"fails"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/client.go#L107-L145 |
137,498 | exoscale/egoscale | client.go | Delete | func (client *Client) Delete(g Deletable) error {
ctx, cancel := context.WithTimeout(context.Background(), client.Timeout)
defer cancel()
return client.DeleteWithContext(ctx, g)
} | go | func (client *Client) Delete(g Deletable) error {
ctx, cancel := context.WithTimeout(context.Background(), client.Timeout)
defer cancel()
return client.DeleteWithContext(ctx, g)
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"Delete",
"(",
"g",
"Deletable",
")",
"error",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"client",
".",
"Timeout",
")",
"\n",
"defer",
... | // Delete removes the given resource of fails | [
"Delete",
"removes",
"the",
"given",
"resource",
"of",
"fails"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/client.go#L148-L153 |
137,499 | exoscale/egoscale | client.go | DeleteWithContext | func (client *Client) DeleteWithContext(ctx context.Context, g Deletable) error {
return g.Delete(ctx, client)
} | go | func (client *Client) DeleteWithContext(ctx context.Context, g Deletable) error {
return g.Delete(ctx, client)
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"DeleteWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"g",
"Deletable",
")",
"error",
"{",
"return",
"g",
".",
"Delete",
"(",
"ctx",
",",
"client",
")",
"\n",
"}"
] | // DeleteWithContext removes the given resource of fails | [
"DeleteWithContext",
"removes",
"the",
"given",
"resource",
"of",
"fails"
] | 4e527724b8225e8315d580accd1c4e860202d41b | https://github.com/exoscale/egoscale/blob/4e527724b8225e8315d580accd1c4e860202d41b/client.go#L156-L158 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.